Beispiel #1
0
def table_resource():
    _table_title = 'Resource'
    _field_arrangement = ['res_type', 'res_type_class',
                          'agency_ref_num', 'res_emp_num',
                          'res_fullname', 'res_job_title',
                          'grade_level', 'date_of_joining',
                          'mobile_num', 'email',
                          'manager', 'cost_center',
                          'division', 'section',
                          'sub_section', 'job_class',
                          'work_base', 'nationality',
                          'remarks', 'status'
                          ]
    _field_dictionary = key_label(_field_arrangement)
    _template = '_table.html'
    _add_link_func_name = 'resource_mgt.add_resource'

    data = resource_table()
#    data = VendorSchema(vendor, many=True).data

    return render_template(_template,
                           data=data,
                           columns=_field_dictionary,
                           keys=_field_arrangement,
                           add_link_func=_add_link_func_name,
                           table_title = _table_title
                           )
Beispiel #2
0
def invoices_summary(record_id):

    record = Task.query.filter(Task.id==record_id).first()
    (data, total) = table_invoices_summary_(record_id)

    _field_arrangement = [
        'id',
        'contractor_name',
        'invoice_no',
        'contract_no',
        'region',
        'invoice_cert_date',
        'amount',
    ]
    _field_dictionary = key_label(_field_arrangement)

    _template = 'budget_mgt/invoices_summary.html'

    meta = {'task_no': record.task_no,
            'commitment_value': record.commitment_value,
            'actual_total': total,
            'overrun': True if total > record.commitment_value else False
            }

    return render_template(_template,
                            data=data,
                            columns=_field_dictionary,
                            keys=_field_arrangement,
                            meta = meta
#                           add_link_func=_add_link_func_name,
#                           timeline_link_func=_timeline_link_func_name,
#                           table_title = _table_title
                           )
Beispiel #3
0
def table_team_task(filter=None):
    _table_title = 'Team Task'
    _field_arrangement = [
        'contractor_name',
        'description',
        'contract_no', 'category',
        'status', 'severity',
        'date_team_task', 'date_expected',
        'user_names'
      ]
    _field_dictionary = key_label(_field_arrangement)
    _template = 'team_mgt/table.html'
    _add_link_func_name = 'team_mgt.add_team_task'
    _timeline_link_func_name = 'team_mgt.timeline'

    data = team_task_table()

    return render_template(_template,
                           data=data,
                           columns=_field_dictionary,
                           keys=_field_arrangement,
                           add_link_func=_add_link_func_name,
                           timeline_link_func=_timeline_link_func_name,
                           table_title = _table_title
                           )
Beispiel #4
0
def table(filter_val=None):
    _table_title = 'Issue'
    _field_arrangement = ['vendor_name', #'issue_no',
                          'issue_description', 'contract_no',
                          'category', 'status',
                          'severity', 'end_user',
                          'remarks', 'impact','person_in_charge'
                          ]
    _field_dictionary = key_label(_field_arrangement)
    _template = 'table-history.html'
    _add_link_func_name = 'issue.add'
    _reply_link_func_name = 'issue.reply'
    _timeline_link_func_name = 'issue.timeline'
    _update_link_func_name = 'issue.update'


    data = issue_table(filter_val)
#    data = VendorSchema(vendor, many=True).data

    return render_template(_template,
                           data=data,
                           columns=_field_dictionary,
                           keys=_field_arrangement,
                           add_link_func=_add_link_func_name,
                           reply_link_func = _reply_link_func_name,
                           timeline_link_func = _timeline_link_func_name,
                           update_link_func = _update_link_func_name,
                           table_title = _table_title,
                           )
Beispiel #5
0
def table_specification(record_id=None):
    _table_title = "Financial KPI Specification"
    _field_arrangement = ["filename"]
    _field_dictionary = key_label(_field_arrangement)
    _template = "section_kpi_mgt/spec_table.html"
    _add_link_func_name = "section_kpi_mgt.add_specification"
    data = spec_section_kpi_table()

    return render_template(
        _template,
        data=data,
        columns=_field_dictionary,
        keys=_field_arrangement,
        add_link_func=_add_link_func_name,
        table_title=_table_title,
    )
Beispiel #6
0
def table():
    _table_title = 'Vendor'
    _field_arrangement = ['name', 'short_hand', 'remarks', 'profile']
    _field_dictionary = key_label(_field_arrangement)
    _template = 'table.html'
    _add_link_func_name = 'vendor.add'

    vendor = Vendor.query.all()
#    data = VendorSchema(vendor, many=True).data

    return render_template(_template,
                           data=vendor,
                           columns=_field_dictionary,
                           keys=_field_arrangement,
                           add_link_func=_add_link_func_name,
                           table_title = _table_title
                           )
Beispiel #7
0
def table_task():
    _table_title = 'Task'
    _field_arrangement = [
        'contractor_id','contract_id',
        'task_number', 'remarks'
      ]
    _field_dictionary = key_label(_field_arrangement)
    _template = 'contract/accrual_table.html'

    data = task_table()
#    data = VendorSchema(vendor, many=True).data

    return render_template(_template,
                           data=data,
                           columns=_field_dictionary,
                           keys=_field_arrangement,
                           table_title = _table_title,
                           )
Beispiel #8
0
def table_accrual(month=None):
    _table_title = 'Accrual'
    _field_arrangement = [
        'contractor_name','contract_no',
        'accrued', 'accrued_date', 'amount'
      ]
    _field_dictionary = key_label(_field_arrangement)
    _template = 'contract/accrual_table.html'

    data = accrual_table()
#    data = VendorSchema(vendor, many=True).data

    return render_template(_template,
                           data=data,
                           columns=_field_dictionary,
                           keys=_field_arrangement,
                           table_title = _table_title,
                           )
Beispiel #9
0
def table_project():
    _table_title = 'Project'
    _field_arrangement = [
       'project_no', 'commitment_budget', 'expenditure_budget', 'contract_id'
       ]
    _field_dictionary = key_label(_field_arrangement)
    _template = 'default/table.html'
    _add_link_func_name = 'budget_mgt.add_project'

    data = project_table()

    return render_template(_template,
                           data=data,
                           columns=_field_dictionary,
                           keys=_field_arrangement,
                           add_link_func=_add_link_func_name,
                           table_title = _table_title
                           )
Beispiel #10
0
def table_certificate():
    _table_title = 'Certificate'
    _field_arrangement = [
        'certificate_type_string', 'contractor_name',
        'contract_no', 'contractual_date', 'actual_date',
      ]
    _field_dictionary = key_label(_field_arrangement)
    _template = 'default/table.html'
    _add_link_func_name = 'contract_mgt.add_certificate'
    data = certificate_table()
#    data = VendorSchema(vendor, many=True).data

    return render_template(_template,
                           data=data,
                           columns=_field_dictionary,
                           keys=_field_arrangement,
                           add_link_func=_add_link_func_name,
                           table_title = _table_title,
                           )
Beispiel #11
0
def table_contractor():
    _table_title = 'Contractor'
    _field_arrangement = [
        'name', 'profile',
        'short_hand', 'remarks',
      ]
    _field_dictionary = key_label(_field_arrangement)
    _template = 'default/table.html'
    _add_link_func_name = 'contract_mgt.add_contractor'

    data = contractor_table()
#    data = VendorSchema(vendor, many=True).data

    return render_template(_template,
                           data=data,
                           columns=_field_dictionary,
                           keys=_field_arrangement,
                           add_link_func=_add_link_func_name,
                           table_title = _table_title
                           )
Beispiel #12
0
def table():
    _table_title = 'Vendor Contact'
    _field_arrangement = ['vendor_name', 'contact_name',
                          'position', 'department',
                          'email', 'mobile_no',
                          'office_no', 'fax_no',
                          'primary']
    _field_dictionary = key_label(_field_arrangement)
    _template = 'table.html'
    _add_link_func_name = 'v_contact.add'
    data = vendor_contact_table()
#    data = VendorSchema(vendor, many=True).data

    return render_template(_template,
                           data=data,
                           columns=_field_dictionary,
                           keys=_field_arrangement,
                           add_link_func=_add_link_func_name,
                           table_title = _table_title,
                           )
Beispiel #13
0
def table_task(filter=None):
    _table_title = 'Task'
    _field_arrangement = [
        'task_no',
        'commitment_value',
        'actual',
        'id',
    ]

    _field_dictionary = key_label(_field_arrangement)
    _template = 'budget_mgt/table-task.html'
    _add_link_func_name = 'budget_mgt.table_task'
    _invoices_summary_func_name = 'budget_mgt.invoices_summary'

    return render_template(_template,
                           columns=_field_dictionary,
                           keys=_field_arrangement,
                           add_link_func=_add_link_func_name,
                           invoices_summary_func = _invoices_summary_func_name,
                           table_title = _table_title
                           )
Beispiel #14
0
def table_document():
    _table_title = 'Document'
    _field_arrangement = [
        'contractor_name', 'reference_no',
        'contract_no', 'type_of_doc',
        'subject', 'status',
        'remarks','destination'
      ]
    _field_dictionary = key_label(_field_arrangement)
    _template = 'team_mgt/table-document.html'
    _add_link_func_name = 'team_mgt.add_document'

    data = document_table()

    return render_template(_template,
                           data=data,
                           columns=_field_dictionary,
                           keys=_field_arrangement,
                           add_link_func=_add_link_func_name,
                           table_title = _table_title
                           )
Beispiel #15
0
def table_contractor_contact():
    _table_title = 'Contact'
    _field_arrangement = [
        'contractor_name', 'contact_name', 'position',
        'eadd', 'mobile_no', 'office_no',
        'fax_no',
      ]
    _field_dictionary = key_label(_field_arrangement)
    _template = 'default/table.html'
    _add_link_func_name = 'contract_mgt.add_contractor_contact'

    data = contractor_contact_table()
#    data = VendorSchema(vendor, many=True).data

    return render_template(_template,
                           data=data,
                           columns=_field_dictionary,
                           keys=_field_arrangement,
                           add_link_func=_add_link_func_name,
                           table_title = _table_title
                           )
Beispiel #16
0
def table_po():
    _table_title = 'Purchase Order'
    _field_arrangement = [
        'po_number', 'po_number_renew', 'po_date',
        'po_value', 'contractor', 'budget_type',
        'cpx_commitment_value', 'cpx_expenditure_value', 'opx_value',
        'revenue_value', 'task_num', 'status',
        'status_renew',
    ]
    _field_dictionary = key_label(_field_arrangement)
    _template = '_table.html'
    _add_link_func_name = 'resource_mgt.add_po'

    data = resource_table()
#    data = VendorSchema(vendor, many=True).data

    return render_template(_template,
                           data=data,
                           columns=_field_dictionary,
                           keys=_field_arrangement,
                           add_link_func=_add_link_func_name,
                           table_title = _table_title
                           )
Beispiel #17
0
def table(filter_val=None):

    _table_title = 'CSR'
    _field_arrangement = ['vendor_name', 'csr_reference',
                          'contract_no', 'description',
                          'csr_type', 'status',
                          'incident_date', 'report_date',
                          'close_date', 'remarks'
                          ]
    _field_dictionary = key_label(_field_arrangement)
    _template = 'analytic/table.html'
    _add_link_func_name = 'memo.add'

    data = csr_table(filter_val)
#    data = VendorSchema(vendor, many=True).data

    return render_template(_template,
                           data=data,
                           columns=_field_dictionary,
                           keys=_field_arrangement,
                           table_title = _table_title,
                            add_link_func=_add_link_func_name,
                          )
Beispiel #18
0
def table_pl():
    _table_title = 'Purchase Order Line'
    _field_arrangement = [
        'line_num', 'line_duration', 'line_value',
        'line_r_value', 'line_rate', 'line_status',
        'line_actuals', 'cpx_percent', 'opx_percent',
        'rev_percent', 'division', 'section',
        'sub_section', 'director_name',
    ]
    _field_dictionary = key_label(_field_arrangement)
    _template = '_table.html'
    _add_link_func_name = 'resource_mgt.add_po'

    data = resource_table()
#    data = VendorSchema(vendor, many=True).data

    return render_template(_template,
                           data=data,
                           columns=_field_dictionary,
                           keys=_field_arrangement,
                           add_link_func=_add_link_func_name,
                           table_title = _table_title
                           )
Beispiel #19
0
def table_contract():
    _table_title = 'Contract'
    _field_arrangement = [
        'contractor_name', 'cwp_no',
        'contract_number',
        'delivery_date',
        'signed_date',
        'expired_date', 'support_provided', 'support_start_date',
      ]
    _field_dictionary = key_label(_field_arrangement)
    _template = 'default/table.html'
    _add_link_func_name = 'contract_mgt.add_contract'
    _history_link_func_name = 'contract_mgt.timeline'
    data = contract_table()
#    data = VendorSchema(vendor, many=True).data

    return render_template(_template,
                           data=data,
                           columns=_field_dictionary,
                           keys=_field_arrangement,
                           add_link_func=_add_link_func_name,
                           table_title = _table_title,
                           history_link_func=_history_link_func_name,
                           )
Beispiel #20
0
def report_view_team_task(filter_class=None, filter_val=None):
    summary = {}
    how = 'left'    # default merging how
    _field_arrangement = [
       'contractor_name', 'description', 'action_taken', 'update_date',  'action_by'
       ]
    _field_dictionary = key_label(_field_arrangement)
    _template = 'dashboard/team-task.html'
    _timeline_link_func_name = 'team_mgt.timeline'
    _notify_link_func_name = 'team_mgt.notify'
    _severity =  sort_tuple(choices_team_task_severity())
    _category = sort_tuple(choices_team_task_category())
    _classification = sort_tuple(choices_team_task_class())

    df_team_task = query_to_df(TeamTask.query.all())
    df_contractor = query_to_df(Contractor.query.all())
    df_history = query_to_df(TeamTaskHistory.query.\
                             order_by(TeamTaskHistory.date_action.desc(),
                                      TeamTaskHistory.id.desc()).\
     #                        limit(1).
                             all()
                             )
    df_user = query_to_df(User.query.all())

    if filter_class == 'Contractor':
        df_contractor = df_contractor[df_contractor['id']==filter_val]
        how = 'right'   # to remove other contractors

    elif filter_class is not None:
        df_team_task = df_team_task[df_team_task[filter_class.lower()]==filter_val]
        how = 'left'    #retain all

    df_team_task_open = df_team_task[df_team_task['status']!=2]      # filter by status open

    mg_history_user = pd.merge(df_history, df_user, left_on='action_taken_by', right_on='id', how='left')
    mg = pd.merge(df_team_task_open, df_contractor, left_on='contractor_id', right_on='id', how=how)

    #id_x is the team_task ID
    mg = pd.merge(mg, mg_history_user, left_on='id_x', right_on='team_task_id', how='outer')

    group_by_severity = df_team_task_open.groupby('severity')
    group_by_category = df_team_task_open.groupby('category')
    group_by_classification = df_team_task_open.groupby('classification')
    group_by_contractor = mg.groupby('name')

    #id_x_x is the team_task ID
    group_by_team_task = mg.groupby('id_x_x')
    summary['total_closed'] = len(df_team_task[df_team_task['status']==2])
    summary['total_open'] = len(df_team_task[df_team_task['status']!=2])
    summary['by_contractor'] = ('Contractor', group_sort_to_list(group_by_contractor, str_list=None))
    summary['by_severity'] = ('Severity', group_sort_to_list(group_by_severity,str_list=_severity))
    summary['by_category'] = ('Category', group_sort_to_list(group_by_category,str_list=_category))
    summary['by_classification'] = ('Classification', group_sort_to_list(group_by_classification,str_list=_classification))

    data=[]
    for group in group_by_team_task:
        record = group[1].head(1)       # 0 is the group name; 1 is the group data
        index = record.index[0]     #takes the index in the Dataframe to access
        try:
            data.append(
                {
                'id': int(group[0]),
                'contractor_name': record.loc[index, 'name'],
                'description': record.loc[index, 'description'],
                'update_date': record.loc[index, 'date_action'].strftime('%Y-%m-%d'),
                'action_taken': record.loc[index, 'action_taken'],
                'action_by': record.loc[index, 'username']
                }
            )

        except:
            data.append(
                {
                'id': int(group[0]),
                'contractor_name': record.loc[index, 'name'],
                'description': record.loc[index, 'description'],
                'latest_action': "No Update",
                'action_taken': "No Update",
                'action_by': "No Update"
                }
            )

    # records = TeamTask.query.\
    #     filter(TeamTask.status != 2).\
    #     all()
    # data=[]
    # for record in records:
    #     try:
    #         data.append(
    #             {
    #             'id': record.id,
    #             'contractor_name': record.contractor.name,
    #             'description': record.description,
    #             'update_date': record.history[0].date_action.strftime('%Y-%m-%d'),
    #             'action_taken': record.history[0].action_taken,
    #             'action_by': record.history[0].action_taken_by_username
    #             }
    #         )
    #
    #     except IndexError:
    #         data.append(
    #             {
    #             'id': record.id,
    #             'contractor_name': record.contractor.name,
    #             'description': record.description,
    #             'latest_action': "No Update",
    #             'action_taken': "No Update",
    #             'action_by': "No Update"
    #             }
    #         )

    return render_template(_template,
#                           table_meta = table_meta,
                            data = data,
                            summary=summary,
                            columns=_field_dictionary,
                            keys=_field_arrangement,
                            timeline_link_func=_timeline_link_func_name,
                            notify_link_func=_notify_link_func_name
                        )