From 898508781d18e92d4b0df6f834f77b7a81467844 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 14 Aug 2025 09:34:48 +0530 Subject: [PATCH 1/5] FIX_LIVE_ISSUE : RV --- .../PolicyTransactionController.php | 3 +++ app/Views/client_policy.php | 25 ++++++++++--------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index dddedd54..d6bc5167 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -35,6 +35,7 @@ use App\Models\COShareStmtDetailsModel; use App\Models\BdsPlacementModel; use Kint\Kint; use App\Helpers\MailHelper; +use App\Helpers\ExcelSanitizeHelper; use Exception; class PolicyTransactionController extends BaseController @@ -2270,6 +2271,7 @@ class PolicyTransactionController extends BaseController // dd($highestRowAndColumn); $excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']); unset($excel_data[0]); + $excel_data = ExcelSanitizeHelper::sanitizeArrayData($excel_data); // Kint::dump($excel_data);die(); //get no of line items and update in DB $line_items = 0; @@ -2384,6 +2386,7 @@ class PolicyTransactionController extends BaseController // dd($highestRowAndColumn); $excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']); unset($excel_data[0]); + $excel_data = ExcelSanitizeHelper::sanitizeArrayData($excel_data); // dd($excel_data); //get no of line items and update in DB $line_items = count($excel_data); diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index 3e5d15f0..8dfdcce8 100755 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -2242,18 +2242,19 @@ // Start the interval function startAutoSubmit(attrId) { - if (!submitInterval) { - submitInterval = setInterval(function() { - if(attrId == "GMC"){ - autoSaveGmcTerms(); - }else if(attrId == "GPA"){ - autoSaveGpaTerms(); - }else if(attrId == "OTHERS"){ - autoSaveOtherTerms(); - } - }, 20000); - console.log("Auto-submit started."); - } + // if (!submitInterval) { + // submitInterval = setInterval(function() { + // if(attrId == "GMC"){ + // autoSaveGmcTerms(); + // }else if(attrId == "GPA"){ + // autoSaveGpaTerms(); + // }else if(attrId == "OTHERS"){ + // autoSaveOtherTerms(); + // } + // }, 20000); + // console.log("Auto-submit started."); + // } + console.log("Auto-submit Disabled."); } // Stop the interval From 9834fc4e7fbaaaa92db04ffb941b087bca893b5e Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 14 Aug 2025 10:34:25 +0530 Subject: [PATCH 2/5] FIX : RV --- app/Controllers/TicketController.php | 201 +++++++++++++++++++- app/Views/view_policy_terms.php | 267 +++++++++++++++++++-------- 2 files changed, 385 insertions(+), 83 deletions(-) diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index 5e119628..95a4bbe2 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -829,11 +829,25 @@ class TicketController extends BaseController $data['ticket_data'] = $ticket_data; $data['acms'] = $this->employeeModel->getAcmUsingClientID($ticket_data['client_id']); - $raw_json = $this->ticketMasterModel->getPolicyTermsJson($ticket_id) ; - - $decoded_top = json_decode($raw_json ?? "", true) ?? []; - $data['policy_terms'] = $this->recursive_json_decode($decoded_top); + // do not remove this + // $raw_json = $this->ticketMasterModel->getPolicyTermsJson($ticket_id) ; + // $decoded_top = json_decode($raw_json ?? "", true) ?? []; + // $data['policy_terms'] = $this->recursive_json_decode($decoded_top); + + $policy_data = $this->ticketMasterModel + ->select('client_policy.policy_terms') + ->join('client_policy', 'ticket_master.client_policy_id = client_policy.id') + ->where('client_policy.is_active', 1) + ->where('ticket_master.is_active', 1) + ->where('ticket_master.id', $ticket_id) + ->first(); + + if(isset($policy_data['policy_terms']) && !empty($policy_data['policy_terms'])){ + $terms = json_decode($policy_data['policy_terms'], true); + $data['policy_terms'] = $this->convertTermsToDisplay($terms); + // print_rr($data); die; + } return $this->loadLayout('ticket_edit_onbording', $data); } @@ -2232,7 +2246,8 @@ class TicketController extends BaseController } } - public function recursive_json_decode($input) { + public function recursive_json_decode($input) + { if (is_string($input)) { $decoded = json_decode($input, true); if (json_last_error() === JSON_ERROR_NONE) { @@ -2251,6 +2266,182 @@ class TicketController extends BaseController return $input; } + function convertTermsToDisplay(array $data) + { + $result = []; + + $LableKeys = [ + "sum_insured" => "Sum Insured", + "family_floater" => "Family Floater", + "family_floaters" => "Family Floater Details", + "age_ratio" => "Age Ratio", + "is_payable_employee" => "Payable by Employee", + "waiverofpreexistingdiseases" => "Waivers of Pre Existing Diseases", + "waiverof1,2,3&4thyearexclusions" => "Waivers of 1, 2, 3 & 4th Year Exclusions", + "waiverof30dayswaitingperiod" => "Waivers of 30 Days Waiting Period", + "waiver_of_90_days_waiting_period" => "Waiver of 90 Days Waiting Period", + "waiver_of_other_waiting_periods" => "Waiver of Other Waiting Periods", + "maternity_benefit" => "Maternity Benefit", + "9monthwaitingperiodwaived" => "9 Month Waiting Period Waived", + "maternitycoverage" => "Maternity Coverage", + "twindelivery" => "Twin Delivery", + "well_baby_well_mother_expenses" => "Well Baby & Well Mother Expenses", + "preandpostnatal" => "Pre and Post Natal", + "infertility_treatment_coverage" => "Infertility Treatment Coverage", + "babyday1cover" => "Baby Day 1 Cover", + "coverfromthedateofjoining" => "Cover from the Date of Joining", + "mid_term_addition_of_new_born_newly_wedded_spouse" => "Mid Term Addition of New Born / Newly Wedded Spouse", + "prehospitalizationcover" => "Pre Hospitalization Cover", + "posthospitalizationcover" => "Post Hospitalization Cover", + "congenitaldiseasesinternal" => "Congenital Diseases - Internal", + "congenitaldiseasesexternal" => "Congenital Diseases - External", + "copayzonewisecopay" => "Co-Pay (Zone Wise)", + "roomrentlimit" => "Room Rent Limit", + "icu_limit" => "ICU Limit", + "proportionatedeductionclause" => "Proportionate Deduction Clause", + "ailmentcapping" => "Ailment Capping", + "ailment_capping_details" => "Ailment Capping Details", + "corporatebuffer" => "Corporate Buffer", + "non_admissible_contingency_corporate_buffer" => "Non-Admissible Contingency Corporate Buffer", + "ambulancecharges" => "Ambulance Charges", + "airambulance" => "Air Ambulance", + "reasonableandcustomarycharges" => "Reasonable and Customary Charges", + "daycaretreatment" => "Day Care Treatment", + "lasiksurgery" => "Lasik Surgery", + "ayudhtreatmentcover" => "Ayudh Treatment Cover", + "moderntreatmentsasperirdai" => "Modern Treatments as per IRDAI", + "opd_treatment" => "OPD Treatment", + "days_of_discharge" => "Days of Discharge", + "days_from_dod" => "Days from Date of Discharge", + "terrorism" => "Terrorism Cover", + "widower_cover" => "Widower Cover", + "breavement_cover" => "Breavement Cover", + "suminsuredenhancement" => "Sum Insured Enhancement", + "special_condition_label" => "Special Condition Label", + "special_condition_input" => "Special Condition Input" + ]; + + // // 1. Family Floaters + // $floatersMap = [ + // 'self' => 'Self', + // 'spouse' => 'Spouse', + // 'childrens' => 'Childrens', + // 'parents' => 'Parents', + // 'parents-in-law' => 'Parents-in-law', + // 'either-parents-pil' => 'Either Parents/PIL', + // 'elders_count' => 'Elders' + // ]; + + // 1. Family Floaters + $floatersMap = [ + 'self' => 'Self', + 'spouse' => 'Spouse', + 'childrens' => 'Childrens', + 'parents' => 'Parents', + 'parents-in-law' => 'Parents-in-law', + 'either-parents-pil' => 'Either Parents/PIL', + 'elders_count' => 'Total Elders Count' + ]; + + if(isset($data['family_floaters'])){ + $floatersOutput = []; + foreach ($floatersMap as $key => $label) { + if (isset($data['family_floaters'][$key])) { + $val = $data['family_floaters'][$key]; + $floatersOutput[] = "$label : " . ($val > 0 ? $val : 'No'); + } + } + $data['family_floaters'] = implode(', ', $floatersOutput); + } + + // 2. Age Ratio + if (!empty($data['age_ratio'])) { + $ageOutput = []; + foreach ($data['age_ratio'] as $person => $age) { + if (isset($age['min']) && isset($age['max'])) { + // $ageOutput[] = ucfirst($person) . " - Min : {$age['min']}, Max : {$age['max']}"; + $ageOutput[] = "" . ucfirst($person) . " - Min : {$age['min']}, Max : {$age['max']}"; + } + } + $data['age_ratio'] = implode(', ', $ageOutput); + } + + // 3. Is Payable Employee + if (!empty($data['is_payable_employee'])) { + $payableOutput = []; + foreach ($data['is_payable_employee'] as $person => $status) { + // $payableOutput[] = ucfirst($person) . " : " . ($status ? 'Yes' : 'No'); + $payableOutput[] = "" . ucfirst($person) . " : " . ($status ? 'Yes' : 'No'); + } + $data['is_payable_employee'] = implode(', ', $payableOutput); + } + + // 4. Remove the Enrollment display key + if(isset($data['enrollment_display_key'])){ + unset($data['enrollment_display_key']); + } + + // 5. Merge the Sum Insured value if the multiple sum insured exists + if(isset($data['multiple_sum_insured'])){ + if($data['sumInsured2']){ + $data['sumInsured2'] = $data['sumInsured2'] . ", " . implode(", ", $data['multiple_sum_insured']); + }else{ + $data['sum_insured'] = $data['sum_insured'] . ", " . implode(", ", $data['multiple_sum_insured']); + } + unset($data['multiple_sum_insured']); + } + + // 6. Add the special condition to key value pair + + if(!empty($data['special_condition_label'])){ + foreach ($data['special_condition_label'] as $key => $value) { + if($value != "" && $value != null) { + $data[$value] = $data['special_condition_input'][$key]; + } + } + }//GMC + + if(!empty($data['gpa_special_condition_label'])){ + foreach ($data['gpa_special_condition_label'] as $key => $value) { + if($value != "" && $value != null) { + $data[$value] = $data['gpa_special_condition_input'][$key]; + } + } + }//GPA + + // 7. Remove the special condition keys + unset($data['special_condition_label']); + unset($data['special_condition_input']); + unset($data['gpa_special_condition_label']); + unset($data['gpa_special_condition_input']); + + if(isset($data['sumInsured2'])){ + $firstItem = ["Sum Insured" => $data['sumInsured2']]; + unset($data['sumInsured2']); + $data = $firstItem + $data; + } + + // 8. Change the key name to lable name + $result = []; + foreach ($data as $key => $value) { + + // $label = isset($LableKeys[$key]) ? $LableKeys[$key] : $key; + if (isset($LableKeys[$key])) { + $label = $LableKeys[$key]; + // echo "1"; + } else { + // Handle camelCase first, then snake_case + $label = preg_replace('/(? + + + + + +
+ $value){ ?> +
+
+ +
+
+ +
+ +
+ +
+
+ No Terms Found
- +
+ + + From 03e90088988732cbf2744486d7ad0595812f7455 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 14 Aug 2025 11:51:06 +0530 Subject: [PATCH 3/5] FIX_VIEW_TERS : RV --- app/Controllers/TicketController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index 95a4bbe2..4c344c28 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -95,6 +95,7 @@ class TicketController extends BaseController 4 => "Smart Service Desk", 5 => "Direct to TPA" ]; + $this->claimType = [ 1 => [ 1 => "Main Hospitalization", @@ -2383,7 +2384,7 @@ class TicketController extends BaseController // 5. Merge the Sum Insured value if the multiple sum insured exists if(isset($data['multiple_sum_insured'])){ - if($data['sumInsured2']){ + if(isset($data['sumInsured2'])){ $data['sumInsured2'] = $data['sumInsured2'] . ", " . implode(", ", $data['multiple_sum_insured']); }else{ $data['sum_insured'] = $data['sum_insured'] . ", " . implode(", ", $data['multiple_sum_insured']); From b3361766fea082772a913fcce107326834959235 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 14 Aug 2025 12:37:35 +0530 Subject: [PATCH 4/5] FIX_LEAD_VIEW_DEMO : RV --- app/Controllers/LeadsController.php | 177 +++++++++++++++------------- app/Views/view_rfq.php | 2 +- 2 files changed, 93 insertions(+), 86 deletions(-) diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index 4d7e2170..fc4a4e86 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -2080,95 +2080,102 @@ class LeadsController extends BaseController if (!$lead_data) { return ['status' => 'failed', 'message' => 'Lead data not found']; } - if ($lead_data['file_name']) { - // $file_name_with_path = WRITEPATH . "/uploads/lead_files/NonPrintableCharacters.xlsx"; - //check physical file - if (!file_exists($file_name_with_path)) { - //file not found update status and reason - $message = "Lead Physcial file not found"; - // echo $message; - $this->myLogger->logme('error', ($message . ' for file ' . $file_name_with_path)); - return ['status' => 'failed', 'message' => 'no physical file']; - } + try{ + if ($lead_data['file_name']) { + // $file_name_with_path = WRITEPATH . "/uploads/lead_files/NonPrintableCharacters.xlsx"; - $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path); - - //get members data - $members_sheet = $spreadsheet->getSheet(0); - $highestRowAndColumn = $members_sheet->getHighestRowAndColumn(); - // dd($highestRowAndColumn); - $uncleaned_members = $members_sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']); - $members = ExcelSanitizeHelper::sanitizeArrayData($uncleaned_members); - //get age band data - $age_band_sheet = $spreadsheet->getSheet(1); - $highestRowAndColumn = $age_band_sheet->getHighestRowAndColumn(); - $age_band_data = $age_band_sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']); - - - //check age or dob column - $members_heading = $members[0]; - $available_col = null; - $col_index = null; - - if (in_array('age', array_map('strtolower', $members_heading))) { - $available_col = 'age'; - $col_index = array_search('age', array_map('strtolower', $members_heading)); - } elseif (in_array('dob', array_map('strtolower', $members_heading))) { - $available_col = 'dob'; - $col_index = array_search('dob', array_map('strtolower', $members_heading)); - } - - if ($available_col == null) { - $message = 'No DOB or Age column '; - $this->myLogger->logme('error', ($message . $file_name_with_path)); - return ['status' => 'failed', 'message' => $message]; - } - - try { - $classifiers = $this->getDemographyData($members, $age_band_data, $members_heading, $available_col, $col_index); - } catch (Exception $e) { - return ['status' => 'fail', 'message' => $e->getMessage()]; - } - - //for this to view the demography in the RFQ and QCR page to using internal - if($returnType == "internal"){ - return ['data' => $classifiers]; - // print_rr($classifiers); die; - } - - - try { - $result = $this->generateClassifierSpreadsheet($classifiers, WRITEPATH . 'uploads/lead_files/'); - if ($result['success']) { - $this->myLogger->logme('error', "Spreadsheet generated successfully!"); - - echo "Location: " . $result['fullpath'] . "\n"; - echo "Filename: " . $result['filename'] . "\n"; - $filePaths = [ - ['file_path' => WRITEPATH . 'uploads/lead_files/' . $lead_data['file_name'], 'sheets' => [0, 1]], - ['file_path' => WRITEPATH . '/uploads/lead_files/' . $result['filename'], 'sheets' => []], - ]; - $outputPath = WRITEPATH . 'uploads/lead_files/' . $lead_data['file_name']; - $result_merge = ExcelMergeHelper::mergeExcelFiles($filePaths, $outputPath); - if ($result_merge) { - // Call the delete function after the file is successfully created - $deleteResponse = $this->deleteGeneratedFile($result['fullpath']); - - // Add delete message to response - $response['deleteMessage'] = $deleteResponse['message']; - return ['status' => 'success', 'message' => 'Member_Data Merged Suceesfully']; - } - } else { - echo "Error generating spreadsheet: " . $result['error']; + //check physical file + if (!file_exists($file_name_with_path)) { + //file not found update status and reason + $message = "Lead Physcial file not found"; + // echo $message; + $this->myLogger->logme('error', ($message . ' for file ' . $file_name_with_path)); + return ['status' => 'failed', 'message' => 'no physical file']; } - } catch (Exception $e) { - echo "Error: " . $e->getMessage(); - return ['status' => 'fail', 'message' => $e->getMessage()]; + + $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path); + + //get members data + $members_sheet = $spreadsheet->getSheet(0); + $highestRowAndColumn = $members_sheet->getHighestRowAndColumn(); + // dd($highestRowAndColumn); + $uncleaned_members = $members_sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']); + $members = ExcelSanitizeHelper::sanitizeArrayData($uncleaned_members); + //get age band data + $age_band_sheet = $spreadsheet->getSheet(1); + $highestRowAndColumn = $age_band_sheet->getHighestRowAndColumn(); + $age_band_data = $age_band_sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']); + + + //check age or dob column + $members_heading = $members[0]; + $available_col = null; + $col_index = null; + + if (in_array('age', array_map('strtolower', $members_heading))) { + $available_col = 'age'; + $col_index = array_search('age', array_map('strtolower', $members_heading)); + } elseif (in_array('dob', array_map('strtolower', $members_heading))) { + $available_col = 'dob'; + $col_index = array_search('dob', array_map('strtolower', $members_heading)); + } + + if ($available_col == null) { + $message = 'No DOB or Age column '; + $this->myLogger->logme('error', ($message . $file_name_with_path)); + return ['status' => 'failed', 'message' => $message]; + } + + try { + $classifiers = $this->getDemographyData($members, $age_band_data, $members_heading, $available_col, $col_index); + } catch (Exception $e) { + return ['status' => 'fail', 'message' => $e->getMessage()]; + } + + //for this to view the demography in the RFQ and QCR page to using internal + if($returnType == "internal"){ + return ['data' => $classifiers]; + // print_rr($classifiers); die; + } + + + try { + $result = $this->generateClassifierSpreadsheet($classifiers, WRITEPATH . 'uploads/lead_files/'); + if ($result['success']) { + $this->myLogger->logme('error', "Spreadsheet generated successfully!"); + + echo "Location: " . $result['fullpath'] . "\n"; + echo "Filename: " . $result['filename'] . "\n"; + $filePaths = [ + ['file_path' => WRITEPATH . 'uploads/lead_files/' . $lead_data['file_name'], 'sheets' => [0, 1]], + ['file_path' => WRITEPATH . '/uploads/lead_files/' . $result['filename'], 'sheets' => []], + ]; + $outputPath = WRITEPATH . 'uploads/lead_files/' . $lead_data['file_name']; + $result_merge = ExcelMergeHelper::mergeExcelFiles($filePaths, $outputPath); + if ($result_merge) { + // Call the delete function after the file is successfully created + $deleteResponse = $this->deleteGeneratedFile($result['fullpath']); + + // Add delete message to response + $response['deleteMessage'] = $deleteResponse['message']; + return ['status' => 'success', 'message' => 'Member_Data Merged Suceesfully']; + } + } else { + echo "Error generating spreadsheet: " . $result['error']; + } + } catch (Exception $e) { + echo "Error: " . $e->getMessage(); + return ['status' => 'fail', 'message' => $e->getMessage()]; + } + } else { + $this->myLogger->logme('error', (' no file found ' . $file_name_with_path)); + return ['status' => 'failed', 'message' => 'no file found']; } - } else { - $this->myLogger->logme('error', (' no file found ' . $file_name_with_path)); - return ['status' => 'failed', 'message' => 'no file found']; + + }catch(Exception $e){ + $this->myLogger->logme("error", "Exception: " . $e->getMessage() . " --- Line: " . $e->getLine() . " --- Trace: " . $e->getTraceAsString()); + return ['status' => 'fail', 'error' => "File not found / Wrong file"]; } } diff --git a/app/Views/view_rfq.php b/app/Views/view_rfq.php index f00350cb..58e0fc03 100644 --- a/app/Views/view_rfq.php +++ b/app/Views/view_rfq.php @@ -706,7 +706,7 @@ if(isset($demogrphy_html_data) && !empty($demogrphy_html_data)){ echo $demogrphy_html_data; }else{ - echo "

No Demography Data Found

"; + echo "

No Demography Data Found or Wrong File

"; } ?> From 1240eef35ced3da910ea7dd836427cf7cddedefb Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 14 Aug 2025 14:34:29 +0530 Subject: [PATCH 5/5] CHNAGE_DEMOGRAPHY : RV --- app/Views/view_rfq.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Views/view_rfq.php b/app/Views/view_rfq.php index 58e0fc03..9e906235 100644 --- a/app/Views/view_rfq.php +++ b/app/Views/view_rfq.php @@ -293,7 +293,7 @@ onclick="checkTheTableDataChanged(3)">Send Insurer Mail - +