diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php index d13676aa..19d57a7d 100755 --- a/app/Controllers/EmpDataServiceController.php +++ b/app/Controllers/EmpDataServiceController.php @@ -949,6 +949,9 @@ class EmpDataServiceController extends BaseController $export_data['event_type'] = 'correction'; $correctionData = $this->employeePolicyModel->getCorrectionEmployeesDataForExportExcel($export_data); + }else if($value == "missed_inception"){ + $export_data['event_type'] = 'missed_inception'; + $additionData = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($export_data); } } diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php index 035fbd37..9917796f 100755 --- a/app/Controllers/EmployeeServiceController.php +++ b/app/Controllers/EmployeeServiceController.php @@ -1035,6 +1035,14 @@ class EmployeeServiceController extends AdminController // kint::dump($family); $family = data_group_by_family($family)[ $emp_id ];// reason to call this again bring self to first index of the array } + $firstNonTemp = null; + + foreach ($family as $fam) { + if (!isset($fam['temp'])) { + $firstNonTemp = $fam; + break; + } + } // kint::dump($family);//die(); //check name dup within a family @@ -1070,7 +1078,7 @@ class EmployeeServiceController extends AdminController if(!count($self_details)) { array_push($result['error_summary'],14); // Self not found - $result['error_data'][ $family[0][0] ]['sno']['error'][] = "Self not found in Database"; + $result['error_data'][ $firstNonTemp[0] ]['sno']['error'][] = "Self not found in Database"; } } @@ -1078,7 +1086,7 @@ class EmployeeServiceController extends AdminController if($file['action'] == 'dependent_addition' || $file['action'] == 'addition' || $file['action'] == 'inception'|| $file['action'] == 'missed_inception' || $file['action'] == 'enrollment') { $res = check_dependent_conflict($family,$policy_terms,$file['action'],$is_lgbtq); - // dd($res); + // Kint::dump($res); if(!$res['status']) { foreach($res['error_data'] as $key => $value) @@ -1091,7 +1099,7 @@ class EmployeeServiceController extends AdminController //check dup with empid and name with db $res = name_and_empid_check_in_db($family,$file); - // dd($res); + // Kint::dump($res['del']); // echo '
'; // print_r($res); if(count($res['del'])) @@ -1113,7 +1121,7 @@ class EmployeeServiceController extends AdminController }// end of foreach }// end of if current action I,DA,A - // return $result; + // return $result; // die(); if(isset($result['error_summary']) && count($result['error_summary'])) { diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index bcc0bc47..7a50cf81 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -103,8 +103,9 @@ class LeadsController extends BaseController $this->issuer = [1 => 'JIBS', 2 => 'Nhance']; $this->clientType = [1 => 'Group', 2 => 'Individual']; $this->leadType = [1 => 'Fresh', 2 => 'Renewal', 3 => 'Roll Over']; - $this->buisnessType = [1 => 'Industrial', 2 => 'Non Industrial']; - + $data = $this->kycEntityTypeModel->where('is_active', 1)->findAll(); + $this->buisnessType = array_column($data, 'name', 'id'); + // $this->buisnessType = [1 => 'Public Sector', 2 => 'Private Sector',3=> 'Trust',4 => 'Proprietorship',5 => 'Partnership',6 => 'Private',7 => 'Individual']; $this->leadsStatus = [ 'queued' => 'In-Queued', 'rfq_created' => 'RFQ Created', @@ -739,11 +740,14 @@ class LeadsController extends BaseController $data["child_table_data"] = json_decode($data['question_json'], true)['child_table_data']; } + $data['product'] = $this->leadsModel->select("policy_type.policy_type")->join('policy_type', 'leads.policy_type_id = policy_type.id')->where('leads.id', $id)->first()['policy_type']; // $data['lead_register_data'] = json_decode($data['lead_data']['custom_fields']); // dd($data['lead_register_data']); + // $data['entity_type'] = $this->kycEntityTypeModel->where('is_active', 1)->findAll(); + $data['buisness_type'] = $this->buisnessType; + // dd($data); $data['client_type'] = $this->clientType; - $data['buisness_type'] = $this->buisnessType; $this->loadLayout('view_rfq_non_eb', $data); } } @@ -2148,6 +2152,7 @@ class LeadsController extends BaseController ->where('leads.id', $lead_id) ->first(); + // log_message('error', 'Lead Data' . json_encode($lead_data)); // print_r($lead_data ); die; $cc_mails = []; @@ -2308,9 +2313,9 @@ class LeadsController extends BaseController foreach ($recipient_data as $recipient) { $message = $original_message; - $message = str_replace("{{RECIPIENT_NAME}}", $recipient['name'], $message); - $message = str_replace("{{CLIENT_NAME}}", $lead_data['client_name'], $message); - $message = str_replace("{{POLICY_LONG_NAME}}", $lead_data['long_name'], $message); + $message = str_replace("{{RECIPIENT_NAME}}", $recipient['name'] != "" ? $recipient['name'] :" ", $message); + $message = str_replace("{{CLIENT_NAME}}", $lead_data['client_name'] != "" ? $lead_data['client_name'] : "", $message); + $message = str_replace("{{POLICY_LONG_NAME}}",$lead_data['long_name'] != ""? $lead_data['long_name'] : "", $message); $message = str_replace("{{POLICY_START_DATE}}", change_date_format($lead_data['policy_start_date'], 'Y-m-d', 'd-m-Y'), $message); $message = str_replace("{{DURATION}}", calculate_days_bw_dates($lead_data['policy_end_date'] ?? "", $lead_data['policy_start_date'] ?? "")->days, $message) ?? '--'; @@ -2917,7 +2922,7 @@ class LeadsController extends BaseController $value = $cellData['display_content'] ?? ''; // Skip unwanted keys - if (in_array($parentth, ['SNO', 'Particulars', 'Action']) || $subth === 'Quote Asked') { + if (in_array($parentth, ['SNO', 'Particulars', 'Action']) || $subth === 'Sum Insured' || $subth === 'Fidelity Limit') { continue; } @@ -3158,7 +3163,6 @@ class LeadsController extends BaseController $data['lead_edit_data']['claims_details_html'] = ""; } } - // dd($data); return $this->loadLayout('leads_form_handler', $data); @@ -3191,6 +3195,7 @@ class LeadsController extends BaseController 3 => 'rfq/gmc', 4 => 'rfq/gmc', 5 => 'rfq/gmc', + 17=> 'rfq/burglary', 22 => 'rfq/car', 23 => 'rfq/cpm', 24 => 'rfq/cyber_crime', @@ -3330,11 +3335,11 @@ class LeadsController extends BaseController $sheet->getColumnDimension('B')->setWidth($maxWidthA * 1.2); $sheet->getColumnDimension('C')->setWidth($maxWidthB * 1.2); - $rowNumber += 2; + $rowNumber += 1; //Policy Registration if (!empty($policy_registration_data)) { foreach ($policy_registration_data as $key => $value) { - + // kint::dump($value); $startRow = $rowNumber; // Track where the block starts // Title Row @@ -3421,6 +3426,24 @@ class LeadsController extends BaseController $rowNumber++; } + if (isset($value['policyDetails']) && !empty($value['policyDetails'])) { + // Type of Business + $sheet->mergeCells("A{$rowNumber}:B{$rowNumber}"); + $sheet->setCellValue("A{$rowNumber}", "Terrorism"); + $sheet->setCellValue("C{$rowNumber}", ucfirst($value['policyDetails']['terrorism'] ?? 'No')); + + $sheet->getStyle("A{$rowNumber}")->applyFromArray([ + 'font' => ['bold' => true], + 'alignment' => [ + 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER, + 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER, + ], + ]); + + $rowNumber++; + + } + $endRow = $rowNumber - 1; // Block ends at previous row // Apply border to the whole block @@ -3433,8 +3456,9 @@ class LeadsController extends BaseController ], ]); - $rowNumber += 2; // Add space before the next block + $rowNumber += 1; // Add space before the next block } + // die(); } //Table Data @@ -3538,6 +3562,18 @@ class LeadsController extends BaseController } } + // For the subheader row, merge B and C and set the value + $sheet->setCellValue("B{$subHeaderRow}", "Sum Insured"); + $sheet->mergeCells("B{$subHeaderRow}:C{$subHeaderRow}"); + $sheet->getStyle("B{$subHeaderRow}:C{$subHeaderRow}")->applyFromArray([ + 'font' => ['bold' => true], + 'alignment' => [ + 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER, + 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER, + ], + ]); + + // Apply border to the header range $prevColumn4 = $this->getPreviousColumn($columnLetter); $headerRange = "A{$rowNumber}:" . "{$prevColumn4}" . "{$subHeaderRow}"; @@ -3554,7 +3590,9 @@ class LeadsController extends BaseController $sheet->getRowDimension($rowNumber)->setRowHeight(25); // Header row height $sheet->getRowDimension($subHeaderRow)->setRowHeight(20); // Subheader row height - $rowNumber = $subHeaderRow + 2; + // $rowNumber = $subHeaderRow + 2; + $rowNumber = $subHeaderRow + 1; + $column_data = $data['table_data']['data']; // dd($column_data); $serial_no = 1; @@ -3842,7 +3880,7 @@ class LeadsController extends BaseController $row['data'] = array_filter( $row['data'], function ($item) { - return in_array($item['subth'], ['Quote asked', '-']); + return in_array($item['subth'], ['Sum Insured', '-',"Liability Limit"]); } ); @@ -3931,7 +3969,7 @@ class LeadsController extends BaseController if ($subHeader === $insurer) { $headerData[] = [ 'parentHeader' => $header['parentHeader'], - 'subHeaders' => ['Quote asked', $subHeader] + 'subHeaders' => ['Sum Insured', $subHeader] ]; break 2; // Exit both loops after match is found } @@ -3964,8 +4002,8 @@ class LeadsController extends BaseController $filteredData[] = $item; } - // Include Proposal with Quote Asked - if ($item['parentth'] === $proposal && $item['subth'] === "Quote asked") { + // Include Proposal with Sum Insured + if ($item['parentth'] === $proposal && ($item['subth'] === "Sum Insured" || $item['subth'] === "Liability Limit")) { $filteredData[] = $item; } diff --git a/app/Helpers/excel_util_helper.php b/app/Helpers/excel_util_helper.php index c13ab491..d2e30828 100755 --- a/app/Helpers/excel_util_helper.php +++ b/app/Helpers/excel_util_helper.php @@ -440,8 +440,20 @@ if (!function_exists('name_dup_check_within_family')) foreach ($family_data as $rkey => $row) { if(in_array($row[2],$temp)) - { - array_push($result,$row[0]); + { + // Kint::dump($row); + $emp_code = $row[1]; + $tempFam = null; + foreach ($family_data as $family) { + if ($family[1] == $emp_code &&!isset($family['temp'])) { + $tempFam = $family; + break; // Stop at the first match + } + } + // Kint::dump($tempFam); + // die(); + + array_push($result,$tempFam[0]); } else { @@ -449,7 +461,7 @@ if (!function_exists('name_dup_check_within_family')) } } - + // dd($result); return $result; } } @@ -519,7 +531,15 @@ if (!function_exists('name_and_empid_check_in_db')) } if(($current_action == 'inception' || $current_action == 'dependent_addition' || $current_action == 'addition' || $current_action == 'enrollment') && count($res)) { - array_push($result['i'],$row[0]); + $emp_code = $row[1]; + $tempFam = null; + foreach ($family_data as $family) { + if ($family[1] == $emp_code &&!isset($family['temp'])) { + $tempFam = $family; + break; // Stop at the first match + } + } + array_push($result['i'],$tempFam[0]); } } diff --git a/app/Views/leads_form.php b/app/Views/leads_form.php index fc2ee0f0..265d1f32 100644 --- a/app/Views/leads_form.php +++ b/app/Views/leads_form.php @@ -884,7 +884,7 @@ " . $value['policy_type'] . ""; } } diff --git a/app/Views/leads_non_eb.php b/app/Views/leads_non_eb.php index fef3f394..0dc0d785 100644 --- a/app/Views/leads_non_eb.php +++ b/app/Views/leads_non_eb.php @@ -256,19 +256,19 @@ hr.solid { -
+
diff --git a/app/Views/policyRegisterModel.php b/app/Views/policyRegisterModel.php index 4e2419d9..f9b1ee91 100644 --- a/app/Views/policyRegisterModel.php +++ b/app/Views/policyRegisterModel.php @@ -1,9 +1,9 @@ -