diff --git a/app/Config/Routes.php b/app/Config/Routes.php index e94c6ad4..1f6d0bf9 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -308,7 +308,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) { $routes->get("send_mail_for_individual_employee_ecard/(:any)", "EmployeeController::send_mail_for_individual_employee_ecard/$1"); $routes->post("update_emp_data", "EmployeeController::update_emp_data"); $routes->get("checkDeletionGetDataFunction", "EmployeeController::checkDeletionGetDataFunction"); - + $routes->get("download_import_excel/(:any)", "EmployeeController::downloadSampleImportExcelFile/$1"); }); $routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) { diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index b937e835..e90f1e1b 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -120,7 +120,29 @@ class ClientController extends AdminController public function smapletest() { - $headers = ['S.No','EMP ID','EMP NAME','DOB','GENDER','RELATIONSHIP','SUM INSURED','Date of Leaving','Policy End Date','No Of Days','Premium','Pro Rata Premium','GST','Total','Claim Status','ENDORSEMENT_ID']; + $headers = [ + 'S.No', + 'NAME OF EMP/DEP', + 'EMP ID', + // 'EMP/DEP TYPE', + // 'RELATIONSHIP CODE', + 'DOB', + 'GENDER', + 'PRE EXISTING AILMENTS', + 'BASIC COVER SI', + 'DATE OF COVERAGE', + 'AGE', + 'RELATIONSHIP', + 'REMARKS', + 'POLICY END DATE', + 'NO OF DAYS', + 'TPA ID', + 'UHID', + // 'PREMIUM', + 'PRO RATA PREMIUM', + 'GST', + 'TOTAL AMOUNT' + ]; $filePath = generateExcelWithHeader($headers); echo "Excel file created at: $filePath"; } diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php index ff8e0413..8bd4e545 100755 --- a/app/Controllers/EmpDataServiceController.php +++ b/app/Controllers/EmpDataServiceController.php @@ -225,93 +225,93 @@ class EmpDataServiceController extends BaseController 'column_name' => 'EMP ID', 'db_column_name' => 'emp_code' ], + // [ + // 'column_index' => 3, + // 'column_name' => 'EMP/DEP TYPE', + // 'db_column_name' => 'emp_type' + // ], + // [ + // 'column_index' => 4, + // 'column_name' => 'RELATIONSHIP CODE', + // 'db_column_name' => 'emp_relationship_code' + // ], [ 'column_index' => 3, - 'column_name' => 'EMP/DEP TYPE', - 'db_column_name' => 'emp_type' - ], - [ - 'column_index' => 4, - 'column_name' => 'RELATIONSHIP CODE', - 'db_column_name' => 'emp_relationship_code' - ], - [ - 'column_index' => 5, 'column_name' => 'DOB', 'db_column_name' => 'emp_dob' ], [ - 'column_index' => 6, + 'column_index' => 4, 'column_name' => 'GENDER', 'db_column_name' => 'emp_gender' ], [ - 'column_index' => 7, + 'column_index' => 5, 'column_name' => 'PRE EXISTING AILMENTS', 'db_column_name' => 'pre_existing_alignments' ], [ - 'column_index' => 8, + 'column_index' => 6, 'column_name' => 'BASIC COVER SI', 'db_column_name' => 'basic_cover_si' ], [ - 'column_index' => 9, + 'column_index' => 7, 'column_name' => 'DATE OF COVERAGE', 'db_column_name' => 'date_coverage' ], [ - 'column_index' => 10, + 'column_index' => 8, 'column_name' => 'AGE', 'db_column_name' => 'emp_age' ], [ - 'column_index' => 11, + 'column_index' => 9, 'column_name' => 'RELATIONSHIP', 'db_column_name' => 'emp_relationship' ], [ - 'column_index' => 12, + 'column_index' => 10, 'column_name' => 'REMARKS', 'db_column_name' => 'remarks' ], [ - 'column_index' => 13, + 'column_index' => 11, 'column_name' => 'POLICY END DATE', 'db_column_name' => 'policy_end_date' ], [ - 'column_index' => 14, + 'column_index' => 12, 'column_name' => 'NO OF DAYS', 'db_column_name' => 'days' ], [ - 'column_index' => 15, + 'column_index' => 13, 'column_name' => 'TPA ID', 'db_column_name' => 'tpa_id' ], [ - 'column_index' => 16, + 'column_index' => 14, 'column_name' => 'UHID', 'db_column_name' => 'uhid' ], + // [ + // 'column_index' => 15, + // 'column_name' => 'PREMIUM', + // 'db_column_name' => 'premium' + // ], [ - 'column_index' => 17, - 'column_name' => 'PREMIUM', - 'db_column_name' => 'premium' - ], - [ - 'column_index' => 18, + 'column_index' => 15, 'column_name' => 'PRO RATA PREMIUM', 'db_column_name' => 'rata_premimum' ], [ - 'column_index' => 19, + 'column_index' => 16, 'column_name' => 'GST', 'db_column_name' => 'gst' ], [ - 'column_index' => 20, + 'column_index' => 17, 'column_name' => 'TOTAL AMOUNT', 'db_column_name' => 'total' ] @@ -335,93 +335,93 @@ class EmpDataServiceController extends BaseController 'column_name' => 'EMP ID', 'db_column_name' => 'emp_code' ], + // [ + // 'column_index' => 3, + // 'column_name' => 'EMP/DEP TYPE', + // 'db_column_name' => 'emp_type' + // ], + // [ + // 'column_index' => 4, + // 'column_name' => 'RELATIONSHIP CODE', + // 'db_column_name' => 'emp_relationship_code' + // ], [ 'column_index' => 3, - 'column_name' => 'EMP/DEP TYPE', - 'db_column_name' => 'emp_type' - ], - [ - 'column_index' => 4, - 'column_name' => 'RELATIONSHIP CODE', - 'db_column_name' => 'emp_relationship_code' - ], - [ - 'column_index' => 5, 'column_name' => 'DOB', 'db_column_name' => 'emp_dob' ], [ - 'column_index' => 6, + 'column_index' => 4, 'column_name' => 'GENDER', 'db_column_name' => 'emp_gender' ], [ - 'column_index' => 7, + 'column_index' => 5, 'column_name' => 'PRE EXISTING AILMENTS', 'db_column_name' => 'pre_existing_alignments' ], [ - 'column_index' => 8, + 'column_index' => 6, 'column_name' => 'BASIC COVER SI', 'db_column_name' => 'basic_cover_si' ], [ - 'column_index' => 9, + 'column_index' => 7, 'column_name' => 'DATE OF COVERAGE', 'db_column_name' => 'date_coverage' ], [ - 'column_index' => 10, + 'column_index' => 8, 'column_name' => 'AGE', 'db_column_name' => 'emp_age' ], [ - 'column_index' => 11, + 'column_index' => 9, 'column_name' => 'RELATIONSHIP', 'db_column_name' => 'emp_relationship' ], [ - 'column_index' => 12, + 'column_index' => 10, 'column_name' => 'REMARKS', 'db_column_name' => 'remarks' ], [ - 'column_index' => 13, + 'column_index' => 11, 'column_name' => 'POLICY END DATE', 'db_column_name' => 'policy_end_date' ], [ - 'column_index' => 14, + 'column_index' => 12, 'column_name' => 'NO OF DAYS', 'db_column_name' => 'no_of_days' ], [ - 'column_index' => 15, + 'column_index' => 13, 'column_name' => 'TPA ID', 'db_column_name' => 'tpa_id' ], [ - 'column_index' => 16, + 'column_index' => 14, 'column_name' => 'UHID', 'db_column_name' => 'uhid' ], + // [ + // 'column_index' => 17, + // 'column_name' => 'PREMIUM', + // 'db_column_name' => 'premium' + // ], [ - 'column_index' => 17, - 'column_name' => 'PREMIUM', - 'db_column_name' => 'premium' - ], - [ - 'column_index' => 18, + 'column_index' => 15, 'column_name' => 'PRO RATA PREMIUM', 'db_column_name' => 'pro_rata_premium' ], [ - 'column_index' => 19, + 'column_index' => 16, 'column_name' => 'GST', 'db_column_name' => 'gst' ], [ - 'column_index' => 20, + 'column_index' => 17, 'column_name' => 'TOTAL AMOUNT', 'db_column_name' => 'total' ] @@ -1283,7 +1283,29 @@ class EmpDataServiceController extends BaseController unset($excel_data[0]); // array_pop($excel_data); - $inceptionHeader = ['S.No', 'NAME OF EMP/DEP','EMP ID','EMP/DEP TYPE','RELATIONSHIP CODE','DOB','GENDER','PRE EXISTING AILMENTS','BASIC COVER SI','DATE OF COVERAGE','AGE','RELATIONSHIP','REMARKS','POLICY END DATE','NO OF DAYS','TPA ID','UHID','PREMIUM','PRO RATA PREMIUM','GST','TOTAL AMOUNT']; + $inceptionHeader = [ + 'S.No', + 'NAME OF EMP/DEP', + 'EMP ID', + // 'EMP/DEP TYPE', + // 'RELATIONSHIP CODE', + 'DOB', + 'GENDER', + 'PRE EXISTING AILMENTS', + 'BASIC COVER SI', + 'DATE OF COVERAGE', + 'AGE', + 'RELATIONSHIP', + 'REMARKS', + 'POLICY END DATE', + 'NO OF DAYS', + 'TPA ID', + 'UHID', + // 'PREMIUM', + 'PRO RATA PREMIUM', + 'GST', + 'TOTAL AMOUNT' + ]; foreach ($inceptionHeader as $key => $value) { if($excel_header[$key] != $value){ @@ -1427,14 +1449,14 @@ class EmpDataServiceController extends BaseController } if ($insurer_or_tpa == 'tpa') { - if ($excel_data[$key][15] === null) { + if ($excel_data[$key][13] === null) { $missing_id[$key][] = [ 'row' => $key, 'column' => 15, ]; } } else if ($insurer_or_tpa == 'insurer') { - if ($excel_data[$key][16] === null) { + if ($excel_data[$key][14] === null) { $missing_id[$key][] = [ 'row' => $key, 'column' => 16, @@ -1461,115 +1483,115 @@ class EmpDataServiceController extends BaseController ]; } - if ($emp_value['emp_dob'] != $excel_data[$key][5]) { + if ($emp_value['emp_dob'] != $excel_data[$key][3]) { + $errors[$key][] = [ + 'row' => $key, + 'column' => 3, + 'db_data' => $emp_value['emp_dob'], + 'excel_data' => $excel_data[$key][3] + ]; + } + + if ($emp_value['emp_gender'] != $excel_data[$key][4]) { + $errors[$key][] = [ + 'row' => $key, + 'column' => 4, + 'db_data' => $emp_value['emp_gender'], + 'excel_data' => $excel_data[$key][4] + ]; + } + + if ($emp_value['pre_existing_alignments'] != $excel_data[$key][5]) { $errors[$key][] = [ 'row' => $key, 'column' => 5, - 'db_data' => $emp_value['emp_dob'], + 'db_data' => $emp_value['pre_existing_alignments'], 'excel_data' => $excel_data[$key][5] ]; } - if ($emp_value['emp_gender'] != $excel_data[$key][6]) { + if ($emp_value['basic_cover_si'] != $excel_data[$key][6]) { $errors[$key][] = [ 'row' => $key, 'column' => 6, - 'db_data' => $emp_value['emp_gender'], + 'db_data' => $emp_value['basic_cover_si'], 'excel_data' => $excel_data[$key][6] ]; } - if ($emp_value['pre_existing_alignments'] != $excel_data[$key][7]) { + if ($emp_value['emp_relationship'] != $excel_data[$key][9]) { $errors[$key][] = [ 'row' => $key, - 'column' => 7, - 'db_data' => $emp_value['pre_existing_alignments'], - 'excel_data' => $excel_data[$key][7] + 'column' => 9, + 'db_data' => $emp_value['emp_relationship'], + 'excel_data' => $excel_data[$key][9] ]; } - if ($emp_value['basic_cover_si'] != $excel_data[$key][8]) { - $errors[$key][] = [ - 'row' => $key, - 'column' => 8, - 'db_data' => $emp_value['basic_cover_si'], - 'excel_data' => $excel_data[$key][8] - ]; - } - - if ($emp_value['emp_relationship'] != $excel_data[$key][11]) { + if ($emp_value['policy_end_date'] != $excel_data[$key][11]) { $errors[$key][] = [ 'row' => $key, 'column' => 11, - 'db_data' => $emp_value['emp_relationship'], + 'db_data' => $emp_value['policy_end_date'], 'excel_data' => $excel_data[$key][11] ]; } - if ($emp_value['policy_end_date'] != $excel_data[$key][13]) { + if ($emp_value['no_of_days'] != $excel_data[$key][12]) { $errors[$key][] = [ 'row' => $key, - 'column' => 13, - 'db_data' => $emp_value['policy_end_date'], - 'excel_data' => $excel_data[$key][13] - ]; - } - - if ($emp_value['no_of_days'] != $excel_data[$key][14]) { - $errors[$key][] = [ - 'row' => $key, - 'column' => 14, + 'column' => 12, 'db_data' => $emp_value['no_of_days'], - 'excel_data' => $excel_data[$key][14] + 'excel_data' => $excel_data[$key][12] ]; } - if ($emp_value['premium'] != $excel_data[$key][17]) { - $errors[$key][] = [ - 'row' => $key, - 'column' => 17, - 'db_data' => $emp_value['premium'], - 'excel_data' => $excel_data[$key][17] - ]; - } + // if ($emp_value['premium'] != $excel_data[$key][17]) { + // $errors[$key][] = [ + // 'row' => $key, + // 'column' => 17, + // 'db_data' => $emp_value['premium'], + // 'excel_data' => $excel_data[$key][17] + // ]; + // } - if ($emp_value['pro_rata_premium'] != $excel_data[$key][18]) { + if ($emp_value['pro_rata_premium'] != $excel_data[$key][15]) { $errors[$key][] = [ 'row' => $key, - 'column' => 18, + 'column' => 15, 'db_data' => $emp_value['pro_rata_premium'], - 'excel_data' => $excel_data[$key][18] + 'excel_data' => $excel_data[$key][15] ]; } - if ($emp_value['gst'] != $excel_data[$key][19]) { + if ($emp_value['gst'] != $excel_data[$key][16]) { $errors[$key][] = [ 'row' => $key, - 'column' => 19, + 'column' => 16, 'db_data' => $emp_value['gst'], - 'excel_data' => $excel_data[$key][19] + 'excel_data' => $excel_data[$key][16] ]; } if ($insurer_or_tpa == 'tpa') { - if ($emp_value['uhid'] != $excel_data[$key][16]) { + if ($emp_value['uhid'] != $excel_data[$key][14]) { $errors[$key][] = [ 'row' => $key, - 'column' => 16, + 'column' => 14, 'db_data' => $emp_value['uhid'], - 'excel_data' => $excel_data[$key][16] + 'excel_data' => $excel_data[$key][14] ]; } } else if ($insurer_or_tpa == 'insurer') { - if ($emp_value['tpa_id'] != $excel_data[$key][15]) { + if ($emp_value['tpa_id'] != $excel_data[$key][13]) { $errors[$key][] = [ 'row' => $key, - 'column' => 15, + 'column' => 13, 'db_data' => $emp_value['tpa_id'], - 'excel_data' => $excel_data[$key][15] + 'excel_data' => $excel_data[$key][13] ]; } } @@ -1735,9 +1757,9 @@ class EmpDataServiceController extends BaseController $name = $value[1]; $emp_code = $value[2]; - $tpa_id[] = $value[15]; - $uhid[] = $value[16]; - $amount = $value[20]; + $tpa_id[] = $value[13]; + $uhid[] = $value[14]; + $amount = $value[17]; if(!empty($name) && !empty($emp_code)){ @@ -1767,7 +1789,7 @@ class EmpDataServiceController extends BaseController $result = $query->get()->getRowArray(); if (isset($result['id']) && $result['id'] !== null) { $emp_policy_ids[] = $result['id']; //for cash deposite - $emp_details[] = array('id' => $result['id'], 'tpa_id' => $value[15], 'uhid' => $value[16]); + $emp_details[] = array('id' => $result['id'], 'tpa_id' => $value[13], 'uhid' => $value[14]); } } diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index 841671a5..dfb76e4e 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -1128,7 +1128,7 @@ class EmployeeController extends AdminController '{SELF_NAME}' => $value['self'] ?? $value['name'], '{POLICY_DATE}' => date('d-M-Y', strtotime($value['policy_end_date'])), '{POLICY_START_DATE}' => date('d-M-Y', strtotime($value['policy_start_date'])), - '{POLICY_NO}' => date('d-M-Y', strtotime($value['policy_start_date'])), + '{POLICY_NO}' => $value['policy_no'], '{INSURER_NAME}' => strtoupper($value['insurer_name']), '{INSURER_LOGO}' => base_url() . 'public/uploads/logo/' . $value['insurer_logo'], '{FRONT_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['front_card'], @@ -1786,4 +1786,40 @@ class EmployeeController extends AdminController } + // ---------------------------------------------------------------------------------------------------------- + + public function downloadSampleImportExcelFile($actionType = null) + { + // $actionType = $this->request->getGet(); + $filePath = ''; + // Path to your file + if ($actionType == 'inception') { + $filePath = ROOTPATH . 'public/sample_import_excel/sample_import_Inception.xlsx'; + } else if ($actionType == 'correction') { + $filePath = ROOTPATH . 'public/sample_import_excel/sample_import_correction.xlsx'; + } else if ($actionType == 'si_enhancement') { + $filePath = ROOTPATH . 'public/sample_import_excel/sample_import_SI_Enhancement.xlsx'; + } else if ($actionType == 'dependent_addition') { + $filePath = ROOTPATH . 'public/sample_import_excel/sample_import_Dependent_Addition.xlsx'; + } else if ($actionType == 'addition') { + $filePath = ROOTPATH . 'public/sample_import_excel/sample_import_Addition.xlsx'; + } else if ($actionType == 'deletion') { + $filePath = ROOTPATH . 'public/sample_import_excel/sample_import_Deletion.xlsx'; + }else if ($actionType == 'missed_inception') { + $filePath = ROOTPATH . 'public/sample_import_excel/sample_import_Inception.xlsx'; + } + + // Check if the file exists + if (file_exists($filePath)) { + + // Set the appropriate MIME type + $mimeType = mime_content_type($filePath); + + // Send the file to the client for download + return $this->response->download($filePath, null, $mimeType); + } else { + // File not found, show an error message or redirect + echo view('errors/html/production'); + } + } } diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index 13305f50..e3123418 100755 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -1671,7 +1671,7 @@ class MasterController extends AdminController 'logo' => ROOTPATH . 'public/uploads/logo/', 'template_bg' => ROOTPATH . 'public/uploads/template_bg/', 'attachments' => WRITEPATH . 'uploads/attachments/', - + 'sample_import_excel' => ROOTPATH . 'public/sample_import_excel', ]; foreach ($folders as $folderName => $folderPath) { diff --git a/app/Models/ClientModel.php b/app/Models/ClientModel.php index 3b40a3fb..2151ec97 100755 --- a/app/Models/ClientModel.php +++ b/app/Models/ClientModel.php @@ -55,14 +55,14 @@ class ClientModel extends Model ->where('is_active',1) ->findAll(); - if($role_id == 2 || $role_id == 3){ + // if($role_id == 2 || $role_id == 3){ - $clients = $this->select($columns) - ->join('client_rm', 'client_rm.client_id = clients.id') - ->where('client_rm.user_id', $user_id) - ->where('clients.is_active',1) - ->findAll(); - } + // $clients = $this->select($columns) + // ->join('client_rm', 'client_rm.client_id = clients.id') + // ->where('client_rm.user_id', $user_id) + // ->where('clients.is_active',1) + // ->findAll(); + // } diff --git a/app/Views/insurer_or_tpa_data.php b/app/Views/insurer_or_tpa_data.php index 5c77af6c..2dc6c83b 100755 --- a/app/Views/insurer_or_tpa_data.php +++ b/app/Views/insurer_or_tpa_data.php @@ -95,7 +95,7 @@
- +  [ ]
@@ -627,4 +627,32 @@ }) + //------------------------------------------------------------------------------------------------------ + + + $('#import_excel_download').click(function() { + + // Check if the element with ID "import_excel_download" has the href attribute set + if (!$(this).attr('href')) { + // If href attribute is not set, show an error message + toastr.warning('Please select an Action to download a sample Excel.', 'Warning'); + } else { + // console.log('Download action triggered.'); + } + }); + + /**This function updates the download link based on the selected option in the dropdown menu. **/ + $('#event_type').change(function() { + + var selectedValue = $(this).val(); + if (selectedValue !== '') { + $('#import_excel_download').show(); + var fullURL = '' + selectedValue; + $('#import_excel_download').attr('href', fullURL); + } else { + $('#import_excel_download').hide(); + $('#import_excel_download').removeAttr('href'); + } + }); + \ No newline at end of file diff --git a/public/sample_import_excel/sample_import_Addition.xlsx b/public/sample_import_excel/sample_import_Addition.xlsx new file mode 100644 index 00000000..19b1f86f Binary files /dev/null and b/public/sample_import_excel/sample_import_Addition.xlsx differ diff --git a/public/sample_import_excel/sample_import_Deletion.xlsx b/public/sample_import_excel/sample_import_Deletion.xlsx new file mode 100644 index 00000000..d37c2955 Binary files /dev/null and b/public/sample_import_excel/sample_import_Deletion.xlsx differ diff --git a/public/sample_import_excel/sample_import_Dependent_Addition.xlsx b/public/sample_import_excel/sample_import_Dependent_Addition.xlsx new file mode 100644 index 00000000..19b1f86f Binary files /dev/null and b/public/sample_import_excel/sample_import_Dependent_Addition.xlsx differ diff --git a/public/sample_import_excel/sample_import_Inception.xlsx b/public/sample_import_excel/sample_import_Inception.xlsx new file mode 100644 index 00000000..19b1f86f Binary files /dev/null and b/public/sample_import_excel/sample_import_Inception.xlsx differ diff --git a/public/sample_import_excel/sample_import_SI_Enhancement.xlsx b/public/sample_import_excel/sample_import_SI_Enhancement.xlsx new file mode 100644 index 00000000..14925d00 Binary files /dev/null and b/public/sample_import_excel/sample_import_SI_Enhancement.xlsx differ diff --git a/public/sample_import_excel/sample_import_correction.xlsx b/public/sample_import_excel/sample_import_correction.xlsx new file mode 100644 index 00000000..d1535f28 Binary files /dev/null and b/public/sample_import_excel/sample_import_correction.xlsx differ