MERGE_UAT_BDSLIVEISSUES
This commit is contained in:
commit
1ae95806b9
@ -18,6 +18,7 @@ $routes->get("update-policy-terms-for-corrections", "ClientController::updatePol
|
|||||||
$routes->get("update_rack_rate_json", "ClientController::updateRackRateJson");
|
$routes->get("update_rack_rate_json", "ClientController::updateRackRateJson");
|
||||||
$routes->get("updatajson", "EmpDataServiceController::updatajson");
|
$routes->get("updatajson", "EmpDataServiceController::updatajson");
|
||||||
$routes->get("view", "EmployeeController::viewECard/$1");
|
$routes->get("view", "EmployeeController::viewECard/$1");
|
||||||
|
// $routes->get("exportQCRandRFQ", "LeadsController::exportQCRandRFQ");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -299,6 +300,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->get("send_manual_reminder/(:any)", "DashboardController::sendManualReminder/$1");
|
$routes->get("send_manual_reminder/(:any)", "DashboardController::sendManualReminder/$1");
|
||||||
$routes->get("get_client_policy_list_for_remainder/(:any)", "EmployeeController::get_client_policy_list_for_remainder/$1");
|
$routes->get("get_client_policy_list_for_remainder/(:any)", "EmployeeController::get_client_policy_list_for_remainder/$1");
|
||||||
$routes->get("get_client_branch_data/(:any)", "ClientController::get_client_branch_data/$1");
|
$routes->get("get_client_branch_data/(:any)", "ClientController::get_client_branch_data/$1");
|
||||||
|
$routes->get("getLevelContects", "LeadsController::getLevelContects");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -343,8 +345,17 @@ $routes->group("leads", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->get("list", "LeadsController::viewLeadsList");
|
$routes->get("list", "LeadsController::viewLeadsList");
|
||||||
$routes->post("create", "LeadsController::createLead");
|
$routes->post("create", "LeadsController::createLead");
|
||||||
$routes->get("list/(:any)", "LeadsController::getLeadDataForEdit/$1");
|
$routes->get("list/(:any)", "LeadsController::getLeadDataForEdit/$1");
|
||||||
|
$routes->get("sendMail", "LeadsController::sendMailWithAttachement");
|
||||||
|
$routes->get("exportQCRandRFQ/(:any)", "LeadsController::exportQCRandRFQ/$1");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$routes->group("rfq", ["filter" => "authMVC"], function ($routes) {
|
||||||
|
$routes->post("create", "LeadsController::createRFQ");
|
||||||
|
$routes->post("createQCR", "LeadsController::createQCR");
|
||||||
|
$routes->get("list/(:any)", "LeadsController::viewRFQ/$1");
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
$routes->get("driveListFiles", "GoogleDriveController::listFiles");
|
$routes->get("driveListFiles", "GoogleDriveController::listFiles");
|
||||||
$routes->post('dmsSearch', 'PolicyTransactionController::dmsSearch', ['filter' => 'authMVC']);
|
$routes->post('dmsSearch', 'PolicyTransactionController::dmsSearch', ['filter' => 'authMVC']);
|
||||||
$routes->get('dmsSearch', 'PolicyTransactionController::dmsSearch', ['filter' => 'authMVC']);
|
$routes->get('dmsSearch', 'PolicyTransactionController::dmsSearch', ['filter' => 'authMVC']);
|
||||||
@ -355,7 +366,8 @@ $routes->cli('cli/processjobs', 'JobWorker::processJobs');
|
|||||||
|
|
||||||
$routes->get("processjob", "JobWorker::processJob");
|
$routes->get("processjob", "JobWorker::processJob");
|
||||||
$routes->cli('cli/new_gmail_token', 'MasterController::generateNewGmailAPIToken');
|
$routes->cli('cli/new_gmail_token', 'MasterController::generateNewGmailAPIToken');
|
||||||
$routes->cli('cli/send_mail_cli(/:any)?', 'MasterController::testGmailAPIViaCLI$1');
|
$routes->cli('cli/send_mail_cli', 'MasterController::testGmailAPIViaCLI');
|
||||||
|
$routes->cli('cli/check_bounce_mail_cli', 'MasterController::testCheckBounceMails');
|
||||||
$routes->cli('cli/app_check_list', 'MasterController::appCheckList');
|
$routes->cli('cli/app_check_list', 'MasterController::appCheckList');
|
||||||
$routes->cli('cli/new_gdrive_token', 'GoogleDriveController::generateNewGoogleDriveAccessToken');
|
$routes->cli('cli/new_gdrive_token', 'GoogleDriveController::generateNewGoogleDriveAccessToken');
|
||||||
|
|
||||||
@ -379,6 +391,8 @@ $routes->group("/api", ["filter" => "authJWT"], function ($routes) {
|
|||||||
|
|
||||||
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||||
|
|
||||||
|
$routes->post("getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
|
||||||
|
|
||||||
$routes->post("storeFireBase", "EmployeeRestController::storeFireBase");
|
$routes->post("storeFireBase", "EmployeeRestController::storeFireBase");
|
||||||
$routes->post("saveMpin", "RestAuthenticationController::saveMpin");
|
$routes->post("saveMpin", "RestAuthenticationController::saveMpin");
|
||||||
$routes->post("updateMpin", "RestAuthenticationController::updateMpin");
|
$routes->post("updateMpin", "RestAuthenticationController::updateMpin");
|
||||||
|
|||||||
@ -2105,6 +2105,7 @@ class ClientController extends AdminController
|
|||||||
$data['airambulance'] = str_replace(',', '', $this->request->getPost("airambulance"));
|
$data['airambulance'] = str_replace(',', '', $this->request->getPost("airambulance"));
|
||||||
$data['familytransportationbenefit'] = str_replace(',', '', $this->request->getPost("familytransportationbenefit"));
|
$data['familytransportationbenefit'] = str_replace(',', '', $this->request->getPost("familytransportationbenefit"));
|
||||||
$data['reasonableandcustomarycharges'] = str_replace(',', '', $this->request->getPost("reasonableandcustomarycharges"));
|
$data['reasonableandcustomarycharges'] = str_replace(',', '', $this->request->getPost("reasonableandcustomarycharges"));
|
||||||
|
$data['daycaretreatment'] = str_replace(',', '', $this->request->getPost("daycaretreatment"));
|
||||||
$data['ayudhtreatmentcover'] = str_replace(',', '', $this->request->getPost("ayudhtreatmentcover"));
|
$data['ayudhtreatmentcover'] = str_replace(',', '', $this->request->getPost("ayudhtreatmentcover"));
|
||||||
|
|
||||||
$data['congenitaldiseasesexternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesexternal"));
|
$data['congenitaldiseasesexternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesexternal"));
|
||||||
|
|||||||
@ -313,22 +313,6 @@ class EmpDataServiceController extends BaseController
|
|||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
// get excel export format structure array
|
|
||||||
$template_json = $this->clientPolicyModel
|
|
||||||
->select('insurer_excel_export_template.jsoncolumns')
|
|
||||||
->join('insurer_excel_export_template', 'insurer_excel_export_template.insurer_id = client_policy.insurer_id and insurer_excel_export_template.policy_type_id = client_policy.policy_type_id')
|
|
||||||
->where('client_policy.id', $export_data['client_policy_id'])
|
|
||||||
->where('insurer_excel_export_template.event_name', $export_data['event_type'])
|
|
||||||
->where('insurer_excel_export_template.is_active', 1) //Live issue changes 17-10-2024
|
|
||||||
->where('insurer_excel_export_template.type_name', $export_data['actions'])
|
|
||||||
->first();
|
|
||||||
|
|
||||||
if(!empty($template_json) && $template_json != null){
|
|
||||||
$excel_header_columns = json_decode($template_json['jsoncolumns'], true);
|
|
||||||
}else{
|
|
||||||
return 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( $export_data['insurer_or_tpa'] == 'tpa'){
|
if( $export_data['insurer_or_tpa'] == 'tpa'){
|
||||||
|
|
||||||
$excel_header_columns = [
|
$excel_header_columns = [
|
||||||
@ -380,7 +364,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
[
|
[
|
||||||
'column_index' => 9,
|
'column_index' => 9,
|
||||||
'column_name' => 'DATE OF COVERAGE',
|
'column_name' => 'DATE OF COVERAGE',
|
||||||
'db_column_name' => 'date_of_coverage'
|
'db_column_name' => 'date_coverage'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'column_index' => 10,
|
'column_index' => 10,
|
||||||
@ -438,6 +422,22 @@ class EmpDataServiceController extends BaseController
|
|||||||
'db_column_name' => 'total'
|
'db_column_name' => 'total'
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
}else{
|
||||||
|
// get excel export format structure array
|
||||||
|
$template_json = $this->clientPolicyModel
|
||||||
|
->select('insurer_excel_export_template.jsoncolumns')
|
||||||
|
->join('insurer_excel_export_template', 'insurer_excel_export_template.insurer_id = client_policy.insurer_id and insurer_excel_export_template.policy_type_id = client_policy.policy_type_id')
|
||||||
|
->where('client_policy.id', $export_data['client_policy_id'])
|
||||||
|
->where('insurer_excel_export_template.event_name', $export_data['event_type'])
|
||||||
|
->where('insurer_excel_export_template.is_active', 1) //Live issue changes 17-10-2024
|
||||||
|
->where('insurer_excel_export_template.type_name', $export_data['actions'])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if(!empty($template_json) && $template_json != null){
|
||||||
|
$excel_header_columns = json_decode($template_json['jsoncolumns'], true);
|
||||||
|
}else{
|
||||||
|
return 6;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$excel_data_info = generate_insurer_based_excel($excel_header_columns, $objects);
|
$excel_data_info = generate_insurer_based_excel($excel_header_columns, $objects);
|
||||||
@ -1253,20 +1253,26 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
$insurer_or_tpa = $file['insurer_or_tpa'];
|
$insurer_or_tpa = $file['insurer_or_tpa'];
|
||||||
if ($insurer_or_tpa == 'tpa') {
|
if ($insurer_or_tpa == 'tpa') {
|
||||||
|
|
||||||
$id = 'tpa_id';
|
$id = 'tpa_id';
|
||||||
} else if ($insurer_or_tpa == 'insurer') {
|
} else if ($insurer_or_tpa == 'insurer') {
|
||||||
|
|
||||||
$id = 'uhid';
|
$id = 'uhid';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$ref_data = [
|
||||||
|
'client_id' => $client_id,
|
||||||
|
'client_policy_id' => $client_policy_id,
|
||||||
|
'client_branch_id' => $client_branch_id,
|
||||||
|
'insurer_or_tpa' => $insurer_or_tpa,
|
||||||
|
'event_type' => $file['event_type'],
|
||||||
|
];
|
||||||
|
|
||||||
$file_name_with_path = WRITEPATH . "/uploads/import_excel/" . $file['file_name'];
|
$file_name_with_path = WRITEPATH . "/uploads/import_excel/" . $file['file_name'];
|
||||||
$excel_data = $this->readExcelFileToArray($file_name_with_path);
|
$excel_data = $this->readExcelFileToArray($file_name_with_path);
|
||||||
$excel_header = $excel_data[0];
|
$excel_header = $excel_data[0];
|
||||||
unset($excel_data[0]);
|
unset($excel_data[0]);
|
||||||
array_pop($excel_data);
|
// 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','PR0 RATA PREMIUM','GST','TOTAL'];
|
$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','PR0 RATA PREMIUM','GST','TOTAL AMOUNT'];
|
||||||
|
|
||||||
foreach ($inceptionHeader as $key => $value) {
|
foreach ($inceptionHeader as $key => $value) {
|
||||||
if($excel_header[$key] != $value){
|
if($excel_header[$key] != $value){
|
||||||
@ -1280,49 +1286,50 @@ class EmpDataServiceController extends BaseController
|
|||||||
$this->setPullNotification($file_data);
|
$this->setPullNotification($file_data);
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'Inception File Validation -- Upload the worng excel file');
|
$this->myLogger->logme('error', 'Inception File Validation -- Upload the worng excel file');
|
||||||
return ['status' => 'error', 'message' => 'Upload the worng excel file'];
|
return ['status' => 'error', 'message' => 'Upload the worng excel file', 'excel_header' => $excel_header, 'inception_header' => $inceptionHeader];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$emp_count = count($excel_data);
|
$emp_count = count($excel_data);
|
||||||
|
|
||||||
$employee_data = $this->employeePolicyModel
|
$employee_data = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($ref_data, 1);
|
||||||
->select('
|
|
||||||
|
|
||||||
employee_polices.id as emp_policy_id,
|
// ->select('
|
||||||
employees.name AS emp_name,
|
|
||||||
employees.emp_code AS emp_code,
|
|
||||||
"Has Define" as emp_type,
|
|
||||||
employees.relationship_code AS emp_relationship_code,
|
|
||||||
employees.dob AS emp_dob,
|
|
||||||
employees.gender AS emp_gender,
|
|
||||||
employee_polices.pre_existing_alignments,
|
|
||||||
employee_polices.basic_cover_si,
|
|
||||||
employee_polices.date_coverage,
|
|
||||||
TIMESTAMPDIFF(YEAR, employees.dob, CURDATE()) AS emp_age,
|
|
||||||
employees.relationship AS emp_relationship,
|
|
||||||
employees.change_event AS change_event,
|
|
||||||
employee_polices.policy_end_date,
|
|
||||||
employee_polices.days,
|
|
||||||
employee_polices.tpa_id,
|
|
||||||
employee_polices.uhid,
|
|
||||||
employee_polices.premium,
|
|
||||||
employee_polices.rata_premimum,
|
|
||||||
employee_polices.gst,
|
|
||||||
(employee_polices.rata_premimum + employee_polices.gst) AS total
|
|
||||||
')
|
|
||||||
|
|
||||||
->join('employees', 'employees.id = employee_polices.employee_id')
|
// employee_polices.id as emp_policy_id,
|
||||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
// employees.name AS emp_name,
|
||||||
->where('employees.client_id', $client_id)
|
// employees.emp_code AS emp_code,
|
||||||
->where('employees.client_branch_id', $client_branch_id)
|
// "Has Define" as emp_type,
|
||||||
->where("employee_polices.{$id} IS NULL OR employee_polices.{$id} = ''")
|
// employees.relationship_code AS emp_relationship_code,
|
||||||
->where('employee_polices.is_active', 1)
|
// employees.dob AS emp_dob,
|
||||||
->where('employee_polices.status', 'active')
|
// employees.gender AS emp_gender,
|
||||||
->where('employees.is_active', 1)
|
// employee_polices.pre_existing_alignments,
|
||||||
->where('employees.emp_status', 'active')
|
// employee_polices.basic_cover_si,
|
||||||
->findAll();
|
// employee_polices.date_coverage,
|
||||||
|
// TIMESTAMPDIFF(YEAR, employees.dob, CURDATE()) AS emp_age,
|
||||||
|
// employees.relationship AS emp_relationship,
|
||||||
|
// employees.change_event AS change_event,
|
||||||
|
// employee_polices.policy_end_date,
|
||||||
|
// employee_polices.days,
|
||||||
|
// employee_polices.tpa_id,
|
||||||
|
// employee_polices.uhid,
|
||||||
|
// employee_polices.premium,
|
||||||
|
// employee_polices.rata_premimum,
|
||||||
|
// employee_polices.gst,
|
||||||
|
// (employee_polices.rata_premimum + employee_polices.gst) AS total
|
||||||
|
// ')
|
||||||
|
|
||||||
|
// ->join('employees', 'employees.id = employee_polices.employee_id')
|
||||||
|
// ->where('employee_polices.client_policy_id', $client_policy_id)
|
||||||
|
// ->where('employees.client_id', $client_id)
|
||||||
|
// ->where('employees.client_branch_id', $client_branch_id)
|
||||||
|
// ->where("employee_polices.{$id} IS NULL OR employee_polices.{$id} = ''")
|
||||||
|
// ->where('employee_polices.is_active', 1)
|
||||||
|
// ->where('employee_polices.status', 'active')
|
||||||
|
// ->where('employees.is_active', 1)
|
||||||
|
// ->where('employees.emp_status', 'active')
|
||||||
|
// ->findAll();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1372,15 +1379,14 @@ class EmpDataServiceController extends BaseController
|
|||||||
$difference = $emp_data_count - $excel_data_count;
|
$difference = $emp_data_count - $excel_data_count;
|
||||||
|
|
||||||
$status = 'in-progress';
|
$status = 'in-progress';
|
||||||
if ($excel_data_count < $emp_data_count) {
|
|
||||||
|
|
||||||
|
if ($excel_data_count < $emp_data_count) {
|
||||||
$status = 'in-progress-partially';
|
$status = 'in-progress-partially';
|
||||||
$partially_updated_data = 'Expected : ' . $emp_data_count . ', ' . 'Updated : ' . $excel_data_count . ', ' . 'difference : ' . $difference;
|
$partially_updated_data = 'Expected : ' . $emp_data_count . ', ' . 'Updated : ' . $excel_data_count . ', ' . 'difference : ' . $difference;
|
||||||
$this->myLogger->logme('error', 'Inception File Validation -- excel file count partially : {data}', ['data' => $partially_updated_data]);
|
$this->myLogger->logme('error', 'Inception File Validation -- excel file count partially : {data}', ['data' => $partially_updated_data]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($emp_data_count < $excel_data_count) {
|
if ($emp_data_count < $excel_data_count) {
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
@ -1498,11 +1504,11 @@ class EmpDataServiceController extends BaseController
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($emp_value['days'] != $excel_data[$key][14]) {
|
if ($emp_value['no_of_days'] != $excel_data[$key][14]) {
|
||||||
$errors[$key][] = [
|
$errors[$key][] = [
|
||||||
'row' => $key,
|
'row' => $key,
|
||||||
'column' => 14,
|
'column' => 14,
|
||||||
'db_data' => $emp_value['days'],
|
'db_data' => $emp_value['no_of_days'],
|
||||||
'excel_data' => $excel_data[$key][14]
|
'excel_data' => $excel_data[$key][14]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -1516,11 +1522,11 @@ class EmpDataServiceController extends BaseController
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($emp_value['rata_premimum'] != $excel_data[$key][18]) {
|
if ($emp_value['pro_rata_premium'] != $excel_data[$key][18]) {
|
||||||
$errors[$key][] = [
|
$errors[$key][] = [
|
||||||
'row' => $key,
|
'row' => $key,
|
||||||
'column' => 18,
|
'column' => 18,
|
||||||
'db_data' => $emp_value['rata_premimum'],
|
'db_data' => $emp_value['pro_rata_premium'],
|
||||||
'excel_data' => $excel_data[$key][18]
|
'excel_data' => $excel_data[$key][18]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -1557,7 +1563,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$batch_list_id[] = $emp_value['emp_policy_id'];
|
$batch_list_id[] = $emp_value['primaryKey'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -279,7 +279,7 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
$data['fileList'] = $this->fileModel
|
$data['fileList'] = $this->fileModel
|
||||||
->select([
|
->select([
|
||||||
'files.*',
|
'files.id','files.file_name','files.created_by','files.created_at','files.is_active','files.status','files.client_id','files.policy_id','files.client_branch_id','files.action','files.uploaded_by',
|
||||||
'up.emp_code',
|
'up.emp_code',
|
||||||
'up.first_name',
|
'up.first_name',
|
||||||
'c.short_name',
|
'c.short_name',
|
||||||
@ -301,9 +301,10 @@ class EmployeeController extends AdminController
|
|||||||
->join('client_branch cb', 'files.client_branch_id = cb.id', 'left')
|
->join('client_branch cb', 'files.client_branch_id = cb.id', 'left')
|
||||||
->join('policy_type', 'policy_type.id = cp.policy_type_id')
|
->join('policy_type', 'policy_type.id = cp.policy_type_id')
|
||||||
->join('clients c', 'files.client_id = c.id and files.client_id = cp.client_id', 'left')
|
->join('clients c', 'files.client_id = c.id and files.client_id = cp.client_id', 'left')
|
||||||
->where('files.created_by', get_session_userid())
|
// ->where('files.created_by', get_session_userid())
|
||||||
->orderBy('files.created_at', 'desc')
|
->orderBy('files.created_at', 'desc')
|
||||||
->findAll();
|
->limit(100)
|
||||||
|
->find();
|
||||||
// dd($data['fileList']);
|
// dd($data['fileList']);
|
||||||
|
|
||||||
$data['batch_list'] = $this->batchFileModel->select(
|
$data['batch_list'] = $this->batchFileModel->select(
|
||||||
@ -318,7 +319,8 @@ class EmployeeController extends AdminController
|
|||||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||||
->join('clients', 'clients.id = client_policy.client_id')
|
->join('clients', 'clients.id = client_policy.client_id')
|
||||||
->orderBy('batch_files.id', 'desc')
|
->orderBy('batch_files.id', 'desc')
|
||||||
->findAll();
|
->limit(100)
|
||||||
|
->find();
|
||||||
|
|
||||||
|
|
||||||
// dd($data['fileList']);die();
|
// dd($data['fileList']);die();
|
||||||
@ -825,7 +827,7 @@ class EmployeeController extends AdminController
|
|||||||
$res = $empServiceController->employeesOnboardPreprocess(['client_policy_id' => $client_policy_id,'client_branch_id' => $client_data['client_branch_id']]);
|
$res = $empServiceController->employeesOnboardPreprocess(['client_policy_id' => $client_policy_id,'client_branch_id' => $client_data['client_branch_id']]);
|
||||||
// dd($res);
|
// dd($res);
|
||||||
|
|
||||||
$count = count($res);
|
$count = ($res);
|
||||||
$message = $count . ' Employees are Initiate Onboard Process againts Client ' . $client_data['client_name'] . ' and the Policy is ' . $client_data['policy_name'];
|
$message = $count . ' Employees are Initiate Onboard Process againts Client ' . $client_data['client_name'] . ' and the Policy is ' . $client_data['policy_name'];
|
||||||
session()->setFlashdata('success1', $message);
|
session()->setFlashdata('success1', $message);
|
||||||
return redirect()->to(base_url('/employee/upload'));
|
return redirect()->to(base_url('/employee/upload'));
|
||||||
@ -1123,6 +1125,7 @@ class EmployeeController extends AdminController
|
|||||||
'{FRONT_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['front_card'],
|
'{FRONT_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['front_card'],
|
||||||
'{BACK_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['back_card'],
|
'{BACK_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['back_card'],
|
||||||
'{EMP_ID}' => $value['emp_code'],
|
'{EMP_ID}' => $value['emp_code'],
|
||||||
|
'{SI_AMT}' => $value['basic_cover_si'],
|
||||||
'{CORPORATE_NAME}' => $value['client_name'],
|
'{CORPORATE_NAME}' => $value['client_name'],
|
||||||
'{AGE}' => $value['emp_age'],
|
'{AGE}' => $value['emp_age'],
|
||||||
'{TPA_NAME}' => $value['tpa_name'],
|
'{TPA_NAME}' => $value['tpa_name'],
|
||||||
@ -1304,10 +1307,9 @@ class EmployeeController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Preview E-Card Template function
|
||||||
public function previewTemplate($id = null)
|
public function previewTemplate($id = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
$value = [
|
$value = [
|
||||||
'tpa_id' => 'TPA12345',
|
'tpa_id' => 'TPA12345',
|
||||||
'name' => 'John Doe',
|
'name' => 'John Doe',
|
||||||
@ -1324,10 +1326,10 @@ class EmployeeController extends AdminController
|
|||||||
'emp_age' => 39,
|
'emp_age' => 39,
|
||||||
'tpa_name' => 'Example TPA',
|
'tpa_name' => 'Example TPA',
|
||||||
'insurer_branch_city' => 'New York',
|
'insurer_branch_city' => 'New York',
|
||||||
'relationship' => 'Self'
|
'relationship' => 'Self',
|
||||||
|
'basic_cover_si' => '5,00,000',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
$tpa_id = $this->TPAModel->where('id', $id)->first();
|
$tpa_id = $this->TPAModel->where('id', $id)->first();
|
||||||
|
|
||||||
$template_data_path = WRITEPATH . 'e_card_template/';
|
$template_data_path = WRITEPATH . 'e_card_template/';
|
||||||
@ -1354,6 +1356,7 @@ class EmployeeController extends AdminController
|
|||||||
'{POLICY_NO}' => $value['policy_no'],
|
'{POLICY_NO}' => $value['policy_no'],
|
||||||
'{INSURER_NAME}' => strtoupper($value['insurer_name']),
|
'{INSURER_NAME}' => strtoupper($value['insurer_name']),
|
||||||
'{EMP_ID}' => $value['emp_code'],
|
'{EMP_ID}' => $value['emp_code'],
|
||||||
|
'{SI_AMT}' => $value['basic_cover_si'],
|
||||||
'{CORPORATE_NAME}' => $value['client_name'],
|
'{CORPORATE_NAME}' => $value['client_name'],
|
||||||
'{AGE}' => $value['emp_age'],
|
'{AGE}' => $value['emp_age'],
|
||||||
'{TPA_NAME}' => $value['tpa_name'],
|
'{TPA_NAME}' => $value['tpa_name'],
|
||||||
@ -1399,6 +1402,8 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
$error_data = json_decode($file['error_data']);
|
$error_data = json_decode($file['error_data']);
|
||||||
|
|
||||||
|
// dd($error_data);
|
||||||
|
|
||||||
$file_name_with_path = WRITEPATH . "/uploads/import_excel/" . $file['file_name'];
|
$file_name_with_path = WRITEPATH . "/uploads/import_excel/" . $file['file_name'];
|
||||||
|
|
||||||
if (!file_exists($file_name_with_path)) {
|
if (!file_exists($file_name_with_path)) {
|
||||||
|
|||||||
@ -309,6 +309,7 @@ class EmployeeRestController extends AdminController
|
|||||||
$data['client_policy_id']= $client_policy_id;
|
$data['client_policy_id']= $client_policy_id;
|
||||||
$data['basic_cover_si']= $basic_cover_si;
|
$data['basic_cover_si']= $basic_cover_si;
|
||||||
$data['status']= 'draft';
|
$data['status']= 'draft';
|
||||||
|
$data['date_coverage'] = $this->getEmployeeCoverageDate($emp_code, $client_policy_id);
|
||||||
|
|
||||||
$this->employeePolicyModel->insert($data);
|
$this->employeePolicyModel->insert($data);
|
||||||
|
|
||||||
@ -320,10 +321,7 @@ class EmployeeRestController extends AdminController
|
|||||||
public function updatePremiumAmount($client_policy_id , $emp_code , $client_branch_id)
|
public function updatePremiumAmount($client_policy_id , $emp_code , $client_branch_id)
|
||||||
{
|
{
|
||||||
$response = $this->calculatePremium($client_policy_id , $emp_code , null , $client_branch_id);
|
$response = $this->calculatePremium($client_policy_id , $emp_code , null , $client_branch_id);
|
||||||
// echo '<pre>';
|
|
||||||
// print_r($response);
|
|
||||||
// echo '</pre>';
|
|
||||||
// die();
|
|
||||||
if(count($response[$emp_code]))
|
if(count($response[$emp_code]))
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -354,6 +352,45 @@ class EmployeeRestController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getEmployeeCoverageDate($emp_code, $client_policy_id)
|
||||||
|
{
|
||||||
|
$empData = $this->employeeModel->where('emp_code',$emp_code)->where('relationship', 'self')->where('is_active',1)->first();;
|
||||||
|
if($empData)
|
||||||
|
{
|
||||||
|
$empPolicyData = $this->employeePolicyModel->select('employee_polices.employee_id,employee_polices.client_policy_id,employee_polices.date_coverage,client_policy.policy_type_id,client_policy.base_policy')
|
||||||
|
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id', 'left')
|
||||||
|
->where('employee_polices.employee_id' , $empData['id'] )
|
||||||
|
->where('employee_polices.is_active' , 1 )
|
||||||
|
->findAll();
|
||||||
|
if(count($empPolicyData))
|
||||||
|
{
|
||||||
|
// find same policy 'self' date of coverage
|
||||||
|
$filterSelfPolicy = array_filter($empPolicyData, function($row) use ($client_policy_id) {
|
||||||
|
return $row['client_policy_id'] == $client_policy_id;
|
||||||
|
});
|
||||||
|
$filterSelfPolicy = array_values($filterSelfPolicy); // Reset the index of the filtered result
|
||||||
|
|
||||||
|
if(count($filterSelfPolicy)){
|
||||||
|
return $filterSelfPolicy[0]['date_coverage'];
|
||||||
|
}else{
|
||||||
|
// find base policy 'self' date of coverage
|
||||||
|
$basePolicy = $this->clientPolicyModel->where('id',$client_policy_id)->get()->getRow()->base_policy;
|
||||||
|
|
||||||
|
$filterSelfBasePolicy = array_filter($empPolicyData, function($row) use ($basePolicy) {
|
||||||
|
return $row['client_policy_id'] == $basePolicy;
|
||||||
|
});
|
||||||
|
$filterSelfBasePolicy = array_values($filterSelfBasePolicy); // Reset the index of the filtered result
|
||||||
|
|
||||||
|
if(count($filterSelfBasePolicy)){
|
||||||
|
return $filterSelfBasePolicy[0]['date_coverage'];
|
||||||
|
}else{ return null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{ return null; }
|
||||||
|
|
||||||
|
}else{ return null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function RelationshipMap($value){
|
public function RelationshipMap($value){
|
||||||
|
|
||||||
@ -432,7 +469,6 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the RelationShip list
|
|
||||||
public function createOrUpdateEmployeePolicySiAmount()
|
public function createOrUpdateEmployeePolicySiAmount()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -632,11 +668,6 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Upload the Employee Detail in DB by Sheet Data
|
// Upload the Employee Detail in DB by Sheet Data
|
||||||
public function employeeUpload()
|
public function employeeUpload()
|
||||||
{
|
{
|
||||||
@ -672,7 +703,7 @@ class EmployeeRestController extends AdminController
|
|||||||
$file_name_with_path = WRITEPATH."/uploads/excel/".$filename;
|
$file_name_with_path = WRITEPATH."/uploads/excel/".$filename;
|
||||||
|
|
||||||
//make an entry in DB
|
//make an entry in DB
|
||||||
$file_id = $this->fileModel->insert(['file_name' => $filename, 'client_id' => $client_id, 'policy_id' => $policy_id, 'created_by' => $employee_id, 'status' => 'draft', 'action' => 'enrollment', 'client_branch_id' => $client_branch_id]); //here field policy_id have client_policy_id and not policy id from policy master
|
$file_id = $this->fileModel->insert(['file_name' => $filename, 'client_id' => $client_id, 'policy_id' => $policy_id, 'created_by' => $employee_id, 'status' => 'inprogress', 'action' => 'enrollment', 'client_branch_id' => $client_branch_id]); //here field policy_id have client_policy_id and not policy id from policy master
|
||||||
$this->myLogger->logme("error", '{file_id} - client uploaded success', ['file_id' => $file_id]);
|
$this->myLogger->logme("error", '{file_id} - client uploaded success', ['file_id' => $file_id]);
|
||||||
|
|
||||||
$empServiceController = new EmployeeServiceController();
|
$empServiceController = new EmployeeServiceController();
|
||||||
@ -803,7 +834,8 @@ class EmployeeRestController extends AdminController
|
|||||||
'band'=> $extra['10'][$index],
|
'band'=> $extra['10'][$index],
|
||||||
'basic_pay'=> $extra['11'][$index],
|
'basic_pay'=> $extra['11'][$index],
|
||||||
'unit'=> isset($extra['12'][$index]) ? $extra['12'][$index] : null,
|
'unit'=> isset($extra['12'][$index]) ? $extra['12'][$index] : null,
|
||||||
'client_branch_id' => $client_branch_id
|
'client_branch_id' => $client_branch_id,
|
||||||
|
'date_coverage' => $extra['13'][$index]
|
||||||
|
|
||||||
];
|
];
|
||||||
$basic_cover_si_value = null;
|
$basic_cover_si_value = null;
|
||||||
@ -840,6 +872,8 @@ class EmployeeRestController extends AdminController
|
|||||||
$count = 0;
|
$count = 0;
|
||||||
for ($a=0; $a <count($dataToInsert) ; $a++)
|
for ($a=0; $a <count($dataToInsert) ; $a++)
|
||||||
{
|
{
|
||||||
|
$date_coverage = $dataToInsert[$a]['date_coverage'];
|
||||||
|
unset($dataToInsert[$a]['date_coverage']);
|
||||||
$employee = $this->employeeModel->checkExistingEmployee($dataToInsert[$a],$client_branch_id);
|
$employee = $this->employeeModel->checkExistingEmployee($dataToInsert[$a],$client_branch_id);
|
||||||
$emp_id =0;
|
$emp_id =0;
|
||||||
|
|
||||||
@ -891,6 +925,7 @@ class EmployeeRestController extends AdminController
|
|||||||
'employee_id'=>$emp_id,
|
'employee_id'=>$emp_id,
|
||||||
'client_policy_id'=>$policy_id,
|
'client_policy_id'=>$policy_id,
|
||||||
'status'=> 'draft',
|
'status'=> 'draft',
|
||||||
|
'date_coverage' => $date_coverage,
|
||||||
'basic_cover_si'=>isset($basic_cover_si[$a]) ? $basic_cover_si[$a] : null
|
'basic_cover_si'=>isset($basic_cover_si[$a]) ? $basic_cover_si[$a] : null
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -932,6 +967,7 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$this->fileModel->where('id', $file_id)->set(['status' => 'success','reason' => '','error_data' => ''])->update();
|
||||||
return $this->respond(['status' => 'success', 'code' => 200, 'message' => "Success" ], 200);
|
return $this->respond(['status' => 'success', 'code' => 200, 'message' => "Success" ], 200);
|
||||||
}else{
|
}else{
|
||||||
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Client id and Client Policy id is Not Match!" ], 404);
|
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Client id and Client Policy id is Not Match!" ], 404);
|
||||||
@ -1856,6 +1892,7 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
public function iAgreeForAddOn()
|
public function iAgreeForAddOn()
|
||||||
{
|
{
|
||||||
|
|
||||||
$postData = json_decode($this->request->getBody(), true);
|
$postData = json_decode($this->request->getBody(), true);
|
||||||
$client_policy_id = $postData['client_policy_id'];
|
$client_policy_id = $postData['client_policy_id'];
|
||||||
sort($client_policy_id);
|
sort($client_policy_id);
|
||||||
@ -1875,6 +1912,9 @@ class EmployeeRestController extends AdminController
|
|||||||
{
|
{
|
||||||
$array_list = [];
|
$array_list = [];
|
||||||
foreach ($client_policy_id as $key => $value)
|
foreach ($client_policy_id as $key => $value)
|
||||||
|
{
|
||||||
|
$policy = $this->clientPolicyModel->where('id',$value)->where('open_for_enrollment',1)->find();
|
||||||
|
if($policy)
|
||||||
{
|
{
|
||||||
foreach ($empData as $empDataKey => $empDataValue)
|
foreach ($empData as $empDataKey => $empDataValue)
|
||||||
{
|
{
|
||||||
@ -1889,6 +1929,9 @@ class EmployeeRestController extends AdminController
|
|||||||
if(count($find) > 0){
|
if(count($find) > 0){
|
||||||
$array_list[] = $find;
|
$array_list[] = $find;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$notification = $this->notificationModel->where('client_id' ,$client_id)->where('template_name', 'member_review_and_summary_mail')->first();
|
$notification = $this->notificationModel->where('client_id' ,$client_id)->where('template_name', 'member_review_and_summary_mail')->first();
|
||||||
|
|||||||
@ -594,6 +594,15 @@ class EmployeeServiceController extends AdminController
|
|||||||
'data_type' => 'str',
|
'data_type' => 'str',
|
||||||
'format' => null,
|
'format' => null,
|
||||||
'allowed_values' => null
|
'allowed_values' => null
|
||||||
|
],
|
||||||
|
'doc' => [
|
||||||
|
'col_idx' => 13,
|
||||||
|
'col_cell_name' => 'N',
|
||||||
|
'col_name' => 'DOC',
|
||||||
|
'is_mandatory' => false,
|
||||||
|
'data_type' => 'str',
|
||||||
|
'format' => 'd-M-Y',
|
||||||
|
'allowed_values' => null
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -605,7 +614,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
4 => 4, // inception: gender (Gender) -> enrollment: gender (Gender)
|
4 => 4, // inception: gender (Gender) -> enrollment: gender (Gender)
|
||||||
5 => 5, // inception: relationship (RELATIONSHIP) -> enrollment: relationship (Relation)
|
5 => 5, // inception: relationship (RELATIONSHIP) -> enrollment: relationship (Relation)
|
||||||
6 => 9, // inception: basic_cover_si (BASIC COVER SI) -> enrollment: basic_cover_si (SI)
|
6 => 9, // inception: basic_cover_si (BASIC COVER SI) -> enrollment: basic_cover_si (SI)
|
||||||
7 => null, // inception: doc (Date of Coverage) -> No match in enrollment
|
7 => 13, // inception: doc (Date of Coverage)
|
||||||
8 => 3, // inception: doj (DOJ) -> enrollment: doj (DOJ)
|
8 => 3, // inception: doj (DOJ) -> enrollment: doj (DOJ)
|
||||||
9 => 11, // inception: basic_pay (Basic Pay) -> enrollment: basic_pay (Basic Pay)
|
9 => 11, // inception: basic_pay (Basic Pay) -> enrollment: basic_pay (Basic Pay)
|
||||||
10 => 10, // inception: band_grade (Band/Grade) -> enrollment: band_grade (Grade)
|
10 => 10, // inception: band_grade (Band/Grade) -> enrollment: band_grade (Grade)
|
||||||
@ -1088,7 +1097,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
}// end of foreach
|
}// end of foreach
|
||||||
}// end of if current action I,DA,A
|
}// end of if current action I,DA,A
|
||||||
|
|
||||||
// s($result);
|
// return $result;
|
||||||
// die();
|
// die();
|
||||||
if(isset($result['error_summary']) && count($result['error_summary']))
|
if(isset($result['error_summary']) && count($result['error_summary']))
|
||||||
{
|
{
|
||||||
@ -1249,7 +1258,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
//get policy slab rates
|
//get policy slab rates
|
||||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($client_policy_id,$client_id);
|
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($client_policy_id,$client_id);
|
||||||
|
|
||||||
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $client_policy_id,emp_status: ['enrolled','draft'],policy_status:['enrolled','draft']);
|
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $client_policy_id,emp_status: ['enrolled'],policy_status:['enrolled']);
|
||||||
|
|
||||||
// $file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception'];
|
// $file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception'];
|
||||||
$file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception','created_by' => get_session_userid(),'client_branch_id' => $params['client_branch_id']];
|
$file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception','created_by' => get_session_userid(),'client_branch_id' => $params['client_branch_id']];
|
||||||
@ -1613,6 +1622,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
$value['emp_status'] = 'active';
|
$value['emp_status'] = 'active';
|
||||||
$value['created_by'] = $file['created_by'];
|
$value['created_by'] = $file['created_by'];
|
||||||
$value['client_branch_id'] = $file['client_branch_id'];
|
$value['client_branch_id'] = $file['client_branch_id'];
|
||||||
|
$value['family_floater_key'] = generate_family_floater_key($value['relationship']);
|
||||||
$log_message = 'Insert Employee- '.$value['name'] .'('.$value['emp_code'] .') with PK ';
|
$log_message = 'Insert Employee- '.$value['name'] .'('.$value['emp_code'] .') with PK ';
|
||||||
// $this->myLogger->logme('error',('Insert - ' . $value['emp_code'] .' - '. $value['name']));
|
// $this->myLogger->logme('error',('Insert - ' . $value['emp_code'] .' - '. $value['name']));
|
||||||
// echo 'update emp';
|
// echo 'update emp';
|
||||||
@ -1983,7 +1993,7 @@ public function employeesEnrollmentInsert($params)
|
|||||||
$value['file_id'] = $file_id;
|
$value['file_id'] = $file_id;
|
||||||
|
|
||||||
$value['temp']['emp_id'] = null; // dummy value for using exisitng funciton in model
|
$value['temp']['emp_id'] = null; // dummy value for using exisitng funciton in model
|
||||||
if (strtolower(trim($value['relationship'])) === 'mother' || strtolower(trim($value['relationship'])) === 'Father') {
|
if (strtolower(trim($value['relationship'])) === 'mother' || strtolower(trim($value['relationship'])) === 'father') {
|
||||||
$relation = 'parent';
|
$relation = 'parent';
|
||||||
} else if(strtolower(trim($value['relationship'])) === 'son' || strtolower(trim($value['relationship'])) === 'daughter'){
|
} else if(strtolower(trim($value['relationship'])) === 'son' || strtolower(trim($value['relationship'])) === 'daughter'){
|
||||||
$relation = 'child';
|
$relation = 'child';
|
||||||
@ -1997,6 +2007,7 @@ public function employeesEnrollmentInsert($params)
|
|||||||
$value['family_floater_key'] = $relation;
|
$value['family_floater_key'] = $relation;
|
||||||
|
|
||||||
$policy_data['basic_cover_si'] = $row[9];
|
$policy_data['basic_cover_si'] = $row[9];
|
||||||
|
$policy_data['date_coverage'] = $row[13];
|
||||||
$policy_data['client_policy_id'] = $file['policy_id'];
|
$policy_data['client_policy_id'] = $file['policy_id'];
|
||||||
|
|
||||||
$employee = $this->employeeModel->checkExistingEmployee($value,$file['client_branch_id']);
|
$employee = $this->employeeModel->checkExistingEmployee($value,$file['client_branch_id']);
|
||||||
|
|||||||
@ -4,6 +4,9 @@ namespace App\Controllers;
|
|||||||
|
|
||||||
use CodeIgniter\API\ResponseTrait;
|
use CodeIgniter\API\ResponseTrait;
|
||||||
|
|
||||||
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
|
|
||||||
use App\Models\UserModel;
|
use App\Models\UserModel;
|
||||||
use App\Models\ClientModel;
|
use App\Models\ClientModel;
|
||||||
use App\Models\ClientBranchModel;
|
use App\Models\ClientBranchModel;
|
||||||
@ -15,6 +18,12 @@ use App\Models\KYCEntityTypeModel;
|
|||||||
use App\Models\PolicyTransactionStatusModel;
|
use App\Models\PolicyTransactionStatusModel;
|
||||||
use App\Models\InsurerBranchModel;
|
use App\Models\InsurerBranchModel;
|
||||||
use App\Models\TPABranchModel;
|
use App\Models\TPABranchModel;
|
||||||
|
use App\Models\RFQModel;
|
||||||
|
use App\Models\InsurerModel;
|
||||||
|
|
||||||
|
use App\Helpers\MailHelper;
|
||||||
|
use Kint;
|
||||||
|
|
||||||
|
|
||||||
class LeadsController extends BaseController
|
class LeadsController extends BaseController
|
||||||
{
|
{
|
||||||
@ -35,6 +44,8 @@ class LeadsController extends BaseController
|
|||||||
protected $policyTransactionStatusModel;
|
protected $policyTransactionStatusModel;
|
||||||
protected $insurerBranchModel;
|
protected $insurerBranchModel;
|
||||||
protected $tpaBranchModel;
|
protected $tpaBranchModel;
|
||||||
|
protected $RFQModel;
|
||||||
|
protected $insurerModel;
|
||||||
|
|
||||||
//variables for storing array
|
//variables for storing array
|
||||||
protected $issuer;
|
protected $issuer;
|
||||||
@ -58,6 +69,8 @@ class LeadsController extends BaseController
|
|||||||
$this->policyTransactionStatusModel = new PolicyTransactionStatusModel();
|
$this->policyTransactionStatusModel = new PolicyTransactionStatusModel();
|
||||||
$this->insurerBranchModel = new InsurerBranchModel();
|
$this->insurerBranchModel = new InsurerBranchModel();
|
||||||
$this->tpaBranchModel = new TPABranchModel();
|
$this->tpaBranchModel = new TPABranchModel();
|
||||||
|
$this->RFQModel = new RFQModel();
|
||||||
|
$this->insurerModel = new InsurerModel();
|
||||||
|
|
||||||
$this->issuer = [1 => 'JIBS', 2 => 'Nhance'];
|
$this->issuer = [1 => 'JIBS', 2 => 'Nhance'];
|
||||||
$this->clientType = [1 => 'Group', 2 => 'Individual'];
|
$this->clientType = [1 => 'Group', 2 => 'Individual'];
|
||||||
@ -296,4 +309,362 @@ class LeadsController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------RFQ-----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
public function viewRFQ($id, $type = 1){
|
||||||
|
|
||||||
|
$data['rfq_data'] = $this->RFQModel
|
||||||
|
->where('lead_id', $id)
|
||||||
|
->where('type', $type)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$data['rfq_count'] = $this->RFQModel
|
||||||
|
->where('lead_id', $id)
|
||||||
|
->where('type', 1)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->countAllResults();
|
||||||
|
|
||||||
|
$data['qcr_count'] = $this->RFQModel
|
||||||
|
->where('lead_id', $id)
|
||||||
|
->where('type', 2)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->countAllResults();
|
||||||
|
|
||||||
|
// dd(count($data['rfq_data']));
|
||||||
|
|
||||||
|
$data['lead_id'] = $id;
|
||||||
|
$lead_data = $this->leadsModel
|
||||||
|
->select('policy_type.question_json')
|
||||||
|
->join('policy_type', 'leads.policy_type_id = policy_type.id')
|
||||||
|
->where('leads.id', $id)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$data['question_json'] = $lead_data['question_json'];
|
||||||
|
$data['page_name'] = isset($data['rfq_data']['type']) && $data['rfq_data']['type'] == 2 ? 'QCR' : 'RFQ';
|
||||||
|
$data['insurer'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
|
||||||
|
|
||||||
|
$data['lead_data'] = $this->leadsModel->where('leads.id', $id)->where('leads.is_active', 1)->first();
|
||||||
|
// dd($data);
|
||||||
|
$this->loadLayout('view_rfq.php', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function createRFQ(){
|
||||||
|
|
||||||
|
$data = $this->request->getPost();
|
||||||
|
$lead_id = $data['lead_id'];
|
||||||
|
$data['type'] = 1;
|
||||||
|
$this->RFQModel
|
||||||
|
->where('lead_id', $lead_id)
|
||||||
|
->where('type', 1)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->set('is_active', 0)
|
||||||
|
->update();
|
||||||
|
|
||||||
|
$result = $this->RFQModel->insert($data);
|
||||||
|
|
||||||
|
if ($result) {
|
||||||
|
return $this->respond(['status' => true, 'id' => $result, 'message' => 'New RFQ created successfully', 'data' =>$data], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->respond(['status' => false, 'id' => $result, 'message' => "Failed to create RFQ", 'data' =>$data], 200);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function createQCR(){
|
||||||
|
|
||||||
|
$data = $this->request->getPost();
|
||||||
|
$lead_id = $data['lead_id'];
|
||||||
|
$data['type'] = 2;
|
||||||
|
|
||||||
|
$this->RFQModel
|
||||||
|
->where('lead_id', $lead_id)
|
||||||
|
->where('type', 2)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->set('is_active', 0)
|
||||||
|
->update();
|
||||||
|
|
||||||
|
$result = $this->RFQModel->insert($data);
|
||||||
|
|
||||||
|
if ($result) {
|
||||||
|
return $this->respond(['status' => true, 'id' => $result, 'message' => 'New QCR created successfully', 'data' =>$data], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->respond(['status' => false, 'id' => $result, 'message' => "Failed to create QCR", 'data' =>$data], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----RFQ and QCR EXPORT------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//export main route function
|
||||||
|
public function exportQCRandRFQ($lead_id, $type, $export_type){
|
||||||
|
|
||||||
|
if($export_type == 'mail'){
|
||||||
|
$this-> exportMailForQCRandRFQ($lead_id, $type);
|
||||||
|
}else{
|
||||||
|
$this-> exportExcelForQCRandRFQ($lead_id, $type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//FOR EXCEL
|
||||||
|
public function exportExcelForQCRandRFQ($lead_id, $type)
|
||||||
|
{
|
||||||
|
$filepath = $this->constructExcelToSaveTemp($lead_id, $type);
|
||||||
|
$filepath = $filepath['filePath'];
|
||||||
|
|
||||||
|
if (file_exists($filepath)) {
|
||||||
|
// Set headers to force download
|
||||||
|
header('Content-Description: File Transfer');
|
||||||
|
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||||
|
header('Content-Disposition: attachment; filename="' . basename($filepath) . '"');
|
||||||
|
header('Content-Length: ' . filesize($filepath));
|
||||||
|
header('Pragma: public');
|
||||||
|
|
||||||
|
// Output the file content
|
||||||
|
readfile($filepath);
|
||||||
|
|
||||||
|
// Delete the file after download
|
||||||
|
unlink($filepath);
|
||||||
|
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
echo "File does not exist.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//FOR MAIL
|
||||||
|
public function exportMailForQCRandRFQ($lead_id, $type){
|
||||||
|
|
||||||
|
$filepath = $this->constructExcelToSaveTemp($lead_id, $type);
|
||||||
|
|
||||||
|
if ($filepath) {
|
||||||
|
return $this->respond(['status' => true, 'file_path' => $filepath, 'message' => 'Mail send successfully'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->respond(['status' => false, 'file_path' => $filepath, 'message' => "Mail send failed"], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Construct excel file and save the file to the folder and return file path
|
||||||
|
public function constructExcelToSaveTemp($lead_id, $type)
|
||||||
|
{
|
||||||
|
$rfq_data = $this->RFQModel
|
||||||
|
->select('
|
||||||
|
leads.client_name,
|
||||||
|
leads.client_short_name,
|
||||||
|
insurers.name as insurer_name,
|
||||||
|
insurer_branch.branch_name as insurer_branch_name,
|
||||||
|
tpa.name as tpa_name,
|
||||||
|
tpa_branch.branch_name as tpa_branch_name,
|
||||||
|
policy_type.policy_type,
|
||||||
|
rfq.json
|
||||||
|
')
|
||||||
|
->join('leads', 'rfq.lead_id = leads.id')
|
||||||
|
->join('policy_type', 'leads.policy_type_id = policy_type.id')
|
||||||
|
->join('insurers', 'leads.insurer_id = insurers.id')
|
||||||
|
->join('insurer_branch', 'leads.insurer_branch_id = insurer_branch.id')
|
||||||
|
->join('tpa', 'leads.tpa_id = tpa.id')
|
||||||
|
->join('tpa_branch', 'leads.tpa_branch_id = tpa_branch.id')
|
||||||
|
->where('rfq.lead_id', $lead_id)
|
||||||
|
->where('rfq.type', $type)
|
||||||
|
->where('rfq.is_active', 1)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$lead_data = [
|
||||||
|
'Insured' => $rfq_data['client_name'],
|
||||||
|
'Insurer' => $rfq_data['insurer_name'] . ' - ' . $rfq_data['insurer_branch_name'],
|
||||||
|
'TPA' => $rfq_data['tpa_name'] . ' - ' . $rfq_data['tpa_branch_name'],
|
||||||
|
];
|
||||||
|
|
||||||
|
$jsonData = $rfq_data['json'];
|
||||||
|
$data = json_decode($jsonData, true);
|
||||||
|
|
||||||
|
// Initialize PhpSpreadsheet
|
||||||
|
$spreadsheet = new Spreadsheet();
|
||||||
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
|
|
||||||
|
// Start with lead_data at the top
|
||||||
|
$rowNumber = 1;
|
||||||
|
foreach ($lead_data as $key => $value) {
|
||||||
|
$sheet->setCellValue("A{$rowNumber}", $key);
|
||||||
|
$sheet->setCellValue("B{$rowNumber}", $value);
|
||||||
|
|
||||||
|
// Apply bold style to the key
|
||||||
|
$sheet->getStyle("A{$rowNumber}")->applyFromArray([
|
||||||
|
'font' => [
|
||||||
|
'bold' => true,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$rowNumber++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Leave two blank rows
|
||||||
|
$rowNumber += 2;
|
||||||
|
|
||||||
|
// Set headers and subheaders starting from current row
|
||||||
|
$headers = $data['table_data']['headers'];
|
||||||
|
$subHeaderRow = $rowNumber + 1;
|
||||||
|
$columnLetter = 'A';
|
||||||
|
|
||||||
|
// Add headers in the first row and subheaders in the second row
|
||||||
|
foreach ($headers as $header) {
|
||||||
|
if ($header['parentHeader'] === 'Item Key' || $header['parentHeader'] == 'Action') {
|
||||||
|
continue; // Skip "Item Key" and "Action" columns
|
||||||
|
}
|
||||||
|
|
||||||
|
if($header['parentHeader'] === 'Sno'){
|
||||||
|
$header['parentHeader'] = 'S.No.';
|
||||||
|
}
|
||||||
|
|
||||||
|
$sheet->setCellValue("{$columnLetter}{$rowNumber}", $header['parentHeader']);
|
||||||
|
|
||||||
|
// Apply bold style to the header
|
||||||
|
$sheet->getStyle("{$columnLetter}{$rowNumber}")->applyFromArray([
|
||||||
|
'font' => [
|
||||||
|
'bold' => true,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
foreach ($header['subHeaders'] as $subHeader) {
|
||||||
|
$sheet->setCellValue("{$columnLetter}{$subHeaderRow}", $subHeader);
|
||||||
|
|
||||||
|
// Apply bold style to the subheader
|
||||||
|
$sheet->getStyle("{$columnLetter}{$subHeaderRow}")->applyFromArray([
|
||||||
|
'font' => [
|
||||||
|
'bold' => true,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$columnLetter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move to next row for data entries
|
||||||
|
$rowNumber = $subHeaderRow + 1;
|
||||||
|
|
||||||
|
// Add data rows
|
||||||
|
foreach ($data['table_data']['data'] as $dataRow) {
|
||||||
|
$columnLetter = 'A';
|
||||||
|
foreach ($dataRow['data'] as $cellData) {
|
||||||
|
if ($cellData['parentth'] === 'Item Key' || $cellData['parentth'] == 'Action') {
|
||||||
|
continue; // Skip "Item Key" data
|
||||||
|
}
|
||||||
|
$sheet->setCellValue("{$columnLetter}{$rowNumber}", $cellData['value']);
|
||||||
|
$columnLetter++;
|
||||||
|
}
|
||||||
|
$rowNumber++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set filename based on type
|
||||||
|
$string = ($type == 2) ? 'QCR' : 'RFQ';
|
||||||
|
$filename = $string . '_' . $rfq_data['client_short_name'] . '_' . $rfq_data['policy_type'] . '_' . date('Ymdhis') . '.xlsx';
|
||||||
|
|
||||||
|
// Save to temporary location
|
||||||
|
$uploadFilePath = WRITEPATH . 'tmp/' . $filename;
|
||||||
|
$writer = new Xlsx($spreadsheet);
|
||||||
|
$writer->save($uploadFilePath);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'filePath' => $uploadFilePath,
|
||||||
|
'fileName' => $filename,
|
||||||
|
]; // Return file path and file name
|
||||||
|
}
|
||||||
|
|
||||||
|
//this funciton for send mail to insurer and client with either RFQ/QCR
|
||||||
|
public function sendMailWithAttachement()
|
||||||
|
{
|
||||||
|
helper('excel_util_helper');
|
||||||
|
helper('MailHelper');
|
||||||
|
|
||||||
|
$params = $this->request->getGet();
|
||||||
|
// dd($params);
|
||||||
|
$lead_id = $params['lead_id'];
|
||||||
|
$file_type = $params['file_type']; //rfq or qcr
|
||||||
|
$recipient_type = $params['recipient_type'];//insurer or client
|
||||||
|
$recipient_mail = $params['recipient_mail'];// - only primary key of contacts
|
||||||
|
$recipient_mail = json_decode($params['recipient_mail'], true);;// - only primary key of contacts
|
||||||
|
$cc = 'velz1990@gmail.com,vitvelz@gmail.com';
|
||||||
|
|
||||||
|
$result_data = [];
|
||||||
|
// dd($recipient_mail);
|
||||||
|
if($recipient_type == 'insurer' && (!is_array($recipient_mail) || count($recipient_mail) == 0))
|
||||||
|
{
|
||||||
|
return $this->respond(['status' => 'failed','code' => 400,'data' => '','messgae' => 'Recipient mail not found ! ' ], 200);
|
||||||
|
}
|
||||||
|
// dd();
|
||||||
|
//gather lead info
|
||||||
|
$lead_data = $this->leadsModel
|
||||||
|
->select('leads.*,policy_type.long_name,policy_type.policy_type,user_profiles.email as created_person_email')
|
||||||
|
->join('policy_type','leads.policy_type_id = policy_type.id')
|
||||||
|
->join('user_profiles','leads.created_by = user_profiles.id')
|
||||||
|
->where('leads.id', $lead_id)
|
||||||
|
->first();
|
||||||
|
if( $recipient_type == 'client' && ($lead_data['contact_person_email'] == '' || $lead_data['contact_person_email'] == null))
|
||||||
|
{
|
||||||
|
return $this->respond(['status' => 'failed','code' => 400,'data' => '','messgae' => 'Recipient mail not found ! ' ], 200);
|
||||||
|
}
|
||||||
|
// dd($lead_data);
|
||||||
|
$reply_to = $lead_data['created_person_email'];
|
||||||
|
//get file path to attach
|
||||||
|
$file_info = $this->constructExcelToSaveTemp($lead_id, ( $file_type == 'rfq' ? 1 : 2) );
|
||||||
|
// $file_path = WRITEPATH."uploads/excel/sample/correction.xls";
|
||||||
|
// $file_name = $file_type.'.xlsx';
|
||||||
|
// !dd($file_info);
|
||||||
|
$file_path = $file_info['filePath'];
|
||||||
|
$file_name = $file_info['fileName'];
|
||||||
|
$attachments = [['fileName' => $file_name,'filePath' => $file_path]];
|
||||||
|
|
||||||
|
//get recipient address
|
||||||
|
if($recipient_type == 'insurer')
|
||||||
|
{
|
||||||
|
$recipient_data = $this->levelContactModel
|
||||||
|
->where(['contact_type' => $recipient_type, 'is_active' => 1])
|
||||||
|
->whereIn('id', $recipient_mail)
|
||||||
|
->findAll();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$recipient_data = [['name' => $lead_data['contact_person_name'],'email' => $lead_data['contact_person_email']] ];
|
||||||
|
}
|
||||||
|
// !dd($recipient_data);
|
||||||
|
|
||||||
|
$subject = $file_type == 'rfq' ? 'Request for Quotation from '. $lead_data['client_name'] . ' for '.$lead_data['policy_type'] : 'Quotation Comparison Report for ' .$lead_data['policy_type'];
|
||||||
|
$original_message = '<div style="width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9;font-family:Arial,sans-serif;color:#333;line-height:1.6"><div style=background-color:#4a90e2;color:#fff;padding:15px;text-align:center><h1 style=margin:0;font-size:24px>Request for Quotation (RFQ)</h1></div><div style=padding:20px;background-color:#fff><h2 style=color:#4a90e2;font-size:20px;margin-top:0>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2 style=color:#4a90e2;font-size:20px;margin-top:20px>RFQ Details</h2><table style=width:100%;border-collapse:collapse;margin-top:20px><tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Client name<td style="border:1px solid #ddd;padding:10px;text-align:left">{{CLIENT_NAME}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Coverage Type<td style="border:1px solid #ddd;padding:10px;text-align:left">{{POLICY_LONG_NAME}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Policy Start Date<td style="border:1px solid #ddd;padding:10px;text-align:left">{{POLICY_START_DATE}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Policy Duration<td style="border:1px solid #ddd;padding:10px;text-align:left">{{DURATION}}</table><div style="margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic">Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div style=margin-top:20px;font-size:12px;color:#777;text-align:center><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>';
|
||||||
|
|
||||||
|
|
||||||
|
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("{{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);
|
||||||
|
|
||||||
|
// print_rr($message);
|
||||||
|
|
||||||
|
$res = MailHelper::send_email(['mail' => $recipient['email'], 'subject' => $subject, 'message' => $message,'attachments' => $attachments,'reply_to' => $reply_to]);
|
||||||
|
// !dd($res);
|
||||||
|
|
||||||
|
$result_data[] = ['mail' => $recipient['email'],'status' => $res];
|
||||||
|
}
|
||||||
|
//delete attachment file
|
||||||
|
unlink($file_path);
|
||||||
|
return $this->respond(['status' => 'success','code' => 200,'data' => $result_data ], 200);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLevelContects(){
|
||||||
|
|
||||||
|
$data = $this->levelContactModel->getContectForRFQ();
|
||||||
|
|
||||||
|
if($data){
|
||||||
|
return $this->respond(['status' => true, 'data' => $data], 200);
|
||||||
|
}else{
|
||||||
|
return $this->respond(['status' => false], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,6 +34,8 @@ use App\Models\InsurerExcelExportTemplateModel;
|
|||||||
use App\Models\SettingsModel;
|
use App\Models\SettingsModel;
|
||||||
use App\Models\VehicleModel;
|
use App\Models\VehicleModel;
|
||||||
|
|
||||||
|
use CodeIgniter\CLI\CLI;
|
||||||
|
|
||||||
class MasterController extends AdminController
|
class MasterController extends AdminController
|
||||||
{
|
{
|
||||||
use ResponseTrait;
|
use ResponseTrait;
|
||||||
@ -175,6 +177,7 @@ class MasterController extends AdminController
|
|||||||
$editData['action'] = ['import' => 'Import', 'export' => 'Export'];
|
$editData['action'] = ['import' => 'Import', 'export' => 'Export'];
|
||||||
$editData['db_column_name'] = [
|
$editData['db_column_name'] = [
|
||||||
|
|
||||||
|
'S.No.' => 'index',
|
||||||
'Employee Name' => 'emp_name',
|
'Employee Name' => 'emp_name',
|
||||||
'Employee ID' => 'emp_code',
|
'Employee ID' => 'emp_code',
|
||||||
'Date of Birth' => 'emp_dob',
|
'Date of Birth' => 'emp_dob',
|
||||||
@ -1602,13 +1605,34 @@ class MasterController extends AdminController
|
|||||||
//testing a sample mail from cli
|
//testing a sample mail from cli
|
||||||
public function testGmailAPIViaCLI(string $email_id = 'velmurugan.s@venbainfotech.com')
|
public function testGmailAPIViaCLI(string $email_id = 'velmurugan.s@venbainfotech.com')
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$email_id = CLI::getOption('to') ? CLI::getOption('to') : $email_id;
|
||||||
// print_r($email_id);die();
|
// print_r($email_id);die();
|
||||||
// $gmailapi = \Config\Services::gmailapi();
|
// $gmailapi = \Config\Services::gmailapi();
|
||||||
$res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Mail Via CLI', 'message' => 'This is sample mail sent via CLI mode']);
|
$message = '<style>body{font-family:Arial,sans-serif;color:#333;line-height:1.6;margin:0;padding:0}.email-container{width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9}.header{background-color:#4a90e2;color:#fff;padding:15px;text-align:center}.header h1{margin:0;font-size:24px}.content{padding:20px;background-color:#fff}.content h2{color:#4a90e2;font-size:20px;margin-top:0}.content p{margin:10px 0}.details-table{width:100%;border-collapse:collapse;margin-top:20px}.details-table td,.details-table th{border:1px solid #ddd;padding:10px;text-align:left}.details-table th{background-color:#f2f2f2}.footer{margin-top:20px;font-size:12px;color:#777;text-align:center}.attachment-note{margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic}</style><div class=email-container><div class=header><h1>Request for Quotation (RFQ)</h1></div><div class=content><h2>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2>RFQ Details</h2><table class=details-table><tr><th>Client name<td>{{CLIENT_NAME}}<tr><th>Coverage Type<td>{{POLICY_LONG_NAME}}<tr><th>Policy Start Date<td>{{POLICY_START_DATE}}<tr><th>Policy Duration<td>{{DURATION}}</table><div class=attachment-note>Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div class=footer><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>';
|
||||||
|
|
||||||
|
$attachments = [
|
||||||
|
["filePath" => WRITEPATH."uploads/excel/sample/correction.xls","fileName" => "correction.xls"],
|
||||||
|
["filePath" => WRITEPATH."uploads/excel/sample/deletion.xls","fileName" => "deletion.xls"],
|
||||||
|
["filePath" => "C:\\Users\\Venba\\Desktop\\IQ.pdf","fileName" => "Questions.pdf"],
|
||||||
|
["filePath" => "C:\\Users\\Venba\\Desktop\\config_age.png","fileName" => "config_age.png"]
|
||||||
|
];
|
||||||
|
|
||||||
|
$email_id = CLI::getOption('to') ? CLI::getOption('to') : $email_id;
|
||||||
|
$res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Mail Via CLI', 'message' => $message,'attachments' => $attachments]);
|
||||||
print_r($res);
|
print_r($res);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public function testCheckBounceMails()
|
||||||
|
{
|
||||||
|
$gmailapi = \Config\Services::gmailapi();
|
||||||
|
$from_date = CLI::getOption('from') ? CLI::getOption('from') : null;
|
||||||
|
$to_date = CLI::getOption('to') ? CLI::getOption('to') : null;
|
||||||
|
$count = CLI::getOption('count') ? CLI::getOption('count') : null;
|
||||||
|
$page = CLI::getOption('page') ? CLI::getOption('page') : null;
|
||||||
|
$res = $gmailapi->checkBounceStatus(from_date:$from_date,to_date:$to_date,count:$count,page:$page);
|
||||||
|
print_r($res);
|
||||||
|
}
|
||||||
|
|
||||||
public function appCheckList()
|
public function appCheckList()
|
||||||
{
|
{
|
||||||
@ -1671,7 +1695,7 @@ class MasterController extends AdminController
|
|||||||
echo "Check the following..!\n";
|
echo "Check the following..!\n";
|
||||||
echo "1. Update Gmail Oauth credentials in 'gmail_api_oauth_credentials' field in 'settings' table in JSON format.\n";
|
echo "1. Update Gmail Oauth credentials in 'gmail_api_oauth_credentials' field in 'settings' table in JSON format.\n";
|
||||||
echo "2. Call this cli route to generate new access token: 'php public/index.php cli/new_gmail_token' from root of the project.\n";
|
echo "2. Call this cli route to generate new access token: 'php public/index.php cli/new_gmail_token' from root of the project.\n";
|
||||||
echo "3. Call this cli route : 'php public/index.php cli/send_mail_cli someone@gmail.com' to send test mail to testGmailAPIViaCLI ( replace someone@gmail.com with real time mail).\n";
|
echo "3. Call this cli route : 'php public/index.php cli/send_mail_cli --to someone@gmail.com' to send test mail to testGmailAPIViaCLI ( replace someone@gmail.com with real time mail).\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -96,7 +96,14 @@ class RestAuthenticationController extends AdminController
|
|||||||
$mobile_number = $this->request->getJSON()->mobile_number;
|
$mobile_number = $this->request->getJSON()->mobile_number;
|
||||||
$otp_verification = $this->request->getJSON()->otp_verification;
|
$otp_verification = $this->request->getJSON()->otp_verification;
|
||||||
|
|
||||||
|
if (isset($this->request->getJSON()->login_by_hr))
|
||||||
|
{
|
||||||
|
$employeeData = $this->employeeModel->where('id', $this->request->getJSON()->employee_id)->where('relationship', 'self')->first();
|
||||||
|
}else{
|
||||||
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
|
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($employeeData && $otp_verification == true || $employeeData && isset($this->request->getJSON()->login_by_hr)) {
|
if ($employeeData && $otp_verification == true || $employeeData && isset($this->request->getJSON()->login_by_hr)) {
|
||||||
$auth = HttpRequestHelper::getRequestInfo();
|
$auth = HttpRequestHelper::getRequestInfo();
|
||||||
|
|||||||
@ -93,6 +93,7 @@ class MailHelper
|
|||||||
$emaill = $params['mail'];
|
$emaill = $params['mail'];
|
||||||
$subject = $params['subject'];
|
$subject = $params['subject'];
|
||||||
$message = $params['message'];
|
$message = $params['message'];
|
||||||
|
$attachments = isset($params['attachments']) && count($params['attachments']) ? $params['attachments'] : [];
|
||||||
|
|
||||||
//check BCC mail
|
//check BCC mail
|
||||||
if (isset($params['bcc'])) {
|
if (isset($params['bcc'])) {
|
||||||
@ -118,7 +119,7 @@ class MailHelper
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$res = $gmailapi->sendMessage($emaill, $subject, $message, 'no-reply@nhanceindia.in', $reply_to, $cc, $bcc);
|
$res = $gmailapi->sendMessage($emaill, $subject, $message, 'no-reply@nhanceindia.in', $reply_to, $cc, $bcc,$attachments);
|
||||||
|
|
||||||
if($res['status'])
|
if($res['status'])
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1646,7 +1646,7 @@ if(!function_exists('get_premium_for_si'))
|
|||||||
// dd($slab_details);
|
// dd($slab_details);
|
||||||
foreach ($slab_details as $skey => $slab_value)
|
foreach ($slab_details as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
if($slab_value['si'] == $si_amount && $slab_value['grade'] == $band && $slab_value['unit'] == $unit && $slab_value['max_si'] == 0)
|
if($slab_value['si'] == $si_amount && $slab_value['grade'] == $band && $slab_value['unit'] == $unit)
|
||||||
{
|
{
|
||||||
return $slab_value['premium'];
|
return $slab_value['premium'];
|
||||||
}
|
}
|
||||||
@ -1800,7 +1800,7 @@ if(!function_exists('transform_enrollment_row_to_inception_row'))
|
|||||||
$res[4] = $row[4]; // inception: gender (Gender) -> enrollment: gender (Gender)
|
$res[4] = $row[4]; // inception: gender (Gender) -> enrollment: gender (Gender)
|
||||||
$res[5] = $row[5]; // inception: relationship (RELATIONSHIP) -> enrollment: relationship (Relation)
|
$res[5] = $row[5]; // inception: relationship (RELATIONSHIP) -> enrollment: relationship (Relation)
|
||||||
$res[6] = $row[9]; // inception: basic_cover_si (BASIC COVER SI) -> enrollment: basic_cover_si (SI)
|
$res[6] = $row[9]; // inception: basic_cover_si (BASIC COVER SI) -> enrollment: basic_cover_si (SI)
|
||||||
$res[7] = null; // inception: doc (Date of Coverage) -> No match in enrollment
|
$res[7] = $row[13]; // inception: doc (Date of Coverage) -> No match in enrollment
|
||||||
$res[8] = $row[3]; // inception: doj (DOJ) -> enrollment: doj (DOJ)
|
$res[8] = $row[3]; // inception: doj (DOJ) -> enrollment: doj (DOJ)
|
||||||
$res[9] = $row[11]; // inception: basic_pay (Basic Pay) -> enrollment: basic_pay (Basic Pay)
|
$res[9] = $row[11]; // inception: basic_pay (Basic Pay) -> enrollment: basic_pay (Basic Pay)
|
||||||
$res[10] = $row[10]; // inception: band_grade (Band/Grade) -> enrollment: band_grade (Grade)
|
$res[10] = $row[10]; // inception: band_grade (Band/Grade) -> enrollment: band_grade (Grade)
|
||||||
@ -2120,3 +2120,23 @@ if(!function_exists('group_slab_rates_basedon_name'))
|
|||||||
return $temp_slab_rates;
|
return $temp_slab_rates;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//this key generating mandantory for display employee info in enrolment app w/o error
|
||||||
|
if(!function_exists('generate_family_floater_key'))
|
||||||
|
{
|
||||||
|
function generate_family_floater_key($relationship)
|
||||||
|
{
|
||||||
|
if (strtolower(trim($relationship)) === 'mother' || strtolower(trim($relationship)) === 'father') {
|
||||||
|
$relation = 'parent';
|
||||||
|
} else if(strtolower(trim($relationship)) === 'son' || strtolower(trim($relationship)) === 'daughter'){
|
||||||
|
$relation = 'child';
|
||||||
|
}else if(strtolower(trim($relationship)) === 'father in Law' || strtolower(trim($relationship)) === 'mother in Law'){
|
||||||
|
$relation = 'parent_in_law';
|
||||||
|
}else if(strtolower(trim($relationship)) === 'spouse'){
|
||||||
|
$relation = 'spouse';
|
||||||
|
}else{
|
||||||
|
$relation = 'self';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -26,18 +26,20 @@ class GmailAPI
|
|||||||
'https://www.googleapis.com/auth/gmail.addons.current.message.readonly',
|
'https://www.googleapis.com/auth/gmail.addons.current.message.readonly',
|
||||||
'https://www.googleapis.com/auth/gmail.readonly',
|
'https://www.googleapis.com/auth/gmail.readonly',
|
||||||
'https://www.googleapis.com/auth/gmail.labels',
|
'https://www.googleapis.com/auth/gmail.labels',
|
||||||
'https://www.googleapis.com/auth/gmail.send'
|
'https://www.googleapis.com/auth/gmail.send',
|
||||||
|
'https://mail.google.com/'
|
||||||
]);
|
]);
|
||||||
$this->setAuthConfig();
|
$this->setAuthConfig();
|
||||||
//die();
|
//die();
|
||||||
$this->client->setAccessType('offline');
|
$this->client->setAccessType('offline');
|
||||||
$this->client->setPrompt('select_account consent');
|
$this->client->setPrompt('select_account consent');
|
||||||
|
// echo uri_string();//die();
|
||||||
if (php_sapi_name() !== 'cli' || (uri_string() == 'cli/send_mail_cli' || uri_string() == 'cli/processjob') )
|
if (php_sapi_name() !== 'cli' || (uri_string() == 'cli/send_mail_cli' || uri_string() == 'cli/processjob' || uri_string() == 'cli/check_bounce_mail_cli') )
|
||||||
{
|
{
|
||||||
|
// echo 'getting token';die();
|
||||||
$this->setTokenFromDB(); // Call only if not in CLI
|
$this->setTokenFromDB(); // Call only if not in CLI
|
||||||
}
|
}
|
||||||
|
// die();
|
||||||
$this->service = new Gmail($this->client);
|
$this->service = new Gmail($this->client);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -99,10 +101,12 @@ class GmailAPI
|
|||||||
$settingsModel->where('id', 1)->set([$this->tokenField => $token])->update();
|
$settingsModel->where('id', 1)->set([$this->tokenField => $token])->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createMessage($to, $subject, $htmlContent, $from, $replyTo, $cc = [], $bcc = [])
|
public function createMessage($to, $subject, $htmlContent, $from, $replyTo, $cc = [], $bcc = [], $attachments = [])
|
||||||
{
|
{
|
||||||
$boundary = uniqid(rand(), true);
|
// print_r($to);die();
|
||||||
|
$boundary = uniqid(rand(), true); // Unique boundary for separating parts
|
||||||
|
|
||||||
|
// Initialize raw message headers
|
||||||
$rawMessageString = "From: $from\r\n";
|
$rawMessageString = "From: $from\r\n";
|
||||||
$rawMessageString .= "To: $to\r\n";
|
$rawMessageString .= "To: $to\r\n";
|
||||||
$rawMessageString .= "Reply-To: $replyTo\r\n";
|
$rawMessageString .= "Reply-To: $replyTo\r\n";
|
||||||
@ -117,26 +121,53 @@ class GmailAPI
|
|||||||
|
|
||||||
$rawMessageString .= "Subject: $subject\r\n";
|
$rawMessageString .= "Subject: $subject\r\n";
|
||||||
$rawMessageString .= "MIME-Version: 1.0\r\n";
|
$rawMessageString .= "MIME-Version: 1.0\r\n";
|
||||||
$rawMessageString .= "Content-Type: multipart/alternative; boundary=\"$boundary\"\r\n\r\n";
|
$rawMessageString .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\r\n\r\n";
|
||||||
|
|
||||||
|
// Add HTML content as an alternative part
|
||||||
$rawMessageString .= "--$boundary\r\n";
|
$rawMessageString .= "--$boundary\r\n";
|
||||||
$rawMessageString .= "Content-Type: text/html; charset=UTF-8\r\n";
|
$rawMessageString .= "Content-Type: text/html; charset=UTF-8\r\n";
|
||||||
$rawMessageString .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
|
$rawMessageString .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
|
||||||
$rawMessageString .= $htmlContent . "\r\n";
|
$rawMessageString .= $htmlContent . "\r\n\r\n";
|
||||||
|
|
||||||
|
// Process each attachment
|
||||||
|
foreach ($attachments as $attachment) {
|
||||||
|
$filePath = $attachment['filePath'];
|
||||||
|
$fileName = $attachment['fileName'];
|
||||||
|
$fileData = file_get_contents($filePath);
|
||||||
|
|
||||||
|
if ($fileData === false) {
|
||||||
|
continue; // Skip this attachment if file cannot be read
|
||||||
|
}
|
||||||
|
|
||||||
|
$base64File = base64_encode($fileData);
|
||||||
|
|
||||||
|
// Add each attachment with appropriate headers
|
||||||
|
$rawMessageString .= "--$boundary\r\n";
|
||||||
|
$rawMessageString .= "Content-Type: application/octet-stream; name=\"$fileName\"\r\n";
|
||||||
|
$rawMessageString .= "Content-Disposition: attachment; filename=\"$fileName\"\r\n";
|
||||||
|
$rawMessageString .= "Content-Transfer-Encoding: base64\r\n\r\n";
|
||||||
|
$rawMessageString .= chunk_split($base64File) . "\r\n\r\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// End boundary to signify the end of the message
|
||||||
$rawMessageString .= "--$boundary--";
|
$rawMessageString .= "--$boundary--";
|
||||||
|
|
||||||
|
// Encode the final raw message in base64 for Gmail API
|
||||||
$rawMessage = base64_encode($rawMessageString);
|
$rawMessage = base64_encode($rawMessageString);
|
||||||
$rawMessage = str_replace(['+', '/', '='], ['-', '_', ''], $rawMessage);
|
$rawMessage = str_replace(['+', '/', '='], ['-', '_', ''], $rawMessage);
|
||||||
|
|
||||||
|
// Create Gmail message object
|
||||||
$message = new Message();
|
$message = new Message();
|
||||||
$message->setRaw($rawMessage);
|
$message->setRaw($rawMessage);
|
||||||
|
|
||||||
return $message;
|
return $message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendMessage($to, $subject, $htmlContent, $from, $replyTo, $cc = [], $bcc = [])
|
|
||||||
|
public function sendMessage($to, $subject, $htmlContent, $from, $replyTo, $cc = [], $bcc = [],$attachments = [])
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$message = $this->createMessage($to, $subject, $htmlContent, $from, $replyTo, $cc, $bcc);
|
$message = $this->createMessage($to, $subject, $htmlContent, $from, $replyTo, $cc, $bcc,$attachments);
|
||||||
$res = $this->service->users_messages->send('me', $message);
|
$res = $this->service->users_messages->send('me', $message);
|
||||||
return array('status' => true, 'data' => $res);
|
return array('status' => true, 'data' => $res);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@ -177,4 +208,59 @@ class GmailAPI
|
|||||||
$this->myLogger->logme('error', 'New token generated and stored in the database.');
|
$this->myLogger->logme('error', 'New token generated and stored in the database.');
|
||||||
print 'New token generated and stored in the database.';
|
print 'New token generated and stored in the database.';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function checkBounceStatus( string $userId = 'me',string $from_date = null,string $to_date = null,int $count = null,string $page = null)
|
||||||
|
{
|
||||||
|
$query = 'from:mailer-daemon OR "delivery failed" OR "failure notice"';
|
||||||
|
if($from_date != '' && $to_date != '')
|
||||||
|
{
|
||||||
|
$query .= 'after:' . $from_date . ' before:' . $to_date;
|
||||||
|
}
|
||||||
|
$maxResults = $count ? $count : 20;
|
||||||
|
$pageToken = $page ? $page : null;
|
||||||
|
|
||||||
|
$params = ['q' => $query,'maxResults' => $maxResults];
|
||||||
|
if(isset($pageToken)){ $params['pageToken'] = $pageToken; }
|
||||||
|
$messages = $this->service->users_messages->listUsersMessages($userId, $params);
|
||||||
|
|
||||||
|
$bounceDetails = [];
|
||||||
|
$pageToken = $messages->getNextPageToken();
|
||||||
|
$bounceDetails['pageToken'] = $pageToken;
|
||||||
|
if (count($messages->getMessages()) > 0) {
|
||||||
|
foreach ($messages->getMessages() as $message) {
|
||||||
|
// Get full message details
|
||||||
|
$msg = $this->service->users_messages->get($userId, $message->getId(), ['format' => 'full']);
|
||||||
|
|
||||||
|
// Extract important headers and content
|
||||||
|
$headers = $msg->getPayload()->getHeaders();
|
||||||
|
$subject = null;
|
||||||
|
$date = null;
|
||||||
|
$to = null;
|
||||||
|
|
||||||
|
foreach ($headers as $header) {
|
||||||
|
if ($header->getName() === 'Subject') {
|
||||||
|
$subject = $header->getValue();
|
||||||
|
}
|
||||||
|
if ($header->getName() === 'Date') {
|
||||||
|
$date = $header->getValue();
|
||||||
|
}
|
||||||
|
if ($header->getName() === 'To') {
|
||||||
|
$to = $header->getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$bounceDetails['data'][] = [
|
||||||
|
'subject' => $subject,
|
||||||
|
'date' => $date,
|
||||||
|
'to' => $to,
|
||||||
|
'snippet' => $msg->getSnippet(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $bounceDetails;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -168,7 +168,7 @@ class EmployeePolicyModel extends Model
|
|||||||
//-------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
public function getInceptionEmployeeDataForExportExcel($ref_data)
|
public function getInceptionEmployeeDataForExportExcel($ref_data, $return_type = 0)
|
||||||
{
|
{
|
||||||
$client_policy_id = $ref_data['client_policy_id'];
|
$client_policy_id = $ref_data['client_policy_id'];
|
||||||
$client_branch_id = $ref_data['client_branch_id'];
|
$client_branch_id = $ref_data['client_branch_id'];
|
||||||
@ -269,7 +269,12 @@ class EmployeePolicyModel extends Model
|
|||||||
|
|
||||||
// Get the result set
|
// Get the result set
|
||||||
$query = $this->db->query($sql);
|
$query = $this->db->query($sql);
|
||||||
|
|
||||||
|
if($return_type == 1){
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
}else{
|
||||||
$results = $query->getResult();
|
$results = $query->getResult();
|
||||||
|
}
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -801,8 +806,8 @@ class EmployeePolicyModel extends Model
|
|||||||
->where('emp.client_id',$client_id)
|
->where('emp.client_id',$client_id)
|
||||||
->where('employee_polices.client_policy_id',$policy_id);
|
->where('employee_polices.client_policy_id',$policy_id);
|
||||||
|
|
||||||
$result->whereIn('employee_polices.status', ['draft', 'enrolled']);
|
$result->whereIn('employee_polices.status', ['enrolled']);
|
||||||
$result->whereIn('emp.emp_status', ['draft', 'enrolled']);
|
$result->whereIn('emp.emp_status', ['enrolled']);
|
||||||
$result = $result->findAll();
|
$result = $result->findAll();
|
||||||
return ($result);
|
return ($result);
|
||||||
}
|
}
|
||||||
@ -846,6 +851,7 @@ class EmployeePolicyModel extends Model
|
|||||||
ep.tpa_id,
|
ep.tpa_id,
|
||||||
ep.uhid,
|
ep.uhid,
|
||||||
ep.policy_end_date,
|
ep.policy_end_date,
|
||||||
|
ep.basic_cover_si,
|
||||||
|
|
||||||
clients.client_name,
|
clients.client_name,
|
||||||
clients.short_name AS client_short_name,
|
clients.short_name AS client_short_name,
|
||||||
@ -853,8 +859,6 @@ class EmployeePolicyModel extends Model
|
|||||||
cp.policy_start_date,
|
cp.policy_start_date,
|
||||||
cp.policy_no,
|
cp.policy_no,
|
||||||
|
|
||||||
policies.name AS policy_name,
|
|
||||||
|
|
||||||
insurers.name AS insurer_name,
|
insurers.name AS insurer_name,
|
||||||
insurers.short_name AS insurer_short_name,
|
insurers.short_name AS insurer_short_name,
|
||||||
insurers.insurer_logo,
|
insurers.insurer_logo,
|
||||||
@ -873,7 +877,6 @@ class EmployeePolicyModel extends Model
|
|||||||
->join('employee_polices ep', 'ep.employee_id = e.id')
|
->join('employee_polices ep', 'ep.employee_id = e.id')
|
||||||
->join('client_policy cp', 'cp.id = ep.client_policy_id')
|
->join('client_policy cp', 'cp.id = ep.client_policy_id')
|
||||||
->join('clients', 'clients.id = cp.client_id')
|
->join('clients', 'clients.id = cp.client_id')
|
||||||
->join('policies', 'policies.id = cp.policy_id')
|
|
||||||
->join('insurers', 'insurers.id = cp.insurer_id')
|
->join('insurers', 'insurers.id = cp.insurer_id')
|
||||||
->join('insurer_branch', 'insurer_branch.id = cp.insurer_branch_id')
|
->join('insurer_branch', 'insurer_branch.id = cp.insurer_branch_id')
|
||||||
->join('tpa', 'tpa.id = cp.tpa_id')
|
->join('tpa', 'tpa.id = cp.tpa_id')
|
||||||
@ -913,6 +916,7 @@ class EmployeePolicyModel extends Model
|
|||||||
ep.tpa_id,
|
ep.tpa_id,
|
||||||
ep.uhid,
|
ep.uhid,
|
||||||
ep.policy_end_date,
|
ep.policy_end_date,
|
||||||
|
ep.basic_cover_si,
|
||||||
|
|
||||||
clients.client_name,
|
clients.client_name,
|
||||||
clients.short_name AS client_short_name,
|
clients.short_name AS client_short_name,
|
||||||
@ -920,8 +924,6 @@ class EmployeePolicyModel extends Model
|
|||||||
cp.policy_start_date,
|
cp.policy_start_date,
|
||||||
cp.policy_no,
|
cp.policy_no,
|
||||||
|
|
||||||
policies.name AS policy_name,
|
|
||||||
|
|
||||||
insurers.name AS insurer_name,
|
insurers.name AS insurer_name,
|
||||||
insurers.short_name AS insurer_short_name,
|
insurers.short_name AS insurer_short_name,
|
||||||
insurers.insurer_logo,
|
insurers.insurer_logo,
|
||||||
@ -940,7 +942,6 @@ class EmployeePolicyModel extends Model
|
|||||||
->join('employee_polices ep', 'ep.employee_id = e.id')
|
->join('employee_polices ep', 'ep.employee_id = e.id')
|
||||||
->join('client_policy cp', 'cp.id = ep.client_policy_id')
|
->join('client_policy cp', 'cp.id = ep.client_policy_id')
|
||||||
->join('clients', 'clients.id = cp.client_id')
|
->join('clients', 'clients.id = cp.client_id')
|
||||||
->join('policies', 'policies.id = cp.policy_id')
|
|
||||||
->join('insurers', 'insurers.id = cp.insurer_id')
|
->join('insurers', 'insurers.id = cp.insurer_id')
|
||||||
->join('insurer_branch', 'insurer_branch.id = cp.insurer_branch_id')
|
->join('insurer_branch', 'insurer_branch.id = cp.insurer_branch_id')
|
||||||
->join('tpa', 'tpa.id = cp.tpa_id')
|
->join('tpa', 'tpa.id = cp.tpa_id')
|
||||||
@ -1020,6 +1021,7 @@ class EmployeePolicyModel extends Model
|
|||||||
// Execute the query
|
// Execute the query
|
||||||
$this->db->query($sql);
|
$this->db->query($sql);
|
||||||
|
|
||||||
|
|
||||||
// Commit the transaction
|
// Commit the transaction
|
||||||
if ($this->db->transStatus() === FALSE) {
|
if ($this->db->transStatus() === FALSE) {
|
||||||
// If something went wrong, rollback
|
// If something went wrong, rollback
|
||||||
|
|||||||
@ -91,14 +91,27 @@ class LeadsModel extends Model
|
|||||||
leads.*,
|
leads.*,
|
||||||
kyc_entity_type.name as entity_type,
|
kyc_entity_type.name as entity_type,
|
||||||
policy_type.policy_type,
|
policy_type.policy_type,
|
||||||
user_profiles.first_name as salse_person_name
|
user_profiles.first_name as salse_person_name,
|
||||||
|
|
||||||
|
(
|
||||||
|
SELECT COUNT(*) AS qcr_count
|
||||||
|
FROM rfq
|
||||||
|
WHERE type = 2
|
||||||
|
AND is_active = 1 and lead_id = leads.id
|
||||||
|
) AS qcr_count,
|
||||||
|
|
||||||
|
(
|
||||||
|
SELECT COUNT(*) AS rfq_count
|
||||||
|
FROM rfq
|
||||||
|
WHERE type = 1
|
||||||
|
AND is_active = 1 and lead_id = leads.id
|
||||||
|
|
||||||
|
) AS rfq_count
|
||||||
')
|
')
|
||||||
->join('kyc_entity_type', 'leads.entity_type_id = kyc_entity_type.id', 'left')
|
->join('kyc_entity_type', 'leads.entity_type_id = kyc_entity_type.id', 'left')
|
||||||
->join('user_profiles', 'leads.salse_person_id = user_profiles.id', 'left')
|
->join('user_profiles', 'leads.salse_person_id = user_profiles.id', 'left')
|
||||||
->join('policy_type', 'leads.policy_type_id = policy_type.id', 'left')
|
->join('policy_type', 'leads.policy_type_id = policy_type.id', 'left')
|
||||||
->where('leads.is_active', 1)
|
->where('leads.is_active', 1)
|
||||||
->where('leads.is_active', 1)
|
|
||||||
->where('leads.is_active', 1)
|
|
||||||
->orderBy('id', 'desc')
|
->orderBy('id', 'desc')
|
||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
|
|||||||
@ -25,4 +25,28 @@ class LevelContactModel extends Model
|
|||||||
"token_time_out"
|
"token_time_out"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
public function getContectForRFQ(){
|
||||||
|
|
||||||
|
$result = $this
|
||||||
|
|
||||||
|
->select('
|
||||||
|
level_contacts.id,
|
||||||
|
insurers.short_name as insurer_name,
|
||||||
|
insurer_branch.branch_code,
|
||||||
|
level_contacts.name as contect_person_name,
|
||||||
|
level_contacts.email as contect_person_email,
|
||||||
|
')
|
||||||
|
->join('insurer_branch', 'level_contacts.ref_id = insurer_branch.id')
|
||||||
|
->join('insurers', 'insurer_branch.insurer_id = insurers.id')
|
||||||
|
->where('level_contacts.contact_type', 'insurer')
|
||||||
|
->where('level_contacts.is_active', 1)
|
||||||
|
->where('insurer_branch.is_active', 1)
|
||||||
|
->where('insurers.is_active', 1)
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,5 +22,6 @@ class PolicyTypeModel extends Model
|
|||||||
"etp",
|
"etp",
|
||||||
"iep",
|
"iep",
|
||||||
"itp",
|
"itp",
|
||||||
|
"question_json",
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
60
app/Models/RFQModel.php
Normal file
60
app/Models/RFQModel.php
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class RFQModel extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'rfq';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $useAutoIncrement = true;
|
||||||
|
protected $returnType = 'array';
|
||||||
|
protected $useSoftDeletes = false;
|
||||||
|
protected $protectFields = true;
|
||||||
|
protected $allowedFields = [
|
||||||
|
'id',
|
||||||
|
'type',
|
||||||
|
'lead_id',
|
||||||
|
'json',
|
||||||
|
'created_at',
|
||||||
|
'created_by',
|
||||||
|
'updated_at',
|
||||||
|
'updated_by',
|
||||||
|
'is_active'
|
||||||
|
];
|
||||||
|
|
||||||
|
// Callbacks
|
||||||
|
protected $allowCallbacks = true;
|
||||||
|
protected $beforeInsert = ["checkAndADDCreatedByValue"];
|
||||||
|
protected $afterInsert = [];
|
||||||
|
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
|
||||||
|
protected $afterUpdate = [];
|
||||||
|
protected $beforeFind = [];
|
||||||
|
protected $afterFind = [];
|
||||||
|
protected $beforeDelete = [];
|
||||||
|
protected $afterDelete = [];
|
||||||
|
|
||||||
|
protected function checkAndADDCreatedByValue(array $data)
|
||||||
|
{
|
||||||
|
// Check if 'updated_by' value is null or empty
|
||||||
|
if (empty($data['data']['created_by'])) {
|
||||||
|
// Set 'updated_by' value to the current session user ID
|
||||||
|
$data['data']['created_by'] = get_session_userid();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function checkAndUpdateUpdatedByValue(array $data)
|
||||||
|
{
|
||||||
|
// Check if 'updated_by' value is null or empty
|
||||||
|
if (empty($data['data']['updated_by'])) {
|
||||||
|
// Set 'updated_by' value to the current session user ID
|
||||||
|
$data['data']['updated_by'] = get_session_userid();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -202,7 +202,7 @@ body {
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<?php if(get_role_id() == 1 || get_role_id() == 5) { ?>
|
<?php if(get_role_id() == 1 || get_role_id() == 5 && (in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()))) { ?>
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="#bds-dash-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="bds_tab">
|
<a href="#bds-dash-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="bds_tab">
|
||||||
|
|||||||
@ -67,7 +67,7 @@
|
|||||||
|
|
||||||
<td><?php echo format_indian_number($file['amount'])?></td>
|
<td><?php echo format_indian_number($file['amount'])?></td>
|
||||||
<td class="reload">
|
<td class="reload">
|
||||||
<?php echo date('d-M-Y H:i:a', strtotime($file['created_at'])) ?> by <?php echo get_username($file['created_by']) ?>
|
<?php echo change_date_format($file['created_at'],'Y-m-d H:i:s', 'd M Y h:i a') ?> by <?php echo get_username($file['created_by']) ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php if ($file['status'] == 'failed') { ?>
|
<?php if ($file['status'] == 'failed') { ?>
|
||||||
|
|||||||
@ -34,6 +34,10 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.right-align-input {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<?php $pro_rata_total = 0; $gst_total = 0 ?>
|
<?php $pro_rata_total = 0; $gst_total = 0 ?>
|
||||||
@ -47,24 +51,24 @@
|
|||||||
<h4 style="position: relative;">Employees</h4>
|
<h4 style="position: relative;">Employees</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<table class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0" id="tickets-table">
|
<table class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table">
|
||||||
<thead class="bg-light">
|
<thead class="bg-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="font-weight-medium">SNO</th>
|
<th class="font-weight-medium">SNO</th>
|
||||||
|
|
||||||
<?php if (isset($getData)) { ?>
|
<?php if (isset($getData)) {
|
||||||
<?php if ($getData['client_id'] == '0' && $getData['policy_id'] == '0' && $getData['branch_id'] == '0' && ($getData['emp_code'] != "" || $getData['emp_name'] != "" || $getData['status'] != "")) { ?>
|
if ($getData['client_id'] == '0' && $getData['policy_id'] == '0' && $getData['branch_id'] == '0' && ($getData['emp_code'] != "" || $getData['emp_name'] != "" || $getData['status'] != "")) { ?>
|
||||||
<th class="font-weight-medium">Client/Branch</th>
|
<th class="font-weight-medium">Client/Branch</th>
|
||||||
<?php } ?>
|
<?php }
|
||||||
<?php } ?>
|
if ($getData['client_id'] != '0' && $getData['branch_id'] == '0') { ?>
|
||||||
|
|
||||||
<?php if (isset($getData)) { ?>
|
|
||||||
<?php if ($getData['client_id'] != '0' && $getData['branch_id'] == '0') { ?>
|
|
||||||
<th class="font-weight-medium">Branch</th>
|
<th class="font-weight-medium">Branch</th>
|
||||||
<?php } ?>
|
<?php } } ?>
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<th class="font-weight-medium">Name/code</th>
|
<th class="font-weight-medium">Name</th>
|
||||||
|
<th class="font-weight-medium">EMP Code</th>
|
||||||
|
<th class="font-weight-medium">Relationship</th>
|
||||||
|
<th class="font-weight-medium">Gender</th>
|
||||||
|
<th class="font-weight-medium">Date of Birth</th>
|
||||||
<th class="font-weight-medium">Policy name</th>
|
<th class="font-weight-medium">Policy name</th>
|
||||||
<th class="font-weight-medium">Insurer name</th>
|
<th class="font-weight-medium">Insurer name</th>
|
||||||
<th class="font-weight-medium">TPA ID</th>
|
<th class="font-weight-medium">TPA ID</th>
|
||||||
@ -86,19 +90,19 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><b><?php echo ($key + 1); ?></b></td>
|
<td><b><?php echo ($key + 1); ?></b></td>
|
||||||
|
|
||||||
<?php if (isset($getData)) { ?>
|
<?php if (isset($getData)) {
|
||||||
<?php if ($getData['client_id'] == '0' && $getData['policy_id'] == '0' && $getData['branch_id'] == '0' && ($getData['emp_code'] != "" || $getData['emp_name'] != "" || $getData['status'] != "")) { ?>
|
if ($getData['client_id'] == '0' && $getData['policy_id'] == '0' && $getData['branch_id'] == '0' && ($getData['emp_code'] != "" || $getData['emp_name'] != "" || $getData['status'] != "")) { ?>
|
||||||
<td><?php echo $employee['client_short_name'] . ' - ' . $employee['client_branch_name']; ?></td>
|
<td><?php echo $employee['client_short_name'] . ' - ' . $employee['client_branch_name']; ?></td>
|
||||||
<?php } ?>
|
<?php }
|
||||||
<?php } ?>
|
if ($getData['client_id'] != '0' && $getData['branch_id'] == '0') { ?>
|
||||||
|
|
||||||
<?php if (isset($getData)) { ?>
|
|
||||||
<?php if ($getData['client_id'] != '0' && $getData['branch_id'] == '0') { ?>
|
|
||||||
<td><?php echo $employee['client_branch_name']; ?></td>
|
<td><?php echo $employee['client_branch_name']; ?></td>
|
||||||
<?php } ?>
|
<?php } } ?>
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<td><?php echo $employee['name'] . ' (' . $employee['emp_code'] . ' - ' . $employee['relationship'] . ')'; ?></td>
|
<td><?php echo $employee['name']; ?></td>
|
||||||
|
<td><?php echo $employee['emp_code']; ?></td>
|
||||||
|
<td><?php echo $employee['relationship']; ?></td>
|
||||||
|
<td><?php echo $employee['gender']; ?></td>
|
||||||
|
<td><?php echo date('d/m/Y', strtotime($employee['dob'])); ?></td>
|
||||||
<td><?php echo isset($employee['policy_type']) ? $employee['policy_type'] : ''; ?> - <?php echo isset($employee['policy_no']) ? $employee['policy_no'] : ''; ?></td>
|
<td><?php echo isset($employee['policy_type']) ? $employee['policy_type'] : ''; ?> - <?php echo isset($employee['policy_no']) ? $employee['policy_no'] : ''; ?></td>
|
||||||
<td><?php echo $employee['insurer_short_name']; ?></td>
|
<td><?php echo $employee['insurer_short_name']; ?></td>
|
||||||
<td><?php echo $employee['tpa_id']; ?></td>
|
<td><?php echo $employee['tpa_id']; ?></td>
|
||||||
@ -132,24 +136,22 @@
|
|||||||
<td><?php $pro_rata_total += $employee['rata_premimum']; echo format_indian_number($employee['rata_premimum']); ?></td>
|
<td><?php $pro_rata_total += $employee['rata_premimum']; echo format_indian_number($employee['rata_premimum']); ?></td>
|
||||||
<td><?php $gst_total += $employee['gst']; echo format_indian_number($employee['gst']); ?></td>
|
<td><?php $gst_total += $employee['gst']; echo format_indian_number($employee['gst']); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php }
|
<?php } } ?>
|
||||||
} ?>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<th></th>
|
<th></th>
|
||||||
<?php if (isset($getData)) { ?>
|
<?php if (isset($getData)) {
|
||||||
<?php if ($getData['client_id'] == '0' && $getData['policy_id'] == '0' && $getData['branch_id'] == '0' && ($getData['emp_code'] != "" || $getData['emp_name'] != "" || $getData['status'] != "")) { ?>
|
if ($getData['client_id'] == '0' && $getData['policy_id'] == '0' && $getData['branch_id'] == '0' && ($getData['emp_code'] != "" || $getData['emp_name'] != "" || $getData['status'] != "")) { ?>
|
||||||
|
<th></th>
|
||||||
|
<?php }
|
||||||
|
if ($getData['client_id'] != '0' && $getData['branch_id'] == '0') { ?>
|
||||||
|
<th></th>
|
||||||
|
<?php } } ?>
|
||||||
|
<th></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
<?php } ?>
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<?php if (isset($getData)) { ?>
|
|
||||||
<?php if ($getData['client_id'] != '0' && $getData['branch_id'] == '0') { ?>
|
|
||||||
<th></th>
|
<th></th>
|
||||||
<?php } ?>
|
|
||||||
<?php } ?>
|
|
||||||
<th></th>
|
<th></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
@ -174,6 +176,7 @@
|
|||||||
|
|
||||||
if (ticketsTable.length) {
|
if (ticketsTable.length) {
|
||||||
ticketsTable.DataTable({
|
ticketsTable.DataTable({
|
||||||
|
scrollX: true,
|
||||||
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
||||||
"<'row'<'col-sm-12'tr>>" +
|
"<'row'<'col-sm-12'tr>>" +
|
||||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
||||||
@ -181,9 +184,10 @@
|
|||||||
extend: 'csv',
|
extend: 'csv',
|
||||||
text: 'CSV',
|
text: 'CSV',
|
||||||
title: 'Member-List',
|
title: 'Member-List',
|
||||||
exportOptions: {
|
},{
|
||||||
columns: ':not(:last-child)'
|
extend: 'excel',
|
||||||
},
|
text: 'Excel',
|
||||||
|
title: 'Member-List',
|
||||||
}],
|
}],
|
||||||
language: {
|
language: {
|
||||||
search: "_INPUT_",
|
search: "_INPUT_",
|
||||||
|
|||||||
@ -115,7 +115,6 @@ var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
|
|||||||
var client_branch_id = '<?= isset($getData) ? $getData['branch_id'] : '0' ?>';
|
var client_branch_id = '<?= isset($getData) ? $getData['branch_id'] : '0' ?>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
console.log("document loaded");
|
console.log("document loaded");
|
||||||
//fetchClientPolicies();
|
//fetchClientPolicies();
|
||||||
@ -127,7 +126,6 @@ $(window).on("load", function() {
|
|||||||
fetchClientPolicies();
|
fetchClientPolicies();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function fetchClientPolicies() {
|
function fetchClientPolicies() {
|
||||||
$('#loader').show();
|
$('#loader').show();
|
||||||
var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
|
var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
|
||||||
@ -204,7 +202,6 @@ function fetchClientPolicies() {
|
|||||||
$('#loader').hide();
|
$('#loader').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function appendClients(data) {
|
function appendClients(data) {
|
||||||
var clientID = <?= isset($getData) ? $getData['client_id'] : '0' ?>;
|
var clientID = <?= isset($getData) ? $getData['client_id'] : '0' ?>;
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
@ -219,7 +216,6 @@ function appendClients(data) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function appendBranch(data) {
|
function appendBranch(data) {
|
||||||
|
|
||||||
$('#branch_id').empty();
|
$('#branch_id').empty();
|
||||||
@ -239,7 +235,6 @@ function appendBranch(data) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function appendPolicies(data) {
|
function appendPolicies(data) {
|
||||||
|
|
||||||
$('#policies').empty();
|
$('#policies').empty();
|
||||||
@ -286,7 +281,6 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$('#branch_id').on('change', function() {
|
$('#branch_id').on('change', function() {
|
||||||
@ -321,7 +315,6 @@ function objectToQueryString(obj) {
|
|||||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function fetchEmpolyeeList(event) {
|
function fetchEmpolyeeList(event) {
|
||||||
event.preventDefault(); // Prevent default action
|
event.preventDefault(); // Prevent default action
|
||||||
|
|
||||||
|
|||||||
@ -53,7 +53,7 @@
|
|||||||
<!-- <td><?php echo isset($file['policy_name']) ? $file['policy_name'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?> - <?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?></td> -->
|
<!-- <td><?php echo isset($file['policy_name']) ? $file['policy_name'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?> - <?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?></td> -->
|
||||||
<td><?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?></td>
|
<td><?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?></td>
|
||||||
<td><?php echo $file['action'] ?></td>
|
<td><?php echo $file['action'] ?></td>
|
||||||
<td><?php echo fancy_date_time_format($file['created_at']) . ' by <strong>' . $file['first_name'] . '</strong>' ?>
|
<td><?php echo change_date_format($file['created_at'],'Y-m-d H:i:s', 'd M Y h:i a') . ' by <strong>' . $file['first_name'] . '</strong>' ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
@ -663,7 +663,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li> -->
|
</li> -->
|
||||||
|
|
||||||
<?php if((get_role_id() == 1 || get_role_id() == 5) && (in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()))) { ?>
|
<?php if((get_role_id() == 1 || get_role_id() == 5) && (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()))) { ?>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
|
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
|
||||||
|
|||||||
@ -278,6 +278,8 @@
|
|||||||
|
|
||||||
//SELECT2 document ready function
|
//SELECT2 document ready function
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
getURLParamsForReport()
|
||||||
addHTMLInput()
|
addHTMLInput()
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$("textarea.select2-search__field").attr('rows', '1');
|
$("textarea.select2-search__field").attr('rows', '1');
|
||||||
@ -537,6 +539,7 @@ function getPolicyData(input) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Salse team user list data
|
||||||
function selecSalsePerson(salse_person_ids) {
|
function selecSalsePerson(salse_person_ids) {
|
||||||
|
|
||||||
salse_person_ids = JSON.parse(salse_person_ids);
|
salse_person_ids = JSON.parse(salse_person_ids);
|
||||||
@ -588,7 +591,7 @@ function addHTMLInput() {
|
|||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
<label for="insurer">Insurer <span class="text-danger">*</span></label>
|
<label for="insurer">Insurer <span class="text-danger">*</span></label>
|
||||||
<select class="form-control" id="insurer_${increment}" name="insurer[]" required>
|
<select class="form-control" id="insurer_${increment}" name="insurer[]" onchange="insurerChange(this, ${increment})" required>
|
||||||
<option value="">Select Insurer</option>
|
<option value="">Select Insurer</option>
|
||||||
<?php if (isset($insurer)) { ?>
|
<?php if (isset($insurer)) { ?>
|
||||||
<?php foreach ($insurer as $value) { ?>
|
<?php foreach ($insurer as $value) { ?>
|
||||||
@ -602,7 +605,7 @@ function addHTMLInput() {
|
|||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
<label for="tpa">TPA <span class="text-danger">*</span></label>
|
<label for="tpa">TPA <span class="text-danger">*</span></label>
|
||||||
<select class="form-control" id="tpa_${increment}" name="tpa[]" required>
|
<select class="form-control" id="tpa_${increment}" name="tpa[]" onchange="tpaChange(this, ${increment})" required>
|
||||||
<option value="">Select TPA</option>
|
<option value="">Select TPA</option>
|
||||||
<?php if (isset($tpa)) { ?>
|
<?php if (isset($tpa)) { ?>
|
||||||
<?php foreach ($tpa as $value) { ?>
|
<?php foreach ($tpa as $value) { ?>
|
||||||
@ -715,7 +718,6 @@ function addHTMLInput() {
|
|||||||
increment++; // Increment after adding the input
|
increment++; // Increment after adding the input
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function removeHTMLInput(element)
|
function removeHTMLInput(element)
|
||||||
{
|
{
|
||||||
const container = document.getElementById('dynamic-form-container');
|
const container = document.getElementById('dynamic-form-container');
|
||||||
@ -849,21 +851,41 @@ $('#lead_type').change(function() {
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function insurerChange(input, unique_id) {
|
||||||
|
var lead_type = $('#lead_type').val()
|
||||||
|
|
||||||
|
if(lead_type == 2){
|
||||||
|
var val = $(input).val();
|
||||||
|
$('#proposed_insurer_'+unique_id).val(val).select2();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function tpaChange(input, unique_id) {
|
||||||
|
var lead_type = $('#lead_type').val()
|
||||||
|
|
||||||
|
if(lead_type == 2){
|
||||||
|
var val = $(input).val();
|
||||||
|
$('#proposed_tpa_'+unique_id).val(val).select2();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function getURLParamsForReport() {
|
function getURLParamsForReport() {
|
||||||
const params = new URLSearchParams(window.location.search);
|
|
||||||
const pt_id = params.get('pt_id') ?? 0;
|
|
||||||
|
|
||||||
if (pt_id != 0) {
|
const params = new URLSearchParams(window.location.search);
|
||||||
|
const lead_id = params.get('lead_id') ?? 0;
|
||||||
|
|
||||||
|
if (lead_id != 0) {
|
||||||
hide_list_show_add();
|
hide_list_show_add();
|
||||||
setTimeout(() =>
|
setTimeout(() =>
|
||||||
getPolicyTransactionDataForEdit(pt_id),
|
getLeadsDataForEdit(lead_id),
|
||||||
1500); // Reduced timeout
|
1500); // Reduced timeout
|
||||||
} else {
|
} else {
|
||||||
show_list_hide_add();
|
show_list_hide_add();
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('pt_id', pt_id); // Retain the log if necessary
|
console.log('lead_id', lead_id); // Retain the log if necessary
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -98,6 +98,14 @@ table.dataTable tbody td {
|
|||||||
<a class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>" onclick="getLeadsDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
<a class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>" onclick="getLeadsDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
||||||
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||||
</a>
|
</a>
|
||||||
|
<a href="<?= base_url('/rfq/list/').$row['id'] . '/' . 1; ?>" class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>">
|
||||||
|
<i class="mdi mdi-note-text mr-2 text-muted font-18 vertical-middle"></i>RFQ
|
||||||
|
</a>
|
||||||
|
<?php if($row['qcr_count'] > 0) { ?>
|
||||||
|
<a href="<?= base_url('/rfq/list/').$row['id'] . '/' . 2; ?>" class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>">
|
||||||
|
<i class="mdi mdi-note-text mr-2 text-muted font-18 vertical-middle"></i>QCR
|
||||||
|
</a>
|
||||||
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@ -604,53 +604,53 @@ $(document).on('change', 'input[type="checkbox"][name="co_share_type[]"]', funct
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('input', '[name="cgst[]"]', function() {
|
// $(document).on('input', '[name="cgst[]"]', function() {
|
||||||
|
|
||||||
let val = $(this).val();
|
// let val = $(this).val();
|
||||||
|
|
||||||
if(val){
|
// if(val){
|
||||||
$('[name="igst[]"]').val(0);
|
// $('[name="igst[]"]').val(0);
|
||||||
$('[name="cgst[]"]').val(val);
|
// $('[name="cgst[]"]').val(val);
|
||||||
$('[name="sgst[]"]').val(val);
|
// $('[name="sgst[]"]').val(val);
|
||||||
|
|
||||||
}else{
|
// }else{
|
||||||
$('[name="igst[]"]').val('');
|
// $('[name="igst[]"]').val('');
|
||||||
$('[name="sgst[]"]').val('');
|
// $('[name="sgst[]"]').val('');
|
||||||
}
|
// }
|
||||||
console.log('cgst value', val);
|
// console.log('cgst value', val);
|
||||||
});
|
// });
|
||||||
|
|
||||||
$(document).on('input', '[name="sgst[]"]', function() {
|
// $(document).on('input', '[name="sgst[]"]', function() {
|
||||||
|
|
||||||
let val = $(this).val();
|
// let val = $(this).val();
|
||||||
|
|
||||||
if(val){
|
// if(val){
|
||||||
$('[name="igst[]"]').val(0);
|
// $('[name="igst[]"]').val(0);
|
||||||
$('[name="sgst[]"]').val(val)
|
// $('[name="sgst[]"]').val(val)
|
||||||
$('[name="cgst[]"]').val(val)
|
// $('[name="cgst[]"]').val(val)
|
||||||
}else{
|
// }else{
|
||||||
$('[name="igst[]"]').val('');
|
// $('[name="igst[]"]').val('');
|
||||||
$('[name="sgst[]"]').val('')
|
// $('[name="sgst[]"]').val('')
|
||||||
$('[name="cgst[]"]').val('')
|
// $('[name="cgst[]"]').val('')
|
||||||
}
|
// }
|
||||||
console.log('cgst value', val);
|
// console.log('cgst value', val);
|
||||||
});
|
// });
|
||||||
|
|
||||||
$(document).on('input', '[name="igst[]"]', function() {
|
// $(document).on('input', '[name="igst[]"]', function() {
|
||||||
|
|
||||||
let val = $(this).val();
|
// let val = $(this).val();
|
||||||
|
|
||||||
if(val){
|
// if(val){
|
||||||
$('[name="cgst[]"], [name="sgst[]"]').val(0);
|
// $('[name="cgst[]"], [name="sgst[]"]').val(0);
|
||||||
$('[name="igst[]"]').val(val)
|
// $('[name="igst[]"]').val(val)
|
||||||
}else{
|
// }else{
|
||||||
$('[name="cgst[]"], [name="sgst[]"]').val('');
|
// $('[name="cgst[]"], [name="sgst[]"]').val('');
|
||||||
$('[name="igst[]"]').val('')
|
// $('[name="igst[]"]').val('')
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
console.log('igst value', val);
|
// console.log('igst value', val);
|
||||||
});
|
// });
|
||||||
|
|
||||||
$(document).on('click', '[name="co_share_type[]"]', function() {
|
$(document).on('click', '[name="co_share_type[]"]', function() {
|
||||||
|
|
||||||
@ -924,6 +924,30 @@ function getPolicyTransactionDataForEndorsementEdit(input){
|
|||||||
}
|
}
|
||||||
//end edit function
|
//end edit function
|
||||||
|
|
||||||
|
function checkAndDistributeTax(input)
|
||||||
|
{
|
||||||
|
const event = window.event;
|
||||||
|
// console.log("Event type:", event.type);
|
||||||
|
// console.log("Event target:", event.target);
|
||||||
|
console.log("Event id:", event.target.id);
|
||||||
|
|
||||||
|
let cgst = parseFloat($('#cgst_' + input).val());
|
||||||
|
let sgst = parseFloat($('#sgst_' + input).val());
|
||||||
|
let igst = parseFloat($('#igst_' + input).val());
|
||||||
|
if(((event.target.id).startsWith('cgst') || (event.target.id).startsWith('sgst') ))
|
||||||
|
{
|
||||||
|
if(cgst !== 0) { $('#sgst_' + input).val(cgst.toFixed(2)); }
|
||||||
|
else if(sgst !== 0) { $('#cgst_' + input).val(sgst.toFixed(2)); }
|
||||||
|
|
||||||
|
$('#igst_' + input).val(0.00);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$('#cgst_' + input).val(0.00);
|
||||||
|
$('#sgst_' + input).val(0.00);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function amountCalculation(input) {
|
function amountCalculation(input) {
|
||||||
|
|
||||||
// console.log(input);
|
// console.log(input);
|
||||||
@ -945,6 +969,7 @@ function amountCalculation(input) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let cop = parseFloat($('#co_premium_' + input).val()) || 0;
|
let cop = parseFloat($('#co_premium_' + input).val()) || 0;
|
||||||
|
checkAndDistributeTax(input);
|
||||||
let cgst = parseFloat($('#cgst_' + input).val()) || 0;
|
let cgst = parseFloat($('#cgst_' + input).val()) || 0;
|
||||||
let sgst = parseFloat($('#sgst_' + input).val()) || 0;
|
let sgst = parseFloat($('#sgst_' + input).val()) || 0;
|
||||||
let igst = parseFloat($('#igst_' + input).val()) || 0;
|
let igst = parseFloat($('#igst_' + input).val()) || 0;
|
||||||
|
|||||||
@ -748,14 +748,14 @@
|
|||||||
<!-- end form row -->
|
<!-- end form row -->
|
||||||
|
|
||||||
<!-- Client form content modal-->
|
<!-- Client form content modal-->
|
||||||
<div class="modal fade" id="upload_enrollment_model" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="false">
|
<div class="modal fade" id="upload_enrollment_model" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="false" data-backdrop="static" data-keyboard="false">
|
||||||
<div class="modal-dialog modal-dialog-centered">
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h4 class="modal-title" id="myCenterModalLabel">Add New Client</h4>
|
<h4 class="modal-title" id="myCenterModalLabel">Add New Client</h4>
|
||||||
<button type="button" id="close_btn" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
<button type="button" id="close_btn" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body" style="overflow-y: auto;height: 90vh;">
|
||||||
<form class="parsley-examples" method="post" id="client_form" enctype="multipart/form-data">
|
<form class="parsley-examples" method="post" id="client_form" enctype="multipart/form-data">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
||||||
@ -799,7 +799,7 @@
|
|||||||
|
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label for="aadhar">Aadhar<span class="text-danger">*</span></label>
|
<label for="aadhar">Aadhar<span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="aadhar" placeholder="Enter PAN No" name="aadhar">
|
<input type="text" class="form-control" id="aadhar" placeholder="Enter Aadher No" name="aadhar">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -858,7 +858,7 @@
|
|||||||
</div><!-- /.modal-dialog -->
|
</div><!-- /.modal-dialog -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Client form content modal-->
|
<!-- Vehicle form content modal-->
|
||||||
<div class="modal fade" id="vehicle_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="false">
|
<div class="modal fade" id="vehicle_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="false">
|
||||||
<div class="modal-dialog modal-dialog-centered">
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
@ -998,11 +998,31 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
var team_id = [];
|
var team_id = [];
|
||||||
|
let isClientFormSubmitting = false;
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
// hidePermiumDetailsBasedOnTheTeam()
|
// hidePermiumDetailsBasedOnTheTeam()
|
||||||
|
|
||||||
|
// $('#upload_enrollment_model').modal({
|
||||||
|
// backdrop: 'static',
|
||||||
|
// keyboard: false
|
||||||
|
// })
|
||||||
|
|
||||||
|
$('#upload_enrollment_model').on('hide.bs.modal', function (e) {
|
||||||
|
if (!isClientFormSubmitting) {
|
||||||
|
// Ask for confirmation
|
||||||
|
if (confirm("Are you sure you want to close? Unsaved changes will be lost.")) {
|
||||||
|
// If confirmed, reset the form
|
||||||
|
$('#client_form')[0].reset();
|
||||||
|
} else {
|
||||||
|
// If not confirmed, prevent the modal from closing
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
team_id = <?php echo json_encode(user_team()); ?>;
|
team_id = <?php echo json_encode(user_team()); ?>;
|
||||||
console.log('team_id', team_id);
|
console.log('team_id', team_id);
|
||||||
|
|
||||||
@ -1203,53 +1223,53 @@ $(document).on('change', 'input[type="checkbox"][name="co_share_type[]"]', funct
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('input', '[name="cgst[]"]', function() {
|
// $(document).on('input', '[name="cgst[]"]', function() {
|
||||||
|
|
||||||
let val = $(this).val();
|
// let val = $(this).val();
|
||||||
|
|
||||||
if(val){
|
// if(val){
|
||||||
$('[name="igst[]"]').val(0);
|
// $('[name="igst[]"]').val(0);
|
||||||
$('[name="cgst[]"]').val(val);
|
// $('[name="cgst[]"]').val(val);
|
||||||
$('[name="sgst[]"]').val(val);
|
// $('[name="sgst[]"]').val(val);
|
||||||
|
|
||||||
}else{
|
// }else{
|
||||||
$('[name="igst[]"]').val('');
|
// $('[name="igst[]"]').val('');
|
||||||
$('[name="sgst[]"]').val('');
|
// $('[name="sgst[]"]').val('');
|
||||||
}
|
// }
|
||||||
// console.log('cgst value', val);
|
// // console.log('cgst value', val);
|
||||||
});
|
// });
|
||||||
|
|
||||||
$(document).on('input', '[name="sgst[]"]', function() {
|
// $(document).on('input', '[name="sgst[]"]', function() {
|
||||||
|
|
||||||
let val = $(this).val();
|
// let val = $(this).val();
|
||||||
|
|
||||||
if(val){
|
// if(val){
|
||||||
$('[name="igst[]"]').val(0);
|
// $('[name="igst[]"]').val(0);
|
||||||
$('[name="sgst[]"]').val(val)
|
// $('[name="sgst[]"]').val(val)
|
||||||
$('[name="cgst[]"]').val(val)
|
// $('[name="cgst[]"]').val(val)
|
||||||
}else{
|
// }else{
|
||||||
$('[name="igst[]"]').val('');
|
// $('[name="igst[]"]').val('');
|
||||||
$('[name="sgst[]"]').val('')
|
// $('[name="sgst[]"]').val('')
|
||||||
$('[name="cgst[]"]').val('')
|
// $('[name="cgst[]"]').val('')
|
||||||
}
|
// }
|
||||||
// console.log('cgst value', val);
|
// // console.log('cgst value', val);
|
||||||
});
|
// });
|
||||||
|
|
||||||
$(document).on('input', '[name="igst[]"]', function() {
|
// $(document).on('input', '[name="igst[]"]', function() {
|
||||||
|
|
||||||
let val = $(this).val();
|
// let val = $(this).val();
|
||||||
|
|
||||||
if(val){
|
// if(val){
|
||||||
$('[name="cgst[]"], [name="sgst[]"]').val(0);
|
// $('[name="cgst[]"], [name="sgst[]"]').val(0);
|
||||||
$('[name="igst[]"]').val(val)
|
// $('[name="igst[]"]').val(val)
|
||||||
}else{
|
// }else{
|
||||||
$('[name="cgst[]"], [name="sgst[]"]').val('');
|
// $('[name="cgst[]"], [name="sgst[]"]').val('');
|
||||||
$('[name="igst[]"]').val('')
|
// $('[name="igst[]"]').val('')
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
// console.log('igst value', val);
|
// // console.log('igst value', val);
|
||||||
});
|
// });
|
||||||
|
|
||||||
$(document).on('click', '[name="co_share_type[]"]', function() {
|
$(document).on('click', '[name="co_share_type[]"]', function() {
|
||||||
|
|
||||||
@ -1595,8 +1615,8 @@ function getPolicyTransactionDataForEdit(input) {
|
|||||||
$('#policy_start_date').prop('required', true);
|
$('#policy_start_date').prop('required', true);
|
||||||
$('#policy_end_date').prop('required', true);
|
$('#policy_end_date').prop('required', true);
|
||||||
// $('#tpa').prop('required', true);
|
// $('#tpa').prop('required', true);
|
||||||
$('#emp_count').prop('required', true);
|
// $('#emp_count').prop('required', true);
|
||||||
$('#dependent_count').prop('required', true);
|
// $('#dependent_count').prop('required', true);
|
||||||
$('.follow_insurer').prop('required', true);
|
$('.follow_insurer').prop('required', true);
|
||||||
} else {
|
} else {
|
||||||
$('#sales_row').hide();
|
$('#sales_row').hide();
|
||||||
@ -1605,8 +1625,8 @@ function getPolicyTransactionDataForEdit(input) {
|
|||||||
$('#policy_start_date').prop('required', false);
|
$('#policy_start_date').prop('required', false);
|
||||||
$('#policy_end_date').prop('required', false);
|
$('#policy_end_date').prop('required', false);
|
||||||
// $('#tpa').prop('required', false);
|
// $('#tpa').prop('required', false);
|
||||||
$('#emp_count').prop('required', false);
|
// $('#emp_count').prop('required', false);
|
||||||
$('#dependent_count').prop('required', false);
|
// $('#dependent_count').prop('required', false);
|
||||||
$('.follow_insurer').prop('required', false);
|
$('.follow_insurer').prop('required', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1650,9 +1670,33 @@ function getPolicyTransactionDataForEdit(input) {
|
|||||||
checkInvoiceStatusToHideSubmitBtn(id)
|
checkInvoiceStatusToHideSubmitBtn(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkAndDistributeTax(input)
|
||||||
|
{
|
||||||
|
const event = window.event;
|
||||||
|
// console.log("Event type:", event.type);
|
||||||
|
// console.log("Event target:", event.target);
|
||||||
|
console.log("Event id:", event.target.id);
|
||||||
|
|
||||||
|
let cgst = parseFloat($('#cgst_' + input).val());
|
||||||
|
let sgst = parseFloat($('#sgst_' + input).val());
|
||||||
|
let igst = parseFloat($('#igst_' + input).val());
|
||||||
|
if(((event.target.id).startsWith('cgst') || (event.target.id).startsWith('sgst') ))
|
||||||
|
{
|
||||||
|
if(cgst !== 0) { $('#sgst_' + input).val(cgst.toFixed(2)); }
|
||||||
|
else if(sgst !== 0) { $('#cgst_' + input).val(sgst.toFixed(2)); }
|
||||||
|
|
||||||
|
$('#igst_' + input).val(0.00);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$('#cgst_' + input).val(0.00);
|
||||||
|
$('#sgst_' + input).val(0.00);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function amountCalculation(input) {
|
function amountCalculation(input) {
|
||||||
|
|
||||||
// console.log(input);
|
console.log('amountCalculation - ' + input);
|
||||||
let selectedOption = $('#policy_type_id').find('option:selected');
|
let selectedOption = $('#policy_type_id').find('option:selected');
|
||||||
let bap = selectedOption.data('bap');
|
let bap = selectedOption.data('bap');
|
||||||
|
|
||||||
@ -1671,9 +1715,12 @@ function amountCalculation(input) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let cop = parseFloat($('#co_premium_' + input).val()) || 0;
|
let cop = parseFloat($('#co_premium_' + input).val()) || 0;
|
||||||
|
checkAndDistributeTax(input);
|
||||||
let cgst = parseFloat($('#cgst_' + input).val()) || 0;
|
let cgst = parseFloat($('#cgst_' + input).val()) || 0;
|
||||||
let sgst = parseFloat($('#sgst_' + input).val()) || 0;
|
let sgst = parseFloat($('#sgst_' + input).val()) || 0;
|
||||||
let igst = parseFloat($('#igst_' + input).val()) || 0;
|
let igst = parseFloat($('#igst_' + input).val()) || 0;
|
||||||
|
|
||||||
|
|
||||||
let stamp_duty_amt = parseFloat($('#stamp_duty_' + input).val()) || 0;
|
let stamp_duty_amt = parseFloat($('#stamp_duty_' + input).val()) || 0;
|
||||||
let agreed_amount = parseFloat($('#agreed_amount_' + input).val()) || 0;
|
let agreed_amount = parseFloat($('#agreed_amount_' + input).val()) || 0;
|
||||||
|
|
||||||
@ -1697,7 +1744,10 @@ function amountCalculation(input) {
|
|||||||
// Calculate GST percentage
|
// Calculate GST percentage
|
||||||
let gst_per = igst;
|
let gst_per = igst;
|
||||||
if (igst === 0) {
|
if (igst === 0) {
|
||||||
gst_per = cgst + sgst;
|
console.log('called' + cgst + sgst);
|
||||||
|
gst_per = parseFloat(cgst) + parseFloat(sgst);
|
||||||
|
// gst_per = (cgst) + (sgst);
|
||||||
|
console.log(gst_per);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the total premium (Base + TP + Co-Premium)
|
// Calculate the total premium (Base + TP + Co-Premium)
|
||||||
@ -2658,7 +2708,7 @@ $("#inception_form_id").submit(function(event) {
|
|||||||
$("#client_form").submit(function(event) {
|
$("#client_form").submit(function(event) {
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
isClientFormSubmitting = true;
|
||||||
var isValid = $('#client_form').parsley().validate();
|
var isValid = $('#client_form').parsley().validate();
|
||||||
if (!isValid) {
|
if (!isValid) {
|
||||||
console.log('Form is Empty', 'Warning');
|
console.log('Form is Empty', 'Warning');
|
||||||
@ -2703,7 +2753,9 @@ $("#client_form").submit(function(event) {
|
|||||||
toastr.error(res.message, 'Error');
|
toastr.error(res.message, 'Error');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('#client_form')[0].reset();
|
||||||
$('.close').click();
|
$('.close').click();
|
||||||
|
isClientFormSubmitting = false;
|
||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
@ -2771,6 +2823,7 @@ $("#vehicle_form").submit(function(event) {
|
|||||||
toastr.error(res.message, 'Error');
|
toastr.error(res.message, 'Error');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('#vehicle_form')[0].reset();
|
||||||
$('.close').click();
|
$('.close').click();
|
||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
@ -2830,6 +2883,7 @@ $("#CDMasterForm").submit(function(event) {
|
|||||||
toastr.error(res.message, 'Error');
|
toastr.error(res.message, 'Error');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('#CDMasterForm')[0].reset();
|
||||||
$('.close').click();
|
$('.close').click();
|
||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
@ -3024,8 +3078,8 @@ $('#policy_status').change(function(){
|
|||||||
$('#policy_start_date').prop('required', true);
|
$('#policy_start_date').prop('required', true);
|
||||||
$('#policy_end_date').prop('required', true);
|
$('#policy_end_date').prop('required', true);
|
||||||
// $('#tpa').prop('required', true);
|
// $('#tpa').prop('required', true);
|
||||||
$('#emp_count').prop('required', true);
|
// $('#emp_count').prop('required', true);
|
||||||
$('#dependent_count').prop('required', true);
|
// $('#dependent_count').prop('required', true);
|
||||||
$('.follow_insurer').prop('required', true);
|
$('.follow_insurer').prop('required', true);
|
||||||
|
|
||||||
if(policy_type_id == 3 || policy_type_id == 4 || policy_type_id == 5){
|
if(policy_type_id == 3 || policy_type_id == 4 || policy_type_id == 5){
|
||||||
@ -3053,8 +3107,8 @@ $('#policy_status').change(function(){
|
|||||||
$('#policy_start_date').prop('required', false)
|
$('#policy_start_date').prop('required', false)
|
||||||
$('#policy_end_date').prop('required', false)
|
$('#policy_end_date').prop('required', false)
|
||||||
// $('#tpa').prop('required', false)
|
// $('#tpa').prop('required', false)
|
||||||
$('#emp_count').prop('required', false)
|
// $('#emp_count').prop('required', false)
|
||||||
$('#dependent_count').prop('required', false)
|
// $('#dependent_count').prop('required', false)
|
||||||
$('.follow_insurer').prop('required', false)
|
$('.follow_insurer').prop('required', false)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3125,6 +3179,12 @@ $('#policy_no').change(function(){
|
|||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
|
|
||||||
|
$('.close').on('click', function(){
|
||||||
|
$('#client_form')[0].reset();
|
||||||
|
$('#vehicle_form')[0].reset();
|
||||||
|
$('#CDMasterForm')[0].reset();
|
||||||
|
});
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
var insurerCount = 0;
|
var insurerCount = 0;
|
||||||
|
|||||||
@ -116,14 +116,18 @@
|
|||||||
var PrimaryKey = $('#tpa_General_PrimaryKey').val();
|
var PrimaryKey = $('#tpa_General_PrimaryKey').val();
|
||||||
var form_action = '';
|
var form_action = '';
|
||||||
|
|
||||||
|
console.log('tpa_General_PrimaryKey', PrimaryKey);
|
||||||
|
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
|
|
||||||
if (PrimaryKey === '') {
|
if (PrimaryKey === "") {
|
||||||
form_action = '<?= base_url("master/tpa/createpost"); ?>';
|
form_action = '<?= base_url("master/tpa/createpost"); ?>';
|
||||||
} else {
|
} else {
|
||||||
form_action = '<?= base_url("master/tpa/edit"); ?>';
|
form_action = '<?= base_url("master/tpa/edit"); ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('tpa_General_form_action', form_action);
|
||||||
|
|
||||||
var formData = new FormData($('#tpa_general_form')[0]);
|
var formData = new FormData($('#tpa_general_form')[0]);
|
||||||
var OptionsHTML1 = '';
|
var OptionsHTML1 = '';
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
@ -138,7 +142,6 @@
|
|||||||
success: function(res) {
|
success: function(res) {
|
||||||
|
|
||||||
if($('#tpa_General_PrimaryKey').val() == ""){
|
if($('#tpa_General_PrimaryKey').val() == ""){
|
||||||
|
|
||||||
window.location.href = '<?= base_url("master/tpa/list/"); ?>' + res.data.id;
|
window.location.href = '<?= base_url("master/tpa/list/"); ?>' + res.data.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +152,6 @@
|
|||||||
|
|
||||||
console.log(res);
|
console.log(res);
|
||||||
$('#tpa_id').val(res.data.id);
|
$('#tpa_id').val(res.data.id);
|
||||||
$('#tpa_General_PrimaryKey').val(res.data.id);
|
|
||||||
$('#tpa_id_branch').val(res.data.id);
|
$('#tpa_id_branch').val(res.data.id);
|
||||||
$('#tpa_branch_contacts_id').click();
|
$('#tpa_branch_contacts_id').click();
|
||||||
|
|
||||||
@ -157,14 +159,6 @@
|
|||||||
var message = "TPA General Info";
|
var message = "TPA General Info";
|
||||||
toastr.success(message, 'Success');
|
toastr.success(message, 'Success');
|
||||||
|
|
||||||
// $.toast({
|
|
||||||
// text: 'Insurer General Info',
|
|
||||||
// heading: "Submitted Sucessfully",
|
|
||||||
// position: 'top-right',
|
|
||||||
// icon: 'success',
|
|
||||||
// bgColor: !1,
|
|
||||||
// });
|
|
||||||
|
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
@ -172,7 +166,8 @@
|
|||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
console.log('Something Wrong!', 'warning'); }, 1000);
|
console.log('Something Wrong!', 'warning');
|
||||||
|
}, 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -228,7 +223,6 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function PreviewImage3() {
|
function PreviewImage3() {
|
||||||
var oFReader = new FileReader();
|
var oFReader = new FileReader();
|
||||||
oFReader.readAsDataURL(document.getElementById("bc").files[0]);
|
oFReader.readAsDataURL(document.getElementById("bc").files[0]);
|
||||||
@ -238,8 +232,6 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#preview').click(function() {
|
$('#preview').click(function() {
|
||||||
var ecardContent = $('#ecard_content').val();
|
var ecardContent = $('#ecard_content').val();
|
||||||
$('#Preview_data').html(ecardContent);
|
$('#Preview_data').html(ecardContent);
|
||||||
|
|||||||
3007
app/Views/view_rfq.php
Normal file
3007
app/Views/view_rfq.php
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Loading…
Reference in New Issue
Block a user