Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
a1e4bae6d1
@ -928,21 +928,73 @@ class TicketController extends BaseController
|
||||
$toDate = \DateTime::createFromFormat('d-m-Y', $to_Date)->format('Y-m-d');
|
||||
$policy_type = $received_data['policy_type'];
|
||||
// print_rr($received_data);
|
||||
if ($received_data['report_type'] == "acc_manager_wise_status") {
|
||||
|
||||
$viewData['account_manager_wise_data'] = $this->accountManagerWiseReport($policy_type, $fromDate, $toDate);
|
||||
if ($received_data['report_type'] == "acc_manager_wise_status"){
|
||||
$viewData['policy_type'] = $received_data['policy_type'];
|
||||
$viewData['account_manager_wise_data'] = $this->ticketMasterModel->accountManagerWiseReport($policy_type,$fromDate,$toDate);
|
||||
// print_rr($viewData);
|
||||
if ($policy_type == 1) {
|
||||
$html = view('claims_report_acc_manager_gmc', $viewData);
|
||||
if ($policy_type == 1){
|
||||
$viewData['column_order'] = [
|
||||
'ACM_NAME', 'ID NOT GENERATED', 'NON ID', 'CDA', 'INFORMATION REQUIRED',
|
||||
'UNDER PROCESS - CLAIM NO. UPDATION', 'UNDER PROCESS - INVESTIGATION STATUS',
|
||||
'UNDER PROCESS - QUERY DOCUMENT RECEIVED', 'APPROVED', 'PAYMENT INITIATED',
|
||||
'TOTAL'
|
||||
];
|
||||
$ordered_data = [];
|
||||
|
||||
foreach ($viewData['account_manager_wise_data'] as $tpa_data) {
|
||||
$temp = [];
|
||||
foreach ($viewData['column_order'] as $key) {
|
||||
$temp[$key] = isset($tpa_data[$key]) ? $tpa_data[$key] : 0; // Default to 0 if key is missing
|
||||
}
|
||||
$ordered_data[] = $temp;
|
||||
}
|
||||
$viewData['tpa_wise_data'] = $ordered_data;
|
||||
$html = view('claims_report_acc_manager_wise', $viewData);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
} else {
|
||||
$html = view('claims_report_acc_manager_gpa', $viewData);
|
||||
}else{
|
||||
$viewData['column_order'] = [
|
||||
'ACM_NAME', 'CLAIM INTIMATION', 'INTIMATION TO INSURER', 'CLIENT PENDING',
|
||||
'INSURER PENDING','INVESTIGATION','APPROVED','ON HOLD','TOTAL', 'NOT COVERED',
|
||||
'CLOSED', 'SETTLED', 'CLEARED_TOTAL'
|
||||
];
|
||||
$ordered_data = [];
|
||||
|
||||
foreach ($viewData['account_manager_wise_data'] as $tpa_data) {
|
||||
$temp = [];
|
||||
foreach ($viewData['column_order'] as $key) {
|
||||
$temp[$key] = isset($tpa_data[$key]) ? $tpa_data[$key] : 0; // Default to 0 if key is missing
|
||||
}
|
||||
$ordered_data[] = $temp;
|
||||
}
|
||||
$viewData['tpa_wise_data'] = $ordered_data;
|
||||
$html = view('claims_report_acc_manager_wise', $viewData);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
}
|
||||
} elseif ($received_data['report_type'] == 'tpa_wise_status') {
|
||||
|
||||
$viewData['tpa_wise_data'] = $this->tpaWiseReport($policy_type, $fromDate, $toDate);
|
||||
$html = view('claims_report_tpa_wise', $viewData);
|
||||
$viewData['tpa_wise_data'] = $this->ticketMasterModel->tpaWiseReport($policy_type, $fromDate, $toDate);
|
||||
|
||||
$viewData['column_order'] = [
|
||||
'TPA_NAME', 'NON ID', 'ID NOT GENERATED', 'CDA', 'INFORMATION REQUIRED',
|
||||
'UNDER PROCESS - CLAIM NO. UPDATION', 'UNDER PROCESS - INVESTIGATION STATUS',
|
||||
'UNDER PROCESS - QUERY DOCUMENT RECEIVED', 'APPROVED', 'PAYMENT INITIATED',
|
||||
'TOTAL', 'SETTLED', 'CLOSED', 'CANCELLED', 'RETURNED', 'CLEARED_TOTAL'
|
||||
];
|
||||
|
||||
// Reorder data based on column order
|
||||
$ordered_data = [];
|
||||
|
||||
foreach ($viewData['tpa_wise_data'] as $tpa_data) {
|
||||
$temp = [];
|
||||
foreach ($viewData['column_order'] as $key) {
|
||||
$temp[$key] = isset($tpa_data[$key]) ? $tpa_data[$key] : 0; // Default to 0 if key is missing
|
||||
}
|
||||
$ordered_data[] = $temp;
|
||||
}
|
||||
$viewData['tpa_wise_data'] = $ordered_data;
|
||||
// $html = view('claims_report_tpa_wise', $viewData);
|
||||
|
||||
$html = view('claims_report_tpa_wise',$viewData);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
} else if ($received_data['report_type'] == 'tat_band_wise') {
|
||||
|
||||
@ -953,134 +1005,134 @@ class TicketController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
public function accountManagerWiseReport($policy_type = null, $start_date = null, $end_date = null)
|
||||
{
|
||||
// public function accountManagerWiseReport($policy_type = null ,$start_date = null, $end_date = null){
|
||||
|
||||
if ($policy_type == 1) {
|
||||
$sql = "SELECT
|
||||
u.first_name AS acc_manager_name,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'ID NOT GENERATED' AND master.ticket_type_id = 1 THEN master.id END) AS id_not_generated,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'NON ID' AND master.ticket_type_id = 1 THEN master.id END) AS non_id,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'CDA' AND master.ticket_type_id = 1 THEN master.id END) AS cda,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'INFORMATION REQUIRED' AND master.ticket_type_id = 1 THEN master.id END) AS information_required,
|
||||
COUNT(CASE WHEN tcs.claim_status LIKE '%UNDER PROCESS%' AND master.ticket_type_id = 1 THEN master.id END) AS under_process,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = 1 THEN master.id END) AS approved,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'PAYMENT INITIATED' AND master.ticket_type_id = 1 THEN master.id END) AS payment_initiated,
|
||||
(
|
||||
COUNT(CASE WHEN tcs.claim_status = 'ID NOT GENERATED' AND master.ticket_type_id = 1 THEN master.id END) +
|
||||
COUNT(CASE WHEN tcs.claim_status = 'NON ID' AND master.ticket_type_id = 1 THEN master.id END) +
|
||||
COUNT(CASE WHEN tcs.claim_status = 'CDA' AND master.ticket_type_id = 1 THEN master.id END) +
|
||||
COUNT(CASE WHEN tcs.claim_status = 'INFORMATION REQUIRED' AND master.ticket_type_id = 1 THEN master.id END) +
|
||||
COUNT(CASE WHEN tcs.claim_status LIKE '%UNDER PROCESS%' AND master.ticket_type_id = 1 THEN master.id END) +
|
||||
COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = 1 THEN master.id END) +
|
||||
COUNT(CASE WHEN tcs.claim_status = 'PAYMENT INITIATED' AND master.ticket_type_id = 1 THEN master.id END)
|
||||
) AS total
|
||||
FROM
|
||||
ticket_master master
|
||||
JOIN
|
||||
user_profiles u ON master.acm_id = u.id and u.is_active = 1
|
||||
JOIN
|
||||
ticket_claim_status tcs ON tcs.id = master.claim_status_id and tcs.is_active = 1
|
||||
WHERE
|
||||
master.created_at <= '$end_date' and master.created_at >= '$start_date' and master.is_active = 1
|
||||
GROUP BY
|
||||
u.id;
|
||||
";
|
||||
$result = $this->ticketMasterModel->query($sql)->getResultArray();
|
||||
// dd($result);
|
||||
// if ($policy_type == 1) {
|
||||
// $sql = "SELECT
|
||||
// u.first_name AS acc_manager_name,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'ID NOT GENERATED' AND master.ticket_type_id = 1 THEN master.id END) AS id_not_generated,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'NON ID' AND master.ticket_type_id = 1 THEN master.id END) AS non_id,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'CDA' AND master.ticket_type_id = 1 THEN master.id END) AS cda,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'INFORMATION REQUIRED' AND master.ticket_type_id = 1 THEN master.id END) AS information_required,
|
||||
// COUNT(CASE WHEN tcs.claim_status LIKE '%UNDER PROCESS%' AND master.ticket_type_id = 1 THEN master.id END) AS under_process,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = 1 THEN master.id END) AS approved,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'PAYMENT INITIATED' AND master.ticket_type_id = 1 THEN master.id END) AS payment_initiated,
|
||||
// (
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'ID NOT GENERATED' AND master.ticket_type_id = 1 THEN master.id END) +
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'NON ID' AND master.ticket_type_id = 1 THEN master.id END) +
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'CDA' AND master.ticket_type_id = 1 THEN master.id END) +
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'INFORMATION REQUIRED' AND master.ticket_type_id = 1 THEN master.id END) +
|
||||
// COUNT(CASE WHEN tcs.claim_status LIKE '%UNDER PROCESS%' AND master.ticket_type_id = 1 THEN master.id END) +
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = 1 THEN master.id END) +
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'PAYMENT INITIATED' AND master.ticket_type_id = 1 THEN master.id END)
|
||||
// ) AS total
|
||||
// FROM
|
||||
// ticket_master master
|
||||
// JOIN
|
||||
// user_profiles u ON master.acm_id = u.id and u.is_active = 1
|
||||
// JOIN
|
||||
// ticket_claim_status tcs ON tcs.id = master.claim_status_id and tcs.is_active = 1
|
||||
// WHERE
|
||||
// master.created_at <= '$end_date' and master.created_at >= '$start_date' and master.is_active = 1
|
||||
// GROUP BY
|
||||
// u.id;
|
||||
// ";
|
||||
// $result = $this->ticketMasterModel->query($sql)->getResultArray();
|
||||
// // dd($result);
|
||||
|
||||
return $result;
|
||||
} else {
|
||||
$sql = "SELECT u.first_name AS acc_manager_name,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'CLAIM INTIMATION' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS claim_intimation,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'INTIMATION TO INSURER' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS int_to_insurer,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'CLIENT PENDING' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS client_pending,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'INSURER PENDING' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS information_required,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'INVESTIGATION' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS investigation,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS approved,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'ON HOLD' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS on_hold,
|
||||
// return $result;
|
||||
|
||||
|
||||
// }else{
|
||||
// $sql = "SELECT u.first_name AS acc_manager_name,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'CLAIM INTIMATION' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS claim_intimation,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'INTIMATION TO INSURER' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS int_to_insurer,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'CLIENT PENDING' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS client_pending,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'INSURER PENDING' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS information_required,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'INVESTIGATION' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS investigation,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS approved,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'ON HOLD' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS on_hold,
|
||||
|
||||
(
|
||||
COUNT(CASE WHEN tcs.claim_status = 'CLAIM INTIMATION' AND master.ticket_type_id = '$policy_type' THEN master.id END)+
|
||||
COUNT(CASE WHEN tcs.claim_status = 'INTIMATION TO INSURER' AND master.ticket_type_id = '$policy_type' THEN master.id END)+
|
||||
COUNT(CASE WHEN tcs.claim_status = 'CLIENT PENDING' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
COUNT(CASE WHEN tcs.claim_status = 'INSURER PENDING' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
COUNT(CASE WHEN tcs.claim_status = 'INVESTIGATION' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
COUNT(CASE WHEN tcs.claim_status = 'ON HOLD' AND master.ticket_type_id = '$policy_type' THEN master.id END)
|
||||
) AS total1,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'NOT COVERED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS not_covered,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'CLOSED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS closed,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'SETTLED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS settled,
|
||||
(
|
||||
COUNT(CASE WHEN tcs.claim_status = 'NOT COVERED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
COUNT(CASE WHEN tcs.claim_status = 'CLOSED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
COUNT(CASE WHEN tcs.claim_status = 'SETTLED' AND master.ticket_type_id = '$policy_type' THEN master.id END)
|
||||
) AS total2
|
||||
FROM
|
||||
ticket_master master
|
||||
JOIN
|
||||
user_profiles u ON master.acm_id = u.id and u.is_active = 1
|
||||
JOIN
|
||||
ticket_claim_status tcs ON tcs.id = master.claim_status_id and tcs.is_active = 1
|
||||
WHERE
|
||||
master.created_at <= '$end_date' and master.created_at >= '$start_date' and master.is_active = 1 and master.ticket_type_id = '$policy_type'
|
||||
GROUP BY
|
||||
u.id;
|
||||
";
|
||||
$result = $this->ticketMasterModel->query($sql)->getResultArray();
|
||||
// (
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'CLAIM INTIMATION' AND master.ticket_type_id = '$policy_type' THEN master.id END)+
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'INTIMATION TO INSURER' AND master.ticket_type_id = '$policy_type' THEN master.id END)+
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'CLIENT PENDING' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'INSURER PENDING' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'INVESTIGATION' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'ON HOLD' AND master.ticket_type_id = '$policy_type' THEN master.id END)
|
||||
// ) AS total1,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'NOT COVERED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS not_covered,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'CLOSED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS closed,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'SETTLED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS settled,
|
||||
// (
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'NOT COVERED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'CLOSED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'SETTLED' AND master.ticket_type_id = '$policy_type' THEN master.id END)
|
||||
// ) AS total2
|
||||
// FROM
|
||||
// ticket_master master
|
||||
// JOIN
|
||||
// user_profiles u ON master.acm_id = u.id and u.is_active = 1
|
||||
// JOIN
|
||||
// ticket_claim_status tcs ON tcs.id = master.claim_status_id and tcs.is_active = 1
|
||||
// WHERE
|
||||
// master.created_at <= '$end_date' and master.created_at >= '$start_date' and master.is_active = 1 and master.ticket_type_id = '$policy_type'
|
||||
// GROUP BY
|
||||
// u.id;
|
||||
// ";
|
||||
// $result = $this->ticketMasterModel->query($sql)->getResultArray();
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
// return $result;
|
||||
// }
|
||||
// }
|
||||
|
||||
public function tpaWiseReport($policy_type = null, $start_date = null, $end_date = null)
|
||||
{
|
||||
// $policy_type = 1;
|
||||
$sql = "SELECT
|
||||
tpa.name AS tpa_name,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'ID NOT GENERATED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS id_not_generated,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'NON ID' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS non_id,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'CDA' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS cda,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'INFORMATION REQUIRED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS information_required,
|
||||
COUNT(CASE WHEN tcs.claim_status LIKE '%UNDER PROCESS%' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS under_process,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS approved,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'PAYMENT INITIATED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS payment_initiated,
|
||||
(
|
||||
COUNT(CASE WHEN tcs.claim_status = 'ID NOT GENERATED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
COUNT(CASE WHEN tcs.claim_status = 'NON ID' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
COUNT(CASE WHEN tcs.claim_status = 'CDA' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
COUNT(CASE WHEN tcs.claim_status = 'INFORMATION REQUIRED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
COUNT(CASE WHEN tcs.claim_status LIKE '%UNDER PROCESS%' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
COUNT(CASE WHEN tcs.claim_status = 'PAYMENT INITIATED' AND master.ticket_type_id = '$policy_type' THEN master.id END)
|
||||
) AS total,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'CLOSED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS closed,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'SETTLED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS settled,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'RETURNED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS returned,
|
||||
COUNT(CASE WHEN tcs.claim_status = 'REJECTED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS denied,
|
||||
(
|
||||
COUNT(CASE WHEN tcs.claim_status = 'CLOSED' AND master.ticket_type_id = '$policy_type'THEN master.id END) +
|
||||
COUNT(CASE WHEN tcs.claim_status = 'SETTLED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
COUNT(CASE WHEN tcs.claim_status = 'RETURNED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
COUNT(CASE WHEN tcs.claim_status = 'REJECTED' AND master.ticket_type_id = '$policy_type' THEN master.id END)
|
||||
) AS total2
|
||||
FROM
|
||||
ticket_master master
|
||||
JOIN
|
||||
tpa ON master.tpa_id = tpa.id and tpa.is_active = 1
|
||||
JOIN
|
||||
ticket_claim_status tcs ON tcs.id = master.claim_status_id and tcs.is_active = 1
|
||||
WHERE
|
||||
master.created_at <= '$end_date' and master.created_at >= '$start_date' and master.is_active = 1
|
||||
GROUP BY
|
||||
tpa.id;
|
||||
// public function tpaWiseReport($policy_type = null ,$start_date = null,$end_date = null ){
|
||||
// // $policy_type = 1;
|
||||
// $sql = "SELECT
|
||||
// tpa.name AS tpa_name,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'ID NOT GENERATED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS id_not_generated,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'NON ID' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS non_id,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'CDA' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS cda,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'INFORMATION REQUIRED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS information_required,
|
||||
// COUNT(CASE WHEN tcs.claim_status LIKE '%UNDER PROCESS%' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS under_process,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS approved,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'PAYMENT INITIATED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS payment_initiated,
|
||||
// (
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'ID NOT GENERATED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'NON ID' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'CDA' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'INFORMATION REQUIRED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
// COUNT(CASE WHEN tcs.claim_status LIKE '%UNDER PROCESS%' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'PAYMENT INITIATED' AND master.ticket_type_id = '$policy_type' THEN master.id END)
|
||||
// ) AS total,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'CLOSED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS closed,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'SETTLED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS settled,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'RETURNED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS returned,
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'REJECTED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS denied,
|
||||
// (
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'CLOSED' AND master.ticket_type_id = '$policy_type'THEN master.id END) +
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'SETTLED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'RETURNED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||
// COUNT(CASE WHEN tcs.claim_status = 'REJECTED' AND master.ticket_type_id = '$policy_type' THEN master.id END)
|
||||
// ) AS total2
|
||||
// FROM
|
||||
// ticket_master master
|
||||
// JOIN
|
||||
// tpa ON master.tpa_id = tpa.id and tpa.is_active = 1
|
||||
// JOIN
|
||||
// ticket_claim_status tcs ON tcs.id = master.claim_status_id and tcs.is_active = 1
|
||||
// WHERE
|
||||
// master.created_at <= '$end_date' and master.created_at >= '$start_date' and master.is_active = 1
|
||||
// GROUP BY
|
||||
// tpa.id;
|
||||
|
||||
|
||||
";
|
||||
$result = $this->ticketMasterModel->query($sql)->getResultArray();
|
||||
// ";
|
||||
// $result = $this->ticketMasterModel->query($sql)->getResultArray();
|
||||
|
||||
return $result;
|
||||
}
|
||||
// return $result;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@ -450,5 +450,201 @@ class TicketMasterModel extends Model
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function tpaWiseReport($policy_type = null ,$start_date = null, $end_date = null){
|
||||
$ticket_type_data_1 = "";
|
||||
$ticket_type_data_2 = "";
|
||||
|
||||
if (!empty($policy_type)) {
|
||||
$ticket_type_data_1 = "AND ticket_type = $policy_type";
|
||||
$ticket_type_data_2 = "AND master.ticket_type_id = $policy_type";
|
||||
}
|
||||
|
||||
// Fetch claim statuses dynamically
|
||||
$statusQuery = "SELECT id, claim_status FROM ticket_claim_status WHERE is_active = 1 $ticket_type_data_1";
|
||||
$statusResult = $this->db->query($statusQuery)->getResultArray();
|
||||
|
||||
// Initialize dynamic query parts
|
||||
$dynamicSelect = '';
|
||||
$dynamicTotal = '';
|
||||
$dynamicClosedTotal = '';
|
||||
|
||||
// Loop through each claim status and generate the CASE statements
|
||||
foreach ($statusResult as $status) {
|
||||
$dynamicSelect .= "
|
||||
COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) AS `{$status['claim_status']}`, ";
|
||||
|
||||
if (in_array($status['claim_status'], ['ID NOT GENERATED', 'NON ID', 'CDA', 'INFORMATION REQUIRED','UNDER PROCESS - CLAIM NO. UPDATION',
|
||||
'UNDER PROCESS - INVESTIGATION STATUS','UNDER PROCESS - QUERY DOCUMENT RECEIVED','APPROVED','PAYMENT INITIATED'])) {
|
||||
$dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||
}
|
||||
// Include in total count
|
||||
// $dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||
|
||||
// Include only closed-related statuses in total2 count
|
||||
if (in_array($status['claim_status'], ['CLOSED', 'SETTLED', 'RETURNED', 'REJECTED'])) {
|
||||
$dynamicClosedTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the trailing commas and `+` signs
|
||||
$dynamicSelect = rtrim($dynamicSelect, ', ');
|
||||
$dynamicTotal = rtrim($dynamicTotal, ' +');
|
||||
$dynamicClosedTotal = rtrim($dynamicClosedTotal, ' +');
|
||||
// print_rr($dynamicSelect);
|
||||
// Construct the final SQL query
|
||||
$sql = "
|
||||
SELECT
|
||||
tpa.name AS TPA_NAME,
|
||||
$dynamicSelect,
|
||||
($dynamicTotal) AS TOTAL,
|
||||
($dynamicClosedTotal) AS CLEARED_TOTAL
|
||||
FROM
|
||||
ticket_master master
|
||||
JOIN
|
||||
tpa ON master.tpa_id = tpa.id AND tpa.is_active = 1
|
||||
WHERE
|
||||
master.created_at BETWEEN '$start_date' AND '$end_date'
|
||||
AND master.is_active = 1
|
||||
$ticket_type_data_2
|
||||
GROUP BY
|
||||
tpa.id;
|
||||
";
|
||||
|
||||
// Execute the query
|
||||
$result = $this->db->query($sql)->getResultArray();
|
||||
|
||||
// print_rr($result);die();
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
public function accountManagerWiseReport($policy_type = null ,$start_date = null, $end_date = null){
|
||||
|
||||
if ($policy_type == 1) {
|
||||
$ticket_type_data_1 = "";
|
||||
$ticket_type_data_2 = "";
|
||||
|
||||
if (!empty($policy_type)) {
|
||||
$ticket_type_data_1 = "AND ticket_type = $policy_type";
|
||||
$ticket_type_data_2 = "AND master.ticket_type_id = $policy_type";
|
||||
}
|
||||
|
||||
// Fetch claim statuses dynamically
|
||||
$statusQuery = "SELECT id, claim_status FROM ticket_claim_status WHERE is_active = 1 $ticket_type_data_1";
|
||||
$statusResult = $this->db->query($statusQuery)->getResultArray();
|
||||
|
||||
// Initialize dynamic query parts
|
||||
$dynamicSelect = '';
|
||||
$dynamicTotal = '';
|
||||
|
||||
// Loop through each claim status and generate the CASE statements
|
||||
foreach ($statusResult as $status) {
|
||||
$dynamicSelect .= "
|
||||
COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) AS `{$status['claim_status']}`, ";
|
||||
|
||||
|
||||
// Include in total count
|
||||
$dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||
|
||||
// Include only closed-related statuses in total2 count
|
||||
|
||||
}
|
||||
|
||||
// Remove the trailing commas and `+` signs
|
||||
$dynamicSelect = rtrim($dynamicSelect, ', ');
|
||||
$dynamicTotal = rtrim($dynamicTotal, ' +');
|
||||
// print_rr($dynamicSelect);
|
||||
// Construct the final SQL query
|
||||
$sql = "
|
||||
SELECT
|
||||
user_profiles.first_name AS ACM_NAME,
|
||||
$dynamicSelect,
|
||||
($dynamicTotal) AS TOTAL
|
||||
FROM
|
||||
ticket_master master
|
||||
JOIN
|
||||
user_profiles ON master.acm_id = user_profiles.id AND user_profiles.is_active = 1
|
||||
WHERE
|
||||
master.created_at BETWEEN '$start_date' AND '$end_date'
|
||||
AND master.is_active = 1
|
||||
$ticket_type_data_2
|
||||
GROUP BY
|
||||
user_profiles.id;
|
||||
";
|
||||
|
||||
$result = $this->db->query($sql)->getResultArray();
|
||||
// dd($result);
|
||||
|
||||
return $result;
|
||||
|
||||
|
||||
}else{
|
||||
$ticket_type_data_1 = "";
|
||||
$ticket_type_data_2 = "";
|
||||
|
||||
if (!empty($policy_type)) {
|
||||
$ticket_type_data_1 = "AND ticket_type = $policy_type";
|
||||
$ticket_type_data_2 = "AND master.ticket_type_id = $policy_type";
|
||||
}
|
||||
|
||||
// Fetch claim statuses dynamically
|
||||
$statusQuery = "SELECT id, claim_status FROM ticket_claim_status WHERE is_active = 1 $ticket_type_data_1";
|
||||
$statusResult = $this->db->query($statusQuery)->getResultArray();
|
||||
|
||||
// Initialize dynamic query parts
|
||||
$dynamicSelect = '';
|
||||
$dynamicTotal = '';
|
||||
$dynamicClosedTotal = '';
|
||||
|
||||
// Loop through each claim status and generate the CASE statements
|
||||
foreach ($statusResult as $status) {
|
||||
$dynamicSelect .= "
|
||||
COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) AS `{$status['claim_status']}`, ";
|
||||
|
||||
if (in_array($status['claim_status'], ['CLAIM INTIMATION', 'INTIMATION TO INSURER', 'CLIENT PENDING', 'INSURER PENDING','INVESTIGATION',
|
||||
'APPROVED','ON HOLD'])) {
|
||||
$dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||
}
|
||||
// Include in total count
|
||||
// $dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||
|
||||
// Include only closed-related statuses in total2 count
|
||||
if (in_array($status['claim_status'], ['CLOSED', 'SETTLED', 'NOT COVERED'])) {
|
||||
$dynamicClosedTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the trailing commas and `+` signs
|
||||
$dynamicSelect = rtrim($dynamicSelect, ', ');
|
||||
$dynamicTotal = rtrim($dynamicTotal, ' +');
|
||||
$dynamicClosedTotal = rtrim($dynamicClosedTotal, ' +');
|
||||
// print_rr($dynamicSelect);
|
||||
// Construct the final SQL query
|
||||
$sql = "
|
||||
SELECT
|
||||
user_profiles.first_name AS ACM_NAME,
|
||||
$dynamicSelect,
|
||||
($dynamicTotal) AS TOTAL,
|
||||
($dynamicClosedTotal) AS CLEARED_TOTAL
|
||||
FROM
|
||||
ticket_master master
|
||||
JOIN
|
||||
user_profiles ON master.acm_id = user_profiles.id AND user_profiles.is_active = 1
|
||||
WHERE
|
||||
master.created_at BETWEEN '$start_date' AND '$end_date'
|
||||
AND master.is_active = 1
|
||||
$ticket_type_data_2
|
||||
GROUP BY
|
||||
user_profiles.id;
|
||||
";
|
||||
|
||||
// Execute the query
|
||||
$result = $this->db->query($sql)->getResultArray();
|
||||
|
||||
// print_rr($result);die();
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,169 +0,0 @@
|
||||
<style>
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
.col-12 {
|
||||
max-width: 98% !important;
|
||||
}
|
||||
|
||||
.dataTables_filter {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.right-align-input {
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">Insurer List</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>Account Manger</th>
|
||||
<th>ID Not Generated</th>
|
||||
<th>Non-ID</th>
|
||||
<th>CDA</th>
|
||||
<th>Information Required</th>
|
||||
<th>Under Process</th>
|
||||
<th>Approved</th>
|
||||
<th>Payment Initiated</th>
|
||||
<th>Total</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($account_manager_wise_data as $data): ?>
|
||||
<tr>
|
||||
<td><?= $data['acc_manager_name'] ?></td>
|
||||
<td><?= $data['id_not_generated'] ?></td>
|
||||
<td><?= $data['non_id'] ?></td>
|
||||
<td><?= $data['cda']?></td>
|
||||
<td><?= $data['information_required'] ?></td>
|
||||
<td><?= $data['under_process'] ?></td>
|
||||
<td><?= $data['approved'] ?></td>
|
||||
<td><?= $data['payment_initiated'] ?></td>
|
||||
<td><?= $data['total'] ?></td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Grand Total</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var ticketsTable = $('#scroll-horizontal-datatable');
|
||||
|
||||
if (ticketsTable.length) {
|
||||
ticketsTable.DataTable({
|
||||
scrollX: true,
|
||||
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'Insurer-Wise-Report-List',
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
text: 'Excel',
|
||||
title: 'Insurer-Wise-Report-List',
|
||||
exportOptions: {
|
||||
orthogonal: 'sort'
|
||||
},
|
||||
}
|
||||
],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 10, // Set default number of rows per page (optional)
|
||||
ordering: false,
|
||||
footerCallback: function(row, data, start, end, display) {
|
||||
var api = this.api();
|
||||
|
||||
// Helper function to parse numbers
|
||||
var parseNumber = function(value) {
|
||||
return typeof value === 'string' ?
|
||||
parseFloat(value.replace(/[\$,]/g, '')) :
|
||||
typeof value === 'number' ? value : 0;
|
||||
};
|
||||
|
||||
// Calculate total for each column
|
||||
var total_id_not_generated = api.column(1).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
|
||||
var total_non_id = api.column(2).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
|
||||
var total_cda = api.column(3).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
var total_information_required = api.column(4).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
var total_under_process = api.column(5).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
var total_approved = api.column(6).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
var total_payment_initiated = api.column(7).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
var total_of_total = api.column(8).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
|
||||
// Update the footer with totals
|
||||
$(api.column(1).footer()).html(total_id_not_generated);
|
||||
$(api.column(2).footer()).html(total_non_id);
|
||||
$(api.column(3).footer()).html(total_cda);
|
||||
$(api.column(4).footer()).html(total_information_required);
|
||||
$(api.column(5).footer()).html(total_under_process);
|
||||
$(api.column(6).footer()).html(total_approved);
|
||||
$(api.column(7).footer()).html(total_payment_initiated);
|
||||
$(api.column(8).footer()).html(total_of_total);
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.error("Table not found.");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@ -1,203 +0,0 @@
|
||||
<style>
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
.col-12 {
|
||||
max-width: 98% !important;
|
||||
}
|
||||
|
||||
.dataTables_filter {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.right-align-input {
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">Insurer List</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th style="text-align: center;" colspan="8">OPEN</th>
|
||||
<th style="text-align: center;" colspan="5">CLEARED</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Account Manger</th>
|
||||
<th>Claim Intimation</th>
|
||||
<th>Intimation to Insurer</th>
|
||||
<th>Client Pending</th>
|
||||
<th>Insurer Pending</th>
|
||||
<th>Investigation</th>
|
||||
<th>Approved</th>
|
||||
<th>On Hold</th>
|
||||
<th>Total</th>
|
||||
<th>Not Covered</th>
|
||||
<th>Closed</th>
|
||||
<th>Settled</th>
|
||||
<th>Total</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($account_manager_wise_data as $data): ?>
|
||||
<tr>
|
||||
<td><?= $data['acc_manager_name'] ?></td>
|
||||
<td><?= $data['claim_intimation'] ?></td>
|
||||
<td><?= $data['int_to_insurer'] ?></td>
|
||||
<td><?=$data['client_pending']?></td>
|
||||
<td><?=$data['information_required'] ?></td>
|
||||
<td><?=$data['investigation'] ?></td>
|
||||
<td><?=$data['approved'] ?></td>
|
||||
<td><?=$data['on_hold'] ?></td>
|
||||
<td><?=$data['total1'] ?></td>
|
||||
<td><?=$data['not_covered'] ?></td>
|
||||
<td><?=$data['closed'] ?></td>
|
||||
<td><?=$data['settled'] ?></td>
|
||||
<td><?=$data['total2'] ?></td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Grand Total</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
|
||||
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var ticketsTable = $('#scroll-horizontal-datatable');
|
||||
|
||||
if (ticketsTable.length) {
|
||||
ticketsTable.DataTable({
|
||||
scrollX: true,
|
||||
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'Insurer-Wise-Report-List',
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
text: 'Excel',
|
||||
title: 'Insurer-Wise-Report-List',
|
||||
exportOptions: {
|
||||
orthogonal: 'sort'
|
||||
},
|
||||
}
|
||||
],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 10, // Set default number of rows per page (optional)
|
||||
ordering: false,
|
||||
footerCallback: function(row, data, start, end, display) {
|
||||
var api = this.api();
|
||||
|
||||
// Helper function to parse numbers
|
||||
var parseNumber = function(value) {
|
||||
return typeof value === 'string' ?
|
||||
parseFloat(value.replace(/[\$,]/g, '')) :
|
||||
typeof value === 'number' ? value : 0;
|
||||
};
|
||||
|
||||
// Calculate total for each column
|
||||
var total_claim_intimation = api.column(1).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
|
||||
var total_int_to_insurer = api.column(2).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
|
||||
var total_client_pending = api.column(3).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
var total_information_required = api.column(4).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
var total_investigation = api.column(5).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
var total_approved = api.column(6).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
var total_on_hold = api.column(7).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
var total_of_total = api.column(8).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
var total_not_covered = api.column(9).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
var total_closed = api.column(10).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
var total_settled = api.column(11).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
var total_of_total2 = api.column(12).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
|
||||
// Update the footer with totals
|
||||
$(api.column(1).footer()).html(total_claim_intimation);
|
||||
$(api.column(2).footer()).html(total_int_to_insurer);
|
||||
$(api.column(3).footer()).html(total_client_pending);
|
||||
$(api.column(4).footer()).html(total_information_required);
|
||||
$(api.column(5).footer()).html(total_investigation);
|
||||
$(api.column(6).footer()).html(total_approved);
|
||||
$(api.column(7).footer()).html(total_on_hold);
|
||||
$(api.column(8).footer()).html(total_of_total);
|
||||
$(api.column(9).footer()).html(total_not_covered);
|
||||
$(api.column(10).footer()).html(total_closed);
|
||||
$(api.column(11).footer()).html(total_settled);
|
||||
$(api.column(12).footer()).html(total_of_total2);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.error("Table not found.");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
103
app/Views/claims_report_acc_manager_wise.php
Normal file
103
app/Views/claims_report_acc_manager_wise.php
Normal file
@ -0,0 +1,103 @@
|
||||
<style>
|
||||
.table th, .table td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
.col-12 {
|
||||
max-width: 98% !important;
|
||||
}
|
||||
|
||||
.dataTables_filter {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.right-align-input {
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">Account Manger Claim Status List</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="bg-light">
|
||||
<?php if ($policy_type != 1) {?>
|
||||
<tr>
|
||||
<th style="text-align: center;" colspan="8">OPEN</th>
|
||||
<th style="text-align: center;" colspan="5" >CLEARED</th>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<?php foreach ($column_order as $col_name): ?>
|
||||
<th><?= str_replace('_', ' ', $col_name) ?></th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($account_manager_wise_data as $row): ?>
|
||||
<tr>
|
||||
<?php foreach ($column_order as $col_name): ?>
|
||||
<td><?= $row[$col_name] ?></td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Grand Total</th>
|
||||
<?php
|
||||
$totals = array_fill_keys($column_order, 0);
|
||||
foreach ($account_manager_wise_data as $row) {
|
||||
foreach ($column_order as $col_name) {
|
||||
$totals[$col_name] += is_numeric($row[$col_name]) ? $row[$col_name] : 0;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($column_order as $col_name) {
|
||||
if ($col_name !== 'ACM_NAME') {
|
||||
echo "<th>{$totals[$col_name]}</th>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var ticketsTable = $('#scroll-horizontal-datatable');
|
||||
|
||||
if (ticketsTable.length) {
|
||||
ticketsTable.DataTable({
|
||||
scrollX: true,
|
||||
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" +
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||
buttons: [
|
||||
{ extend: 'csv', text: 'CSV', title: 'Insurer-Wise-Report-List' },
|
||||
{ extend: 'excel', text: 'Excel', title: 'Insurer-Wise-Report-List', exportOptions: { orthogonal: 'sort' } }
|
||||
],
|
||||
language: { search: "_INPUT_", searchPlaceholder: "Search..." },
|
||||
paging: true,
|
||||
pageLength: 10,
|
||||
ordering: false
|
||||
});
|
||||
} else {
|
||||
console.error("Table not found.");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@ -1,24 +1,23 @@
|
||||
<style>
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
.table th, .table td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
.col-12 {
|
||||
max-width: 98% !important;
|
||||
}
|
||||
.col-12 {
|
||||
max-width: 98% !important;
|
||||
}
|
||||
|
||||
.dataTables_filter {
|
||||
position: absolute;
|
||||
}
|
||||
.dataTables_filter {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.right-align-input {
|
||||
text-align: right;
|
||||
}
|
||||
.right-align-input {
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="col-12">
|
||||
@ -26,7 +25,7 @@ table.dataTable tbody td {
|
||||
<div class="card-body">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">Insurer List</h4>
|
||||
<h4 style="position: relative;">TPA Claim Status List</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
@ -34,63 +33,40 @@ table.dataTable tbody td {
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th style="text-align: center;" colspan="8">OPEN</th>
|
||||
<th style="text-align: center;" colspan="5">CLEARED</th>
|
||||
<th style="text-align: center;" colspan="5" >CLEARED</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>TPA</th>
|
||||
<th>ID Not Generated</th>
|
||||
<th>Non-ID</th>
|
||||
<th>CDA</th>
|
||||
<th>Information Required</th>
|
||||
<th>Under Process</th>
|
||||
<th>Approved</th>
|
||||
<th>Payment Initiated</th>
|
||||
<th>Total</th>
|
||||
<th>Closed</th>
|
||||
<th>Settled</th>
|
||||
<th>Returned</th>
|
||||
<th>Denied</th>
|
||||
<th>Total</th>
|
||||
|
||||
<?php foreach ($column_order as $col_name): ?>
|
||||
<th><?= str_replace('_', ' ', $col_name) ?></th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($tpa_wise_data as $data): ?>
|
||||
<?php foreach ($tpa_wise_data as $row): ?>
|
||||
<tr>
|
||||
<td><?= $data['tpa_name'] ?></td>
|
||||
<td><?= $data['id_not_generated'] ?></td>
|
||||
<td><?= $data['non_id'] ?></td>
|
||||
<td><?=$data['cda']?></td>
|
||||
<td><?=$data['information_required'] ?></td>
|
||||
<td><?=$data['under_process'] ?></td>
|
||||
<td><?=$data['approved'] ?></td>
|
||||
<td><?=$data['payment_initiated'] ?></td>
|
||||
<td><?=$data['total'] ?></td>
|
||||
<td><?=$data['closed'] ?></td>
|
||||
<td><?=$data['settled'] ?></td>
|
||||
<td><?=$data['returned'] ?></td>
|
||||
<td><?=$data['denied'] ?></td>
|
||||
<td><?=$data['total2'] ?></td>
|
||||
<?php foreach ($column_order as $col_name): ?>
|
||||
<td><?= $row[$col_name] ?></td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Grand Total</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
|
||||
<?php
|
||||
$totals = array_fill_keys($column_order, 0);
|
||||
foreach ($tpa_wise_data as $row) {
|
||||
foreach ($column_order as $col_name) {
|
||||
$totals[$col_name] += is_numeric($row[$col_name]) ? $row[$col_name] : 0;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($column_order as $col_name) {
|
||||
if ($col_name !== 'TPA_NAME') {
|
||||
echo "<th>{$totals[$col_name]}</th>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
@ -106,102 +82,17 @@ table.dataTable tbody td {
|
||||
if (ticketsTable.length) {
|
||||
ticketsTable.DataTable({
|
||||
scrollX: true,
|
||||
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
||||
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" +
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'Insurer-Wise-Report-List',
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
text: 'Excel',
|
||||
title: 'Insurer-Wise-Report-List',
|
||||
exportOptions: {
|
||||
orthogonal: 'sort'
|
||||
},
|
||||
}
|
||||
{ extend: 'csv', text: 'CSV', title: 'Insurer-Wise-Report-List' },
|
||||
{ extend: 'excel', text: 'Excel', title: 'Insurer-Wise-Report-List', exportOptions: { orthogonal: 'sort' } }
|
||||
],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 10, // Set default number of rows per page (optional)
|
||||
ordering: false,
|
||||
footerCallback: function(row, data, start, end, display) {
|
||||
var api = this.api();
|
||||
|
||||
// Helper function to parse numbers
|
||||
var parseNumber = function(value) {
|
||||
return typeof value === 'string' ?
|
||||
parseFloat(value.replace(/[\$,]/g, '')) :
|
||||
typeof value === 'number' ? value : 0;
|
||||
};
|
||||
|
||||
// Calculate total for each column
|
||||
var total_id_not_generated = api.column(1).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
|
||||
var total_non_id = api.column(2).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
|
||||
var total_cda = api.column(3).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
var total_information_required = api.column(4).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
var total_under_process = api.column(5).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
var total_approved = api.column(6).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
var total_payment_initiated = api.column(7).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
var total_of_total = api.column(8).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
var total_closed = api.column(9).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
var total_settled = api.column(10).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
var total_returned = api.column(11).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
var total_denied = api.column(12).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
var total_of_total2 = api.column(13).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
|
||||
// Update the footer with totals
|
||||
$(api.column(1).footer()).html(total_id_not_generated);
|
||||
$(api.column(2).footer()).html(total_non_id);
|
||||
$(api.column(3).footer()).html(total_cda);
|
||||
$(api.column(4).footer()).html(total_information_required);
|
||||
$(api.column(5).footer()).html(total_under_process);
|
||||
$(api.column(6).footer()).html(total_approved);
|
||||
$(api.column(7).footer()).html(total_payment_initiated);
|
||||
$(api.column(8).footer()).html(total_of_total);
|
||||
$(api.column(9).footer()).html(total_closed);
|
||||
$(api.column(10).footer()).html(total_settled);
|
||||
$(api.column(11).footer()).html(total_returned);
|
||||
$(api.column(12).footer()).html(total_denied);
|
||||
$(api.column(13).footer()).html(total_of_total2);
|
||||
|
||||
|
||||
|
||||
}
|
||||
language: { search: "_INPUT_", searchPlaceholder: "Search..." },
|
||||
paging: true,
|
||||
pageLength: 10,
|
||||
ordering: false
|
||||
});
|
||||
} else {
|
||||
console.error("Table not found.");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user