diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index 933ef8aa..ede8146b 100755
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -18,6 +18,7 @@ $routes->get("update-policy-terms-for-corrections", "ClientController::updatePol
$routes->get("update_rack_rate_json", "ClientController::updateRackRateJson");
$routes->get("updatajson", "EmpDataServiceController::updatajson");
$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("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("getLevelContects", "LeadsController::getLevelContects");
});
@@ -343,8 +345,17 @@ $routes->group("leads", ["filter" => "authMVC"], function ($routes) {
$routes->get("list", "LeadsController::viewLeadsList");
$routes->post("create", "LeadsController::createLead");
$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->post('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->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/new_gdrive_token', 'GoogleDriveController::generateNewGoogleDriveAccessToken');
@@ -379,6 +391,8 @@ $routes->group("/api", ["filter" => "authJWT"], function ($routes) {
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
+ $routes->post("getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
+
$routes->post("storeFireBase", "EmployeeRestController::storeFireBase");
$routes->post("saveMpin", "RestAuthenticationController::saveMpin");
$routes->post("updateMpin", "RestAuthenticationController::updateMpin");
diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php
index 020ff116..c6b3f152 100755
--- a/app/Controllers/ClientController.php
+++ b/app/Controllers/ClientController.php
@@ -2105,6 +2105,7 @@ class ClientController extends AdminController
$data['airambulance'] = str_replace(',', '', $this->request->getPost("airambulance"));
$data['familytransportationbenefit'] = str_replace(',', '', $this->request->getPost("familytransportationbenefit"));
$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['congenitaldiseasesexternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesexternal"));
diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php
index 20353e2f..5cefd249 100755
--- a/app/Controllers/EmpDataServiceController.php
+++ b/app/Controllers/EmpDataServiceController.php
@@ -312,22 +312,6 @@ class EmpDataServiceController extends BaseController
'db_column_name' => 'total'
]
];
-
- // 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'){
@@ -380,7 +364,7 @@ class EmpDataServiceController extends BaseController
[
'column_index' => 9,
'column_name' => 'DATE OF COVERAGE',
- 'db_column_name' => 'date_of_coverage'
+ 'db_column_name' => 'date_coverage'
],
[
'column_index' => 10,
@@ -438,6 +422,22 @@ class EmpDataServiceController extends BaseController
'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);
@@ -1253,20 +1253,26 @@ class EmpDataServiceController extends BaseController
$insurer_or_tpa = $file['insurer_or_tpa'];
if ($insurer_or_tpa == 'tpa') {
-
$id = 'tpa_id';
} else if ($insurer_or_tpa == 'insurer') {
-
$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'];
$excel_data = $this->readExcelFileToArray($file_name_with_path);
$excel_header = $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) {
if($excel_header[$key] != $value){
@@ -1280,49 +1286,50 @@ class EmpDataServiceController extends BaseController
$this->setPullNotification($file_data);
$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);
- $employee_data = $this->employeePolicyModel
- ->select('
-
- employee_polices.id as emp_policy_id,
- 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
- ')
+ $employee_data = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($ref_data, 1);
- ->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();
+ // ->select('
+
+ // employee_polices.id as emp_policy_id,
+ // 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')
+ // ->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;
$status = 'in-progress';
- if ($excel_data_count < $emp_data_count) {
+ if ($excel_data_count < $emp_data_count) {
$status = 'in-progress-partially';
$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]);
}
-
if ($emp_data_count < $excel_data_count) {
$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][] = [
'row' => $key,
'column' => 14,
- 'db_data' => $emp_value['days'],
+ 'db_data' => $emp_value['no_of_days'],
'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][] = [
'row' => $key,
'column' => 18,
- 'db_data' => $emp_value['rata_premimum'],
+ 'db_data' => $emp_value['pro_rata_premium'],
'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'];
}
diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php
index 1df4dc16..569f1c65 100755
--- a/app/Controllers/EmployeeController.php
+++ b/app/Controllers/EmployeeController.php
@@ -279,7 +279,7 @@ class EmployeeController extends AdminController
$data['fileList'] = $this->fileModel
->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.first_name',
'c.short_name',
@@ -301,9 +301,10 @@ class EmployeeController extends AdminController
->join('client_branch cb', 'files.client_branch_id = cb.id', 'left')
->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')
- ->where('files.created_by', get_session_userid())
+ // ->where('files.created_by', get_session_userid())
->orderBy('files.created_at', 'desc')
- ->findAll();
+ ->limit(100)
+ ->find();
// dd($data['fileList']);
$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('clients', 'clients.id = client_policy.client_id')
->orderBy('batch_files.id', 'desc')
- ->findAll();
+ ->limit(100)
+ ->find();
// 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']]);
// 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'];
session()->setFlashdata('success1', $message);
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'],
'{BACK_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['back_card'],
'{EMP_ID}' => $value['emp_code'],
+ '{SI_AMT}' => $value['basic_cover_si'],
'{CORPORATE_NAME}' => $value['client_name'],
'{AGE}' => $value['emp_age'],
'{TPA_NAME}' => $value['tpa_name'],
@@ -1304,10 +1307,9 @@ class EmployeeController extends AdminController
}
}
+ // Preview E-Card Template function
public function previewTemplate($id = null)
{
-
-
$value = [
'tpa_id' => 'TPA12345',
'name' => 'John Doe',
@@ -1324,10 +1326,10 @@ class EmployeeController extends AdminController
'emp_age' => 39,
'tpa_name' => 'Example TPA',
'insurer_branch_city' => 'New York',
- 'relationship' => 'Self'
+ 'relationship' => 'Self',
+ 'basic_cover_si' => '5,00,000',
];
-
$tpa_id = $this->TPAModel->where('id', $id)->first();
$template_data_path = WRITEPATH . 'e_card_template/';
@@ -1354,6 +1356,7 @@ class EmployeeController extends AdminController
'{POLICY_NO}' => $value['policy_no'],
'{INSURER_NAME}' => strtoupper($value['insurer_name']),
'{EMP_ID}' => $value['emp_code'],
+ '{SI_AMT}' => $value['basic_cover_si'],
'{CORPORATE_NAME}' => $value['client_name'],
'{AGE}' => $value['emp_age'],
'{TPA_NAME}' => $value['tpa_name'],
@@ -1399,6 +1402,8 @@ class EmployeeController extends AdminController
$error_data = json_decode($file['error_data']);
+ // dd($error_data);
+
$file_name_with_path = WRITEPATH . "/uploads/import_excel/" . $file['file_name'];
if (!file_exists($file_name_with_path)) {
diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php
index c13eb6ba..0c43d7cd 100755
--- a/app/Controllers/EmployeeRestController.php
+++ b/app/Controllers/EmployeeRestController.php
@@ -309,6 +309,7 @@ class EmployeeRestController extends AdminController
$data['client_policy_id']= $client_policy_id;
$data['basic_cover_si']= $basic_cover_si;
$data['status']= 'draft';
+ $data['date_coverage'] = $this->getEmployeeCoverageDate($emp_code, $client_policy_id);
$this->employeePolicyModel->insert($data);
@@ -320,10 +321,7 @@ class EmployeeRestController extends AdminController
public function updatePremiumAmount($client_policy_id , $emp_code , $client_branch_id)
{
$response = $this->calculatePremium($client_policy_id , $emp_code , null , $client_branch_id);
- // echo '
';
- // print_r($response);
- // echo '
';
- // die();
+
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){
@@ -432,7 +469,6 @@ class EmployeeRestController extends AdminController
}
- // Get the RelationShip list
public function createOrUpdateEmployeePolicySiAmount()
{
@@ -632,11 +668,6 @@ class EmployeeRestController extends AdminController
}
-
-
-
-
-
// Upload the Employee Detail in DB by Sheet Data
public function employeeUpload()
{
@@ -672,7 +703,7 @@ class EmployeeRestController extends AdminController
$file_name_with_path = WRITEPATH."/uploads/excel/".$filename;
//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]);
$empServiceController = new EmployeeServiceController();
@@ -803,7 +834,8 @@ class EmployeeRestController extends AdminController
'band'=> $extra['10'][$index],
'basic_pay'=> $extra['11'][$index],
'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;
@@ -840,6 +872,8 @@ class EmployeeRestController extends AdminController
$count = 0;
for ($a=0; $a employeeModel->checkExistingEmployee($dataToInsert[$a],$client_branch_id);
$emp_id =0;
@@ -891,6 +925,7 @@ class EmployeeRestController extends AdminController
'employee_id'=>$emp_id,
'client_policy_id'=>$policy_id,
'status'=> 'draft',
+ 'date_coverage' => $date_coverage,
'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);
}else{
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()
{
+
$postData = json_decode($this->request->getBody(), true);
$client_policy_id = $postData['client_policy_id'];
sort($client_policy_id);
@@ -1876,19 +1913,25 @@ class EmployeeRestController extends AdminController
$array_list = [];
foreach ($client_policy_id as $key => $value)
{
- foreach ($empData as $empDataKey => $empDataValue)
+ $policy = $this->clientPolicyModel->where('id',$value)->where('open_for_enrollment',1)->find();
+ if($policy)
{
- $this->employeePolicyModel->where('client_policy_id', $value )
- ->where('is_active', 1 )
- ->where('employee_id', $empDataValue['id'] )
- ->set(array('status'=>'enrolled'))
- ->update();
+ foreach ($empData as $empDataKey => $empDataValue)
+ {
+ $this->employeePolicyModel->where('client_policy_id', $value )
+ ->where('is_active', 1 )
+ ->where('employee_id', $empDataValue['id'] )
+ ->set(array('status'=>'enrolled'))
+ ->update();
+ }
+
+ $find = $this->employeeModel->getEmpFamilybyEmpCode(client_policy_id: $value,emp_code: $emp_code,client_id: $client_id,emp_status:['draft','enrolled'],policy_status:['draft','enrolled']);
+ if(count($find) > 0){
+ $array_list[] = $find;
+ }
+
}
- $find = $this->employeeModel->getEmpFamilybyEmpCode(client_policy_id: $value,emp_code: $emp_code,client_id: $client_id,emp_status:['draft','enrolled'],policy_status:['draft','enrolled']);
- if(count($find) > 0){
- $array_list[] = $find;
- }
}
$notification = $this->notificationModel->where('client_id' ,$client_id)->where('template_name', 'member_review_and_summary_mail')->first();
diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php
index ef99ee20..f697a04a 100755
--- a/app/Controllers/EmployeeServiceController.php
+++ b/app/Controllers/EmployeeServiceController.php
@@ -594,6 +594,15 @@ class EmployeeServiceController extends AdminController
'data_type' => 'str',
'format' => 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)
5 => 5, // inception: relationship (RELATIONSHIP) -> enrollment: relationship (Relation)
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)
9 => 11, // inception: basic_pay (Basic Pay) -> enrollment: basic_pay (Basic Pay)
10 => 10, // inception: band_grade (Band/Grade) -> enrollment: band_grade (Grade)
@@ -1088,7 +1097,7 @@ class EmployeeServiceController extends AdminController
}// end of foreach
}// end of if current action I,DA,A
- // s($result);
+ // return $result;
// die();
if(isset($result['error_summary']) && count($result['error_summary']))
{
@@ -1249,7 +1258,7 @@ class EmployeeServiceController extends AdminController
//get policy slab rates
$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','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['created_by'] = $file['created_by'];
$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 ';
// $this->myLogger->logme('error',('Insert - ' . $value['emp_code'] .' - '. $value['name']));
// echo 'update emp';
@@ -1983,7 +1993,7 @@ public function employeesEnrollmentInsert($params)
$value['file_id'] = $file_id;
$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';
} else if(strtolower(trim($value['relationship'])) === 'son' || strtolower(trim($value['relationship'])) === 'daughter'){
$relation = 'child';
@@ -1997,6 +2007,7 @@ public function employeesEnrollmentInsert($params)
$value['family_floater_key'] = $relation;
$policy_data['basic_cover_si'] = $row[9];
+ $policy_data['date_coverage'] = $row[13];
$policy_data['client_policy_id'] = $file['policy_id'];
$employee = $this->employeeModel->checkExistingEmployee($value,$file['client_branch_id']);
diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php
index 9c9d153f..d359c7d9 100644
--- a/app/Controllers/LeadsController.php
+++ b/app/Controllers/LeadsController.php
@@ -4,6 +4,9 @@ namespace App\Controllers;
use CodeIgniter\API\ResponseTrait;
+use PhpOffice\PhpSpreadsheet\Spreadsheet;
+use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
+
use App\Models\UserModel;
use App\Models\ClientModel;
use App\Models\ClientBranchModel;
@@ -15,6 +18,12 @@ use App\Models\KYCEntityTypeModel;
use App\Models\PolicyTransactionStatusModel;
use App\Models\InsurerBranchModel;
use App\Models\TPABranchModel;
+use App\Models\RFQModel;
+use App\Models\InsurerModel;
+
+use App\Helpers\MailHelper;
+use Kint;
+
class LeadsController extends BaseController
{
@@ -35,6 +44,8 @@ class LeadsController extends BaseController
protected $policyTransactionStatusModel;
protected $insurerBranchModel;
protected $tpaBranchModel;
+ protected $RFQModel;
+ protected $insurerModel;
//variables for storing array
protected $issuer;
@@ -58,6 +69,8 @@ class LeadsController extends BaseController
$this->policyTransactionStatusModel = new PolicyTransactionStatusModel();
$this->insurerBranchModel = new InsurerBranchModel();
$this->tpaBranchModel = new TPABranchModel();
+ $this->RFQModel = new RFQModel();
+ $this->insurerModel = new InsurerModel();
$this->issuer = [1 => 'JIBS', 2 => 'Nhance'];
$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 = 'Request for Quotation (RFQ)
Dear {{RECIPIENT_NAME}},
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.
RFQ Details
| Client name | {{CLIENT_NAME}} |
|---|
| Coverage Type | {{POLICY_LONG_NAME}} |
|---|
| Policy Start Date | {{POLICY_START_DATE}} |
|---|
| Policy Duration | {{DURATION}} |
|---|
Please note: Additional terms and details are included in the attachment for your reference.
Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.
Best regards,
Nhance India Pvt Ltd
© Nhance India Pvt Ltd. All rights reserved.
';
+
+
+ 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);
+ }
+
+ }
+
+
}
diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php
index a37da6bd..a4927e3d 100755
--- a/app/Controllers/MasterController.php
+++ b/app/Controllers/MasterController.php
@@ -34,6 +34,8 @@ use App\Models\InsurerExcelExportTemplateModel;
use App\Models\SettingsModel;
use App\Models\VehicleModel;
+use CodeIgniter\CLI\CLI;
+
class MasterController extends AdminController
{
use ResponseTrait;
@@ -175,6 +177,7 @@ class MasterController extends AdminController
$editData['action'] = ['import' => 'Import', 'export' => 'Export'];
$editData['db_column_name'] = [
+ 'S.No.' => 'index',
'Employee Name' => 'emp_name',
'Employee ID' => 'emp_code',
'Date of Birth' => 'emp_dob',
@@ -1602,13 +1605,34 @@ class MasterController extends AdminController
//testing a sample mail from cli
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();
// $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 = 'Dear {{RECIPIENT_NAME}},
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.
RFQ Details
| Client name | {{CLIENT_NAME}} |
|---|
| Coverage Type | {{POLICY_LONG_NAME}} |
|---|
| Policy Start Date | {{POLICY_START_DATE}} |
|---|
| Policy Duration | {{DURATION}} |
|---|
Please note: Additional terms and details are included in the attachment for your reference.
Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.
Best regards,
Nhance India Pvt Ltd
';
+
+ $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);
}
-
+ 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()
{
@@ -1671,7 +1695,7 @@ class MasterController extends AdminController
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 "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
{
diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php
index d4256270..bed2e473 100755
--- a/app/Controllers/RestAuthenticationController.php
+++ b/app/Controllers/RestAuthenticationController.php
@@ -96,7 +96,14 @@ class RestAuthenticationController extends AdminController
$mobile_number = $this->request->getJSON()->mobile_number;
$otp_verification = $this->request->getJSON()->otp_verification;
- $employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
+ 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();
+ }
+
+
if ($employeeData && $otp_verification == true || $employeeData && isset($this->request->getJSON()->login_by_hr)) {
$auth = HttpRequestHelper::getRequestInfo();
diff --git a/app/Helpers/MailHelper.php b/app/Helpers/MailHelper.php
index f94d6419..a65a5b31 100755
--- a/app/Helpers/MailHelper.php
+++ b/app/Helpers/MailHelper.php
@@ -93,7 +93,8 @@ class MailHelper
$emaill = $params['mail'];
$subject = $params['subject'];
$message = $params['message'];
-
+ $attachments = isset($params['attachments']) && count($params['attachments']) ? $params['attachments'] : [];
+
//check BCC mail
if (isset($params['bcc'])) {
$bcc = $params['bcc'];
@@ -118,7 +119,7 @@ class MailHelper
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'])
{
diff --git a/app/Helpers/excel_util_helper.php b/app/Helpers/excel_util_helper.php
index 6de54c74..ab6299ac 100755
--- a/app/Helpers/excel_util_helper.php
+++ b/app/Helpers/excel_util_helper.php
@@ -1646,7 +1646,7 @@ if(!function_exists('get_premium_for_si'))
// dd($slab_details);
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'];
}
@@ -1800,7 +1800,7 @@ if(!function_exists('transform_enrollment_row_to_inception_row'))
$res[4] = $row[4]; // inception: gender (Gender) -> enrollment: gender (Gender)
$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[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[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)
@@ -2119,4 +2119,24 @@ if(!function_exists('group_slab_rates_basedon_name'))
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';
+ }
+ }
}
\ No newline at end of file
diff --git a/app/Libraries/GmailAPI.php b/app/Libraries/GmailAPI.php
index f08a832e..e74101d4 100755
--- a/app/Libraries/GmailAPI.php
+++ b/app/Libraries/GmailAPI.php
@@ -26,18 +26,20 @@ class GmailAPI
'https://www.googleapis.com/auth/gmail.addons.current.message.readonly',
'https://www.googleapis.com/auth/gmail.readonly',
'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();
//die();
$this->client->setAccessType('offline');
$this->client->setPrompt('select_account consent');
-
- if (php_sapi_name() !== 'cli' || (uri_string() == 'cli/send_mail_cli' || uri_string() == 'cli/processjob') )
+ // echo uri_string();//die();
+ 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
}
-
+ // die();
$this->service = new Gmail($this->client);
}
@@ -99,44 +101,73 @@ class GmailAPI
$settingsModel->where('id', 1)->set([$this->tokenField => $token])->update();
}
- public function createMessage($to, $subject, $htmlContent, $from, $replyTo, $cc = [], $bcc = [])
- {
- $boundary = uniqid(rand(), true);
+ public function createMessage($to, $subject, $htmlContent, $from, $replyTo, $cc = [], $bcc = [], $attachments = [])
+{
+ // print_r($to);die();
+ $boundary = uniqid(rand(), true); // Unique boundary for separating parts
- $rawMessageString = "From: $from\r\n";
- $rawMessageString .= "To: $to\r\n";
- $rawMessageString .= "Reply-To: $replyTo\r\n";
+ // Initialize raw message headers
+ $rawMessageString = "From: $from\r\n";
+ $rawMessageString .= "To: $to\r\n";
+ $rawMessageString .= "Reply-To: $replyTo\r\n";
- if (!empty($cc)) {
- $rawMessageString .= "Cc: " . implode(',', $cc) . "\r\n";
- }
-
- if (!empty($bcc)) {
- $rawMessageString .= "Bcc: " . implode(',', $bcc) . "\r\n";
- }
-
- $rawMessageString .= "Subject: $subject\r\n";
- $rawMessageString .= "MIME-Version: 1.0\r\n";
- $rawMessageString .= "Content-Type: multipart/alternative; boundary=\"$boundary\"\r\n\r\n";
- $rawMessageString .= "--$boundary\r\n";
- $rawMessageString .= "Content-Type: text/html; charset=UTF-8\r\n";
- $rawMessageString .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
- $rawMessageString .= $htmlContent . "\r\n";
- $rawMessageString .= "--$boundary--";
-
- $rawMessage = base64_encode($rawMessageString);
- $rawMessage = str_replace(['+', '/', '='], ['-', '_', ''], $rawMessage);
-
- $message = new Message();
- $message->setRaw($rawMessage);
-
- return $message;
+ if (!empty($cc)) {
+ $rawMessageString .= "Cc: " . implode(',', $cc) . "\r\n";
}
- public function sendMessage($to, $subject, $htmlContent, $from, $replyTo, $cc = [], $bcc = [])
+ if (!empty($bcc)) {
+ $rawMessageString .= "Bcc: " . implode(',', $bcc) . "\r\n";
+ }
+
+ $rawMessageString .= "Subject: $subject\r\n";
+ $rawMessageString .= "MIME-Version: 1.0\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 .= "Content-Type: text/html; charset=UTF-8\r\n";
+ $rawMessageString .= "Content-Transfer-Encoding: 7bit\r\n\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--";
+
+ // Encode the final raw message in base64 for Gmail API
+ $rawMessage = base64_encode($rawMessageString);
+ $rawMessage = str_replace(['+', '/', '='], ['-', '_', ''], $rawMessage);
+
+ // Create Gmail message object
+ $message = new Message();
+ $message->setRaw($rawMessage);
+
+ return $message;
+}
+
+
+ public function sendMessage($to, $subject, $htmlContent, $from, $replyTo, $cc = [], $bcc = [],$attachments = [])
{
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);
return array('status' => true, 'data' => $res);
} catch (\Exception $e) {
@@ -177,4 +208,59 @@ class GmailAPI
$this->myLogger->logme('error', '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;
+ }
+
}
diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php
index f9e11a2b..18dff3a9 100755
--- a/app/Models/EmployeePolicyModel.php
+++ b/app/Models/EmployeePolicyModel.php
@@ -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_branch_id = $ref_data['client_branch_id'];
@@ -269,7 +269,12 @@ class EmployeePolicyModel extends Model
// Get the result set
$query = $this->db->query($sql);
- $results = $query->getResult();
+
+ if($return_type == 1){
+ $results = $query->getResultArray();
+ }else{
+ $results = $query->getResult();
+ }
return $results;
}
@@ -801,8 +806,8 @@ class EmployeePolicyModel extends Model
->where('emp.client_id',$client_id)
->where('employee_polices.client_policy_id',$policy_id);
- $result->whereIn('employee_polices.status', ['draft', 'enrolled']);
- $result->whereIn('emp.emp_status', ['draft', 'enrolled']);
+ $result->whereIn('employee_polices.status', ['enrolled']);
+ $result->whereIn('emp.emp_status', ['enrolled']);
$result = $result->findAll();
return ($result);
}
@@ -846,6 +851,7 @@ class EmployeePolicyModel extends Model
ep.tpa_id,
ep.uhid,
ep.policy_end_date,
+ ep.basic_cover_si,
clients.client_name,
clients.short_name AS client_short_name,
@@ -853,8 +859,6 @@ class EmployeePolicyModel extends Model
cp.policy_start_date,
cp.policy_no,
- policies.name AS policy_name,
-
insurers.name AS insurer_name,
insurers.short_name AS insurer_short_name,
insurers.insurer_logo,
@@ -873,7 +877,6 @@ class EmployeePolicyModel extends Model
->join('employee_polices ep', 'ep.employee_id = e.id')
->join('client_policy cp', 'cp.id = ep.client_policy_id')
->join('clients', 'clients.id = cp.client_id')
- ->join('policies', 'policies.id = cp.policy_id')
->join('insurers', 'insurers.id = cp.insurer_id')
->join('insurer_branch', 'insurer_branch.id = cp.insurer_branch_id')
->join('tpa', 'tpa.id = cp.tpa_id')
@@ -913,6 +916,7 @@ class EmployeePolicyModel extends Model
ep.tpa_id,
ep.uhid,
ep.policy_end_date,
+ ep.basic_cover_si,
clients.client_name,
clients.short_name AS client_short_name,
@@ -920,8 +924,6 @@ class EmployeePolicyModel extends Model
cp.policy_start_date,
cp.policy_no,
- policies.name AS policy_name,
-
insurers.name AS insurer_name,
insurers.short_name AS insurer_short_name,
insurers.insurer_logo,
@@ -940,7 +942,6 @@ class EmployeePolicyModel extends Model
->join('employee_polices ep', 'ep.employee_id = e.id')
->join('client_policy cp', 'cp.id = ep.client_policy_id')
->join('clients', 'clients.id = cp.client_id')
- ->join('policies', 'policies.id = cp.policy_id')
->join('insurers', 'insurers.id = cp.insurer_id')
->join('insurer_branch', 'insurer_branch.id = cp.insurer_branch_id')
->join('tpa', 'tpa.id = cp.tpa_id')
@@ -1019,6 +1020,7 @@ class EmployeePolicyModel extends Model
try {
// Execute the query
$this->db->query($sql);
+
// Commit the transaction
if ($this->db->transStatus() === FALSE) {
diff --git a/app/Models/LeadsModel.php b/app/Models/LeadsModel.php
index 239ce3c5..9de34d05 100644
--- a/app/Models/LeadsModel.php
+++ b/app/Models/LeadsModel.php
@@ -91,14 +91,27 @@ class LeadsModel extends Model
leads.*,
kyc_entity_type.name as entity_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('user_profiles', 'leads.salse_person_id = user_profiles.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)
->orderBy('id', 'desc')
->findAll();
diff --git a/app/Models/LevelContactModel.php b/app/Models/LevelContactModel.php
index 88f52ab2..234db3aa 100755
--- a/app/Models/LevelContactModel.php
+++ b/app/Models/LevelContactModel.php
@@ -25,4 +25,28 @@ class LevelContactModel extends Model
"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;
+
+ }
+
}
diff --git a/app/Models/PolicyTypeModel.php b/app/Models/PolicyTypeModel.php
index 82c06d70..3edd01f1 100755
--- a/app/Models/PolicyTypeModel.php
+++ b/app/Models/PolicyTypeModel.php
@@ -22,5 +22,6 @@ class PolicyTypeModel extends Model
"etp",
"iep",
"itp",
+ "question_json",
];
}
diff --git a/app/Models/RFQModel.php b/app/Models/RFQModel.php
new file mode 100644
index 00000000..f74a1313
--- /dev/null
+++ b/app/Models/RFQModel.php
@@ -0,0 +1,60 @@
+
-
+
diff --git a/app/Views/batch_list.php b/app/Views/batch_list.php
index 00e5b465..a2c371b2 100755
--- a/app/Views/batch_list.php
+++ b/app/Views/batch_list.php
@@ -67,7 +67,7 @@
|
- by
+ by
|
diff --git a/app/Views/employee_data_list.php b/app/Views/employee_data_list.php
index e3791918..2a70d76a 100755
--- a/app/Views/employee_data_list.php
+++ b/app/Views/employee_data_list.php
@@ -34,6 +34,10 @@
position: absolute;
}
+.right-align-input {
+ text-align: right;
+}
+
@@ -47,24 +51,24 @@
Employees
-
+
| SNO |
-
-
+
Client/Branch |
-
-
-
-
-
+
Branch |
-
-
+
- Name/code |
+ Name |
+ EMP Code |
+ Relationship |
+ Gender |
+ Date of Birth |
Policy name |
Insurer name |
TPA ID |
@@ -86,19 +90,19 @@
|
-
-
+
|
-
-
-
-
-
+
|
-
-
+
- |
+ |
+ |
+ |
+ |
+ |
- |
|
|
@@ -132,24 +136,22 @@
|
|
-
+
|
-
-
+
|
-
-
-
-
-
+
|
-
-
+
+ |
+ |
+ |
|
|
|
@@ -174,6 +176,7 @@
if (ticketsTable.length) {
ticketsTable.DataTable({
+ scrollX: true,
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
@@ -181,9 +184,10 @@
extend: 'csv',
text: 'CSV',
title: 'Member-List',
- exportOptions: {
- columns: ':not(:last-child)'
- },
+ },{
+ extend: 'excel',
+ text: 'Excel',
+ title: 'Member-List',
}],
language: {
search: "_INPUT_",
diff --git a/app/Views/employee_list.php b/app/Views/employee_list.php
index 0d1b3dca..d615e7db 100755
--- a/app/Views/employee_list.php
+++ b/app/Views/employee_list.php
@@ -115,7 +115,6 @@ var client_id = '= isset($getData) ? $getData['client_id'] : '0' ?>';
var client_branch_id = '= isset($getData) ? $getData['branch_id'] : '0' ?>';
-
$(document).ready(function() {
console.log("document loaded");
//fetchClientPolicies();
@@ -127,7 +126,6 @@ $(window).on("load", function() {
fetchClientPolicies();
});
-
function fetchClientPolicies() {
$('#loader').show();
var apiURL = '' + 'util/clients-with-policies';
@@ -204,7 +202,6 @@ function fetchClientPolicies() {
$('#loader').hide();
}
-
function appendClients(data) {
var clientID = = isset($getData) ? $getData['client_id'] : '0' ?>;
$.each(data, function(index, item) {
@@ -219,7 +216,6 @@ function appendClients(data) {
});
}
-
function appendBranch(data) {
$('#branch_id').empty();
@@ -239,7 +235,6 @@ function appendBranch(data) {
});
}
-
function appendPolicies(data) {
$('#policies').empty();
@@ -286,7 +281,6 @@ $(document).ready(function() {
});
});
-
$(document).ready(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('&');
}
-
function fetchEmpolyeeList(event) {
event.preventDefault(); // Prevent default action
diff --git a/app/Views/file_list.php b/app/Views/file_list.php
index 2cd80976..a504ad5f 100755
--- a/app/Views/file_list.php
+++ b/app/Views/file_list.php
@@ -53,7 +53,7 @@
- |
|
- ' . $file['first_name'] . '' ?>
+ | ' . $file['first_name'] . '' ?>
|
-->
-
+
diff --git a/app/Views/leads_form.php b/app/Views/leads_form.php
index 15c97dbe..9cb36865 100644
--- a/app/Views/leads_form.php
+++ b/app/Views/leads_form.php
@@ -278,6 +278,8 @@
//SELECT2 document ready function
$(document).ready(function() {
+
+ getURLParamsForReport()
addHTMLInput()
setTimeout(function() {
$("textarea.select2-search__field").attr('rows', '1');
@@ -537,6 +539,7 @@ function getPolicyData(input) {
}
}
+// Salse team user list data
function selecSalsePerson(salse_person_ids) {
salse_person_ids = JSON.parse(salse_person_ids);
@@ -588,7 +591,7 @@ function addHTMLInput() {
|
diff --git a/app/Views/policy_transaction_endorsement_form.php b/app/Views/policy_transaction_endorsement_form.php
index cace5d10..ea3bb0c1 100644
--- a/app/Views/policy_transaction_endorsement_form.php
+++ b/app/Views/policy_transaction_endorsement_form.php
@@ -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){
- $('[name="igst[]"]').val(0);
- $('[name="cgst[]"]').val(val);
- $('[name="sgst[]"]').val(val);
+// if(val){
+// $('[name="igst[]"]').val(0);
+// $('[name="cgst[]"]').val(val);
+// $('[name="sgst[]"]').val(val);
- }else{
- $('[name="igst[]"]').val('');
- $('[name="sgst[]"]').val('');
- }
- console.log('cgst value', val);
- });
+// }else{
+// $('[name="igst[]"]').val('');
+// $('[name="sgst[]"]').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){
- $('[name="igst[]"]').val(0);
- $('[name="sgst[]"]').val(val)
- $('[name="cgst[]"]').val(val)
- }else{
- $('[name="igst[]"]').val('');
- $('[name="sgst[]"]').val('')
- $('[name="cgst[]"]').val('')
- }
- console.log('cgst value', val);
-});
+// if(val){
+// $('[name="igst[]"]').val(0);
+// $('[name="sgst[]"]').val(val)
+// $('[name="cgst[]"]').val(val)
+// }else{
+// $('[name="igst[]"]').val('');
+// $('[name="sgst[]"]').val('')
+// $('[name="cgst[]"]').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){
- $('[name="cgst[]"], [name="sgst[]"]').val(0);
- $('[name="igst[]"]').val(val)
- }else{
- $('[name="cgst[]"], [name="sgst[]"]').val('');
- $('[name="igst[]"]').val('')
+// if(val){
+// $('[name="cgst[]"], [name="sgst[]"]').val(0);
+// $('[name="igst[]"]').val(val)
+// }else{
+// $('[name="cgst[]"], [name="sgst[]"]').val('');
+// $('[name="igst[]"]').val('')
- }
+// }
- console.log('igst value', val);
-});
+// console.log('igst value', val);
+// });
$(document).on('click', '[name="co_share_type[]"]', function() {
@@ -924,6 +924,30 @@ function getPolicyTransactionDataForEndorsementEdit(input){
}
//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) {
// console.log(input);
@@ -945,6 +969,7 @@ function amountCalculation(input) {
}
let cop = parseFloat($('#co_premium_' + input).val()) || 0;
+ checkAndDistributeTax(input);
let cgst = parseFloat($('#cgst_' + input).val()) || 0;
let sgst = parseFloat($('#sgst_' + input).val()) || 0;
let igst = parseFloat($('#igst_' + input).val()) || 0;
diff --git a/app/Views/policy_transaction_inception_form.php b/app/Views/policy_transaction_inception_form.php
index c6d0e22a..4f6c0f36 100644
--- a/app/Views/policy_transaction_inception_form.php
+++ b/app/Views/policy_transaction_inception_form.php
@@ -748,14 +748,14 @@
-
+
-
-
+
@@ -998,11 +998,31 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/public/sample_excel/enrollment.xlsx b/public/sample_excel/enrollment.xlsx
index dec7c20f..568e3b5e 100755
Binary files a/public/sample_excel/enrollment.xlsx and b/public/sample_excel/enrollment.xlsx differ
|