From b163f3220e4ccc759b2b70e2c08e74b771ec406d Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 21 Jan 2026 09:33:18 +0530 Subject: [PATCH 1/2] FIX_LIVE_ISSUES --- app/Config/Routes.php | 2 +- app/Controllers/ClientController.php | 9 ++-- app/Controllers/EmployeeController.php | 2 +- app/Controllers/LeadsController.php | 19 +++++-- app/Helpers/excel_util_helper.php | 4 +- app/Models/PolicyTransactionModel.php | 48 ++++++++++++++++- app/Views/view_rfq.php | 71 +++++++++++++++++++++++--- 7 files changed, 137 insertions(+), 18 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 89e8cfc8..755be53f 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -427,6 +427,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) { $routes->get('checkDuplicateCdAccount', 'MasterController::checkDuplicateCdAccount'); $routes->get('proceedExcelFileDataValidation', 'EmployeeController::proceedExcelFileDataValidation'); $routes->get('checkTpaApiEnable', 'EmployeeRestController::checkTpaApiEnable'); + $routes->get('generateDemographyDataTable', 'LeadsController::generateDemographyDataTable'); }); $routes->post("policy_tranction/sendInstallmentRemainderMail","PolicyTransactionController::sendInstallmentRemainderMail"); @@ -525,7 +526,6 @@ $routes->cli('cli/check_env', 'MasterController::checkEnv'); $routes->cli('cli/enrollOpendAndClose', 'DashboardController::updatePolicyEnrollmentStatus'); $routes->cli("cli/sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail"); $routes->cli('cli/update-emp-policy-status', 'ClientController::updateEmpAndPolicyStatus'); -$routes->cli('cli/update-emp-policy-status', 'ClientController::updateEmpAndPolicyStatus'); $routes->cli('cli/insurerRFQRemainder', 'LeadsController::remainderForQcr'); $routes->cli('cli/sendMailWithAutoQuery','TicketController::sendMailWithAutoQuery'); $routes->cli('cli/MediAssit-ClaimStatusUpdate','MediAssistApiController::ClaimStatusUpdate'); diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 0b6470bc..0b2f549b 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -6091,6 +6091,8 @@ class ClientController extends AdminController // $response = $ticketServiceController->getClaimExcelErrorData(["file_id" => 41]); // $response = $ticketServiceController->claimDumpOnBoardProcess(["file_id" => 17]); // $response = $ticketServiceController->extractExcelData("claims_dump_form_client.xlsx"); + // $response = $ticketServiceController->tpaClaimDumpImporter(["file_id" => 48]); + // $response = $ticketServiceController->tpaClaimDumpToTicketMasterImporters(["file_id" => 48]); // dd($response); // ---------- TICKET CONTROLLER -------------------------------------------------------------------------------- @@ -6105,7 +6107,8 @@ class ClientController extends AdminController $empServiceController = new EmployeeServiceController(); // $res = $empServiceController->excelFileFormatValidation(['file_id' => '1248']); // $res = $empServiceController->excelFileDataValidation(['file_id' => '1252']); - // $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1183]); + // $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1263]); + // $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1262]); // $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1169]); // $res = $empServiceController->employeesOnboardProcess(['file_id' => 835]); // $res = $empServiceController->employeesEnrollmentInsert(['file_id' => 836]); @@ -6231,8 +6234,8 @@ class ClientController extends AdminController // $res = $LeadsController->convertQCRJsonToPolicyTerms($jsonArray, $policy_type, $proposel_name, $insurer_name); // $res = $LeadsController->handleMemberDataGPATotalSumInsurerFromExcel(['lead_id' => 169]); // $res = $LeadsController->reorderProposalsByInsurerTotal($jsonArray); - // $res = $LeadsController->calculateMembersDemography(['lead_id' => 326]); - // $res = $LeadsController->generateDemographyDataTable(['lead_id' => 326]); + // $res = $LeadsController->calculateMembersDemography(['lead_id' => 287], "internal"); + // $res = $LeadsController->generateDemographyDataTable(['lead_id' => 287]); // echo $res; // dd($res); diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index f4ceecc2..a22add93 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -392,7 +392,7 @@ class EmployeeController extends AdminController CONCAT( ( SELECT lc.name - FROM level_contect lc + FROM level_contacts lc WHERE lc.id = files.hr_id LIMIT 1 ), diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index a3ebe469..b0eef1fb 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -1136,7 +1136,7 @@ class LeadsController extends BaseController // 12. Conditional rendering based on lead_form_type if ($lead_data['lead_form_type'] == 1) { - $data['demogrphy_html_data'] = $this->generateDemographyDataTable(['lead_id' => $id]); + // $data['demogrphy_html_data'] = $this->generateDemographyDataTable(['lead_id' => $id]); $this->loadLayout('view_rfq.php', $data); } else if ($lead_data['lead_form_type'] == 2) { $data['occupancy'] = $this->occupancyModel->findAll(); @@ -5384,8 +5384,13 @@ class LeadsController extends BaseController return []; } - public function generateDemographyDataTable($param) - { + public function generateDemographyDataTable($param = []) + { + + if ($this->request !== null) { + $param['lead_id'] = $this->request->getGet('lead_id'); + } + $returnData = $this->calculateMembersDemography($param, "internal"); $html = ""; @@ -5431,6 +5436,14 @@ class LeadsController extends BaseController } } + if ($this->request !== null) { + if(!empty($html)){ + return $this->respond(['status' => true, 'data' => $html], 200); + }else{ + return $this->respond(['status' => false, 'data' => $html], 200); + } + } + return $html; } diff --git a/app/Helpers/excel_util_helper.php b/app/Helpers/excel_util_helper.php index 98b171e5..c2c77a52 100755 --- a/app/Helpers/excel_util_helper.php +++ b/app/Helpers/excel_util_helper.php @@ -1884,7 +1884,7 @@ if (!function_exists('premium_calculation_manager')) { } // if the family floater case first self add first the process completed, after spouse or any dependent add the rata premium not added this change will handle this - if (strtolower($emp_data['relationship']) != 'self' && $temp_slab_rates[0]['premium_type'] == 1 && $emp_data['temp']['action'] == 'DA') { + if (strtolower($emp_data['relationship']) != 'self' && empty($emp_data['temp']['acting_self']) && $temp_slab_rates[0]['premium_type'] == 1 && $emp_data['temp']['action'] == 'DA') { //set dependent si to 0 $emp_data['policy_details']['basic_cover_si'] = 0; $emp_data['policy_details']['premium'] = 0; @@ -1897,7 +1897,7 @@ if (!function_exists('premium_calculation_manager')) { $emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst / 100)), 2, '.', ''); } - }else if(strtolower($emp_data['relationship']) != 'self' && $temp_slab_rates[0]['premium_type'] == 1 && ($emp_data['temp']['action'] == 'I' || $emp_data['temp']['action'] == 'A' || $emp_data['temp']['action'] == 'MI')){ + }else if(strtolower($emp_data['relationship']) != 'self' && empty($emp_data['temp']['acting_self']) && $temp_slab_rates[0]['premium_type'] == 1 && ($emp_data['temp']['action'] == 'I' || $emp_data['temp']['action'] == 'A' || $emp_data['temp']['action'] == 'MI')){ $emp_data['policy_details']['basic_cover_si'] = 0; $emp_data['policy_details']['premium'] = 0; diff --git a/app/Models/PolicyTransactionModel.php b/app/Models/PolicyTransactionModel.php index 92ab47d8..4c736e26 100644 --- a/app/Models/PolicyTransactionModel.php +++ b/app/Models/PolicyTransactionModel.php @@ -2568,8 +2568,10 @@ pt.action_type as action_type_string, c.client_name, + c.id as client_id, c.short_name AS client_short_name, cb.branch_name AS client_branch_name, + cb.id AS client_branch_id, cb.address1 AS client_address, ptype.policy_type, ptype.bap, @@ -2577,6 +2579,7 @@ ins.name AS insurer_name, ins.short_name AS insurer_short_name, ib.branch_name AS insurer_branch_name, + ib.id AS insurer_branch_id, ib.branch_code AS insurer_branch_code, created_user.first_name AS user_name, @@ -2734,8 +2737,10 @@ pt.action_type as action_type_string, c.client_name, + c.id as client_id, c.short_name AS client_short_name, cb.branch_name AS client_branch_name, + cb.id AS client_branch_id, cb.address1 AS client_address, ptype.policy_type, ptype.bap, @@ -2743,6 +2748,7 @@ ins.name AS insurer_name, ins.short_name AS insurer_short_name, ib.branch_name AS insurer_branch_name, + ib.id AS insurer_branch_id, ib.branch_code AS insurer_branch_code, created_user.first_name as user_name, @@ -3002,13 +3008,14 @@ public function getBDSReportList($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $client_branch_id = 0, $insurer_branch_id = 0, $client_policy_id = 0, $user_id = 0, $where = []) { - + $whereAdded = false; $statement_month_condition = ''; if ($date_type == 'statement_month' && $start_date != 0 && $end_date != 0) { $statement_month_condition = " WHERE statement_month >= '" . $start_date . "' AND statement_month <= '" . $end_date . "' "; + $whereAdded = true; } $default_date_filter = ''; @@ -3098,6 +3105,33 @@ $conditions .= " AND pt.issuer = $issuer "; } + $main_conditions = ''; + function addCondition(&$main_conditions, &$whereAdded, $condition) + { + if (!$whereAdded) { + $main_conditions .= " WHERE $condition "; + $whereAdded = true; + } else { + $main_conditions .= " AND $condition "; + } + } + + // 4. Common filters + if ($client_id != 0) { + addCondition($main_conditions, $whereAdded, "client_id = $client_id"); + } + + if ($insurer_id != 0) { + addCondition($main_conditions, $whereAdded, "insurer_id = $insurer_id"); + } + + if ($client_branch_id != 0) { + addCondition($main_conditions, $whereAdded, "client_branch_id = $client_branch_id"); + } + + if ($insurer_branch_id != 0) { + addCondition($main_conditions, $whereAdded, "insurer_branch_id = $insurer_branch_id"); + } $sql = " SELECT * FROM ( @@ -3137,8 +3171,10 @@ pt.action_type as action_type_string, c.client_name, + c.id as client_id, c.short_name AS client_short_name, cb.branch_name AS client_branch_name, + cb.id AS client_branch_id, cb.address1 AS client_address, ptype.policy_type, ptype.bap, @@ -3146,6 +3182,7 @@ ins.name AS insurer_name, ins.short_name AS insurer_short_name, ib.branch_name AS insurer_branch_name, + ib.id AS insurer_branch_id, ib.branch_code AS insurer_branch_code, created_user.first_name AS user_name, @@ -3294,8 +3331,10 @@ pt.action_type as action_type_string, c.client_name, + c.id as client_id, c.short_name AS client_short_name, cb.branch_name AS client_branch_name, + cb.id AS client_branch_id, cb.address1 AS client_address, ptype.policy_type, ptype.bap, @@ -3303,6 +3342,7 @@ ins.name AS insurer_name, ins.short_name AS insurer_short_name, ib.branch_name AS insurer_branch_name, + ib.id AS insurer_branch_id, ib.branch_code AS insurer_branch_code, created_user.first_name as user_name, @@ -3479,8 +3519,10 @@ pt.action_type as action_type_string, c.client_name, + c.id as client_id, c.short_name AS client_short_name, cb.branch_name AS client_branch_name, + cb.id AS client_branch_id, cb.address1 AS client_address, ptype.policy_type, ptype.bap, @@ -3488,6 +3530,7 @@ ins.name AS insurer_name, ins.short_name AS insurer_short_name, ib.branch_name AS insurer_branch_name, + ib.id AS insurer_branch_id, ib.branch_code AS insurer_branch_code, created_user.first_name as user_name, @@ -3616,6 +3659,7 @@ ) AS final_result $statement_month_condition + $main_conditions -- GROUP BY statement_month, insurer_name, policy_no -- WHERE id = 6143 @@ -3631,7 +3675,7 @@ $result = $query->getResultArray(); // $countofalldata = count($result); // dd($result); - // dd($this->db->getLastQuery()); + // dd($this->db->getLastQuery()->getQuery()); $keys = []; $filtered = []; diff --git a/app/Views/view_rfq.php b/app/Views/view_rfq.php index 63c66276..01d8aed9 100644 --- a/app/Views/view_rfq.php +++ b/app/Views/view_rfq.php @@ -1059,7 +1059,7 @@