def get_status_report_consolidated(db, request, session_user, session_category):
    if not request.csv:
        country_id = request.c_id
        legal_entity_id = request.legal_entity_id
        domain_id = request.d_id
        unit_id = request.unit_id
        act = request.act
        compliance_task = request.compliance_task
        frequency_id = request.frequency_id
        user_type_id = request.user_type_id
        status_name = request.status_name
        usr_id = request.usr_id
        from_date = request.from_date
        to_date = request.to_date
        csv = request.csv
        f_count = request.f_count
        t_count = request.t_count

        status_report_consolidated_list = report_status_report_consolidated(
            db, country_id, legal_entity_id, domain_id, unit_id, act, compliance_task, frequency_id,
            user_type_id, status_name, usr_id, from_date, to_date, session_user, f_count, t_count
        )
        total_count = 0
        if request.count_qry:
            total_count = report_status_report_consolidated_total(
                db, country_id, legal_entity_id, domain_id, unit_id,act, compliance_task,
                frequency_id, user_type_id, status_name, usr_id, from_date, to_date, session_user
            )

        logo_url = legal_entity_logo_url(
            db, legal_entity_id
        )
        return clientreportnew.GetStatusReportConsolidatedSuccess(
            status_report_consolidated_list, total_count, logo_url
        )
    else:
        converter = ConvertJsonToCSV(
            db, request, session_user, "StatusReportConsolidated"
        )
        return clientreport.ExportToCSVSuccess(
            link=converter.FILE_DOWNLOAD_PATH
        )
def get_work_flow_score_card(db, request, session_user, session_category):
    if not request.csv:
        country_id = request.c_id
        legal_entity_id = request.legal_entity_id
        domain_id = request.d_id

        work_flow_score_card_list = report_work_flow_score_card(
            db, country_id, legal_entity_id, domain_id, session_user, session_category
        )
        logo_url = legal_entity_logo_url(
            db, legal_entity_id
        )
        return clientreportnew.GetWorkFlowScoreCardSuccess(work_flow_score_card_list, logo_url)
    else:
        converter = ConvertJsonToCSV(
            db, request, session_user, "Reassign"
        )
        return clientreportnew.ExportToCSVSuccess(
            link=converter.FILE_DOWNLOAD_PATH
        )
def get_statutory_settings_unit_Wise(db, request, session_user, session_category):
    if not request.csv:
        country_id = request.c_id
        bg_id = request.bg_id
        legal_entity_id = request.legal_entity_id
        domain_id = request.d_id
        unit_id = request.unit_id
        div_id = request.div_id
        cat_id = request.cat_id
        act = request.act
        compliance_task = request.compliance_task
        frequency_id = request.frequency_id
        status_name = request.status_name
        csv = request.csv
        f_count = request.f_count
        t_count = request.t_count

        statutory_settings_unit_Wise_list = report_statutory_settings_unit_Wise(
            db, country_id, bg_id, legal_entity_id, domain_id, unit_id,
            div_id, cat_id, act, compliance_task, frequency_id, status_name, session_user, f_count, t_count
        )
        total_count = 0
        if request.count_qry:
            total_count = report_statutory_settings_unit_Wise_total(
                db, country_id, bg_id, legal_entity_id, domain_id, unit_id, div_id, cat_id,
                act, compliance_task, frequency_id, status_name, session_user
            )

        logo_url = legal_entity_logo_url(
            db, legal_entity_id
        )
        return clientreportnew.GetStatutorySettingsUnitWiseSuccess(
            statutory_settings_unit_Wise_list, total_count, logo_url
        )
    else:
        converter = ConvertJsonToCSV(
            db, request, session_user, "StatutorySettingsUnitWise"
        )
        return clientreport.ExportToCSVSuccess(
            link=converter.FILE_DOWNLOAD_PATH
        )
def get_reassignedhistory_report(db, request, session_user, session_category):
    if not request.csv:
        country_id = request.c_id
        legal_entity_id = request.legal_entity_id
        domain_id = request.d_id
        unit_id = request.unit_id
        act = request.act
        compliance_task = request.compliance_task
        usr_id = request.usr_id
        from_date = request.from_date
        to_date = request.to_date
        csv = request.csv
        f_count = request.f_count
        t_count = request.t_count

        reassigned_history_list = report_reassigned_history(
            db, country_id, legal_entity_id, domain_id, unit_id,
            act, compliance_task, usr_id, from_date, to_date, session_user, f_count, t_count
        )
        total_count = 0
        if request.count_qry:
            total_count = report_reassigned_history_total(
                db, country_id, legal_entity_id, domain_id, unit_id,
                act, compliance_task, usr_id, from_date, to_date, session_user
            )
        logo_url = legal_entity_logo_url(
            db, legal_entity_id
        )
        return clientreportnew.GetReassignedHistoryReportSuccess(
            reassigned_history_list, total_count, logo_url
        )
    else:
        converter = ConvertJsonToCSV(
            db, request, session_user, "Reassign"
        )
        return clientreportnew.ExportToCSVSuccess(
            link=converter.FILE_DOWNLOAD_PATH
        )