From 0af952e72575cc471bb42cb882a35f3f1c3abd4e Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Tue, 29 Apr 2025 17:44:09 +0530 Subject: [PATCH 1/3] FEAT_TICKET_LIST_REDIRECT_FROM_REPORT_BASED_ON_ACM --- app/Controllers/TicketController.php | 33 +++++++++++++--- app/Models/TicketMasterModel.php | 6 ++- app/Views/claims_report_acc_manager_wise.php | 40 +++++++++++++++++++- 3 files changed, 71 insertions(+), 8 deletions(-) diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index 1a223689..18f92a56 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -189,13 +189,23 @@ class TicketController extends BaseController $isFromDashboard = $this->request->getPost("is_dashboard"); - if (isset($isFromDashboard) && !empty($isFromDashboard) && $isFromDashboard == 1) { + if (isset($isFromDashboard) && !empty($isFromDashboard)){ $data['page_name'] = "Claims"; - $data['ticket_data'] = $this->ticketSearch(3); + if ($isFromDashboard == 1) { + + $data['ticket_data'] = $this->ticketSearch(3); + + }else if ($isFromDashboard == 2){ + $data['ticket_data'] = $this->ticketSearch(4); + + } $data['claim_status'] = $this->claimStatus->select('id,ticket_type,claim_status')->where('is_active', 1)->findAll(); $data['client_list'] = $this->clientModel->select('id,client_name')->where('is_active', 1)->findAll(); + // dd($data); return $this->loadLayout('ticket_search', $data); - }else{ + + } + else{ $data['ticket_data'] = $this->ticketSearch(); $html = view('ticket_list', $data); return $this->respond(['status' => true, 'html' => $html], 200); @@ -239,7 +249,7 @@ class TicketController extends BaseController ->groupBy('tm.id, tm.created_at, latest_history.created_at'); - //action 1 get last 100 rows, action 2 filter and get all rows related to that and action 3 gets according to dashboard + //action 1 get last 100 rows, action 2 filter and get all rows related to that, action 3 gets according to dashboard, action 4 gets according to ACM if ($action == 1) { $query = $db->table('ticket_master tm') @@ -336,6 +346,16 @@ class TicketController extends BaseController } // dd($where); + } else if ($action == 4){ + $acm_id = $this->request->getPost('ids'); + + // dd($acm_id); + if (!empty($acm_id)) { + $where = "tm.acm_id = $acm_id"; + } else { + $where = '1 = 0'; // No valid IDs, return empty result + } + } else { $search_data = $this->request->getPost(); // print_r($search_data); die() @@ -1364,7 +1384,8 @@ class TicketController extends BaseController 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); + + // print_rr($viewData);die(); if ($policy_type == 1){ $viewData['column_order'] = [ 'ACM_NAME', 'ID NOT GENERATED', 'NON ID', 'CDA', 'INFORMATION REQUIRED', @@ -1382,6 +1403,7 @@ class TicketController extends BaseController $ordered_data[] = $temp; } $viewData['tpa_wise_data'] = $ordered_data; + // print_rr($viewData);die(); $html = view('claims_report_acc_manager_wise', $viewData); return $this->respond(['status' => true, 'html' => $html], 200); }else{ @@ -1400,6 +1422,7 @@ class TicketController extends BaseController $ordered_data[] = $temp; } $viewData['tpa_wise_data'] = $ordered_data; + // print_rr($viewData);die(); $html = view('claims_report_acc_manager_wise', $viewData); return $this->respond(['status' => true, 'html' => $html], 200); } diff --git a/app/Models/TicketMasterModel.php b/app/Models/TicketMasterModel.php index d28fd81f..1404190e 100644 --- a/app/Models/TicketMasterModel.php +++ b/app/Models/TicketMasterModel.php @@ -607,6 +607,7 @@ class TicketMasterModel extends Model // Construct the final SQL query $sql = " SELECT + user_profiles.id as ACM_ID, user_profiles.first_name AS ACM_NAME, $dynamicSelect, ($dynamicTotal) AS TOTAL @@ -623,7 +624,6 @@ class TicketMasterModel extends Model "; $result = $this->db->query($sql)->getResultArray(); - // dd($result); return $result; } else { @@ -677,6 +677,7 @@ class TicketMasterModel extends Model // Construct the final SQL query $sql = " SELECT + user_profiles.id as ACM_ID, user_profiles.first_name AS ACM_NAME, $dynamicSelect, ($dynamicTotal) AS TOTAL, @@ -696,8 +697,9 @@ class TicketMasterModel extends Model // Execute the query $result = $this->db->query($sql)->getResultArray(); - // print_rr($result);die(); return $result; + + } } diff --git a/app/Views/claims_report_acc_manager_wise.php b/app/Views/claims_report_acc_manager_wise.php index a629a01c..3816a419 100644 --- a/app/Views/claims_report_acc_manager_wise.php +++ b/app/Views/claims_report_acc_manager_wise.php @@ -18,6 +18,10 @@ .right-align-input { text-align: right; } + + #scroll-horizontal-datatable tbody tr:hover { + background-color: #e0e0e0; + }
@@ -47,7 +51,7 @@ - + @@ -101,3 +105,37 @@ } }); + + + \ No newline at end of file From 2b142f7f1abdadd9e5cd0ff7769f9f8e775c2aad Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 30 Apr 2025 09:53:27 +0530 Subject: [PATCH 2/3] FEAT_BDS_TAT_REPORT : RV --- app/Config/Routes.php | 2 +- app/Controllers/BDSReportController.php | 76 +++++++++++++++ app/Views/bds_tat_wise_report.php | 122 ++++++++++++++++++++++++ app/Views/layout/header.php | 3 + 4 files changed, 202 insertions(+), 1 deletion(-) create mode 100644 app/Views/bds_tat_wise_report.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index d70d1ab8..36b9a672 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -536,7 +536,7 @@ $routes->group("/bdsReport", ["filter" => "authMVC"], function ($routes) { $routes->get('insurer_wise_data/(:any)','BDSReportController::Insurer_wise_Data/$1'); $routes->get('bap_wise_data/(:any)','BDSReportController::Bap_Wise_Data/$1'); $routes->match( ['get', 'post'], 'renewal_report','BDSReportController::renewalReport'); - + $routes->get('getTATReport','BDSReportController::bdsTATReport'); }); //New Tickets diff --git a/app/Controllers/BDSReportController.php b/app/Controllers/BDSReportController.php index 54abf46f..f0fbd79a 100644 --- a/app/Controllers/BDSReportController.php +++ b/app/Controllers/BDSReportController.php @@ -927,4 +927,80 @@ class BDSReportController extends AdminController return $this->respond(['status' => true, 'html' => $html], 200); } } + + public function bdsTATReport() + { + $sql = " + SELECT + tc.TAT_Category, + COALESCE(SUM(CASE WHEN subquery.status = 'under_process' THEN 1 ELSE 0 END), 0) AS `Under Process`, + COALESCE(SUM(CASE WHEN subquery.status = 'client_pending' THEN 1 ELSE 0 END), 0) AS `Client Pending`, + COALESCE(SUM(CASE WHEN subquery.status = 'insurer_pending' THEN 1 ELSE 0 END), 0) AS `Insurer Pending`, + COALESCE(SUM(CASE WHEN subquery.status = 'instalment_pending' THEN 1 ELSE 0 END), 0) AS `Instalment Pending`, + COALESCE(SUM(CASE WHEN subquery.status = 'co_insurer_pending' THEN 1 ELSE 0 END), 0) AS `Co-Insurer Pending`, + COALESCE(SUM(CASE WHEN subquery.status = 'tpa_pending' THEN 1 ELSE 0 END), 0) AS `TPA Pending`, + COALESCE(SUM(CASE WHEN subquery.status = 'validated' THEN 1 ELSE 0 END), 0) AS `Validated`, + COALESCE(SUM(CASE WHEN subquery.status = 'cancelled' THEN 1 ELSE 0 END), 0) AS `Cancelled`, + COALESCE(SUM(CASE WHEN subquery.status = 'completed' THEN 1 ELSE 0 END), 0) AS `Completed`, + COALESCE(SUM(CASE WHEN subquery.status = 'lost' THEN 1 ELSE 0 END), 0) AS `Lost` FROM + ( + SELECT 'Above 12 Days' AS TAT_Category + UNION ALL + SELECT '9-12 Days' + UNION ALL + SELECT '5-8 Days' + UNION ALL + SELECT '0-4 Days' + ) AS tc + LEFT JOIN ( + SELECT + pt.id AS policy_id, + ls.status, + CASE + WHEN DATEDIFF(CURRENT_DATE, pt.created_at) BETWEEN 0 AND 4 THEN '0-4 Days' + WHEN DATEDIFF(CURRENT_DATE, pt.created_at) BETWEEN 5 AND 8 THEN '5-8 Days' + WHEN DATEDIFF(CURRENT_DATE, pt.created_at) BETWEEN 9 AND 12 THEN '9-12 Days' + ELSE 'Above 12 Days' + END AS TAT_Category + FROM + policy_transaction pt + LEFT JOIN ( + SELECT + pts1.* + FROM + policy_transaction_status pts1 + INNER JOIN ( + SELECT + policy_tran_id, + MAX(created_at) AS max_created_at + FROM + policy_transaction_status + WHERE is_active = 1 + GROUP BY policy_tran_id + ) pts2 + ON pts1.policy_tran_id = pts2.policy_tran_id + AND pts1.created_at = pts2.max_created_at + WHERE pts1.is_active = 1 + ) ls + ON pt.id = ls.policy_tran_id + WHERE pt.is_active = 1 + ) AS subquery + ON tc.TAT_Category = subquery.TAT_Category + GROUP BY + tc.TAT_Category + ORDER BY + FIELD(tc.TAT_Category, '0-4 Days', '5-8 Days' , '9-12 Days' , 'Above 12 Days' ) + "; + + // Run the query + $db = \Config\Database::connect(); + $query = $db->query($sql); + + // Get the result + $result = $query->getResultArray(); + // dd(db_connect()->getLastQuery(),$result); + $data['data'] = $result; + // dd($data, get_role_id(), ENROLLMENT_TEAM_ID, user_team()); + return $this->loadLayout('bds_tat_wise_report', $data); + } } diff --git a/app/Views/bds_tat_wise_report.php b/app/Views/bds_tat_wise_report.php new file mode 100644 index 00000000..e3c428f4 --- /dev/null +++ b/app/Views/bds_tat_wise_report.php @@ -0,0 +1,122 @@ + + + +
+
+
+
+
+
+

BDS TAT Band Wise Report

+
+
+ +
+ + + + + + + + + + + + + + $value): + $numValue = is_numeric($value) ? (int) $value : 0; + if ($key != 'TAT_Category') { + $columnTotals[$key] += $numValue; + $rowTotal += $numValue; + } + ?> + + + + + + + + + + $total): ?> + + + + + +
TOTAL
+
+ +
+
+
+
+ + diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php index 3491cacb..a7500816 100755 --- a/app/Views/layout/header.php +++ b/app/Views/layout/header.php @@ -758,6 +758,9 @@
  • Renewal Reports
  • +
  • + TAT Band Reports +
  • From 9e14f7bf9223735966c444d222dbd37ce32d8bc3 Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Wed, 30 Apr 2025 14:03:09 +0530 Subject: [PATCH 3/3] FEAT_POLICY_REPORTS,FIX_DASH_BDS SRI --- app/Config/Routes.php | 1 + app/Controllers/BDSReportController.php | 183 +++++++++++++++++++++--- app/Controllers/DashboardController.php | 3 +- app/Models/PolicyTransactionModel.php | 7 +- app/Views/DashBoard.php | 8 +- app/Views/bds_multi_report.php | 122 ++++++++++++++++ app/Views/layout/header.php | 20 +++ 7 files changed, 320 insertions(+), 24 deletions(-) create mode 100644 app/Views/bds_multi_report.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 36b9a672..842adbbc 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -537,6 +537,7 @@ $routes->group("/bdsReport", ["filter" => "authMVC"], function ($routes) { $routes->get('bap_wise_data/(:any)','BDSReportController::Bap_Wise_Data/$1'); $routes->match( ['get', 'post'], 'renewal_report','BDSReportController::renewalReport'); $routes->get('getTATReport','BDSReportController::bdsTATReport'); + $routes->get("getMultiReport/(:any)", "BDSReportController::getMultiReport/$1"); }); //New Tickets diff --git a/app/Controllers/BDSReportController.php b/app/Controllers/BDSReportController.php index f0fbd79a..c3005aac 100644 --- a/app/Controllers/BDSReportController.php +++ b/app/Controllers/BDSReportController.php @@ -33,6 +33,7 @@ class BDSReportController extends AdminController protected $PTCOShareDetailsModel; protected $coShareStmtDetailsModel; protected $policyTypeModel; + protected $policyTatReportType; public function __construct() { @@ -46,6 +47,13 @@ class BDSReportController extends AdminController $this->PTCOShareDetailsModel = new PTCOShareDetailsModel(); $this->coShareStmtDetailsModel = new COShareStmtDetailsModel(); $this->policyTypeModel = new PolicyTypeModel(); + + + $this->policyTatReportType = [ + '1' => "TAT Band Wise report", + '2' => "Account Manger Status Wise Report", + '3' => "Account Manger TAT Wise Report" + ]; } // public function Insurer_wise_Data($insurerCategory, $fromDate, $toDate) @@ -209,7 +217,7 @@ class BDSReportController extends AdminController $html = view('bds_report_bap_wise_data', $viewData); return $this->respond(['status' => true, 'html' => $html], 200); - } else if($report_type == 'bapInsurer'){ + } else if ($report_type == 'bapInsurer') { //Condition for BAP Insurer wise date $category = $category == 'life' ? 1 : 0; @@ -217,8 +225,7 @@ class BDSReportController extends AdminController $html = view('irda_bap_insurer_report_list', $viewData); return $this->respond(['status' => true, 'html' => $html], 200); - - }else if($report_type == 'bapClient'){ + } else if ($report_type == 'bapClient') { //Condition for BAP Client wise date $category = $category == 'life' ? 1 : 0; @@ -226,8 +233,7 @@ class BDSReportController extends AdminController $html = view('irda_bap_client_report_list', $viewData); return $this->respond(['status' => true, 'html' => $html], 200); - - }else if($report_type == 'client'){ + } else if ($report_type == 'client') { //Condition for Client wise date $category = $category == 'life' ? 1 : 0; @@ -517,7 +523,7 @@ class BDSReportController extends AdminController if (!empty($start_date) && !empty($end_date)) { $fromDate = change_date_format($start_date); - $toDate = change_date_format($end_date); + $toDate = change_date_format($end_date); } $this->myLogger->logme('error', 'From date : {fromDate} - To date {toDate} ', ['fromDate' => $fromDate, 'toDate' => $toDate]); @@ -597,7 +603,7 @@ class BDSReportController extends AdminController // $db = db_connect(); // $builder = $db->query(" - + // select ins.id, ins.name as insurer_name, // -- Health Policies @@ -706,7 +712,7 @@ class BDSReportController extends AdminController // life_premium DESC, // marine_cargo_premium DESC, // marine_hull_premium DESC; - + // "); // // Get the query @@ -745,7 +751,7 @@ class BDSReportController extends AdminController // $db = db_connect(); // $builder = $db->query(" - + // SELECT // c.id AS client_id, // c.client_name, @@ -808,7 +814,7 @@ class BDSReportController extends AdminController // life_premium DESC, // marine_cargo_premium DESC, // marine_hull_premium DESC - + // "); // // Get the query @@ -847,11 +853,11 @@ class BDSReportController extends AdminController // $db = db_connect(); // $builder = $db->query(" - + // select // c.id as client_id, // c.client_name, - + // ( // select // count(policy_transaction.id) @@ -862,7 +868,7 @@ class BDSReportController extends AdminController // and policy_transaction.is_active = 1 // ) as policy_count, - + // COALESCE(( // select // sum(stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt) as premium @@ -873,9 +879,9 @@ class BDSReportController extends AdminController // and stmt.is_active = 1 // and ptco.is_active = 1 // and pt.is_active = 1 - + // ), 0) as premium - + // from clients c // join policy_transaction on c.id = policy_transaction.client_id AND policy_transaction.policy_issue_date >= '$fromDate' AND policy_transaction.policy_issue_date <= '$toDate' // join policy_type on policy_transaction.policy_type_id = policy_type.id and policy_type.policy_category = $category @@ -910,7 +916,6 @@ class BDSReportController extends AdminController $data['issuer'] = [1 => 'JIBS', 2 => 'Nhance']; $data['page_name'] = "Renewal Report"; return $this->loadLayout('renewal_search', $data); - } else { $fromDate = $this->request->getPost('fromDate'); @@ -1001,6 +1006,150 @@ class BDSReportController extends AdminController // dd(db_connect()->getLastQuery(),$result); $data['data'] = $result; // dd($data, get_role_id(), ENROLLMENT_TEAM_ID, user_team()); - return $this->loadLayout('bds_tat_wise_report', $data); + // return $this->loadLayout('bds_tat_wise_report', $data); + + return $result; + } + + public function accountMangerStatusBDSReport() + { + $data['page_name'] = "Account Manager BDS Report"; + + $sql = " + SELECT + COALESCE(ACM_Name, 'Total') AS ACM_Name, + COALESCE(SUM(CASE WHEN status = 'instalment_pending' THEN 1 ELSE 0 END), 0) AS `Instalment Pending`, + COALESCE(SUM(CASE WHEN status = 'under_process' THEN 1 ELSE 0 END), 0) AS `Under Process`, + COALESCE(SUM(CASE WHEN status = 'client_pending' THEN 1 ELSE 0 END), 0) AS `Client Pending`, + COALESCE(SUM(CASE WHEN status = 'co_insurer_pending' THEN 1 ELSE 0 END), 0) AS `Co Insurer Pending`, + COALESCE(SUM(CASE WHEN status = 'tpa_pending' THEN 1 ELSE 0 END), 0) AS `TPA Pending`, + COALESCE(SUM(CASE WHEN status = 'validated' THEN 1 ELSE 0 END), 0) AS `Validated`, + COALESCE(SUM(CASE WHEN status = 'cancelled' THEN 1 ELSE 0 END), 0) AS `Cancelled`, + COALESCE(SUM(CASE WHEN status = 'completed' THEN 1 ELSE 0 END), 0) AS `Completed`, + COALESCE(SUM(CASE WHEN status = 'lost' THEN 1 ELSE 0 END), 0) AS `Lost`, + COALESCE(SUM(CASE WHEN status = 'insurer_pending' THEN 1 ELSE 0 END), 0) AS `Insurer Pending` + + FROM ( + SELECT + up.first_name AS ACM_Name, + ls.status + FROM policy_transaction pt + JOIN clients c ON pt.client_id = c.id AND c.is_active = 1 + JOIN client_rm crm ON crm.client_id = c.id AND crm.is_active = 1 AND crm.level = 3 + JOIN user_profiles up ON up.id = crm.user_id AND up.is_active = 1 + LEFT JOIN ( + SELECT + pts1.policy_tran_id, + pts1.status, + pts1.created_at + FROM policy_transaction_status pts1 + INNER JOIN ( + SELECT + policy_tran_id, + MAX(created_at) AS max_created_at + FROM policy_transaction_status + WHERE is_active = 1 + GROUP BY policy_tran_id + ) pts2 + ON pts1.policy_tran_id = pts2.policy_tran_id + AND pts1.created_at = pts2.max_created_at + WHERE pts1.is_active = 1 + ) ls ON pt.id = ls.policy_tran_id + WHERE pt.is_active = 1 + AND DATEDIFF(CURDATE(), ls.created_at) >= 4 + ) AS sub + GROUP BY ACM_Name; + "; + + $db = \Config\Database::connect(); + $query = $db->query($sql); + + // Get the result + $result = $query->getResultArray(); + + return $result; + } + + public function accountManagerTatBDSReport(){ + + $sql = " + SELECT + COALESCE(ACM_Name, 'Total') AS ACM_Name, + COALESCE(SUM(CASE WHEN tat_bucket = '0-4 Days' THEN 1 ELSE 0 END), 0) AS `0-4 Days`, + COALESCE(SUM(CASE WHEN tat_bucket = '5-8 Days' THEN 1 ELSE 0 END), 0) AS `5-8 Days`, + COALESCE(SUM(CASE WHEN tat_bucket = '9-12 Days' THEN 1 ELSE 0 END), 0) AS `9-12 Days`, + COALESCE(SUM(CASE WHEN tat_bucket = 'Above 12 Days' THEN 1 ELSE 0 END), 0) AS `Above 12 Days` + FROM ( + SELECT + up.first_name AS ACM_Name, + CASE + WHEN DATEDIFF(CURDATE(), ls.created_at) BETWEEN 0 AND 4 THEN '0-4 Days' + WHEN DATEDIFF(CURDATE(), ls.created_at) BETWEEN 5 AND 8 THEN '5-8 Days' + WHEN DATEDIFF(CURDATE(), ls.created_at) BETWEEN 9 AND 12 THEN '9-12 Days' + WHEN DATEDIFF(CURDATE(), ls.created_at) > 12 THEN 'Above 12 Days' + ELSE 'Unknown' + END AS tat_bucket + FROM policy_transaction pt + JOIN clients c ON pt.client_id = c.id AND c.is_active = 1 + JOIN client_rm crm ON crm.client_id = c.id AND crm.is_active = 1 AND crm.level = 3 + JOIN user_profiles up ON up.id = crm.user_id AND up.is_active = 1 + LEFT JOIN ( + SELECT + pts1.policy_tran_id, + pts1.status, + pts1.created_at + FROM policy_transaction_status pts1 + INNER JOIN ( + SELECT + policy_tran_id, + MAX(created_at) AS max_created_at + FROM policy_transaction_status + WHERE is_active = 1 + GROUP BY policy_tran_id + ) pts2 + ON pts1.policy_tran_id = pts2.policy_tran_id + AND pts1.created_at = pts2.max_created_at + WHERE pts1.is_active = 1 + ) ls ON pt.id = ls.policy_tran_id + WHERE pt.is_active = 1 + AND ls.created_at IS NOT NULL + ) AS sub + GROUP BY ACM_Name; + + "; + + $db = \Config\Database::connect(); + $query = $db->query($sql); + + // Get the result + $result = $query->getResultArray(); + + return $result; + + } + + public function getMultiReport($report_type){ + + $data['page_name'] = "BDS Report"; + + if ($report_type == 1){ + + $data['page_title'] = "BDS TAT Report"; + $data['data'] = $this->bdsTATReport(); + }else if ($report_type == 2){ + + $data['page_title'] = "Account Manager Status Report"; + $data['data'] = $this->accountMangerStatusBDSReport(); + + }else{ + + $data['page_title'] = "Account Manager TAT Report"; + $data['data'] = $this->accountManagerTatBDSReport(); + + } + + return $this->loadLayout('bds_multi_report', $data); + } } + diff --git a/app/Controllers/DashboardController.php b/app/Controllers/DashboardController.php index fc154a4b..b9ed11a4 100755 --- a/app/Controllers/DashboardController.php +++ b/app/Controllers/DashboardController.php @@ -238,6 +238,7 @@ class DashboardController extends AdminController // echo "
    ";
                 $data['pendingActionsData'] = $pendingActionsData;
                 $data['businessTeamCount'] = count($businessTeamData) ?? 0;
    +            // dd($businessTeamData);
                 $data['financeTeamCount'] = count($financeTeamData) ?? 0;
                 $data['businessTeamStatusData'] = $businessTeamStatusData;
                 $data['financeTeamStatusData'] = $financeTeamStatusData;
    @@ -257,6 +258,7 @@ class DashboardController extends AdminController
             }
     
             // dd(get_role_id(),user_team());
    +        // dd($data);
             
             $data['page_name'] = 'Dashboard';
     
    @@ -725,7 +727,6 @@ class DashboardController extends AdminController
                 'validated' => [],
                 'cancelled' => [],
                 'instalment_pending' => [],
    -            'completed' => [],
             ];
     
             // Loop through results and group them by their status
    diff --git a/app/Models/PolicyTransactionModel.php b/app/Models/PolicyTransactionModel.php
    index 2e697698..ec355e34 100644
    --- a/app/Models/PolicyTransactionModel.php
    +++ b/app/Models/PolicyTransactionModel.php
    @@ -1335,6 +1335,8 @@ class PolicyTransactionModel extends Model
                 )
                 ->where("th.last_policy_status_change <= '{$dateThreshold}'", null, false)
                 ->where('policy_transaction.is_active', 1)
    +            ->where("policy_transaction.status is not null", null, false)
    +            ->whereNotIn("policy_transaction.status", ['completed'])
                 // ->where('policy_transaction.status', 'completed')
                 ->where('(pt_co_share_details.bp_amt IS NULL OR pt_co_share_details.bp_amt = 0)', null, false);
     
    @@ -1426,8 +1428,9 @@ class PolicyTransactionModel extends Model
                 // ->where('policy_transaction.status', 'completed')
                 ->where('COALESCE(pt_co_share_details.agreed_bp_per, 0) + COALESCE(pt_co_share_details.agreed_tp_per, 0) + COALESCE(pt_co_share_details.agreed_tep_per, 0) = 0')
                 ->where('COALESCE(pt_co_share_details.actual_bp_amt, 0) + COALESCE(pt_co_share_details.actual_tp_amt, 0) + COALESCE(pt_co_share_details.actual_tep_amt, 0) = 0')
    -            ->where('COALESCE(pt_co_share_details.actual_bp_brokerage_amt, 0) + COALESCE(pt_co_share_details.actual_tp_brokerage_amt, 0) + COALESCE(pt_co_share_details.actual_tep_brokerage_amt, 0) = 0');
    -
    +            ->where('COALESCE(pt_co_share_details.actual_bp_brokerage_amt, 0) + COALESCE(pt_co_share_details.actual_tp_brokerage_amt, 0) + COALESCE(pt_co_share_details.actual_tep_brokerage_amt, 0) = 0')
    +            ->where("policy_transaction.status is not null", null, false)
    +            ->whereNotIn("policy_transaction.status", ['completed']);
     
             if ($start_date != 0 && $end_date != 0 && $date_type != 0) {
     
    diff --git a/app/Views/DashBoard.php b/app/Views/DashBoard.php
    index 40d25654..08e08855 100755
    --- a/app/Views/DashBoard.php
    +++ b/app/Views/DashBoard.php
    @@ -259,10 +259,10 @@
                             
                             
                         
    -
    -                    
    -                        
    -                    
    +                    
     
                         
                     
    diff --git a/app/Views/bds_multi_report.php b/app/Views/bds_multi_report.php
    new file mode 100644
    index 00000000..05b38e6c
    --- /dev/null
    +++ b/app/Views/bds_multi_report.php
    @@ -0,0 +1,122 @@
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    +
    +
    + +
    + + + + + + + + + + + + + + $value): + $numValue = is_numeric($value) ? (int) $value : 0; + if ($key != 'TAT_Category') { + $columnTotals[$key] += $numValue; + $rowTotal += $numValue; + } + ?> + + + + + + + + + + $total): ?> + + + + + +
    TOTAL
    +
    + +
    +
    +
    +
    + + diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php index a7500816..a30e0d10 100755 --- a/app/Views/layout/header.php +++ b/app/Views/layout/header.php @@ -766,6 +766,26 @@ +
  • + + + Policy TAT Reports + +
    + +
    +