CHANGE_TRUNCATED_ADD_DEP_ADD_ENDO_NO_AND_OTHER : RV
This commit is contained in:
parent
bf2a4f2045
commit
0ffb0b4e32
@ -3842,7 +3842,7 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
// dd($this->request);
|
// dd($this->request);
|
||||||
// $employeeRestController = new EmployeeServiceController();
|
// $employeeRestController = new EmployeeServiceController();
|
||||||
// $employeeRestController->employeesEnrollmentInsert(['file_id' => 721]);
|
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 721]);
|
||||||
|
|
||||||
// $r = Jobs::addJob(['job_name' => 'employeesEnrollmentInsert','payload' => ['file_id' => 721]]);
|
// $r = Jobs::addJob(['job_name' => 'employeesEnrollmentInsert','payload' => ['file_id' => 721]]);
|
||||||
|
|
||||||
@ -3871,6 +3871,33 @@ class ClientController extends AdminController
|
|||||||
// $empServiceController = new EmployeeServiceController();
|
// $empServiceController = new EmployeeServiceController();
|
||||||
// $res = $empServiceController->excelFileDataValidation(['file_id' => '319']);
|
// $res = $empServiceController->excelFileDataValidation(['file_id' => '319']);
|
||||||
// dd($res);
|
// dd($res);
|
||||||
|
|
||||||
|
// $EmpDataServiceController = new EmpDataServiceController();
|
||||||
|
// $EmpDataServiceController->importInceptionFileValidation(['file_id' => 160]);
|
||||||
|
|
||||||
|
$EmpDataServiceController = new EmpDataServiceController();
|
||||||
|
// $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 162]);
|
||||||
|
// $EmpDataServiceController->importInceptionFileValidation(['file_id' => 162]);
|
||||||
|
// $EmpDataServiceController->importDeletionValidation(['file_id' => 171]);
|
||||||
|
// $EmpDataServiceController->importDeletionUpdateEndorsementID(['file_id' => 171]);
|
||||||
|
$array = [
|
||||||
|
"employeeIds" => ["12800", "12798", "12797", "12799"],
|
||||||
|
"client_id" => "159",
|
||||||
|
"client_policy_id" => "336",
|
||||||
|
"client_branch_id" => "126",
|
||||||
|
"cd_ac_no" => "Apple_123",
|
||||||
|
"endorsement_no" => "ENDORSEMENT_ID",
|
||||||
|
"count" => 4,
|
||||||
|
"event_name" => "deletion",
|
||||||
|
"policy_name" => "GMC",
|
||||||
|
"user_id" => "1"
|
||||||
|
];
|
||||||
|
|
||||||
|
$EmpDataServiceController->cashDepositCalculationForDeletion($array);
|
||||||
|
|
||||||
|
// $employeeRestController = new EmployeeServiceController();
|
||||||
|
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 757]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -423,7 +423,18 @@ class EmpDataServiceController extends BaseController
|
|||||||
'db_column_name' => 'total'
|
'db_column_name' => 'total'
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
//for addition and dependent addition adding a ENDORSEMENT NO column
|
||||||
|
if(in_array($export_data['event_type'], ['addition', 'dependent_addition'])){
|
||||||
|
$excel_header_columns[] = [
|
||||||
|
'column_index' => 18,
|
||||||
|
'column_name' => 'ENDORSEMENT NO',
|
||||||
|
'db_column_name' => ''
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
// get excel export format structure array
|
// get excel export format structure array
|
||||||
// $template_json = $this->clientPolicyModel
|
// $template_json = $this->clientPolicyModel
|
||||||
// ->select('insurer_excel_export_template.jsoncolumns')
|
// ->select('insurer_excel_export_template.jsoncolumns')
|
||||||
@ -1278,6 +1289,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
$this->myLogger->logme('info', 'Inception File Validation -- Function called');
|
$this->myLogger->logme('info', 'Inception File Validation -- Function called');
|
||||||
|
|
||||||
$file_id = $params['file_id'];
|
$file_id = $params['file_id'];
|
||||||
|
// dd($file_id);
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'Inception File Validation -- Batch File Table Primary ID : {data}', ['data' => $file_id]);
|
$this->myLogger->logme('error', 'Inception File Validation -- Batch File Table Primary ID : {data}', ['data' => $file_id]);
|
||||||
|
|
||||||
@ -1330,10 +1342,16 @@ class EmpDataServiceController extends BaseController
|
|||||||
// 'PREMIUM',
|
// 'PREMIUM',
|
||||||
'PRO RATA PREMIUM',
|
'PRO RATA PREMIUM',
|
||||||
'GST',
|
'GST',
|
||||||
'TOTAL AMOUNT'
|
'TOTAL AMOUNT',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if(in_array($file['event_type'], ['addition', 'dependent_addition'])){
|
||||||
|
$inceptionHeader[] = 'ENDORSEMENT NO';
|
||||||
|
}
|
||||||
|
|
||||||
|
// dd($inceptionHeader);
|
||||||
foreach ($inceptionHeader as $key => $value) {
|
foreach ($inceptionHeader as $key => $value) {
|
||||||
|
|
||||||
if($excel_header[$key] != $value){
|
if($excel_header[$key] != $value){
|
||||||
$data = [
|
$data = [
|
||||||
'status' => 'failed-5',
|
'status' => 'failed-5',
|
||||||
@ -1352,47 +1370,9 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
$emp_count = count($excel_data);
|
$emp_count = count($excel_data);
|
||||||
|
|
||||||
|
//get the employee data for excel file validation
|
||||||
$employee_data = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($ref_data, 1);
|
$employee_data = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($ref_data, 1);
|
||||||
|
|
||||||
// dd($employee_data, $excel_data);
|
|
||||||
// ->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_of_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();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($employee_data == null || empty($employee_data)) {
|
if ($employee_data == null || empty($employee_data)) {
|
||||||
|
|
||||||
if ($insurer_or_tpa == 'tpa') {
|
if ($insurer_or_tpa == 'tpa') {
|
||||||
@ -1425,7 +1405,6 @@ class EmpDataServiceController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'Inception File Validation -- UHID or TPAID already updated or the uploadedfile is not correct');
|
$this->myLogger->logme('error', 'Inception File Validation -- UHID or TPAID already updated or the uploadedfile is not correct');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$excel_data_count = count($excel_data);
|
$excel_data_count = count($excel_data);
|
||||||
@ -1446,7 +1425,6 @@ class EmpDataServiceController extends BaseController
|
|||||||
$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 = [
|
||||||
@ -1724,6 +1702,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
$file_id = $params['file_id'];
|
$file_id = $params['file_id'];
|
||||||
$file = $this->batchFileModel->find($file_id);
|
$file = $this->batchFileModel->find($file_id);
|
||||||
|
// dd($file);
|
||||||
|
|
||||||
if (!$file) {
|
if (!$file) {
|
||||||
|
|
||||||
@ -1756,22 +1735,20 @@ class EmpDataServiceController extends BaseController
|
|||||||
->first();
|
->first();
|
||||||
|
|
||||||
$get_policy_type = $this->clientPolicyModel
|
$get_policy_type = $this->clientPolicyModel
|
||||||
->select('policy_type.policy_type, policies.policy_type_id as policy_type_id')
|
->select('client_policy.*, policy_type.policy_type')
|
||||||
->join('policies', 'policies.id = client_policy.policy_id')
|
->join('policy_type', 'policy_type.id = client_policy.policy_type_id', 'left')
|
||||||
->join('policy_type', 'policy_type.id = policies.policy_type_id')
|
|
||||||
->where('client_policy.id', $client_policy_id)
|
->where('client_policy.id', $client_policy_id)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
|
// dd($get_policy_type);
|
||||||
|
|
||||||
$status_val = 'success';
|
$status_val = 'success';
|
||||||
if ($status == 'in-progress-partially') {
|
if ($status == 'in-progress-partially') {
|
||||||
|
|
||||||
$status_val = 'partially success';
|
$status_val = 'partially success';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'Inception Update TPA and UHID -- file name : {data}', ['data' => $file['file_name']]);
|
$this->myLogger->logme('error', 'Inception Update TPA and UHID -- file name : {data}', ['data' => $file['file_name']]);
|
||||||
|
|
||||||
|
|
||||||
$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);
|
||||||
unset($excel_data[0]); // Remove header row
|
unset($excel_data[0]); // Remove header row
|
||||||
@ -1782,10 +1759,15 @@ class EmpDataServiceController extends BaseController
|
|||||||
$emp_details = [];
|
$emp_details = [];
|
||||||
$tpa_id = [];
|
$tpa_id = [];
|
||||||
$uhid = [];
|
$uhid = [];
|
||||||
|
$emp_endorsement_table_data = [];
|
||||||
|
$enrollment_file_id = null;
|
||||||
|
$endorsement_id = null;
|
||||||
|
|
||||||
$emp_count = count($excel_data);
|
$emp_count = count($excel_data);
|
||||||
$db = \Config\Database::connect();
|
$db = \Config\Database::connect();
|
||||||
|
|
||||||
|
// print_rr($excel_data); die;
|
||||||
|
|
||||||
foreach ($excel_data as $key => $value) {
|
foreach ($excel_data as $key => $value) {
|
||||||
|
|
||||||
$name = $value[1];
|
$name = $value[1];
|
||||||
@ -1825,11 +1807,54 @@ class EmpDataServiceController extends BaseController
|
|||||||
$emp_details[] = array('id' => $result['id'], 'tpa_id' => $value[13], 'uhid' => $value[14]);
|
$emp_details[] = array('id' => $result['id'], 'tpa_id' => $value[13], 'uhid' => $value[14]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//for addition and dependent_addition endorsement , endorsement_id update functionality
|
||||||
|
if(in_array($file['event_type'], ['addition', 'dependent_addition']) && isset($value[18])){
|
||||||
|
|
||||||
|
$action = 'a';
|
||||||
|
if($file['event_type'] == "dependent_addition"){
|
||||||
|
$action = 'da';
|
||||||
|
}
|
||||||
|
|
||||||
|
$endorsement_id = $value[18];
|
||||||
|
|
||||||
|
$result_for_endorsement = $this->empEndorsementModel
|
||||||
|
->select('emp_endorsement.*, employees.id as emp_id, employee_polices.id as emp_policy_id')
|
||||||
|
->join('employee_polices', 'employee_polices.id = emp_endorsement.pk')
|
||||||
|
->join('employees', 'employees.emp_code = emp_endorsement.emp_code')
|
||||||
|
->where('employees.emp_code', $emp_code)
|
||||||
|
->where('employees.name', $name)
|
||||||
|
->where('employees.client_id', $client_id)
|
||||||
|
->where('employees.client_branch_id', $client_branch_id)
|
||||||
|
->where('emp_endorsement.actions', $action)
|
||||||
|
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||||
|
->where('employee_polices.is_active', 1)
|
||||||
|
->where('employee_polices.status', 'active')
|
||||||
|
->where('employees.is_active', 1)
|
||||||
|
->where('employees.emp_status', 'active')
|
||||||
|
->where('(emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = "")')
|
||||||
|
->groupBy('emp_endorsement.group_key')
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if (!empty($result_for_endorsement) && count($result_for_endorsement)) {
|
||||||
|
$enrollment_file_id = $result_for_endorsement['file_id']; //files table primary key
|
||||||
|
$emp_endorsement_table_data[] = array('id' => $result_for_endorsement['id'], 'group_key' => $result_for_endorsement['group_key'], 'endorsement_id' => $value[18], 'status' => 'complete');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// dd($emp_endorsement_table_data, $enrollment_file_id);
|
||||||
|
|
||||||
|
//update the employee policy data (TPAID or UHID)
|
||||||
$return = $this->employeePolicyModel->bulkUpdate($emp_details);
|
$return = $this->employeePolicyModel->bulkUpdate($emp_details);
|
||||||
|
|
||||||
|
if(in_array($file['event_type'], ['addition', 'dependent_addition']) && !empty($emp_endorsement_table_data)){
|
||||||
|
$this->employeePolicyModel->updateEmpEndorsementAddition($emp_endorsement_table_data);
|
||||||
|
$this->storeEndorsementNumber($file_id, $endorsement_id, $enrollment_file_id);
|
||||||
|
}
|
||||||
|
|
||||||
// Update batch file status and amount
|
// Update batch file status and amount
|
||||||
$this->batchFileModel->update($file_id, [
|
$this->batchFileModel->update($file_id, [
|
||||||
'count' => $emp_count,
|
'count' => $emp_count,
|
||||||
@ -1865,7 +1890,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
'client_id' => $client_id,
|
'client_id' => $client_id,
|
||||||
'client_policy_id' => $client_policy_id,
|
'client_policy_id' => $client_policy_id,
|
||||||
'cd_ac_no' => $CD_Account_Number['cd_ac_no'] ?? null,
|
'cd_ac_no' => $CD_Account_Number['cd_ac_no'] ?? null,
|
||||||
'endorsement_no' => null,
|
'endorsement_no' => $endorsement_id,
|
||||||
'client_branch_id' => $client_branch_id,
|
'client_branch_id' => $client_branch_id,
|
||||||
'count' => $emp_count,
|
'count' => $emp_count,
|
||||||
'event_name' => $file['event_type'],
|
'event_name' => $file['event_type'],
|
||||||
@ -2256,6 +2281,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
$emp_details = [];
|
$emp_details = [];
|
||||||
$endorsement_id = [];
|
$endorsement_id = [];
|
||||||
$endorsement_details = [];
|
$endorsement_details = [];
|
||||||
|
$enrollment_file_id = null;
|
||||||
|
|
||||||
$emp_count = count($excel_data);
|
$emp_count = count($excel_data);
|
||||||
$db = \Config\Database::connect();
|
$db = \Config\Database::connect();
|
||||||
@ -2268,7 +2294,6 @@ class EmpDataServiceController extends BaseController
|
|||||||
$endorsement_id[] = $value[10];
|
$endorsement_id[] = $value[10];
|
||||||
$uhid = $value[1];
|
$uhid = $value[1];
|
||||||
|
|
||||||
|
|
||||||
$result = $this->empEndorsementModel
|
$result = $this->empEndorsementModel
|
||||||
->select('emp_endorsement.*, employees.id as emp_id')
|
->select('emp_endorsement.*, employees.id as emp_id')
|
||||||
->join('employees', 'employees.id = emp_endorsement.pk')
|
->join('employees', 'employees.id = emp_endorsement.pk')
|
||||||
@ -2289,8 +2314,8 @@ class EmpDataServiceController extends BaseController
|
|||||||
->first();
|
->first();
|
||||||
|
|
||||||
if (isset($result['id']) && $result['id'] !== null) {
|
if (isset($result['id']) && $result['id'] !== null) {
|
||||||
|
|
||||||
// return $result;
|
// return $result;
|
||||||
|
$enrollment_file_id = $result['file_id'];
|
||||||
$emp_details[] = array('id' => $result['emp_id'], $result['field_name'] => $value[8]);
|
$emp_details[] = array('id' => $result['emp_id'], $result['field_name'] => $value[8]);
|
||||||
$endorsement_details[] = array('group_key' => $result['group_key'], 'id' => $result['id'], 'endorsement_id' => $value[10], 'status' => 'complete');
|
$endorsement_details[] = array('group_key' => $result['group_key'], 'id' => $result['id'], 'endorsement_id' => $value[10], 'status' => 'complete');
|
||||||
}
|
}
|
||||||
@ -2301,7 +2326,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
$this->empEndorsementModel->updateBatch($endorsement_details, 'group_key');
|
$this->empEndorsementModel->updateBatch($endorsement_details, 'group_key');
|
||||||
$this->employeePolicyModel->bulkUpdateForCorrection($emp_details);
|
$this->employeePolicyModel->bulkUpdateForCorrection($emp_details);
|
||||||
$this->storeEndorsementNumber($file_id, $endorsement_id[0]);
|
$this->storeEndorsementNumber($file_id, $endorsement_id[0], $enrollment_file_id);
|
||||||
|
|
||||||
|
|
||||||
// Update batch file status and amount
|
// Update batch file status and amount
|
||||||
@ -2815,6 +2840,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
$employeeIds = [];
|
$employeeIds = [];
|
||||||
$emp_details = [];
|
$emp_details = [];
|
||||||
$endorsement_id = '';
|
$endorsement_id = '';
|
||||||
|
$enrollment_file_id = '';
|
||||||
$endorsement_details = [];
|
$endorsement_details = [];
|
||||||
$totals = 0;
|
$totals = 0;
|
||||||
|
|
||||||
@ -2846,6 +2872,8 @@ class EmpDataServiceController extends BaseController
|
|||||||
->first();
|
->first();
|
||||||
|
|
||||||
if (isset($result['id']) && $result['id'] !== null) {
|
if (isset($result['id']) && $result['id'] !== null) {
|
||||||
|
|
||||||
|
$enrollment_file_id = $result['file_id'];
|
||||||
$emp_policy_ids[] = array('id' => $result['emp_policy_id'], 'is_active' => 0);
|
$emp_policy_ids[] = array('id' => $result['emp_policy_id'], 'is_active' => 0);
|
||||||
$employeeIds[] = $result['emp_policy_id'];
|
$employeeIds[] = $result['emp_policy_id'];
|
||||||
$endorsement_details[] = array('id' => $result['id'], 'group_key' => $result['group_key'], 'endorsement_id' => $value[19], 'status' => 'complete');
|
$endorsement_details[] = array('id' => $result['id'], 'group_key' => $result['group_key'], 'endorsement_id' => $value[19], 'status' => 'complete');
|
||||||
@ -2905,7 +2933,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
$this->employeePolicyModel->bulkUpdateForEndorsement($endorsement_details);
|
$this->employeePolicyModel->bulkUpdateForEndorsement($endorsement_details);
|
||||||
$this->storeEndorsementNumber($file_id, $endorsement_id);
|
$this->storeEndorsementNumber($file_id, $endorsement_id, $enrollment_file_id);
|
||||||
|
|
||||||
|
|
||||||
// Update batch file status and amount
|
// Update batch file status and amount
|
||||||
@ -2990,7 +3018,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
// array_pop($excel_data);
|
// array_pop($excel_data);
|
||||||
|
|
||||||
$headers = ['S.No','EMP ID','EMP NAME','DOB','GENDER','RELATIONSHIP','SUM INSURED','Date of Leaving','Policy End Date','No Of Days','Premium','Pro Rata Premium','GST','Total','Claim Status','ENDORSEMENT_ID'];
|
$headers = ['S.No','EMP ID','EMP NAME','DOB','GENDER','RELATIONSHIP','SUM INSURED','Date of Leaving','Policy End Date','No Of Days','Premium','Pro Rata Premium','GST','Total','Claim Status','ENDORSEMENT_ID'];
|
||||||
|
// dd($headers, $excel_header);
|
||||||
|
|
||||||
foreach ($headers as $key => $value) {
|
foreach ($headers as $key => $value) {
|
||||||
if($excel_header[$key] != $value){
|
if($excel_header[$key] != $value){
|
||||||
@ -3322,6 +3350,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
$employee_policy_table_data = [];
|
$employee_policy_table_data = [];
|
||||||
$employee_policy_table_primaryKey = [];
|
$employee_policy_table_primaryKey = [];
|
||||||
$endorsement_id = '';
|
$endorsement_id = '';
|
||||||
|
$enrollment_file_id = null; //files table primary key
|
||||||
|
|
||||||
$totals = 0;
|
$totals = 0;
|
||||||
|
|
||||||
@ -3342,12 +3371,15 @@ class EmpDataServiceController extends BaseController
|
|||||||
'emp_name' => $emp_name,
|
'emp_name' => $emp_name,
|
||||||
'emp_code' => $emp_code
|
'emp_code' => $emp_code
|
||||||
];
|
];
|
||||||
|
|
||||||
$result = $this->employeePolicyModel->fetchEmpEndorsementData($fetch_data);
|
$result = $this->employeePolicyModel->fetchEmpEndorsementData($fetch_data);
|
||||||
|
// dd($result, db_connect()->getLastQuery());
|
||||||
|
|
||||||
if (isset($result['emp_endorsement_primarykey']) && $result['emp_endorsement_primarykey'] !== null) {
|
if (isset($result['emp_endorsement_primarykey']) && $result['emp_endorsement_primarykey'] !== null) {
|
||||||
|
|
||||||
|
$enrollment_file_id = $result['file_id']; //files table primary key
|
||||||
$employee_policy_table_primaryKey[] = $result['emp_policy_primarykey']; //for cash deposite
|
$employee_policy_table_primaryKey[] = $result['emp_policy_primarykey']; //for cash deposite
|
||||||
$employee_policy_table_data[] = array('id' => $result['emp_policy_primarykey'], 'date_of_exit' => $result['date_of_exit'], 'reason_for_exit' => $result['reason_for_exit'], 'status' => $result['status']);
|
$employee_policy_table_data[] = array('id' => $result['emp_policy_primarykey'], 'date_of_exit' => $result['date_of_exit'], 'reason_for_exit' => $result['reason_for_exit'], 'claim_status' => $result['claim_status'], 'status' => $result['status']);
|
||||||
// $employees_table_data[] = array('id' => $result['employees_id'], 'emp_status' => $result['status']);
|
// $employees_table_data[] = array('id' => $result['employees_id'], 'emp_status' => $result['status']);
|
||||||
$emp_endorsement_table_data[] = array('id' => $result['emp_endorsement_primarykey'], 'group_key' => $result['group_key'], 'endorsement_id' => $value[15], 'status' => 'complete');
|
$emp_endorsement_table_data[] = array('id' => $result['emp_endorsement_primarykey'], 'group_key' => $result['group_key'], 'endorsement_id' => $value[15], 'status' => 'complete');
|
||||||
}
|
}
|
||||||
@ -3360,7 +3392,6 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
// dd($employees_table_data, $emp_endorsement_table_data, $employee_policy_table_data, $employee_policy_table_primaryKey, $totals, $emp_count);
|
// dd($employees_table_data, $emp_endorsement_table_data, $employee_policy_table_data, $employee_policy_table_primaryKey, $totals, $emp_count);
|
||||||
|
|
||||||
|
|
||||||
// Check if $employees_table_data is null or empty
|
// Check if $employees_table_data is null or empty
|
||||||
// if (empty($employees_table_data)) {
|
// if (empty($employees_table_data)) {
|
||||||
// return ['status' => 'error', 'message' => 'Employees table data is empty or null.'];
|
// return ['status' => 'error', 'message' => 'Employees table data is empty or null.'];
|
||||||
@ -3379,7 +3410,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
// $this->employeeModel->updateBatch($employees_table_data, 'id');
|
// $this->employeeModel->updateBatch($employees_table_data, 'id');
|
||||||
$this->employeePolicyModel->updateBatch($employee_policy_table_data, 'id');
|
$this->employeePolicyModel->updateBatch($employee_policy_table_data, 'id');
|
||||||
$this->employeePolicyModel->bulkUpdateForEndorsement($emp_endorsement_table_data);
|
$this->employeePolicyModel->bulkUpdateForEndorsement($emp_endorsement_table_data);
|
||||||
$this->storeEndorsementNumber($file_id, $endorsement_id);
|
$this->storeEndorsementNumber($file_id, $endorsement_id, $enrollment_file_id);
|
||||||
|
|
||||||
// Update batch file status and amount
|
// Update batch file status and amount
|
||||||
$this->batchFileModel->update($file_id, [
|
$this->batchFileModel->update($file_id, [
|
||||||
@ -3388,12 +3419,12 @@ class EmpDataServiceController extends BaseController
|
|||||||
'amount' => $rounded_totals,
|
'amount' => $rounded_totals,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'Deletion Update Endorsement ID -- Employee count : {data}', ['data' => $emp_count]);
|
$this->myLogger->logme('error', 'Deletion Update Endorsement ID -- Employee count : {data}', ['data' => $emp_count]);
|
||||||
$this->myLogger->logme('error', 'Deletion Update Endorsement ID -- Batch File status : {data}', ['data' => $status_val]);
|
$this->myLogger->logme('error', 'Deletion Update Endorsement ID -- Batch File status : {data}', ['data' => $status_val]);
|
||||||
|
|
||||||
//call the cash deposite function
|
//call the cash deposite function
|
||||||
if ($file['insurer_or_tpa'] == 'insurer') {
|
if ($file['insurer_or_tpa'] == 'insurer') {
|
||||||
|
|
||||||
$policy_name = $this->getPolicyNameUsingClientPolicyId($client_policy_id);
|
$policy_name = $this->getPolicyNameUsingClientPolicyId($client_policy_id);
|
||||||
$job_details = new Jobs();
|
$job_details = new Jobs();
|
||||||
$r = Jobs::addJob(['job_name' => 'cashDepositCalculationForDeletion', 'payload' => [
|
$r = Jobs::addJob(['job_name' => 'cashDepositCalculationForDeletion', 'payload' => [
|
||||||
@ -4021,10 +4052,11 @@ class EmpDataServiceController extends BaseController
|
|||||||
WHERE
|
WHERE
|
||||||
employee_polices.id IN (" . implode(',', $arrayData['employeeIds']) . ")
|
employee_polices.id IN (" . implode(',', $arrayData['employeeIds']) . ")
|
||||||
AND emp_endorsement.pk IN (" . implode(',', $arrayData['employeeIds']) . ")
|
AND emp_endorsement.pk IN (" . implode(',', $arrayData['employeeIds']) . ")
|
||||||
|
AND employee_polices.claim_status = 0
|
||||||
AND emp_endorsement.field_name = 'date_of_exit'
|
AND emp_endorsement.field_name = 'date_of_exit'
|
||||||
")->getRow();
|
")->getRow();
|
||||||
|
|
||||||
// dd(db_connect()->getLastQuery(), $amount);
|
dd(db_connect()->getLastQuery(), $amount);
|
||||||
|
|
||||||
if($amount){
|
if($amount){
|
||||||
|
|
||||||
@ -4518,7 +4550,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
$this->messageModel->insert($msg_data);
|
$this->messageModel->insert($msg_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function storeEndorsementNumber($file_id, $endorsement_no)
|
public function storeEndorsementNumber($file_id, $endorsement_no, $enrollment_file_id)
|
||||||
{
|
{
|
||||||
// Log the function entry with input parameters
|
// Log the function entry with input parameters
|
||||||
$this->myLogger->logme('error', "storeEndorsementNumber --- Starting function with file_id: $file_id and endorsement_no: $endorsement_no");
|
$this->myLogger->logme('error', "storeEndorsementNumber --- Starting function with file_id: $file_id and endorsement_no: $endorsement_no");
|
||||||
@ -4554,6 +4586,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
'insurer_id' => $filedata['insurer_id'],
|
'insurer_id' => $filedata['insurer_id'],
|
||||||
'tpa_id' => $filedata['tpa_id'],
|
'tpa_id' => $filedata['tpa_id'],
|
||||||
'endorsement_no' => $endorsement_no,
|
'endorsement_no' => $endorsement_no,
|
||||||
|
'file_id' => $enrollment_file_id,
|
||||||
'endorsement_type' => $filedata['event_type'],
|
'endorsement_type' => $filedata['event_type'],
|
||||||
'created_by' => $filedata['created_by'],
|
'created_by' => $filedata['created_by'],
|
||||||
]);
|
]);
|
||||||
|
|||||||
@ -1236,17 +1236,19 @@ class EmployeeController extends AdminController
|
|||||||
$loggedInUserID = get_session_userid();
|
$loggedInUserID = get_session_userid();
|
||||||
|
|
||||||
$policy_data = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
$policy_data = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||||
|
|
||||||
$cd_tranction = $this->cashDepositModel
|
$cd_tranction = $this->cashDepositModel
|
||||||
->where('client_id', $client_id)
|
->where('client_id', $client_id) //client
|
||||||
->where('insurer_id', $policy_data['insurer_id'])
|
->where('insurer_id', $policy_data['insurer_id']) //insurer
|
||||||
->where('event_name',$file['action'])
|
->where('event_name',$file['action']) //event
|
||||||
->where('client_policy_id', $client_policy_id)
|
->where('client_policy_id', $client_policy_id)//policy
|
||||||
->orderBy('id', 'desc')
|
->orderBy('id', 'desc')
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
|
|
||||||
// $file['action'] = 'si_enhancement';
|
// $file['action'] = 'si_enhancement';
|
||||||
// $result = [];
|
// $result = [];
|
||||||
// !dd($file);
|
// dd($file);
|
||||||
if ($file['action'] == 'inception' || $file['action'] == 'dependent_addition' || $file['action'] == 'addition' || $file['action'] == 'enrollment' || $file['action'] == 'missed_inception') {
|
if ($file['action'] == 'inception' || $file['action'] == 'dependent_addition' || $file['action'] == 'addition' || $file['action'] == 'enrollment' || $file['action'] == 'missed_inception') {
|
||||||
|
|
||||||
|
|
||||||
@ -1256,6 +1258,7 @@ class EmployeeController extends AdminController
|
|||||||
$result = $this->employeeModel->getEmpListByFileId(file_id: $file_id, emp_status: ['active'], policy_status: ['active']);
|
$result = $this->employeeModel->getEmpListByFileId(file_id: $file_id, emp_status: ['active'], policy_status: ['active']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$result = [];
|
||||||
// ~dd($result);
|
// ~dd($result);
|
||||||
if (count($result) && $role_id == null) {
|
if (count($result) && $role_id == null) {
|
||||||
if(get_role_id() == 1 || get_role_id() == 5){
|
if(get_role_id() == 1 || get_role_id() == 5){
|
||||||
@ -1265,18 +1268,57 @@ class EmployeeController extends AdminController
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
$this->myLogger->logme('error', 'TRUNCATED STARTED WITH ADMIN OR HEAD PERMISSION');
|
||||||
|
$this->myLogger->logme('error', 'Event Type : -- {data} --', ['data' => $file['action']]);
|
||||||
|
|
||||||
|
|
||||||
|
// GET THE CD AMOUND
|
||||||
|
//get cd amount for the particular file id to reverse entry to the cash deposite
|
||||||
|
$cd_amount = $cd_tranction['amount'];
|
||||||
|
if(in_array($file['action'], ['addition', 'dependent_addition'])){
|
||||||
|
$cd_amount_total = $this->employeePolicyModel->getAdditionDataForTruncated($file_id, $file['action']);
|
||||||
|
// dd($cd_amount_total);
|
||||||
|
$cd_amount = $cd_amount_total['total'];
|
||||||
|
|
||||||
|
$this->myLogger->logme('error', 'Addition or Dependent Addition CD Amount : {data}', ['data' => $cd_amount]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->myLogger->logme('error', 'CD Amount : {data}', ['data' => $cd_amount]);
|
||||||
|
|
||||||
|
|
||||||
if($file['action'] != 'enrollment')
|
if($file['action'] != 'enrollment')
|
||||||
{
|
{
|
||||||
|
//STEP: 1 - Update employee policy table
|
||||||
//update emp and emp plocies
|
//update emp and emp plocies
|
||||||
$db = db_connect();
|
$db = db_connect();
|
||||||
$query = "UPDATE employees JOIN employee_polices ON employees.id = employee_polices.employee_id and employees.file_id = $file_id SET employees.emp_status = 'truncated', employee_polices.status = 'truncated', employees.is_active = 0,employee_polices.is_active = 0 WHERE employees.file_id = $file_id";
|
$query = "
|
||||||
|
UPDATE employee_polices
|
||||||
|
JOIN employees ON employees.id = employee_polices.employee_id
|
||||||
|
SET employee_polices.status = 'truncated', employee_polices.is_active = 0
|
||||||
|
WHERE employees.file_id = $file_id
|
||||||
|
";
|
||||||
|
|
||||||
$db->query($query);
|
$db->query($query);
|
||||||
$affectedRows = $db->affectedRows();
|
$affectedRows = $db->affectedRows();
|
||||||
|
$this->myLogger->logme('error', 'employee_polices table update query : {data}', ['data' => $query]);
|
||||||
|
$this->myLogger->logme('error', 'employee_polices table updated - Affected Rows : {data}', ['data' => $affectedRows]);
|
||||||
// print_r($db->getLastQuery()); die;
|
// print_r($db->getLastQuery()); die;
|
||||||
// $affectedRows = 10;
|
// $affectedRows = 10;
|
||||||
|
|
||||||
|
//STEP:2 - Update emp_endorsement Table
|
||||||
|
//update truncated status and is_active 0 to the Emp_endorsement table
|
||||||
|
if(in_array($file['action'], ['addition', 'dependent_addition'])){
|
||||||
|
$this->empEndorsementModel->where('file_id', $file_id)
|
||||||
|
->set(['status' => 'truncated','is_active' => 0])
|
||||||
|
->update();
|
||||||
|
|
||||||
|
$this->myLogger->logme('error', 'emp_endorsement table updated');
|
||||||
|
}
|
||||||
|
|
||||||
|
//STEP:3 - Update files table
|
||||||
//update file status
|
//update file status
|
||||||
$this->fileModel->where('id', $file_id)->set(['status' => 'truncated'])->update();
|
$this->fileModel->where('id', $file_id)->set(['status' => 'truncated'])->update();
|
||||||
|
$this->myLogger->logme('error', 'files table updated');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1316,7 +1358,12 @@ class EmployeeController extends AdminController
|
|||||||
$db = db_connect();
|
$db = db_connect();
|
||||||
$emp_codes = '(' . implode(',', array_map(fn($code) => "'$code'", $emp_codes)) . ')';
|
$emp_codes = '(' . implode(',', array_map(fn($code) => "'$code'", $emp_codes)) . ')';
|
||||||
$dependent_policies = '(' . implode(',', $dependent_policies) . ')';
|
$dependent_policies = '(' . implode(',', $dependent_policies) . ')';
|
||||||
$query = "UPDATE employee_polices JOIN employees ON employees.id = employee_polices.employee_id and employees.emp_code in $emp_codes SET employee_polices.status = 'truncated', employee_polices.is_active = 0 WHERE employee_polices.client_policy_id in $dependent_policies";
|
$query = "
|
||||||
|
UPDATE employee_polices
|
||||||
|
JOIN employees ON employees.id = employee_polices.employee_id and employees.emp_code in $emp_codes
|
||||||
|
SET employee_polices.status = 'truncated', employee_polices.is_active = 0
|
||||||
|
WHERE employee_polices.client_policy_id in $dependent_policies
|
||||||
|
";
|
||||||
$db->query($query);
|
$db->query($query);
|
||||||
$affectedRows = $db->affectedRows();
|
$affectedRows = $db->affectedRows();
|
||||||
|
|
||||||
@ -1326,10 +1373,11 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//FINAL STEP - Update reverse entry in cash_deposite table
|
||||||
if($cd_tranction){
|
if($cd_tranction){
|
||||||
|
|
||||||
$cd_data = [
|
$cd_data = [
|
||||||
'amount' => $cd_tranction['amount'],
|
'amount' => $cd_amount,
|
||||||
'sub_type_id' => 8,
|
'sub_type_id' => 8,
|
||||||
'endorsement_no' => null,
|
'endorsement_no' => null,
|
||||||
'insurer_id' =>$policy_data['insurer_id'],
|
'insurer_id' =>$policy_data['insurer_id'],
|
||||||
@ -1339,12 +1387,17 @@ class EmployeeController extends AdminController
|
|||||||
'client_id' => $client_id,
|
'client_id' => $client_id,
|
||||||
'client_policy_id' => $client_policy_id,
|
'client_policy_id' => $client_policy_id,
|
||||||
'cd_ac_no' => $policy_data['cd_ac_no'] ?? null,
|
'cd_ac_no' => $policy_data['cd_ac_no'] ?? null,
|
||||||
|
'cd_ac_pk' => $policy_data['cd_ac_pk'] ?? null,
|
||||||
'event_name' => $file['action'],
|
'event_name' => $file['action'],
|
||||||
];
|
];
|
||||||
|
|
||||||
$response = DepositHelper::saveDeposit($cd_data, $loggedInUserID);
|
$response = DepositHelper::saveDeposit($cd_data, $loggedInUserID);
|
||||||
|
$this->myLogger->logme('error', 'cash_deposite table updated -- cd transaction');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->myLogger->logme('error', 'SUCCESSFULLY TRUNCATED');
|
||||||
|
|
||||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => round($affectedRows / 2)], 200);
|
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => round($affectedRows / 2)], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1361,23 +1414,57 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
// print_r($this->empEndorsementModel->getLastQuery());
|
// print_r($this->empEndorsementModel->getLastQuery());
|
||||||
// echo $res[0]->count;die();
|
// echo $res[0]->count;die();
|
||||||
|
|
||||||
if ($res[0]->count == 0 || $role_id == 5 || $role_id == 1) {
|
if ($res[0]->count == 0 || $role_id == 5 || $role_id == 1) {
|
||||||
//update truncated status to db
|
|
||||||
|
$this->myLogger->logme('error', 'TRUNCATED STARTED WITH ADMIN OR HEAD PERMISSION');
|
||||||
|
$this->myLogger->logme('error', 'Event Type : -- {data} --', ['data' => $file['action']]);
|
||||||
|
|
||||||
|
$transaction_type = 'Credit';
|
||||||
|
$cd_amount = $cd_tranction['amount'];
|
||||||
|
|
||||||
|
if($file['action'] == 'deletion'){
|
||||||
|
$transaction_type = 'Debit';
|
||||||
|
//get cd amount for the particular file id to reverse entry to the cash deposite for only deletion
|
||||||
|
$cd_amount_total = $this->employeePolicyModel->getDeletionDataForTruncated($file['id']);
|
||||||
|
$totalSum = array_sum(array_column($cd_amount_total, 'total'));
|
||||||
|
$cd_amount = $totalSum;
|
||||||
|
|
||||||
|
$this->myLogger->logme('error', 'Deletion CD Amount : {data}', ['data' => $cd_amount]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->myLogger->logme('error', 'Endorsemnt CD Amount : {data}', ['data' => $cd_amount]);
|
||||||
|
|
||||||
|
|
||||||
|
//STEP 1:
|
||||||
|
//update truncated status to the Emp_endorsement table
|
||||||
$this->empEndorsementModel->where('file_id', $file_id)
|
$this->empEndorsementModel->where('file_id', $file_id)
|
||||||
->set(['status' => 'truncated','is_active' => 0])
|
->set(['status' => 'truncated','is_active' => 0])
|
||||||
->update();
|
->update();
|
||||||
//update file status
|
|
||||||
|
$this->myLogger->logme('error', 'emp_endorsement table updated');
|
||||||
|
|
||||||
|
//STEP 2:
|
||||||
|
if($file['action'] == 'deletion') {
|
||||||
|
//update the employee policy table reverse the data
|
||||||
|
$this->employeePolicyModel->updateEmployeePolicyTruncateReverse($file_id);
|
||||||
|
$this->myLogger->logme('error', 'employee_polices table updated for deletion');
|
||||||
|
}
|
||||||
|
|
||||||
|
if($file['action'] == 'correction'){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// STEP 3:
|
||||||
|
//update files table status to "truncated"
|
||||||
$this->fileModel->where('id', $file_id)->set(['status' => 'truncated'])->update();
|
$this->fileModel->where('id', $file_id)->set(['status' => 'truncated'])->update();
|
||||||
|
$this->myLogger->logme('error', 'files table updated');
|
||||||
|
|
||||||
|
|
||||||
if($cd_tranction && $file['action'] != 'correction'){
|
if($cd_tranction && $file['action'] != 'correction'){
|
||||||
|
|
||||||
$transaction_type = 'Credit';
|
|
||||||
if($file['action'] == 'deletion'){
|
|
||||||
$transaction_type = 'Debit';
|
|
||||||
}
|
|
||||||
|
|
||||||
$cd_data = [
|
$cd_data = [
|
||||||
'amount' => $cd_tranction['amount'],
|
'amount' => $cd_amount,
|
||||||
'sub_type_id' => 8,
|
'sub_type_id' => 8,
|
||||||
'endorsement_no' => null,
|
'endorsement_no' => null,
|
||||||
'insurer_id' =>$policy_data['insurer_id'],
|
'insurer_id' =>$policy_data['insurer_id'],
|
||||||
@ -1387,13 +1474,19 @@ class EmployeeController extends AdminController
|
|||||||
'client_id' => $client_id,
|
'client_id' => $client_id,
|
||||||
'client_policy_id' => $client_policy_id,
|
'client_policy_id' => $client_policy_id,
|
||||||
'cd_ac_no' => $policy_data['cd_ac_no'] ?? null,
|
'cd_ac_no' => $policy_data['cd_ac_no'] ?? null,
|
||||||
|
'cd_ac_pk' => $policy_data['cd_ac_pk'] ?? null,
|
||||||
'event_name' => $file['action'],
|
'event_name' => $file['action'],
|
||||||
];
|
];
|
||||||
|
|
||||||
$response = DepositHelper::saveDeposit($cd_data, $loggedInUserID);
|
$response = DepositHelper::saveDeposit($cd_data, $loggedInUserID);
|
||||||
|
$this->myLogger->logme('error', 'cash_deposite table updated -- cd transaction');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->myLogger->logme('error', 'SUCCESSFULLY TRUNCATED');
|
||||||
|
|
||||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => 'success'], 200);
|
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => 'success'], 200);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if(get_role_id() == 1 || get_role_id() == 5){
|
if(get_role_id() == 1 || get_role_id() == 5){
|
||||||
return $this->respond(['role' => get_role_id(), 'dataStatus' => false, 'code' => 404, 'message' => 'File data already processed. Do you want to truncate data from uploaded file?'], 200);
|
return $this->respond(['role' => get_role_id(), 'dataStatus' => false, 'code' => 404, 'message' => 'File data already processed. Do you want to truncate data from uploaded file?'], 200);
|
||||||
|
|||||||
@ -864,11 +864,12 @@ class LeadsController extends BaseController
|
|||||||
{
|
{
|
||||||
$lead_id = $params['lead_id'];
|
$lead_id = $params['lead_id'];
|
||||||
$lead_data = $this->leadsModel->find($lead_id);
|
$lead_data = $this->leadsModel->find($lead_id);
|
||||||
|
$file_name_with_path = WRITEPATH . "/uploads/lead_files/" . $lead_data['file_name'];
|
||||||
|
|
||||||
if (!$lead_data) {
|
if (!$lead_data) {
|
||||||
return ['status' => 'failed', 'message' => 'Lead data not found'];
|
return ['status' => 'failed', 'message' => 'Lead data not found'];
|
||||||
}
|
}
|
||||||
if ($lead_data['file_name']) {
|
if ($lead_data['file_name']) {
|
||||||
$file_name_with_path = WRITEPATH . "/uploads/lead_files/" . $lead_data['file_name'];
|
|
||||||
// $file_name_with_path = WRITEPATH . "/uploads/lead_files/NonPrintableCharacters.xlsx";
|
// $file_name_with_path = WRITEPATH . "/uploads/lead_files/NonPrintableCharacters.xlsx";
|
||||||
|
|
||||||
//check physical file
|
//check physical file
|
||||||
|
|||||||
@ -1314,11 +1314,30 @@ class MasterController extends AdminController
|
|||||||
->where('is_active', 1)
|
->where('is_active', 1)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
|
$db = db_connect();
|
||||||
|
$builder = $db->table('cd_master');
|
||||||
|
$builder->select('cd_master.cd_ac_no, cd_master.id, COUNT(cash_deposit.cd_ac_no) AS cd_ac_no_count_cd_tranction');
|
||||||
|
$builder->join('cash_deposit', 'cash_deposit.cd_ac_pk = cd_master.id');
|
||||||
|
$builder->where('cash_deposit.is_active', 1);
|
||||||
|
$builder->where('cd_master.is_active', 1);
|
||||||
|
$builder->where('cd_master.id', $id);
|
||||||
|
$builder->groupBy('cd_master.id');
|
||||||
|
|
||||||
|
$query = $builder->get();
|
||||||
|
$result = $query->getResultArray();
|
||||||
|
|
||||||
|
// print_r($result); die;
|
||||||
|
|
||||||
|
$count = 0;
|
||||||
|
if(isset($result[0])){
|
||||||
|
$count = $result[0]['cd_ac_no_count_cd_tranction'];
|
||||||
|
}
|
||||||
|
|
||||||
// convert the date formate 2000-01-01 to 01-01-2000
|
// convert the date formate 2000-01-01 to 01-01-2000
|
||||||
$cd_data['opening_date'] = date('d-m-Y', strtotime($cd_data['opening_date']));
|
$cd_data['opening_date'] = date('d-m-Y', strtotime($cd_data['opening_date']));
|
||||||
|
|
||||||
if ($cd_data) {
|
if ($cd_data) {
|
||||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $cd_data], 200);
|
return $this->respond(['status' => true, 'code' => 200, 'data' => $cd_data, 'cd_transaction_count' => $count], 200);
|
||||||
} else {
|
} else {
|
||||||
return $this->respond(['status' => false, 'code' => 404], 200);
|
return $this->respond(['status' => false, 'code' => 404], 200);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1160,7 +1160,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
{
|
{
|
||||||
if($temp_slab_rates[0]['si_or_bp'] == 2)
|
if($temp_slab_rates[0]['si_or_bp'] == 2)
|
||||||
{
|
{
|
||||||
$temp_si = $emp_data['basic_pay'] * $temp_slab_rates[0]['si_or_bp'];
|
$temp_si = $emp_data['basic_pay'] * $temp_slab_rates[0]['basic_multiplier'];
|
||||||
$temp_premium = ($temp_si * $temp_slab_rates[0]['multiplier']) / 1000;
|
$temp_premium = ($temp_si * $temp_slab_rates[0]['multiplier']) / 1000;
|
||||||
|
|
||||||
$emp_data['policy_details']['basic_cover_si'] = $temp_si;
|
$emp_data['policy_details']['basic_cover_si'] = $temp_si;
|
||||||
|
|||||||
@ -65,28 +65,37 @@ class CDMasterModel extends Model
|
|||||||
{
|
{
|
||||||
|
|
||||||
$query = $this->db->table('cd_master')
|
$query = $this->db->table('cd_master')
|
||||||
|
|
||||||
->select('cd_master.*, clients.client_name, clients.short_name, insurers.name AS insurer_name, user_profiles.first_name AS user_name, IFNULL(cd_ac_counts.cd_ac_no_count, 0) AS cd_ac_no_count, IFNULL(cd_ac_counts_for_cdt.cd_ac_no_count_cd_tranction, 0) AS cd_ac_no_count_cd_tranction')
|
->select('cd_master.*, clients.client_name, clients.short_name, insurers.name AS insurer_name, user_profiles.first_name AS user_name, IFNULL(cd_ac_counts.cd_ac_no_count, 0) AS cd_ac_no_count, IFNULL(cd_ac_counts_for_cdt.cd_ac_no_count_cd_tranction, 0) AS cd_ac_no_count_cd_tranction')
|
||||||
->join('clients', 'clients.id = cd_master.client_id')
|
->join('clients', 'clients.id = cd_master.client_id')
|
||||||
->join('insurers', 'insurers.id = cd_master.insurer_id')
|
->join('insurers', 'insurers.id = cd_master.insurer_id')
|
||||||
->join('user_profiles', 'user_profiles.id = cd_master.created_by')
|
->join('user_profiles', 'user_profiles.id = cd_master.created_by')
|
||||||
->join(
|
->join(
|
||||||
'(SELECT cd_master.cd_ac_no, COUNT(client_policy.cd_ac_no) AS cd_ac_no_count
|
'(SELECT cd_master.cd_ac_no, cd_master.id, COUNT(client_policy.cd_ac_no) AS cd_ac_no_count
|
||||||
|
|
||||||
FROM cd_master
|
FROM cd_master
|
||||||
JOIN client_policy ON client_policy.cd_ac_no = cd_master.cd_ac_no
|
JOIN client_policy ON client_policy.cd_ac_pk = cd_master.id
|
||||||
WHERE client_policy.is_active = 1
|
WHERE client_policy.is_active = 1
|
||||||
AND cd_master.is_active = 1
|
AND cd_master.is_active = 1
|
||||||
GROUP BY cd_master.cd_ac_no) AS cd_ac_counts',
|
GROUP BY cd_master.id
|
||||||
'cd_ac_counts.cd_ac_no = cd_master.cd_ac_no',
|
|
||||||
|
) AS cd_ac_counts',
|
||||||
|
|
||||||
|
'cd_ac_counts.id = cd_master.id',
|
||||||
'left'
|
'left'
|
||||||
)
|
)
|
||||||
->join(
|
->join(
|
||||||
'(SELECT cd_master.cd_ac_no, COUNT(cash_deposit.cd_ac_no) AS cd_ac_no_count_cd_tranction
|
'(SELECT cd_master.cd_ac_no, cd_master.id, COUNT(cash_deposit.cd_ac_no) AS cd_ac_no_count_cd_tranction
|
||||||
|
|
||||||
FROM cd_master
|
FROM cd_master
|
||||||
JOIN cash_deposit ON cash_deposit.cd_ac_no = cd_master.cd_ac_no
|
JOIN cash_deposit ON cash_deposit.cd_ac_pk = cd_master.id
|
||||||
WHERE cash_deposit.is_active = 1
|
WHERE cash_deposit.is_active = 1
|
||||||
AND cd_master.is_active = 1
|
AND cd_master.is_active = 1
|
||||||
GROUP BY cd_master.cd_ac_no) AS cd_ac_counts_for_cdt',
|
GROUP BY cd_master.id
|
||||||
'cd_ac_counts_for_cdt.cd_ac_no = cd_master.cd_ac_no',
|
|
||||||
|
) AS cd_ac_counts_for_cdt',
|
||||||
|
|
||||||
|
'cd_ac_counts_for_cdt.id = cd_master.id',
|
||||||
'left'
|
'left'
|
||||||
)
|
)
|
||||||
->where('cd_master.is_active', 1)
|
->where('cd_master.is_active', 1)
|
||||||
|
|||||||
@ -806,26 +806,26 @@ class EmployeePolicyModel extends Model
|
|||||||
deletiondata.dateofexit,
|
deletiondata.dateofexit,
|
||||||
deletiondata.reasonforexit,
|
deletiondata.reasonforexit,
|
||||||
deletiondata.status,
|
deletiondata.status,
|
||||||
|
deletiondata.claimstatus,
|
||||||
|
|
||||||
DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + '$add_one_day' AS no_of_days,
|
DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + '$add_one_day' AS no_of_days,
|
||||||
|
|
||||||
|
|
||||||
CASE
|
CASE
|
||||||
WHEN employee_polices.claim_status = 0 THEN
|
WHEN deletiondata.claimstatus = 0 THEN
|
||||||
ROUND((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365, 2)
|
ROUND((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365, 2)
|
||||||
ELSE
|
ELSE
|
||||||
0
|
0
|
||||||
END AS pro_rata_premium,
|
END AS pro_rata_premium,
|
||||||
|
|
||||||
CASE
|
CASE
|
||||||
WHEN employee_polices.claim_status = 0 THEN
|
WHEN deletiondata.claimstatus = 0 THEN
|
||||||
ROUND(((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365) * 0.18, 2)
|
ROUND(((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365) * 0.18, 2)
|
||||||
ELSE
|
ELSE
|
||||||
0
|
0
|
||||||
END AS gst,
|
END AS gst,
|
||||||
|
|
||||||
CASE
|
CASE
|
||||||
WHEN employee_polices.claim_status = 0 THEN
|
WHEN deletiondata.claimstatus = 0 THEN
|
||||||
ROUND(((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365) +
|
ROUND(((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365) +
|
||||||
(((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365) * 0.18), 2)
|
(((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365) * 0.18), 2)
|
||||||
ELSE
|
ELSE
|
||||||
@ -833,7 +833,7 @@ class EmployeePolicyModel extends Model
|
|||||||
END AS total,
|
END AS total,
|
||||||
|
|
||||||
CASE
|
CASE
|
||||||
WHEN employee_polices.claim_status = 0 THEN
|
WHEN deletiondata.claimstatus = 0 THEN
|
||||||
'No claim'
|
'No claim'
|
||||||
ELSE
|
ELSE
|
||||||
'Claim'
|
'Claim'
|
||||||
@ -854,7 +854,8 @@ class EmployeePolicyModel extends Model
|
|||||||
MAX(CASE WHEN field_name = 'change_event' THEN new_value END) AS changeevent,
|
MAX(CASE WHEN field_name = 'change_event' THEN new_value END) AS changeevent,
|
||||||
MAX(CASE WHEN field_name = 'date_of_exit' THEN new_value END) AS dateofexit,
|
MAX(CASE WHEN field_name = 'date_of_exit' THEN new_value END) AS dateofexit,
|
||||||
MAX(CASE WHEN field_name = 'reason_for_exit' THEN new_value END) AS reasonforexit,
|
MAX(CASE WHEN field_name = 'reason_for_exit' THEN new_value END) AS reasonforexit,
|
||||||
MAX(CASE WHEN field_name = 'status' THEN new_value END) AS status
|
MAX(CASE WHEN field_name = 'status' THEN new_value END) AS status,
|
||||||
|
MAX(CASE WHEN field_name = 'claim_status' THEN new_value END) AS claimstatus
|
||||||
FROM
|
FROM
|
||||||
emp_endorsement
|
emp_endorsement
|
||||||
WHERE
|
WHERE
|
||||||
@ -922,6 +923,7 @@ class EmployeePolicyModel extends Model
|
|||||||
ee.id as emp_endorsement_primarykey,
|
ee.id as emp_endorsement_primarykey,
|
||||||
ep.id as emp_policy_primarykey,
|
ep.id as emp_policy_primarykey,
|
||||||
e.id as employees_primarykey,
|
e.id as employees_primarykey,
|
||||||
|
ee.file_id,
|
||||||
ee.group_key,
|
ee.group_key,
|
||||||
(
|
(
|
||||||
SELECT employees.id
|
SELECT employees.id
|
||||||
@ -949,7 +951,12 @@ class EmployeePolicyModel extends Model
|
|||||||
CASE
|
CASE
|
||||||
WHEN ee.field_name = 'status' THEN ee.new_value
|
WHEN ee.field_name = 'status' THEN ee.new_value
|
||||||
END
|
END
|
||||||
) AS status
|
) AS status,
|
||||||
|
MAX(
|
||||||
|
CASE
|
||||||
|
WHEN ee.field_name = 'claim_status' THEN ee.new_value
|
||||||
|
END
|
||||||
|
) AS claim_status
|
||||||
FROM
|
FROM
|
||||||
emp_endorsement AS ee
|
emp_endorsement AS ee
|
||||||
JOIN employee_polices AS ep ON ep.id = ee.pk
|
JOIN employee_polices AS ep ON ep.id = ee.pk
|
||||||
@ -959,7 +966,7 @@ class EmployeePolicyModel extends Model
|
|||||||
AND ep.client_policy_id = '$client_policy_id'
|
AND ep.client_policy_id = '$client_policy_id'
|
||||||
AND e.client_branch_id = '$client_branch_id'
|
AND e.client_branch_id = '$client_branch_id'
|
||||||
AND ee.name = '$emp_name'
|
AND ee.name = '$emp_name'
|
||||||
AND ee.field_name IN ('date_of_exit', 'reason_for_exit', 'status')
|
AND ee.field_name IN ('date_of_exit', 'reason_for_exit', 'status', 'claim_status')
|
||||||
AND ep.is_active = 1
|
AND ep.is_active = 1
|
||||||
AND ep.status = 'active'
|
AND ep.status = 'active'
|
||||||
AND e.is_active = 1
|
AND e.is_active = 1
|
||||||
@ -1360,13 +1367,13 @@ class EmployeePolicyModel extends Model
|
|||||||
return "WHEN group_key = $id THEN $endorsement_id";
|
return "WHEN group_key = $id THEN $endorsement_id";
|
||||||
}, $escapedIds, $escapedEndorsementIds);
|
}, $escapedIds, $escapedEndorsementIds);
|
||||||
|
|
||||||
$caseStatus = array_map(function ($id, $status) {
|
// $caseStatus = array_map(function ($id, $status) {
|
||||||
return "WHEN status = $id THEN $status";
|
// return "WHEN status = $id THEN $status";
|
||||||
}, $escapedIds, $escapedStatuses);
|
// }, $escapedIds, $escapedStatuses);
|
||||||
|
|
||||||
// Convert cases to a string
|
// Convert cases to a string
|
||||||
$caseEndorsementIdString = implode(' ', $caseEndorsementId);
|
$caseEndorsementIdString = implode(' ', $caseEndorsementId);
|
||||||
$caseStatusString = implode(' ', $caseStatus);
|
// $caseStatusString = implode(' ', $caseStatus);
|
||||||
|
|
||||||
// Convert ids to a string
|
// Convert ids to a string
|
||||||
$idsString = implode(', ', $escapedIds);
|
$idsString = implode(', ', $escapedIds);
|
||||||
@ -1376,10 +1383,12 @@ class EmployeePolicyModel extends Model
|
|||||||
UPDATE emp_endorsement
|
UPDATE emp_endorsement
|
||||||
SET
|
SET
|
||||||
endorsement_id = CASE {$caseEndorsementIdString} END,
|
endorsement_id = CASE {$caseEndorsementIdString} END,
|
||||||
status = CASE {$caseStatusString} END
|
status = 'complete'
|
||||||
WHERE group_key IN ({$idsString})
|
WHERE group_key IN ({$idsString})
|
||||||
";
|
";
|
||||||
|
|
||||||
|
|
||||||
|
// dd($sql);
|
||||||
// Begin a transaction
|
// Begin a transaction
|
||||||
$this->db->transBegin();
|
$this->db->transBegin();
|
||||||
|
|
||||||
@ -1396,6 +1405,7 @@ class EmployeePolicyModel extends Model
|
|||||||
// Otherwise, commit
|
// Otherwise, commit
|
||||||
$this->db->transCommit();
|
$this->db->transCommit();
|
||||||
}
|
}
|
||||||
|
// $this->storeEndorsementNumber($file_id, $endorsement_id, $enrollment_file_id);
|
||||||
|
|
||||||
return $this->db->getLastQuery();
|
return $this->db->getLastQuery();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@ -1467,5 +1477,209 @@ class EmployeePolicyModel extends Model
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//for truncate get deletion data
|
||||||
|
public function getDeletionDataForTruncated($file_id)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Fetch the necessary details in a single query using JOINs
|
||||||
|
$result = $this->db->table('files f')
|
||||||
|
->select('i.deletion_add_day')
|
||||||
|
->join('client_policy cp', 'cp.id = f.policy_id', 'left')
|
||||||
|
->join('insurers i', 'i.id = cp.insurer_id', 'left')
|
||||||
|
->where('f.id', $file_id)
|
||||||
|
->get()
|
||||||
|
->getRowArray();
|
||||||
|
|
||||||
|
// Determine if one day should be added for deletion
|
||||||
|
$add_one_day = (!empty($result) && $result['deletion_add_day'] == 1) ? 1 : 0;
|
||||||
|
|
||||||
|
|
||||||
|
$query = $this->db->query("
|
||||||
|
|
||||||
|
SELECT DISTINCT
|
||||||
|
|
||||||
|
a.id as endorsement_primarykey,
|
||||||
|
a.group_key,
|
||||||
|
employee_polices.id as primaryKey,
|
||||||
|
employees.name AS emp_name,
|
||||||
|
employees.emp_code AS emp_code,
|
||||||
|
employees.dob AS emp_dob,
|
||||||
|
employees.gender AS emp_gender,
|
||||||
|
employees.relationship AS emp_relationship,
|
||||||
|
employees.relationship_code AS emp_relationship_code,
|
||||||
|
employees.emp_type as emp_type,
|
||||||
|
'D' as event_type_data,
|
||||||
|
TIMESTAMPDIFF(YEAR, employees.dob, CURDATE()) AS emp_age,
|
||||||
|
|
||||||
|
employees.doj AS emp_doj,
|
||||||
|
employees.mobile AS emp_mobile,
|
||||||
|
employees.email_corporate AS emp_email_c,
|
||||||
|
employees.email_personal AS emp_email_p,
|
||||||
|
employees.band AS emp_grade,
|
||||||
|
employees.designation AS emp_designation,
|
||||||
|
employees.basic_pay AS emp_basic_pay,
|
||||||
|
|
||||||
|
employee_polices.basic_cover_si,
|
||||||
|
employee_polices.uhid as uhid,
|
||||||
|
employee_polices.policy_end_date,
|
||||||
|
employee_polices.rata_premimum as premium,
|
||||||
|
employee_polices.claim_status,
|
||||||
|
|
||||||
|
deletiondata.empstatus,
|
||||||
|
deletiondata.changeevent,
|
||||||
|
deletiondata.dateofexit,
|
||||||
|
deletiondata.reasonforexit,
|
||||||
|
deletiondata.status,
|
||||||
|
deletiondata.claimstatus,
|
||||||
|
|
||||||
|
DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + '$add_one_day' AS no_of_days,
|
||||||
|
|
||||||
|
CASE
|
||||||
|
WHEN deletiondata.claimstatus = 0 THEN
|
||||||
|
ROUND((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365, 2)
|
||||||
|
ELSE
|
||||||
|
0
|
||||||
|
END AS pro_rata_premium,
|
||||||
|
|
||||||
|
CASE
|
||||||
|
WHEN deletiondata.claimstatus = 0 THEN
|
||||||
|
ROUND(((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365) * 0.18, 2)
|
||||||
|
ELSE
|
||||||
|
0
|
||||||
|
END AS gst,
|
||||||
|
|
||||||
|
CASE
|
||||||
|
WHEN deletiondata.claimstatus = 0 THEN
|
||||||
|
ROUND(((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365) +
|
||||||
|
(((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365) * 0.18), 2)
|
||||||
|
ELSE
|
||||||
|
0
|
||||||
|
END AS total,
|
||||||
|
|
||||||
|
CASE
|
||||||
|
WHEN deletiondata.claimstatus = 0 THEN
|
||||||
|
'No claim'
|
||||||
|
ELSE
|
||||||
|
'Claim'
|
||||||
|
END AS claim_status
|
||||||
|
|
||||||
|
FROM
|
||||||
|
emp_endorsement a
|
||||||
|
LEFT JOIN
|
||||||
|
employee_polices ON a.pk = employee_polices.id
|
||||||
|
LEFT JOIN
|
||||||
|
employees ON employee_polices.employee_id = employees.id
|
||||||
|
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
emp_code,
|
||||||
|
group_key,
|
||||||
|
MAX(CASE WHEN field_name = 'emp_status' THEN new_value END) AS empstatus,
|
||||||
|
MAX(CASE WHEN field_name = 'change_event' THEN new_value END) AS changeevent,
|
||||||
|
MAX(CASE WHEN field_name = 'date_of_exit' THEN new_value END) AS dateofexit,
|
||||||
|
MAX(CASE WHEN field_name = 'reason_for_exit' THEN new_value END) AS reasonforexit,
|
||||||
|
MAX(CASE WHEN field_name = 'status' THEN new_value END) AS status,
|
||||||
|
MAX(CASE WHEN field_name = 'claim_status' THEN new_value END) AS claimstatus
|
||||||
|
FROM
|
||||||
|
emp_endorsement
|
||||||
|
WHERE
|
||||||
|
status != 'truncated'
|
||||||
|
GROUP BY
|
||||||
|
group_key
|
||||||
|
|
||||||
|
) AS deletiondata
|
||||||
|
|
||||||
|
ON a.emp_code = deletiondata.emp_code AND a.status != 'truncated'
|
||||||
|
|
||||||
|
WHERE a.file_id = {$file_id}
|
||||||
|
AND a.actions = 'd'
|
||||||
|
AND a.status != 'truncated'
|
||||||
|
AND employee_polices.is_active = 1
|
||||||
|
AND employees.is_active = 1
|
||||||
|
group by group_key
|
||||||
|
");
|
||||||
|
|
||||||
|
|
||||||
|
$result = $query->getResultArray();
|
||||||
|
// dd($this->db->getLastQuery(), $result);
|
||||||
|
// dd($result);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//for truncate get addition data
|
||||||
|
public function getAdditionDataForTruncated($file_id, $event_type)
|
||||||
|
{
|
||||||
|
$action = "a";
|
||||||
|
if($event_type == "dependent_addition"){
|
||||||
|
$action = "da";
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = $this->db->query("
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
ROUND(SUM(ep.rata_premimum + ep.gst), 2) AS total
|
||||||
|
FROM
|
||||||
|
emp_endorsement ee
|
||||||
|
JOIN
|
||||||
|
employee_polices ep ON ee.pk = ep.id
|
||||||
|
WHERE
|
||||||
|
ee.file_id = $file_id
|
||||||
|
AND ee.actions = '$action'
|
||||||
|
AND ep.status != 'truncated'
|
||||||
|
AND ee.status != 'truncated'
|
||||||
|
AND ee.is_active = 1
|
||||||
|
AND ep.is_active = 1;
|
||||||
|
");
|
||||||
|
|
||||||
|
|
||||||
|
$result = $query->getResultArray();
|
||||||
|
// dd($this->db->getLastQuery(), $result);
|
||||||
|
// dd($result);
|
||||||
|
|
||||||
|
return $result[0];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// reverse the employee policy table data for the truncated the deletion file
|
||||||
|
public function updateEmployeePolicyTruncateReverse($file_id)
|
||||||
|
{
|
||||||
|
$this->db->query("
|
||||||
|
UPDATE employee_polices
|
||||||
|
SET
|
||||||
|
is_active = 1,
|
||||||
|
status = 'active',
|
||||||
|
date_of_exit = NULL,
|
||||||
|
reason_for_exit = NULL,
|
||||||
|
claim_status = 0,
|
||||||
|
WHERE
|
||||||
|
id IN (
|
||||||
|
SELECT pk
|
||||||
|
FROM emp_endorsement
|
||||||
|
WHERE file_id = $file_id
|
||||||
|
GROUP BY group_key
|
||||||
|
)
|
||||||
|
AND status = 'inactive'
|
||||||
|
");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//update employee policy table status truncated and is_active 0 for truncated to the addition file
|
||||||
|
public function updateEmpEndorsementAddition($array)
|
||||||
|
{
|
||||||
|
$caseStatus = "CASE ";
|
||||||
|
$caseEndorsementId = "CASE ";
|
||||||
|
$ids = [];
|
||||||
|
foreach ($array as $item) {
|
||||||
|
$caseStatus .= "WHEN id = {$item['id']} THEN '{$item['status']}' ";
|
||||||
|
$caseEndorsementId .= "WHEN id = {$item['id']} THEN '{$item['endorsement_id']}' ";
|
||||||
|
$ids[] = $item['id'];
|
||||||
|
}
|
||||||
|
$caseStatus .= "END";
|
||||||
|
$caseEndorsementId .= "END";
|
||||||
|
$ids = implode(',', $ids);
|
||||||
|
$query = "UPDATE emp_endorsement SET status = $caseStatus, endorsement_id = $caseEndorsementId WHERE id IN ($ids);"; // Execute the query
|
||||||
|
$this->db->query($query);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -57,28 +57,18 @@ table.dataTable thead th {
|
|||||||
<td><?php echo date('d-M-Y h:i A', strtotime($row['created_at'])) ?> by
|
<td><?php echo date('d-M-Y h:i A', strtotime($row['created_at'])) ?> by
|
||||||
<?php echo $row['user_name']; ?></td>
|
<?php echo $row['user_name']; ?></td>
|
||||||
<td>
|
<td>
|
||||||
<?php if($row['cd_ac_no_count'] > 0 && $row['cd_ac_no_count_cd_tranction'] > 1) {?>
|
|
||||||
<div class="btn-group dropdown">
|
|
||||||
<!-- <a href="javascript: void(0);"class="dropdown-toggle arrow-none btn btn-light btn-sm"aria-expanded="false"></i></a> -->
|
|
||||||
</div>
|
|
||||||
<?php } else { ?>
|
|
||||||
|
|
||||||
<div class="btn-group dropdown">
|
<div class="btn-group dropdown">
|
||||||
<a href="javascript: void(0);"class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
<a href="javascript: void(0);"class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||||
<div class="dropdown-menu dropdown-menu-right">
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
<?php if($row['cd_ac_no_count_cd_tranction'] <= 1) { ?>
|
|
||||||
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" data-toggle="modal" data-target="#con-close-modal"> <i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" data-toggle="modal" data-target="#con-close-modal"> <i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||||
<?php } ?>
|
|
||||||
<?php if($row['cd_ac_no_count'] == 0) { ?>
|
<?php if($row['cd_ac_no_count'] == 0) { ?>
|
||||||
<a class="dropdown-item" data-id="<?= $row['id'];?>" onclick="removeCDMaster(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
<a class="dropdown-item" data-id="<?= $row['id'];?>" onclick="removeCDMaster(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php } ?>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@ -171,6 +161,7 @@ table.dataTable thead th {
|
|||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$('#tickets-table').DataTable({
|
$('#tickets-table').DataTable({
|
||||||
@ -195,7 +186,6 @@ table.dataTable thead th {
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
<?php if (session()->has('error')) : ?>
|
<?php if (session()->has('error')) : ?>
|
||||||
@ -217,7 +207,6 @@ table.dataTable thead th {
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
$('#btnAdd').click(function(){
|
$('#btnAdd').click(function(){
|
||||||
$('#client_id').val('');
|
$('#client_id').val('');
|
||||||
$('#insurer_id').val('');
|
$('#insurer_id').val('');
|
||||||
@ -231,7 +220,6 @@ table.dataTable thead th {
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
$('.close').click(function(){
|
$('.close').click(function(){
|
||||||
$('#CD_Master_ID').val('');
|
$('#CD_Master_ID').val('');
|
||||||
$('#client_id').val('').change();
|
$('#client_id').val('').change();
|
||||||
@ -244,10 +232,10 @@ table.dataTable thead th {
|
|||||||
$('#client_id').prop("disabled", false);
|
$('#client_id').prop("disabled", false);
|
||||||
$('#insurer_id').prop("disabled", false);
|
$('#insurer_id').prop("disabled", false);
|
||||||
$('#cd_ac_no').prop("disabled", false);
|
$('#cd_ac_no').prop("disabled", false);
|
||||||
|
$('#opening_bal').prop("disabled", false)
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
$('body').on('click', '.btnEdit', function () {
|
$('body').on('click', '.btnEdit', function () {
|
||||||
|
|
||||||
var cd_id = $(this).attr('data-id');
|
var cd_id = $(this).attr('data-id');
|
||||||
@ -270,8 +258,13 @@ table.dataTable thead th {
|
|||||||
$('#insurer_id').prop("disabled", true);
|
$('#insurer_id').prop("disabled", true);
|
||||||
$('#opening_date').val(res.data.opening_date);
|
$('#opening_date').val(res.data.opening_date);
|
||||||
$('#cd_ac_no').val(res.data.cd_ac_no);
|
$('#cd_ac_no').val(res.data.cd_ac_no);
|
||||||
$('#cd_ac_no').prop("disabled", true);
|
//$('#cd_ac_no').prop("disabled", true);
|
||||||
$('#opening_bal').val(res.data.opening_bal);
|
$('#opening_bal').val(res.data.opening_bal);
|
||||||
|
if(res.cd_transaction_count <= 1){
|
||||||
|
$('#opening_bal').prop("disabled", false)
|
||||||
|
}else{
|
||||||
|
$('#opening_bal').prop("disabled", true)
|
||||||
|
}
|
||||||
$('#btnSubmit').html('Update');
|
$('#btnSubmit').html('Update');
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -282,7 +275,6 @@ table.dataTable thead th {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('#cd_ac_no').change(function(){
|
$('#cd_ac_no').change(function(){
|
||||||
|
|
||||||
var cd_ac_no = $(this).val();
|
var cd_ac_no = $(this).val();
|
||||||
@ -311,8 +303,7 @@ table.dataTable thead th {
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function removeCDMaster(element) {
|
||||||
function removeCDMaster(element) {
|
|
||||||
|
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Are you sure?",
|
title: "Are you sure?",
|
||||||
@ -355,13 +346,12 @@ function removeCDMaster(element) {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onlyNumbers(event) {
|
||||||
function onlyNumbers(event) {
|
|
||||||
var charcode;
|
var charcode;
|
||||||
charcode = event.which || event.keyCode;
|
charcode = event.which || event.keyCode;
|
||||||
if (charcode >= 48 && charcode <= 57 || charcode == 46) return true;
|
if (charcode >= 48 && charcode <= 57 || charcode == 46) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user