diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 34a9466e..0ac3773a 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -482,3 +482,23 @@ $routes->get("getBackToEnrolledDetails", "EmployeeRestController::getBackToEnrol // Ticketing System // Ticketing System End's + + +//BDSReports +$routes->group("/bdsReport", ["filter" => "authMVC"], function ($routes) { + $routes->match( ['get', 'post'], 'irba_report','BDSReportController::irba_report'); + $routes->get('insurer_wise_data/(:any)','BDSReportController::Insurer_wise_Data/$1'); + $routes->get('bap_wise_data/(:any)','BDSReportController::Bap_Wise_Data/$1'); + +}); + +//New Tickets +$routes->group("/ticket", ["filter" => "authMVC"], function ($routes) { + $routes->match( ['get', 'post'], 'list','TicketController::ticketList'); + $routes->get('new','TicketController::ticket_form'); + $routes->post('create','TicketController::createTicket'); + $routes->get('update','TicketController::updateTicket'); + $routes->get('view/(:any)','TicketController::view_ticket/$1'); + $routes->get('mail_template','TicketController::createMailTemplate'); +}); + diff --git a/app/Controllers/BDSReportController.php b/app/Controllers/BDSReportController.php new file mode 100644 index 00000000..59fd54e1 --- /dev/null +++ b/app/Controllers/BDSReportController.php @@ -0,0 +1,521 @@ +myLogger = \Config\Services::mylogger(); + + $this->clientModel = new ClientModel(); + $this->clientPolicyModel = new ClientPolicyModel(); + $this->insurerModel = new InsurerModel(); + $this->insurerBranchModel = new InsurerBranchModel(); + $this->policyTransactionModel = new PolicyTransactionModel(); + $this->PTCOShareDetailsModel = new PTCOShareDetailsModel(); + $this->coShareStmtDetailsModel = new COShareStmtDetailsModel(); + $this->policyTypeModel = new PolicyTypeModel(); + } + public function Insurer_wise_Data($insurerCategory, $fromDate, $toDate) + { + + $fromDate = \DateTime::createFromFormat('d-m-Y', $fromDate)->format('Y-m-d'); + $toDate = \DateTime::createFromFormat('d-m-Y', $toDate)->format('Y-m-d'); + try { + $sql = " + select ins.id,ins.name as insurers, + COALESCE(SUM(CASE WHEN pt.action_type = 'inception' and pt.insurer_id = ins.id and ptp.policy_category = $insurerCategory THEN 1 ELSE 0 END), 0) AS Policies, + COALESCE(SUM(CASE WHEN stmt.co_share_id = pt_co.id and ptp.policy_category = $insurerCategory and pt_co.insurer_id = ins.id THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS Premium, + COALESCE(SUM(CASE WHEN stmt.co_share_id = pt_co.id and ptp.policy_category = $insurerCategory and pt_co.insurer_id = ins.id THEN stmt.reward + stmt.actual_bp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.actual_tp_brokerage_amt ELSE 0 END), 0) AS Revenue + from insurers ins + left join pt_co_share_details pt_co on ins.id = pt_co.insurer_id and pt_co.is_active = 1 + left join co_share_stmt_details stmt on pt_co.id = stmt.co_share_id and stmt.is_active = 1 + left join policy_transaction pt on pt_co.pt_id = pt.id and pt.is_active = 1 and pt.policy_issue_date >= '$fromDate' and pt.policy_issue_date <= '$toDate' + left join policy_type ptp on pt.policy_type_id = ptp.id and ptp.policy_category = $insurerCategory and ptp.is_active = 1 + where ins.is_active = 1 and (ptp.policy_category = $insurerCategory or ptp.policy_category is null) + group by ins.id + "; + + $data['insurer_wise_data'] = $this->insurerModel->query($sql)->getResultArray(); + // log_message('error',$this->insurerModel->getLastQuery()); + // log_message('error',json_encode($data)); + } catch (\Exception $e) { + $data['message'] = 'No data Found'; + $this->myLogger->logme('error', $e->getMessage()); + return $data; + } + return ($data); + } + + public function Bap_Wise_Data($insurerCategory, $fromDate, $toDate) + { + $fromDate = \DateTime::createFromFormat('d-m-Y', $fromDate)->format('Y-m-d'); + $toDate = \DateTime::createFromFormat('d-m-Y', $toDate)->format('Y-m-d'); + + try { + $sql = " + SELECT + pot.bap AS bap, + COALESCE(COUNT(DISTINCT pt.id), 0) AS Policies, + COALESCE(SUM(co.actual_bp_amt + co.actual_tep_amt + co.actual_tp_amt), 0) AS Premium, + COALESCE(SUM(co.reward + co.actual_bp_brokerage_amt + co.actual_tep_brokerage_amt + co.actual_tp_brokerage_amt), 0) AS Revenue + FROM policy_type AS pot + LEFT JOIN policy_transaction AS pt ON pot.id = pt.policy_type_id AND pt.is_active = 1 AND pt.action_type = 'inception' and pt.policy_issue_date >= '$fromDate' and pt.policy_issue_date <= '$toDate' + LEFT JOIN pt_co_share_details AS ptco ON pt.id = ptco.pt_id AND ptco.is_active = 1 + LEFT JOIN co_share_stmt_details AS co ON ptco.id = co.co_share_id AND co.is_active = 1 + WHERE pot.is_active = 1 + AND pot.policy_category = $insurerCategory + GROUP BY pot.bap; + + "; + $data['bap_wise_data'] = $this->policyTypeModel->query($sql)->getResultArray(); + } catch (\Exception $e) { + $data['message'] = 'No Data Found'; + $this->myLogger->logme('error', $e->getMessage()); + return $data; + } + + + return ($data); + } + + public function irba_report() + { + + if ($this->request->is('get')) { + $default_start = new \DateTime(); + $data['default_end'] = $default_start->format('d-m-Y'); + $data['default_start'] = $default_start->modify('-90 days')->format('d-m-Y'); + $data['categories'] = [ + 'Life' => 'life', + 'Non Life' => 'nonLife' + ]; + $data['report_type'] = [ + 'Insurer' => 'insurer', + 'BAP' => 'bap', + 'BAP-Client' => 'bapClient', + 'BAP-Insurer' => 'bapInsurer', + 'Client' => 'client' + ]; + return $this->loadLayout('irba_report', $data); + } else { + + $fromDate = $this->request->getPost('fromDate'); + $toDate = $this->request->getPost('toDate'); + $category = $this->request->getPost('category'); + $report_type = $this->request->getPost('report_type'); + // log_message('error',json_encode($_POST));die(); + if ($report_type == 'insurer') { + $life = $category == 'life' ? 1 : 0; + $viewData = $this->Insurer_wise_Data($life, $fromDate, $toDate); + if (isset($data['message'])) { + return $this->respond(['status' => false, 'message' => $data['message']], 200); + } + // Ensure $viewData is an array + if (!is_array($viewData)) { + $viewData = []; + } + + + $html = view('bds_report_Insurer_wise_Data', $viewData); + return $this->respond(['status' => true, 'html' => $html], 200); + } else if ($report_type == 'bap') { + + $life = $category == 'life' ? 1 : 0; + $viewData = $this->Bap_wise_Data($life, $fromDate, $toDate); + if (isset($data['message'])) { + return $this->respond(['status' => false, 'message' => $data['message']], 200); + } + // Ensure $viewData is an array + if (!is_array($viewData)) { + $viewData = []; + } + + + $html = view('bds_report_bap_wise_data', $viewData); + return $this->respond(['status' => true, 'html' => $html], 200); + } else if($report_type == 'bapInsurer'){ + + //Condition for BAP Insurer wise date + $category = $category == 'life' ? 1 : 0; + $viewData['data'] = $this->getBAPInsurerData($category, $fromDate, $toDate); + + $html = view('irda_bap_insurer_report_list', $viewData); + return $this->respond(['status' => true, 'html' => $html], 200); + + }else if($report_type == 'bapClient'){ + + //Condition for BAP Client wise date + $category = $category == 'life' ? 1 : 0; + $viewData['data'] = $this->getBAPClientData($category, $fromDate, $toDate); + + $html = view('irda_bap_client_report_list', $viewData); + return $this->respond(['status' => true, 'html' => $html], 200); + + }else if($report_type == 'client'){ + + //Condition for Client wise date + $category = $category == 'life' ? 1 : 0; + $viewData['data'] = $this->getClientData($category, $fromDate, $toDate); + + $html = view('irda_client_report_list', $viewData); + return $this->respond(['status' => true, 'html' => $html], 200); + } + } + } + + // ------------------------------------------------------------------------------------------------ + + //Function for get BAP INSURE wise data for premium , policy count , revenue only + public function getBAPInsurerData($category = 0, $start_date = null, $end_date = null) + { + try { + $this->myLogger->logme('error', 'getBAPInsurerData function called'); + $this->myLogger->logme('error', 'category : {data}', ['data' => $category]); + $this->myLogger->logme('error', 'start date : {start_date} - end date {end_date} ', ['start_date' => $start_date, 'end_date' => $end_date]); + + + //set default last 3 months data date + $fromDate = date('Y-m-d', strtotime('-90 days')); + $toDate = date('Y-m-d 23:59:59'); + + if (!empty($start_date) && !empty($end_date)) { + $fromDate = change_date_format($start_date); + $toDate = change_date_format($end_date); + } + + $this->myLogger->logme('error', 'From date : {fromDate} - To date {toDate} ', ['fromDate' => $fromDate, 'toDate' => $toDate]); + + $db = db_connect(); + $builder = $db->query(" + + select ins.id, ins.name as insurer_name, + + -- Health Policies + COALESCE(SUM(CASE WHEN ptp.bap = 'Health' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS health_policy_count, + COALESCE(SUM(CASE WHEN ptp.bap = 'Health' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS health_premium, + COALESCE(SUM(CASE WHEN ptp.bap = 'Health' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS health_revenue, + + -- Misc Policies + COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS misc_policy_count, + COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS misc_premium, + COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS misc_revenue, + + + -- Motor Policies + COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS motor_policy_count, + COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS motor_premium, + COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS motor_revenue, + + -- Engineering Policies + COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS engineering_policy_count, + COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS engineering_premium, + COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS engineering_revenue, + + + -- Fire Policies + COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS fire_policy_count, + COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS fire_premium, + COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS fire_revenue, + + -- Liability Policies + COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS liability_policy_count, + COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS liability_premium, + COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS liability_revenue, + + + -- Life Policies + COALESCE(SUM(CASE WHEN ptp.bap = 'Life' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS life_policy_count, + COALESCE(SUM(CASE WHEN ptp.bap = 'Life' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS life_premium, + COALESCE(SUM(CASE WHEN ptp.bap = 'Life' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS life_revenue, + + + -- Marine Cargo Policies + COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS marine_cargo_policy_count, + COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS marine_cargo_premium, + COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS marine_cargoe_revenue, + + -- Marine Hull Policies + COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS marine_hull_policy_count, + COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS marine_hull_premium, + COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS marine_hull_revenue, + + -- Grand Totals + COALESCE( + SUM(CASE WHEN ptp.bap = 'Health' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) + + SUM(CASE WHEN ptp.bap = 'Marine Hull' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) + + SUM(CASE WHEN ptp.bap = 'Life' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) + + SUM(CASE WHEN ptp.bap = 'Motor' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) + + SUM(CASE WHEN ptp.bap = 'Fire' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) + + SUM(CASE WHEN ptp.bap = 'Engineering' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) + + SUM(CASE WHEN ptp.bap = 'Liability' AND pt.action_type = 'inception' THEN 1 ELSE 0 END)+ + SUM(CASE WHEN ptp.bap = 'Marine Cargo' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) + + SUM(CASE WHEN ptp.bap = 'Misc' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), + 0 + ) AS total_policy_count, + + COALESCE( + SUM(CASE WHEN ptp.bap = 'Health' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) + + SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) + + SUM(CASE WHEN ptp.bap = 'Life' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) + + SUM(CASE WHEN ptp.bap = 'Motor' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) + + SUM(CASE WHEN ptp.bap = 'Fire' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) + + SUM(CASE WHEN ptp.bap = 'Engineering' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) + + SUM(CASE WHEN ptp.bap = 'Liability' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END)+ + SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END)+ + SUM(CASE WHEN ptp.bap = 'Misc' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), + 0 + ) AS total_premium, + + COALESCE( + SUM(CASE WHEN ptp.bap = 'Health' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END) + + SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END) + + SUM(CASE WHEN ptp.bap = 'Life' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END) + + SUM(CASE WHEN ptp.bap = 'Motor' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END) + + SUM(CASE WHEN ptp.bap = 'Fire' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END) + + SUM(CASE WHEN ptp.bap = 'Engineering' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END) + + SUM(CASE WHEN ptp.bap = 'Liability' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END)+ + SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END)+ + SUM(CASE WHEN ptp.bap = 'Misc' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), + 0 + ) AS total_revenue + + from insurers ins + left join pt_co_share_details pt_co on ins.id = pt_co.insurer_id and pt_co.is_active = 1 + left join co_share_stmt_details stmt on pt_co.id = stmt.co_share_id and stmt.is_active = 1 + left join policy_transaction pt on pt_co.pt_id = pt.id and pt.is_active = 1 AND pt.policy_issue_date >= '$fromDate' AND pt.policy_issue_date <= '$toDate' + left join policy_type ptp on pt.policy_type_id = ptp.id and ptp.policy_category = $category + where ins.is_active = 1 + group by ins.id + ORDER BY + health_premium DESC, + misc_premium DESC, + motor_premium DESC, + engineering_premium DESC, + fire_premium DESC, + liability_premium DESC, + life_premium DESC, + marine_cargo_premium DESC, + marine_hull_premium DESC; + + "); + + // Get the query + $result = $builder->getResultArray(); + $this->myLogger->logme('error', 'Query executed successfully.'); + // dd(db_connect()->getLastQuery(),$result); + return $result; + } catch (\Exception $e) { + + // Log the exception details for debugging + $this->myLogger->logme('error', 'Error occurred in getBAPInsurerData: {message}', ['message' => $e->getMessage()]); + $this->myLogger->logme('error', 'Stack trace: {trace}', ['trace' => $e->getTraceAsString()]); + return []; + } + } + + //Function for get BAP CLIENT wise data for premium , policy count , revenue only + public function getBAPClientData($category = 0, $start_date = null, $end_date = null) + { + + try { + $this->myLogger->logme('error', 'getBAPClientData function called'); + $this->myLogger->logme('error', 'category : {data}', ['data' => $category]); + $this->myLogger->logme('error', 'start date : {start_date} - end date {end_date} ', ['start_date' => $start_date, 'end_date' => $end_date]); + + //set default last 3 months data date + $fromDate = date('Y-m-d', strtotime('-90 days')); + $toDate = date('Y-m-d 23:59:59'); + + if (!empty($start_date) && !empty($end_date)) { + $fromDate = change_date_format($start_date); + $toDate = change_date_format($end_date); + } + + $this->myLogger->logme('error', 'From date : {fromDate} - To date {toDate} ', ['fromDate' => $fromDate, 'toDate' => $toDate]); + + $db = db_connect(); + $builder = $db->query(" + + SELECT + c.id AS client_id, + c.client_name, + + -- Health Policies + COALESCE(SUM(CASE WHEN ptp.bap = 'Health' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS health_policy_count, + COALESCE(SUM(CASE WHEN ptp.bap = 'Health' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS health_premium, + + -- Misc Policies + COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS misc_policy_count, + COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS misc_premium, + + -- Motor Policies + COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS motor_policy_count, + COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS motor_premium, + + -- Engineering Policies + COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS engineering_policy_count, + COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS engineering_premium, + + -- Fire Policies + COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS fire_policy_count, + COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS fire_premium, + + -- Liability Policies + COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS liability_policy_count, + COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS liability_premium, + + -- Life Policies + COALESCE(SUM(CASE WHEN ptp.bap = 'Life' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS life_policy_count, + COALESCE(SUM(CASE WHEN ptp.bap = 'Life' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS life_premium, + + -- Marine Cargo Policies + COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS marine_cargo_policy_count, + COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS marine_cargo_premium, + + -- Marine Hull Policies + COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS marine_hull_policy_count, + COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS marine_hull_premium, + + -- Grand Totals + COALESCE(SUM(CASE WHEN pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS total_policy_count, + COALESCE(SUM(stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt), 0) AS total_premium + + FROM clients c + LEFT JOIN policy_transaction pt ON pt.client_id = c.id AND pt.is_active = 1 AND pt.policy_issue_date >= '$fromDate' AND pt.policy_issue_date <= '$toDate' + LEFT JOIN policy_type ptp ON pt.policy_type_id = ptp.id + LEFT JOIN pt_co_share_details ptco ON ptco.pt_id = pt.id AND ptco.is_active = 1 + LEFT JOIN co_share_stmt_details stmt ON stmt.co_share_id = ptco.id AND stmt.is_active = 1 + WHERE c.is_active = 1 + AND ptp.policy_category = $category + GROUP BY c.id + ORDER BY + health_premium DESC, + misc_premium DESC, + motor_premium DESC, + engineering_premium DESC, + fire_premium DESC, + liability_premium DESC, + life_premium DESC, + marine_cargo_premium DESC, + marine_hull_premium DESC + + "); + + // Get the query + $result = $builder->getResultArray(); + // dd(db_connect()->getLastQuery(),$result); + return $result; + } catch (\Exception $e) { + + // Log the exception details for debugging + $this->myLogger->logme('error', 'Error occurred in getBAPClientData: {message}', ['message' => $e->getMessage()]); + $this->myLogger->logme('error', 'Stack trace: {trace}', ['trace' => $e->getTraceAsString()]); + return []; + } + } + + //Function for get CLIENT wise data for premium and policy count only + public function getClientData($category = 0, $start_date = null, $end_date = null) + { + + try { + + $this->myLogger->logme('error', 'getClientData function called'); + $this->myLogger->logme('error', 'category : {data}', ['data' => $category]); + $this->myLogger->logme('error', 'start date : {start_date} - end date {end_date} ', ['start_date' => $start_date, 'end_date' => $end_date]); + + //set default last 3 months data date + $fromDate = date('Y-m-d', strtotime('-90 days')); + $toDate = date('Y-m-d 23:59:59'); + + if (!empty($start_date) && !empty($end_date)) { + $fromDate = change_date_format($start_date); + $toDate = change_date_format($end_date); + } + + $this->myLogger->logme('error', 'From date : {fromDate} - To date {toDate} ', ['fromDate' => $fromDate, 'toDate' => $toDate]); + + $db = db_connect(); + $builder = $db->query(" + + select + c.id as client_id, + c.client_name, + + ( + select + count(policy_transaction.id) + from policy_transaction + left join policy_type on policy_transaction.policy_type_id = policy_type.id + where policy_transaction.client_id = c.id + and policy_transaction.action_type = 'inception' + 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 + from co_share_stmt_details stmt + left join pt_co_share_details ptco on stmt.co_share_id = ptco.id + left join policy_transaction pt on ptco.pt_id = pt.id + where pt.client_id = c.id + 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 + where c.is_active = 1 + group by client_name + order by premium desc + "); + + // Get the query + $result = $builder->getResultArray(); + // dd(db_connect()->getLastQuery(),$result); + return $result; + } catch (\Exception $e) { + + // Log the exception details for debugging + $this->myLogger->logme('error', 'Error occurred in getClientData: {message}', ['message' => $e->getMessage()]); + $this->myLogger->logme('error', 'Stack trace: {trace}', ['trace' => $e->getTraceAsString()]); + return []; + } + } +} diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index eab0a10b..9c8e8d64 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -4045,6 +4045,20 @@ class ClientController extends AdminController // $returndata = $LeadsController->convertQCRJsonToPolicyTerms($jsonArray, $policy_type, $proposel_name, $insurer_name); // dd($returndata); + // -----------BDS REPORT CONTROLLER--------------------------------------------------------------------------------- + + $BDSReportController = new BDSReportController(); + + // $data['data'] = $BDSReportController->getBAPInsurerData(); + // return $this->loadLayout('irda_bap_insurer_report_list', $data); + + $data['data'] = $BDSReportController->getBAPClientData(); + return $this->loadLayout('irda_bap_client_report_list', $data); + + // $data['data'] = $BDSReportController->getClientData(1); + // return $this->loadLayout('irda_client_report_list', $data); + + // $BDSReportController->getBAPClientData(); } // ------------------------------------------------------------------------------------------------------- diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 409d6b5a..5d24c70a 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -1696,6 +1696,7 @@ class EmployeeRestController extends AdminController $clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id')) ->where('client_branch_id',$this->request->getGet('client_branch_id')) ->where('policy_status', 1) + ->where('is_active', 1) ->findAll(); if(count($clientPolicy)) diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index ea4d3901..c1cbd7d4 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -1103,20 +1103,30 @@ class PolicyTransactionController extends BaseController } - if(!empty($data['data_received_date'])){ + if(empty($data['data_received_date'])){ + $data['data_received_date'] = null; + }else{ $data['data_received_date'] = change_date_format($data['data_received_date'], 'd/m/Y', 'Y-m-d'); } - if(!empty($data['policy_issue_date'])){ + if(empty($data['policy_issue_date'])){ + $data['policy_issue_date'] = null; + }else{ $data['policy_issue_date'] = change_date_format($data['policy_issue_date'], 'd/m/Y', 'Y-m-d'); } - if(!empty($data['endorse_eff_date'])){ + if(empty($data['endorse_eff_date'])){ + $data['endorse_eff_date'] = null; + }else{ $data['endorse_eff_date'] = change_date_format($data['endorse_eff_date'], 'd/m/Y', 'Y-m-d'); + } - if(!empty($data['install_due_date'])){ + if(empty($data['install_due_date'])){ + $data['install_due_date'] = null; + }else{ $data['install_due_date'] = change_date_format($data['install_due_date'], 'd/m/Y', 'Y-m-d'); + } if(!empty($data['month'])){ @@ -1162,7 +1172,8 @@ class PolicyTransactionController extends BaseController 'policy_type_id' => $issue_type['policy_type_id'] ?? null, 'issue_type' => $issue_type['issue_type'] ?? null, 'source_client_policy_id' => $issue_type['source_client_policy_id'] ?? null, - 'cd_ac_no' => $issue_type['issue_type'] ?? null, + 'cd_ac_no' => $issue_type['cd_ac_no'] ?? null, + 'cd_ac_pk' => $issue_type['cd_ac_pk'] ?? null, // 'policy_issue_date' => $issue_type['policy_issue_date'] ?? null, 'policy_start_date' => $issue_type['policy_start_date'] ?? null, 'policy_end_date' => $issue_type['policy_end_date'] ?? null, diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php new file mode 100644 index 00000000..f41e53b1 --- /dev/null +++ b/app/Controllers/TicketController.php @@ -0,0 +1,132 @@ +myLogger = \Config\Services::mylogger(); + $this->ticketType = [1 => "Claim-GMC", 2 => "Claim-GPA", 3 => "EDLI", 4 => "GTLI"]; + $this->priorityType = [ + 1 => "Low", + 2 => "Medium", + 3 => "High", + 4 => "Urgent", + 5 => "Emergency", + 6 => "Critical" + ]; + $this->relationshipType = [ + "self" => "Self", + "spouse" => "Spouse", + "son" => "Son", + "daughter" => "Daughter", + "father" => "Father", + "mother" => "Mother", + "father-in-law" => "Father-in-Law", + "mother-in-law" => "Mother-in-Law" + ]; + } + + public function ticketList() + { + if ($this->request->is('get')) { + $data['page_name'] = "Claims"; + $data['ticket_type'] = $this->ticketType; + $data['claim_status'] = []; + $data['client_list'] = []; + + return $this->loadLayout('ticket_search', $data); + + } else{ + + $data['ticket_data'] = $this->ticketSearch(); + $html = view('ticket_list', $data); + return $this->respond(['status' => true, 'html' => $html], 200); + } + } + + public function ticketSearch() + { + $search_data = $this->request->getPost(); + // print_r($search_data); die; + + $data = [ + [ + 'id' => 1, + 'status' => 'Approved', + 'claim_no' => 'CL12345', + 'tpa_id' => 'TPA001', + 'emp_name' => 'John Doe', + 'insurer_name' => 'ABC Insurance', + 'client_name' => 'XYZ Corp', + 'tat' => '5 Days', + ], + [ + 'id' => 2, + 'status' => 'Pending', + 'claim_no' => 'CL12346', + 'tpa_id' => 'TPA002', + 'emp_name' => 'Jane Smith', + 'insurer_name' => 'DEF Insurance', + 'client_name' => 'LMN Ltd', + 'tat' => '3 Days', + ], + [ + 'id' => 3, + 'status' => 'Rejected', + 'claim_no' => 'CL12347', + 'tpa_id' => 'TPA003', + 'emp_name' => 'Alice Johnson', + 'insurer_name' => 'GHI Insurance', + 'client_name' => 'PQR Co', + 'tat' => '7 Days', + ], + ]; + + return $data; + } + + public function ticket_form() + { + $data['ticket_form'] = 1; + return $this->loadLayout('ticket_form_gmc', $data); + } + + public function view_ticket($ticket_id) + { + $data = []; + return $this->loadLayout('ticket_edit_onbording', $data); + } + + public function createTicket() + { + } + + public function updateTicket() + { + } + + public function createMailTemplate() + { + $data = []; + return $this->loadLayout('ticket_mail_template', $data); + } + + +} diff --git a/app/Helpers/ExcelSanitizeHelper.php b/app/Helpers/ExcelSanitizeHelper.php index 67aaa55e..5c2836a7 100644 --- a/app/Helpers/ExcelSanitizeHelper.php +++ b/app/Helpers/ExcelSanitizeHelper.php @@ -1,4 +1,5 @@ $value) { if (is_array($value)) { $cleanData[$key] = self::sanitizeArrayData($value); // Recursive call for nested arrays } elseif (is_string($value)) { // Remove non-printable characters and trim whitespace from strings - $cleanData[$key] = trim(str_replace(self::$nonPrintableChars, '', $value)); + $cleanData[$key] = trim(preg_replace(self::$nonPrintablePattern, '', $value)); } else { $cleanData[$key] = $value; // Keep non-string/non-array data as is } } - return $cleanData; } catch (\Exception $e) { // Log the error and the problematic data for debugging diff --git a/app/Helpers/sendMailNotification.php b/app/Helpers/sendMailNotification.php index 9136801e..a5af0834 100755 --- a/app/Helpers/sendMailNotification.php +++ b/app/Helpers/sendMailNotification.php @@ -1226,6 +1226,20 @@ class sendMailNotification $notification = $params['notification_data']; $client_data = $params['client_data']; $mail = $params['test_mail']; + $mailAttachmentModel = new MailAttachmentModel(); + $attachment_data = $mailAttachmentModel + ->select('file_path, file_name') + ->where('notification_id', $notification['id']) + ->where('is_active', 1) + ->findAll(); + + $attachments = []; + foreach ($attachment_data as $data) { + $attachments[] = [ + "filePath" => WRITEPATH . $data['file_path'], + "fileName" => $data['file_name'] + ]; + } $mail_content = $notification['mail_content']; $subject = $notification['subject']; @@ -1252,7 +1266,7 @@ class sendMailNotification $mail_content = str_replace("[[ecard_download_link]]", "Download Insurance Card", $mail_content); $mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content); - $wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to']]; + $wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'],'attachments' => $attachments, 'reply_to' => $client_data['reply_to']]; return $wholeData; diff --git a/app/Helpers/utility_helper.php b/app/Helpers/utility_helper.php index f5313bde..ca22481a 100755 --- a/app/Helpers/utility_helper.php +++ b/app/Helpers/utility_helper.php @@ -546,6 +546,7 @@ if (!function_exists('change_date_format')) { 'Y,m,d', // 2024,12,01 'd/m/Y', // 01/01/2025 + 'd-m-Y', // 01-01-2025 ]; diff --git a/app/Models/PolicyTypeModel.php b/app/Models/PolicyTypeModel.php index 29126484..90aa1758 100755 --- a/app/Models/PolicyTypeModel.php +++ b/app/Models/PolicyTypeModel.php @@ -22,6 +22,6 @@ class PolicyTypeModel extends Model "etp", "iep", "itp", - "question_json",'itep','etep' + "question_json",'itep','etep', 'policy_category', ]; } diff --git a/app/Models/TicketClaimStatusModel.php b/app/Models/TicketClaimStatusModel.php new file mode 100644 index 00000000..d0e959e7 --- /dev/null +++ b/app/Models/TicketClaimStatusModel.php @@ -0,0 +1,49 @@ + +.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; +} + + +
+
+
+
+
+

Insurer List

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
InsurerPoliciesPremiumRevenue
Grand Total
+
+
+
+
+ + diff --git a/app/Views/bds_report_bap_wise_data.php b/app/Views/bds_report_bap_wise_data.php new file mode 100644 index 00000000..45585259 --- /dev/null +++ b/app/Views/bds_report_bap_wise_data.php @@ -0,0 +1,131 @@ + + +
+
+
+
+
+

BAP Report List

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
InsurerPoliciesPremiumRevenue
Grand Total
+
+
+
+
+ + \ No newline at end of file diff --git a/app/Views/irba_report.php b/app/Views/irba_report.php new file mode 100644 index 00000000..497798a7 --- /dev/null +++ b/app/Views/irba_report.php @@ -0,0 +1,157 @@ +
+
+
+
+
+ + + +
+
+
+ +
+
+ +
+   + +
+ > + > +
+ + +
+
+ +
+ + +
+
+ +
+ + +
+
+ +
+ Submit +
+
+ +
+
+
+
+
+
+
+ +
+
+ + \ No newline at end of file diff --git a/app/Views/irda_bap_client_report_list.php b/app/Views/irda_bap_client_report_list.php new file mode 100644 index 00000000..3f31a226 --- /dev/null +++ b/app/Views/irda_bap_client_report_list.php @@ -0,0 +1,276 @@ + + +
+
+
+
+
+

BAP Client Report

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $row){ ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EngineeringFireHealthLiabilityLifeMarine CargoMiscMotorMarine HullGrand Total
S. NoInsuredPoliciesPremiumPoliciesPremiumPoliciesPremiumPoliciesPremiumPoliciesPremiumPoliciesPremiumPoliciesPremiumPoliciesPremiumPoliciesPremiumPoliciesPremium
Grand Total
+ +
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/app/Views/irda_bap_insurer_report_list.php b/app/Views/irda_bap_insurer_report_list.php new file mode 100644 index 00000000..8ab3b8fc --- /dev/null +++ b/app/Views/irda_bap_insurer_report_list.php @@ -0,0 +1,353 @@ + + +
+
+
+
+
+

BAP Insurer Report

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $row){ ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EngineeringFireHealthLiabilityLifeMarine CargoMiscMotorMarine HullGrand Total
S. NoInsurerPoliciesPremiumRevenuePoliciesPremiumRevenuePoliciesPremiumRevenuePoliciesPremiumRevenuePoliciesPremiumRevenuePoliciesPremiumRevenuePoliciesPremiumRevenuePoliciesPremiumRevenuePoliciesPremiumRevenuePoliciesPremiumRevenue
Grand Total
+ +
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/app/Views/irda_client_report_list.php b/app/Views/irda_client_report_list.php new file mode 100644 index 00000000..70ba446f --- /dev/null +++ b/app/Views/irda_client_report_list.php @@ -0,0 +1,148 @@ + + +
+
+
+
+
+

Client Report

+
+ +
+
+ + + + + + + + + + + + + $row){ ?> + + + + + + + + + + +
S. NoInsuredPoliciesPremium
+ +
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php index e8f0dd11..e8209e4b 100755 --- a/app/Views/layout/header.php +++ b/app/Views/layout/header.php @@ -60,7 +60,7 @@ - + @@ -75,17 +75,15 @@ }); } - - - - - - - - + + + + + + + + +
+
+
+
+ +
+
+

Ticket

+
+
+ + + +
+
+ + + + + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+ +
+ +
\ No newline at end of file diff --git a/app/Views/ticket_form_gmc.php b/app/Views/ticket_form_gmc.php new file mode 100644 index 00000000..8c381b92 --- /dev/null +++ b/app/Views/ticket_form_gmc.php @@ -0,0 +1,246 @@ +
+
+
"> +
+ +
+
+

Claim GMC

+
+
+ +
+
+
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+
+
+ +
+ +
+ +
+
+
diff --git a/app/Views/ticket_form_gpa.php b/app/Views/ticket_form_gpa.php new file mode 100644 index 00000000..6cac4d51 --- /dev/null +++ b/app/Views/ticket_form_gpa.php @@ -0,0 +1,173 @@ +
+
+
"> +
+ +
+
+

Claim GPA

+
+
+ +
+
+
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + +
+ + +
+ + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+
+
+ +
+
+ +
+
+
\ No newline at end of file diff --git a/app/Views/ticket_history.php b/app/Views/ticket_history.php new file mode 100644 index 00000000..73e0850b --- /dev/null +++ b/app/Views/ticket_history.php @@ -0,0 +1,33 @@ +
+
+
+
+ + + + + + + + + + + + + $row){ ?> + + + + + + + + + + + +
FieldOld ValueNew ValueUserDate/Time
+
+
+
+
diff --git a/app/Views/ticket_list.php b/app/Views/ticket_list.php new file mode 100644 index 00000000..69bacaf5 --- /dev/null +++ b/app/Views/ticket_list.php @@ -0,0 +1,136 @@ + + +
+
+
+
+
+

Claim List

+
+ +
+
+ + + + + + + + + + + + + + + $row){ ?> + + + + + + + + + + + + +
StatusClaim numberTPA IDEmp nameInsured NameCorporate nameTAT
+ +
+
+
+
+
+
+ + + + + + \ No newline at end of file diff --git a/app/Views/ticket_mail_template.php b/app/Views/ticket_mail_template.php new file mode 100644 index 00000000..f48b20d2 --- /dev/null +++ b/app/Views/ticket_mail_template.php @@ -0,0 +1,174 @@ + + +
+
+
+
+
+

Mail Template List

+
+ +
+
+ + + + + + + + + + + $row){ ?> + + + + + + + + +
Template NameStatusPolicy Type
+ +
+
+
+
+
+
+ + + + + + \ No newline at end of file diff --git a/app/Views/ticket_note.php b/app/Views/ticket_note.php new file mode 100644 index 00000000..7839c63c --- /dev/null +++ b/app/Views/ticket_note.php @@ -0,0 +1,62 @@ +
+
+
+
+
+
+
+ + +
+
+
+
+ +
+
+
+
+
+ + + \ No newline at end of file diff --git a/app/Views/ticket_reply.php b/app/Views/ticket_reply.php new file mode 100644 index 00000000..0b719e33 --- /dev/null +++ b/app/Views/ticket_reply.php @@ -0,0 +1,67 @@ +
+
+
+
+
+
+ +
+ + +
+ + +
+ + +
+ + +
+ + +
+
+
+ + +
+ +
+
+
+
+
+ + diff --git a/app/Views/ticket_search.php b/app/Views/ticket_search.php new file mode 100644 index 00000000..24317d79 --- /dev/null +++ b/app/Views/ticket_search.php @@ -0,0 +1,170 @@ + + +
+
+
+
+
+ + + +
+
+
+
+
+ + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + + +
+ +
+
+
+
+ +
+
+
+ + +
+ +
+ + + \ No newline at end of file diff --git a/tests/unit/ExcelSanitizeHelperTest.php b/tests/unit/ExcelSanitizeHelperTest.php new file mode 100644 index 00000000..f098ece7 --- /dev/null +++ b/tests/unit/ExcelSanitizeHelperTest.php @@ -0,0 +1,67 @@ + "HelloWorld", + "withNonPrintable" => "‌71030034240400000016", + "withWhitespace" => " Trim me ", + "nonStringValue" => 'Hello +World', + ]; + $expected = [ + "validString" => "HelloWorld", + "withNonPrintable" => "71030034240400000016", + "withWhitespace" => "Trim me", + "nonStringValue" => 'HelloWorld', + ]; + $result = ExcelSanitizeHelper::sanitizeArrayData($input); + // var_dump($input); + // var_dump($result); + $this->assertSame($expected, ExcelSanitizeHelper::sanitizeArrayData($input)); + + // Test with nested arrays + $input = [ + "nested" => [ + "validString" => "‌71030034240400000016", + "withNonPrintable" => "Nested\x01\x02String_x000A_", + ], + "withWhitespace" => " Outer whitespace ", + ];var_dump($input); + $expected = [ + "nested" => [ + "validString" => "71030034240400000016", + "withNonPrintable" => "NestedString", + ], + "withWhitespace" => "Outer whitespace", + ]; + $this->assertSame($expected, ExcelSanitizeHelper::sanitizeArrayData($input)); + + // Test with empty array + $this->assertSame([], ExcelSanitizeHelper::sanitizeArrayData([])); + + // Test with an array containing only non-string values + $input = [ + "integer" => 42, + "float" => 3.14, + "boolean" => true, + "null" => null, + ]; + $this->assertSame($input, ExcelSanitizeHelper::sanitizeArrayData($input)); + + // Test with invalid input to ensure graceful handling (edge case) + $input = ["invalid" => "\x00\x01\x7F_x000D_", "normal" => "Text"]; + $expected = ["invalid" => "", "normal" => "Text"]; + $this->assertSame($expected, ExcelSanitizeHelper::sanitizeArrayData($input)); + } +}