MERGE_TEST_CRM_TO_BDS_SYNC&OT_ISSUES
This commit is contained in:
commit
a261fed9ed
@ -87,6 +87,7 @@ class ClientController extends AdminController
|
|||||||
protected $vehicleModel;
|
protected $vehicleModel;
|
||||||
protected $leadsModel;
|
protected $leadsModel;
|
||||||
protected $clientApi;
|
protected $clientApi;
|
||||||
|
protected $PTCOShareDetailsModel;
|
||||||
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@ -123,6 +124,7 @@ class ClientController extends AdminController
|
|||||||
$this->vehicleModel = new VehicleModel();
|
$this->vehicleModel = new VehicleModel();
|
||||||
$this->leadsModel = new LeadsModel();
|
$this->leadsModel = new LeadsModel();
|
||||||
$this->clientApi = new ClientApiModel();
|
$this->clientApi = new ClientApiModel();
|
||||||
|
$this->PTCOShareDetailsModel = new PTCOShareDetailsModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------
|
||||||
@ -270,7 +272,7 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
if($mail_active == 1){
|
if($mail_active == 1){
|
||||||
$mail_send_return = MailHelper::send_email($wholeData[0]);
|
$mail_send_return = MailHelper::send_email($wholeData[0]);
|
||||||
$this->myLogger->logme("info", $mail_send_return);
|
$this->myLogger->logme("error", $mail_send_return);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (isset($wholeData)) {
|
// if (isset($wholeData)) {
|
||||||
@ -1255,11 +1257,8 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
public function editClientPolicy()
|
public function editClientPolicy()
|
||||||
{
|
{
|
||||||
|
|
||||||
// print_r('test'); die;
|
|
||||||
$this->myLogger->logme('error', 'Client policy function called');
|
$this->myLogger->logme('error', 'Client policy function called');
|
||||||
|
|
||||||
|
|
||||||
$id = $this->request->getPost('PrimaryKey');
|
$id = $this->request->getPost('PrimaryKey');
|
||||||
$client_id = $this->request->getPost('client_id');
|
$client_id = $this->request->getPost('client_id');
|
||||||
$policy_type_id = $this->request->getPost('policy_type_id');
|
$policy_type_id = $this->request->getPost('policy_type_id');
|
||||||
@ -1280,8 +1279,6 @@ class ClientController extends AdminController
|
|||||||
$data['tpa_id'] = $tpaId;
|
$data['tpa_id'] = $tpaId;
|
||||||
$data['policy_type_id'] = $this->request->getPost('policy_type_id');
|
$data['policy_type_id'] = $this->request->getPost('policy_type_id');
|
||||||
$data['policy_no'] = $this->request->getPost('policy_no');
|
$data['policy_no'] = $this->request->getPost('policy_no');
|
||||||
// $data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d');
|
|
||||||
// $data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d');
|
|
||||||
|
|
||||||
$data['insured'] = $this->request->getPost('insured');
|
$data['insured'] = $this->request->getPost('insured');
|
||||||
$data['no_of_lives'] = $this->request->getPost('no_of_lives');
|
$data['no_of_lives'] = $this->request->getPost('no_of_lives');
|
||||||
@ -1318,19 +1315,6 @@ class ClientController extends AdminController
|
|||||||
$data['reminder_date'] = null;
|
$data['reminder_date'] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if($policy_type_id == 1 || $policy_type_id == 2 || $policy_type_id == 3 || $policy_type_id == 6 || $policy_type_id == 7){
|
|
||||||
|
|
||||||
// $data['is_addon'] = 1;
|
|
||||||
|
|
||||||
// }else if($policy_type_id == 4){
|
|
||||||
|
|
||||||
// $data['is_addon'] = 2;
|
|
||||||
|
|
||||||
// }else if($policy_type_id == 5){
|
|
||||||
|
|
||||||
// $data['is_addon'] = 3;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if ($policy_type_id == 1 || $policy_type_id == 2 || $policy_type_id == 6 || $policy_type_id == 7) {
|
if ($policy_type_id == 1 || $policy_type_id == 2 || $policy_type_id == 6 || $policy_type_id == 7) {
|
||||||
|
|
||||||
$data['is_addon'] = 1; // Base Policy
|
$data['is_addon'] = 1; // Base Policy
|
||||||
@ -1348,47 +1332,26 @@ class ClientController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$policy_terms = $this->clientPolicyModel->where('id', $this->request->getPost('base_policy'))->first();
|
$policy_terms = $this->clientPolicyModel->where('id', $this->request->getPost('base_policy'))->first();
|
||||||
|
|
||||||
// if ( $this->request->getPost('is_addon') == 2 || $this->request->getPost('is_addon') == 3) {
|
$old_client_policy_data = $this->clientPolicyModel->where('is_active', 1)->where('id', $id)->first();
|
||||||
// if ($this->request->getPost('is_addon') == 3) {
|
|
||||||
// $policyTerm = $policy_terms['policy_terms'];
|
|
||||||
// $decoded_policyTerm = json_decode($policyTerm, true);
|
|
||||||
// $decoded_policyTerm['family_floater'] =0;
|
|
||||||
// $decoded_policyTerm['family_floaters']['self'] =0;
|
|
||||||
// $decoded_policyTerm['family_floaters']['spouse'] =0;
|
|
||||||
// $decoded_policyTerm['family_floaters']['childrens'] =0;
|
|
||||||
// $decoded_policyTerm['family_floaters']['parents'] =0;
|
|
||||||
// $decoded_policyTerm['family_floaters']['parents-in-law'] =0;
|
|
||||||
// $decoded_policyTerm['family_floaters']['either-parents-pil'] =0;
|
|
||||||
|
|
||||||
// $data['policy_terms'] = json_encode($decoded_policyTerm);
|
|
||||||
// } else {
|
|
||||||
// $data['policy_terms'] = $policy_terms['policy_terms'];
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
// dd($data);
|
|
||||||
$data['updated_by'] = get_session_userid();
|
$data['updated_by'] = get_session_userid();
|
||||||
// print_r(json_encode($data));die;
|
|
||||||
$insert = $this->clientPolicyModel->update($id, $data);
|
$insert = $this->clientPolicyModel->update($id, $data);
|
||||||
$lastQuery = $this->clientPolicyModel->getLastQuery();
|
|
||||||
|
|
||||||
// echo '<pre>';
|
|
||||||
// print_r($data); die;
|
|
||||||
|
|
||||||
if ($insert) {
|
if ($insert) {
|
||||||
|
|
||||||
|
$new_client_policy_data = $this->clientPolicyModel->where('is_active', 1)->where('id', $id)->first();
|
||||||
|
$policy_transaction_data = $this->policyTransactionModel->where('is_active', 1)->where('client_policy_id', $id)->countAllResults();
|
||||||
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($client_id);
|
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($client_id);
|
||||||
$clientPoliceData['role'] = get_role_id();
|
$clientPoliceData['role'] = get_role_id();
|
||||||
// foreach ($clientPoliceData as $key => $value) {
|
|
||||||
|
|
||||||
// $clientPoliceData[$key]->policy_start_date = date('d-M-Y', strtotime($value->policy_start_date));
|
if($policy_transaction_data > 0){
|
||||||
// $clientPoliceData[$key]->policy_end_date = date('d-M-Y', strtotime($value->policy_end_date));
|
$r = Jobs::addJob(['job_name' => 'updatePolicyTransactionDataWhileClinetPolicyUpdate', 'payload' => [
|
||||||
// }
|
'old_client_policy_data' => $old_client_policy_data ?? null,
|
||||||
|
'new_client_policy_data' => $new_client_policy_data ?? null,
|
||||||
|
]]);
|
||||||
|
}
|
||||||
|
|
||||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $clientPoliceData, 'method' => 'EDIT'], 200);
|
return $this->respond(['status' => true, 'code' => 200, 'data' => $clientPoliceData, 'method' => 'EDIT'], 200);
|
||||||
} else {
|
} else {
|
||||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'no data found'], 200);
|
return $this->respond(['status' => false, 'code' => 404, 'message' => 'no data found'], 200);
|
||||||
@ -1857,6 +1820,146 @@ class ClientController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updatePolicyTransactionDataWhileClinetPolicyUpdate($params)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
// Basic validation
|
||||||
|
if (empty($params) || !isset($params['old_client_policy_data']) || empty($params['old_client_policy_data'])) {
|
||||||
|
$this->myLogger->logme("error", "Old client policy data is missing or empty: " . json_encode(['params' => $params]));
|
||||||
|
return ['status' => "Failed", 'message' => "Old client policy data is missing or empty", 'data' => $params];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($params['new_client_policy_data']) || empty($params['new_client_policy_data'])) {
|
||||||
|
$this->myLogger->logme("error", "New client policy data is missing or empty: " . json_encode(['params' => $params]));
|
||||||
|
return ['status' => "Failed", 'message' => "New client policy data is missing or empty", 'data' => $params];
|
||||||
|
}
|
||||||
|
|
||||||
|
$old = $params['old_client_policy_data'];
|
||||||
|
$new = $params['new_client_policy_data'];
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
// Check differences and prepare update data
|
||||||
|
$fields_to_check = [
|
||||||
|
'client_branch_id', 'policy_type', 'insurer_id', 'insurer_branch_id',
|
||||||
|
'cd_ac_pk', 'policy_end_date', 'policy_start_date', 'tpa_id', 'tpa_branch_id'
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($fields_to_check as $field) {
|
||||||
|
if (isset($new[$field]) && isset($old[$field]) && $new[$field] != $old[$field]) {
|
||||||
|
$data[$field] = $new[$field];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($data)) {
|
||||||
|
$this->myLogger->logme("error", "No changes detected in client policy update.");
|
||||||
|
return ['status' => "Failed", 'message' => "No changes detected in policy data."];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch related policy transactions
|
||||||
|
$policy_transactions = $this->policyTransactionModel
|
||||||
|
->where('is_active', 1)
|
||||||
|
->where('client_policy_id', $new['id'])
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
$updated_pt_ids = [];
|
||||||
|
|
||||||
|
if (!empty($policy_transactions)) {
|
||||||
|
|
||||||
|
// Update each policy transaction and track affected IDs
|
||||||
|
foreach ($policy_transactions as $pt) {
|
||||||
|
$result = $this->policyTransactionModel
|
||||||
|
->where('id', $pt['id'])
|
||||||
|
->set($data)
|
||||||
|
->update();
|
||||||
|
|
||||||
|
if ($this->policyTransactionModel->affectedRows() > 0) {
|
||||||
|
$updated_pt_ids[] = $pt['id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($updated_pt_ids)) {
|
||||||
|
$this->myLogger->logme("error", "No policy_transaction records were updated.");
|
||||||
|
return ['status' => "Failed", 'message' => "No records updated."];
|
||||||
|
}
|
||||||
|
|
||||||
|
// If insurer-related fields are updated, update co-share table as well
|
||||||
|
if (isset($data['insurer_id']) && !empty($data['insurer_id'])) {
|
||||||
|
$co_share_result = $this->updatePTCoShareTableEntry($policy_transactions, $old, $data);
|
||||||
|
$this->myLogger->logme("error", "PT co-share update result: " . json_encode($co_share_result));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->myLogger->logme("error", "Policy transaction(s) updated successfully. Updated IDs: " . json_encode($updated_pt_ids));
|
||||||
|
|
||||||
|
return [
|
||||||
|
'status' => "Success",
|
||||||
|
'message' => "Policy transaction(s) updated.",
|
||||||
|
'updated_ids' => $updated_pt_ids
|
||||||
|
];
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$this->myLogger->logme("error", "No active policy_transaction records found for update.");
|
||||||
|
return ['status' => "Failed", 'message' => "No active policy_transaction records found."];
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
$this->myLogger->logme("error", "Exception during policy_transaction update: " . $e->getMessage());
|
||||||
|
return [
|
||||||
|
'status' => "Failed",
|
||||||
|
'message' => "An error occurred during update.",
|
||||||
|
'error' => $e->getMessage()
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function updatePTCoShareTableEntry($policy_transaction_data, $old_client_policy_data, $data)
|
||||||
|
{
|
||||||
|
$updated_ids = [];
|
||||||
|
$errors = [];
|
||||||
|
|
||||||
|
foreach ($policy_transaction_data as $value) {
|
||||||
|
$pt_id = $value['id'];
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Find matching rows
|
||||||
|
$rows = $this->PTCOShareDetailsModel
|
||||||
|
->where('pt_id', $pt_id)
|
||||||
|
->where('insurer_id', $old_client_policy_data['insurer_id'])
|
||||||
|
->where('insurer_branch_id', $old_client_policy_data['insurer_branch_id'])
|
||||||
|
->where('is_active', 1)
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
// Update each row individually
|
||||||
|
$result = $this->PTCOShareDetailsModel
|
||||||
|
->where('id', $row['id'])
|
||||||
|
->set([
|
||||||
|
'insurer_id' => $data['insurer_id'],
|
||||||
|
'insurer_branch_id' => $data['insurer_branch_id'],
|
||||||
|
])
|
||||||
|
->update();
|
||||||
|
|
||||||
|
// Check if the update was successful
|
||||||
|
if ($this->PTCOShareDetailsModel->affectedRows() > 0) {
|
||||||
|
$updated_ids[] = $row['id'];
|
||||||
|
} else {
|
||||||
|
$errors[] = "No change or failed update for ID {$row['id']}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$errors[] = "Error updating pt_id {$pt_id}: " . $e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'updated_ids' => $updated_ids,
|
||||||
|
'errors' => $errors,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function uploadVehicleFile()
|
public function uploadVehicleFile()
|
||||||
@ -4563,6 +4666,11 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
public function sendextraparam()
|
public function sendextraparam()
|
||||||
{
|
{
|
||||||
|
// $data = db_connect()->table('jobs')->where('id', 1677)->get()->getRowArray();
|
||||||
|
// // dd($data);
|
||||||
|
// $return = $this->updatePolicyTransactionDataWhileClinetPolicyUpdate(json_decode($data['payload'], true));
|
||||||
|
// dd($return);
|
||||||
|
// die;
|
||||||
|
|
||||||
// $employeeController = new EmployeeController();
|
// $employeeController = new EmployeeController();
|
||||||
// $employeeController->truncateFileData('633');
|
// $employeeController->truncateFileData('633');
|
||||||
@ -4578,7 +4686,7 @@ class ClientController extends AdminController
|
|||||||
$empServiceController = new EmployeeServiceController();
|
$empServiceController = new EmployeeServiceController();
|
||||||
// $res = $empServiceController->excelFileFormatValidation(['file_id' => '865']);
|
// $res = $empServiceController->excelFileFormatValidation(['file_id' => '865']);
|
||||||
// $res = $empServiceController->excelFileDataValidation(['file_id' => '865']);
|
// $res = $empServiceController->excelFileDataValidation(['file_id' => '865']);
|
||||||
// $res = $empServiceController->employeesSIEnhanceProcess(['file_id' => '829']);
|
// $res = $empServiceController->employeesSIEnhanceProcess(['file_id' => '978']);
|
||||||
// $res = $empServiceController->employeeDisembark(['file_id' => '858']);
|
// $res = $empServiceController->employeeDisembark(['file_id' => '858']);
|
||||||
|
|
||||||
$policyTransactionController = new PolicyTransactionController();
|
$policyTransactionController = new PolicyTransactionController();
|
||||||
@ -4612,6 +4720,7 @@ class ClientController extends AdminController
|
|||||||
// $EmpDataServiceController->importDeletionValidation(['file_id' => 304]); //for live
|
// $EmpDataServiceController->importDeletionValidation(['file_id' => 304]); //for live
|
||||||
// $EmpDataServiceController->importSIEnhancementUpdateEndorsementID(['file_id' => 1199]); //for live
|
// $EmpDataServiceController->importSIEnhancementUpdateEndorsementID(['file_id' => 1199]); //for live
|
||||||
// $EmpDataServiceController->importSIEnhancementValidation(['file_id' => 1205]); //for live
|
// $EmpDataServiceController->importSIEnhancementValidation(['file_id' => 1205]); //for live
|
||||||
|
$EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 214]); //for live
|
||||||
|
|
||||||
// $result = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($batch_data);
|
// $result = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($batch_data);
|
||||||
// print_rr($result); die;
|
// print_rr($result); die;
|
||||||
@ -4636,12 +4745,12 @@ class ClientController extends AdminController
|
|||||||
// $EmpDataServiceController->importDeletionUpdateEndorsementID(['file_id' => 171]);
|
// $EmpDataServiceController->importDeletionUpdateEndorsementID(['file_id' => 171]);
|
||||||
// $EmpDataServiceController->importCorrectionUpdateEndorsementID(['file_id' => 188]);
|
// $EmpDataServiceController->importCorrectionUpdateEndorsementID(['file_id' => 188]);
|
||||||
|
|
||||||
$params = [
|
// $params = [
|
||||||
'client_policy_id' => 6090,
|
// 'client_policy_id' => 6090,
|
||||||
'action_type' => "inception",
|
// 'action_type' => "inception",
|
||||||
];
|
// ];
|
||||||
$res = $EmpDataServiceController->makeEntryForBDSPolicyTransaction($params);
|
// $res = $EmpDataServiceController->makeEntryForBDSPolicyTransaction($params);
|
||||||
dd($res);
|
// dd($res);
|
||||||
|
|
||||||
// $array = [
|
// $array = [
|
||||||
// "employeeIds" => ["12800", "12798", "12797", "12799"],
|
// "employeeIds" => ["12800", "12798", "12797", "12799"],
|
||||||
@ -4677,7 +4786,7 @@ class ClientController extends AdminController
|
|||||||
// $returndata = $LeadsController->convertQCRJsonToPolicyTerms($jsonArray, $policy_type, $proposel_name, $insurer_name);
|
// $returndata = $LeadsController->convertQCRJsonToPolicyTerms($jsonArray, $policy_type, $proposel_name, $insurer_name);
|
||||||
// dd($returndata);
|
// dd($returndata);
|
||||||
|
|
||||||
$LeadsController->handleMemberDataGPATotalSumInsurerFromExcel(['lead_id' => 169]);
|
// $LeadsController->handleMemberDataGPATotalSumInsurerFromExcel(['lead_id' => 169]);
|
||||||
|
|
||||||
// -----------BDS REPORT CONTROLLER---------------------------------------------------------------------------------
|
// -----------BDS REPORT CONTROLLER---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@ -447,7 +447,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
];
|
];
|
||||||
|
|
||||||
//for addition and dependent addition adding a ENDORSEMENT NO column
|
//for addition and dependent addition adding a ENDORSEMENT NO column
|
||||||
if(in_array($export_data['event_type'], ['addition', 'dependent_addition'])){
|
if(in_array($export_data['event_type'], ['addition', 'dependent_addition', 'missed_inception'])){
|
||||||
$excel_header_columns[] = [
|
$excel_header_columns[] = [
|
||||||
'column_index' => 18,
|
'column_index' => 18,
|
||||||
'column_name' => 'ENDORSEMENT NO',
|
'column_name' => 'ENDORSEMENT NO',
|
||||||
@ -1404,7 +1404,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
'TOTAL AMOUNT',
|
'TOTAL AMOUNT',
|
||||||
];
|
];
|
||||||
|
|
||||||
if(in_array($file['event_type'], ['addition', 'dependent_addition'])){
|
if(in_array($file['event_type'], ['addition', 'dependent_addition', 'missed_inception'])){
|
||||||
$inceptionHeader[] = 'ENDORSEMENT NO';
|
$inceptionHeader[] = 'ENDORSEMENT NO';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1566,6 +1566,17 @@ class EmpDataServiceController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (in_array($file['event_type'], ['addition', 'dependent_addition', 'missed_inception'])) {
|
||||||
|
if ($excel_data[$key][18] === null) {
|
||||||
|
$missing_id[$key][] = [
|
||||||
|
'row' => $key,
|
||||||
|
'column' => 18,
|
||||||
|
'db_data' => "Endorsement ID is Must",
|
||||||
|
'excel_data' => $excel_data[$key][18]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($emp_value['emp_name'] != $excel_data[$key][1]) {
|
if ($emp_value['emp_name'] != $excel_data[$key][1]) {
|
||||||
$errors[$key][] = [
|
$errors[$key][] = [
|
||||||
@ -1900,6 +1911,27 @@ 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]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(in_array($file['event_type'], ['missed_inception']) && isset($value[18])){
|
||||||
|
$endorsement_id = $value[18];
|
||||||
|
|
||||||
|
$result_for_employees_policy = $this->employeePolicyModel
|
||||||
|
->select('employee_polices.*')
|
||||||
|
->join('employees', 'employees.id = employee_polices.employee_id')
|
||||||
|
->join('emp_endorsement', 'emp_endorsement.employee_id = employees.id') // assuming this is the correct join
|
||||||
|
->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('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')
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$enrollment_file_id = $result_for_employees_policy['file_id'] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
//for addition and dependent_addition endorsement , endorsement_id update functionality
|
//for addition and dependent_addition endorsement , endorsement_id update functionality
|
||||||
if(in_array($file['event_type'], ['addition', 'dependent_addition']) && isset($value[18])){
|
if(in_array($file['event_type'], ['addition', 'dependent_addition']) && isset($value[18])){
|
||||||
|
|
||||||
@ -1929,7 +1961,9 @@ class EmpDataServiceController extends BaseController
|
|||||||
->first();
|
->first();
|
||||||
|
|
||||||
if (!empty($result_for_endorsement) && count($result_for_endorsement)) {
|
if (!empty($result_for_endorsement) && count($result_for_endorsement)) {
|
||||||
|
if(empty($enrollment_file_id)){
|
||||||
$enrollment_file_id = $result_for_endorsement['file_id']; //files table primary key
|
$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');
|
$emp_endorsement_table_data[] = array('id' => $result_for_endorsement['id'], 'group_key' => $result_for_endorsement['group_key'], 'endorsement_id' => $value[18], 'status' => 'complete');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1945,7 +1979,6 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
if(in_array($file['event_type'], ['addition', 'dependent_addition']) && !empty($emp_endorsement_table_data)){
|
if(in_array($file['event_type'], ['addition', 'dependent_addition']) && !empty($emp_endorsement_table_data)){
|
||||||
$this->employeePolicyModel->updateEmpEndorsementAddition($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
|
||||||
@ -1962,6 +1995,11 @@ class EmpDataServiceController extends BaseController
|
|||||||
//update CD transaction entry if only insurer
|
//update CD transaction entry if only insurer
|
||||||
if ($file['insurer_or_tpa'] == 'insurer') {
|
if ($file['insurer_or_tpa'] == 'insurer') {
|
||||||
|
|
||||||
|
if(in_array($file['event_type'], ['addition', 'dependent_addition', 'missed_inception'])){
|
||||||
|
$this->storeEndorsementNumber($file_id, $endorsement_id, $enrollment_file_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'Inception Update TPA and UHID -- set cashDepositCalculationForInception and sendMailForDownloadingECard in JOB QUEUE');
|
$this->myLogger->logme('error', 'Inception Update TPA and UHID -- set cashDepositCalculationForInception and sendMailForDownloadingECard in JOB QUEUE');
|
||||||
|
|
||||||
$policy_name = $this->getPolicyNameUsingClientPolicyId($client_policy_id);
|
$policy_name = $this->getPolicyNameUsingClientPolicyId($client_policy_id);
|
||||||
@ -2388,7 +2426,9 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
if (isset($result['id']) && $result['id'] !== null) {
|
if (isset($result['id']) && $result['id'] !== null) {
|
||||||
// return $result;
|
// return $result;
|
||||||
|
if(empty($enrollment_file_id)){
|
||||||
$enrollment_file_id = $result['file_id'];
|
$enrollment_file_id = $result['file_id'];
|
||||||
|
}
|
||||||
|
|
||||||
if($result['field_name'] == 'dob'){
|
if($result['field_name'] == 'dob'){
|
||||||
$value[8] = change_date_format($value[8]);
|
$value[8] = change_date_format($value[8]);
|
||||||
@ -2967,7 +3007,10 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
if (isset($result['id']) && $result['id'] !== null) {
|
if (isset($result['id']) && $result['id'] !== null) {
|
||||||
|
|
||||||
|
if(empty($enrollment_file_id)){
|
||||||
$enrollment_file_id = $result['file_id'];
|
$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');
|
||||||
@ -3472,7 +3515,9 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
if (isset($result['emp_endorsement_primarykey']) && $result['emp_endorsement_primarykey'] !== null) {
|
if (isset($result['emp_endorsement_primarykey']) && $result['emp_endorsement_primarykey'] !== null) {
|
||||||
|
|
||||||
|
if(empty($enrollment_file_id)){
|
||||||
$enrollment_file_id = $result['file_id']; //files table primary key
|
$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' => change_date_format($result['date_of_exit']), 'reason_for_exit' => $result['reason_for_exit'], 'claim_status' => $result['claim_status'], 'status' => $result['status']);
|
$employee_policy_table_data[] = array('id' => $result['emp_policy_primarykey'], 'date_of_exit' => change_date_format($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']);
|
||||||
@ -4735,6 +4780,14 @@ class EmpDataServiceController extends BaseController
|
|||||||
return ['status' => "Failed", 'message' => "Action type is missing or empty", 'data' => ['params' => $params]];
|
return ['status' => "Failed", 'message' => "Action type is missing or empty", 'data' => ['params' => $params]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Function call for if the old policy transaction entries exisit than active the Policy transaction entries
|
||||||
|
$existing_policy_transaction_entry = $this->retrivePolicyTransactionEntries($params);
|
||||||
|
|
||||||
|
if($existing_policy_transaction_entry != false){
|
||||||
|
return $existing_policy_transaction_entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
//get the policy data
|
||||||
$policy_data = $this->clientPolicyModel
|
$policy_data = $this->clientPolicyModel
|
||||||
->where('id', $params['client_policy_id'])
|
->where('id', $params['client_policy_id'])
|
||||||
->where('is_active', 1)
|
->where('is_active', 1)
|
||||||
@ -4745,6 +4798,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
return ['status' => "Failed", 'message' => "No policy data found for the given client policy ID", 'data' => ['params' => $params]];
|
return ['status' => "Failed", 'message' => "No policy data found for the given client policy ID", 'data' => ['params' => $params]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//get the leads data
|
||||||
$lead_data = $this->leadsModel
|
$lead_data = $this->leadsModel
|
||||||
->where('is_policy_created', $params['client_policy_id'])
|
->where('is_policy_created', $params['client_policy_id'])
|
||||||
->where('is_active', 1)
|
->where('is_active', 1)
|
||||||
@ -4752,13 +4806,15 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
if (empty($lead_data)) {
|
if (empty($lead_data)) {
|
||||||
$this->myLogger->logme("error", "No lead data found: " . json_encode(['client_policy_id' => $params['client_policy_id']]));
|
$this->myLogger->logme("error", "No lead data found: " . json_encode(['client_policy_id' => $params['client_policy_id']]));
|
||||||
return ['status' => "Failed", 'message' => "No lead data found for the given client policy ID", 'data' => ['params' => $params]];
|
// return ['status' => "Failed", 'message' => "No lead data found for the given client policy ID", 'data' => ['params' => $params]];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->myLogger->logme("error", "Constructing policy transaction data: " . json_encode(['policy_data' => $policy_data, 'lead_data' => $lead_data]));
|
$this->myLogger->logme("error", "Constructing policy transaction data: " . json_encode(['policy_data' => $policy_data, 'lead_data' => $lead_data]));
|
||||||
|
|
||||||
|
//Function to construct the policy transaction data to insert
|
||||||
$policyTransactionData = $this->constructBDSData($policy_data, $lead_data, $params);
|
$policyTransactionData = $this->constructBDSData($policy_data, $lead_data, $params);
|
||||||
|
|
||||||
|
//insert the policy transaction data to othe table
|
||||||
$insert_id = $this->policyTransactionModel->insert($policyTransactionData);
|
$insert_id = $this->policyTransactionModel->insert($policyTransactionData);
|
||||||
|
|
||||||
if (!$insert_id) {
|
if (!$insert_id) {
|
||||||
@ -4774,6 +4830,9 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
// $this->myLogger->logme("error", "PT Co share data inserted successfully: " . json_encode(['pt_co_share_id' => $pt_co_share_id]));
|
// $this->myLogger->logme("error", "PT Co share data inserted successfully: " . json_encode(['pt_co_share_id' => $pt_co_share_id]));
|
||||||
|
|
||||||
|
// get the lead installment data
|
||||||
|
|
||||||
|
if(!empty($lead_data)){
|
||||||
$lead_installment_data = $this->leadInstallmentPaymentDetailesModel
|
$lead_installment_data = $this->leadInstallmentPaymentDetailesModel
|
||||||
->select('lead_id, installment_amount, payment_date, utr_no')
|
->select('lead_id, installment_amount, payment_date, utr_no')
|
||||||
->where('lead_id', $lead_data['id'])
|
->where('lead_id', $lead_data['id'])
|
||||||
@ -4781,14 +4840,14 @@ class EmpDataServiceController extends BaseController
|
|||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
if (!empty($lead_installment_data) && (isset($params['action_type']) && $params['action_type'] == "inception")) {
|
if (!empty($lead_installment_data) && (isset($params['action_type']) && $params['action_type'] == "inception")) {
|
||||||
|
|
||||||
$this->myLogger->logme("error", "Found lead installment data: " . json_encode($lead_installment_data));
|
$this->myLogger->logme("error", "Found lead installment data: " . json_encode($lead_installment_data));
|
||||||
|
|
||||||
$installment_ids = $this->constructInstallmentData($lead_installment_data, $insert_id);
|
$installment_ids = $this->constructInstallmentData($lead_installment_data, $insert_id);
|
||||||
|
$this->myLogger->logme("error", "BDS Installment data inserted ids: " . json_encode(['installment_ids' => $installment_ids]));
|
||||||
$this->myLogger->logme("error", "Installment data inserted: " . json_encode(['installment_ids' => $installment_ids]));
|
|
||||||
}else{
|
}else{
|
||||||
$this->myLogger->logme("error", "Failed to insert Installment data : " . json_encode($params));
|
$this->myLogger->logme("error", "Failed to insert Installment data : " . json_encode($params));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ['status' => "Success", 'message' => "Policy transaction entry created successfully", 'data' => ['params' => $params, 'insert_id' => $insert_id]];
|
return ['status' => "Success", 'message' => "Policy transaction entry created successfully", 'data' => ['params' => $params, 'insert_id' => $insert_id]];
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
@ -4804,6 +4863,11 @@ class EmpDataServiceController extends BaseController
|
|||||||
private function constructBDSData($policy_data, $lead_data, $params)
|
private function constructBDSData($policy_data, $lead_data, $params)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$action_type_string = $params['action_type'];
|
||||||
|
if(in_array($params['action_type'], ['dependent_addition', 'missed_inception'])){
|
||||||
|
$action_type_string = "addition";
|
||||||
|
}
|
||||||
|
|
||||||
$policyTransactionData = [
|
$policyTransactionData = [
|
||||||
|
|
||||||
'issuer' => 2,
|
'issuer' => 2,
|
||||||
@ -4834,12 +4898,13 @@ class EmpDataServiceController extends BaseController
|
|||||||
'is_cd_reduce_from_bds' => 0,
|
'is_cd_reduce_from_bds' => 0,
|
||||||
'client_type_id' => 0,
|
'client_type_id' => 0,
|
||||||
|
|
||||||
'status' => "completed",
|
'status' => "co_insurer_pending",
|
||||||
'action_type' => $params['action_type'] ?? null,
|
'action_type' => $action_type_string ?? null,
|
||||||
'endorsement_no' => $params['endorsement_no'] ?? null,
|
'endorsement_no' => $params['endorsement_no'] ?? null,
|
||||||
'issue_type' => $lead_data['lead_type'] ?? null,
|
|
||||||
|
'issue_type' => $lead_data['lead_type'] ?? 1,
|
||||||
'source_client_policy_id' => $lead_data['source_policy_id'] ?? null,
|
'source_client_policy_id' => $lead_data['source_policy_id'] ?? null,
|
||||||
'tsi' => generate_tsi_code($lead_data['lead_type']) ?? null,
|
'tsi' => generate_tsi_code($lead_data['lead_type'] ?? 1) ?? null,
|
||||||
'installment' => $lead_data['no_of_installment'] ?? null,
|
'installment' => $lead_data['no_of_installment'] ?? null,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -4877,12 +4942,138 @@ class EmpDataServiceController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function retrivePolicyTransactionEntries($params)
|
||||||
|
|
||||||
public function retriveBDSPolicyTransactionEntry()
|
|
||||||
{
|
{
|
||||||
|
$policy_transaction_data = $this->policyTransactionModel
|
||||||
|
->where('is_active', 0)
|
||||||
|
->where('client_policy_id', $params['client_policy_id']);
|
||||||
|
|
||||||
|
if ($params['action_type'] != "inception") {
|
||||||
|
$policy_transaction_data = $policy_transaction_data->where('endorsement_no', $params['endorsement_no']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$policy_transaction_data = $policy_transaction_data
|
||||||
|
->where('action_type', $params['action_type'])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if(empty($policy_transaction_data)){
|
||||||
|
$this->myLogger->logme("error", "retrive Policy Transaction Entries data not found : " . json_encode(['params' => $params]));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pt_co_share_data = $this->PTCOShareDetailsModel->where('is_active', 0)->where('pt_id', $policy_transaction_data['id'])->findAll();
|
||||||
|
|
||||||
|
if(empty($pt_co_share_data)){
|
||||||
|
$this->myLogger->logme("error", "PT Co Share Table data not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
$activated_pt_co_share_ids = [];
|
||||||
|
foreach ($pt_co_share_data as $key => $value) {
|
||||||
|
$this->PTCOShareDetailsModel->where('id', $value['id'])->set(['is_active' => 1])->update();
|
||||||
|
$activated_pt_co_share_ids[] = $value['id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->myLogger->logme("error", "Activated pt_co_share_ids : ". json_encode($activated_pt_co_share_ids));
|
||||||
|
|
||||||
|
|
||||||
|
$update_return = $this->policyTransactionModel->where('id', $policy_transaction_data['id'])->set(['is_active' => 1])->update();
|
||||||
|
|
||||||
|
if($update_return){
|
||||||
|
$this->myLogger->logme("error", "Invalid action type: " . json_encode(['params' => $params]));
|
||||||
|
return ['status' => "Success", 'message' => "Policy transaction entry Retrived successfully", 'data' => ['params' => $params, 'updated_id' => $policy_transaction_data['id']]];
|
||||||
|
}else{
|
||||||
|
$this->myLogger->logme("error", "Invalid action type: " . json_encode(['params' => $params]));
|
||||||
|
return ['status' => "Success", 'message' => "Failed to retrive the policy transaction entry", 'data' => ['params' => $params, 'updated_id' => $policy_transaction_data['id']]];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeBDSPolicyTransactionEntryFromTruncate($params)
|
||||||
|
{
|
||||||
|
if (empty($params) || !isset($params['client_policy_id']) || empty($params['client_policy_id'])) {
|
||||||
|
$this->myLogger->logme("error", "Invalid parameters provided: " . json_encode(['params' => $params]));
|
||||||
|
return ['status' => "Failed", 'message' => "Client Policy ID is missing or empty", 'data' => ['params' => $params]];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($params['file_id']) || empty($params['file_id'])) {
|
||||||
|
$this->myLogger->logme("error", "File ID is missing or empty : " . json_encode(['params' => $params]));
|
||||||
|
return ['status' => "Failed", 'message' => "File ID is missing or empty : ", 'data' => ['params' => $params]];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($params['action_type']) || empty($params['action_type'])) {
|
||||||
|
$this->myLogger->logme("error", "Invalid action type: " . json_encode(['params' => $params]));
|
||||||
|
return ['status' => "Failed", 'message' => "Action type is missing or empty", 'data' => ['params' => $params]];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if($params['action_type'] != "inception"){
|
||||||
|
|
||||||
|
$endorsement_data = $this->endorsementModel
|
||||||
|
->where('is_active', 1)
|
||||||
|
->where('client_policy_id', $params['client_policy_id'])
|
||||||
|
->where('endorsement_type', $params['action_type'])
|
||||||
|
->where('file_id', $params['file_id'])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if(empty($endorsement_data)){
|
||||||
|
$this->myLogger->logme("error", "Endorsement data not found");
|
||||||
|
return ['status' => "Failed", 'message' => "Endorsement data not found", 'data' => ['params' => $params]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$action_type_string = $params['action_type'];
|
||||||
|
if(in_array($params['action_type'], ['dependent_addition', 'missed_inception'])){
|
||||||
|
$action_type_string = "addition";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$policy_transaction_data = $this->policyTransactionModel
|
||||||
|
->where('is_active', 1)
|
||||||
|
->where('client_policy_id', $params['client_policy_id']);
|
||||||
|
|
||||||
|
if ($params['action_type'] != "inception") {
|
||||||
|
$policy_transaction_data = $policy_transaction_data->where('endorsement_no', $endorsement_data['endorsement_no']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$policy_transaction_data = $policy_transaction_data
|
||||||
|
->where('action_type', $action_type_string)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
|
||||||
|
if(empty($policy_transaction_data)){
|
||||||
|
$this->myLogger->logme("error", "Policy transaction data not found");
|
||||||
|
return ['status' => "Failed", 'message' => "Policy transaction data not found", 'data' => ['params' => $params]];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$pt_co_share_data = $this->PTCOShareDetailsModel->where('is_active', 1)->where('pt_id', $policy_transaction_data['id'])->findAll();
|
||||||
|
|
||||||
|
if(empty($pt_co_share_data)){
|
||||||
|
$this->myLogger->logme("error", "PT Co Share Table data not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
$de_activated_pt_co_share_ids = [];
|
||||||
|
foreach ($pt_co_share_data as $key => $value) {
|
||||||
|
$this->PTCOShareDetailsModel->where('id', $value['id'])->set(['is_active' => 0])->update();
|
||||||
|
$de_activated_pt_co_share_ids[] = $value['id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->myLogger->logme("error", "De-activated pt_co_share_ids : ". json_encode($de_activated_pt_co_share_ids));
|
||||||
|
|
||||||
|
$update_return = $this->policyTransactionModel->where('id', $policy_transaction_data['id'])->set(['is_active' => 0])->update();
|
||||||
|
|
||||||
|
if($update_return){
|
||||||
|
$this->myLogger->logme("error", "Policy transaction data de-active successfully");
|
||||||
|
return ['status' => "Success", 'message' => "Policy transaction data Truncated successfully", 'data' => ['params' => $params]];
|
||||||
|
}else{
|
||||||
|
$this->myLogger->logme("error", "Failed to de-active policy transaction data");
|
||||||
|
return ['status' => "Success", 'message' => "Failed to truncated the policy transaction data", 'data' => ['params' => $params]];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1384,6 +1384,13 @@ class EmployeeController extends AdminController
|
|||||||
$this->myLogger->logme('error', 'cash_deposite table updated -- cd transaction');
|
$this->myLogger->logme('error', 'cash_deposite table updated -- cd transaction');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//this job for deactive policy transaction and pt co share table entry for BDS Sync
|
||||||
|
$r = Jobs::addJob(['job_name' => 'removeBDSPolicyTransactionEntryFromTruncate', 'payload' => [
|
||||||
|
'client_policy_id' => $client_policy_id ?? null,
|
||||||
|
'file_id' => $file_id ?? null,
|
||||||
|
'action_type' => $file['action'] ?? null,
|
||||||
|
]]);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
$this->myLogger->logme('error', '---- There is no data to truncate ----');
|
$this->myLogger->logme('error', '---- There is no data to truncate ----');
|
||||||
@ -1534,6 +1541,13 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//this job for deactive policy transaction and pt co share table entry for BDS Sync
|
||||||
|
$r = Jobs::addJob(['job_name' => 'removeBDSPolicyTransactionEntryFromTruncate', 'payload' => [
|
||||||
|
'client_policy_id' => $client_policy_id ?? null,
|
||||||
|
'file_id' => $file_id ?? null,
|
||||||
|
'action_type' => $file['action'] ?? null,
|
||||||
|
]]);
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'SUCCESSFULLY TRUNCATED');
|
$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);
|
||||||
|
|||||||
@ -153,7 +153,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
'is_mandatory' => ['I', 'A', 'DA'],
|
'is_mandatory' => ['I', 'A', 'DA'],
|
||||||
'data_type' => 'str',
|
'data_type' => 'str',
|
||||||
'format' => null,
|
'format' => null,
|
||||||
'allowed_values' => null,
|
'allowed_values' => ['Self', 'Spouse', 'Son', 'Daughter', 'Father', 'Mother', 'Father in Law', 'Mother in Law'],
|
||||||
'custom' => 'check_relationship',
|
'custom' => 'check_relationship',
|
||||||
'params' => ['row', 'relationship', 'policy_terms']
|
'params' => ['row', 'relationship', 'policy_terms']
|
||||||
],
|
],
|
||||||
@ -1587,9 +1587,17 @@ class EmployeeServiceController extends AdminController
|
|||||||
{
|
{
|
||||||
$pre_rack_rate_name = $slab_value['rack_rate_name'];
|
$pre_rack_rate_name = $slab_value['rack_rate_name'];
|
||||||
$rack_rate_json = json_decode($slab_value['additional_relationship'], true);
|
$rack_rate_json = json_decode($slab_value['additional_relationship'], true);
|
||||||
$relationship_array_key = strtolower($employee['relationship']);
|
$relationship_array_key = strtolower(trim($employee['relationship']));
|
||||||
|
|
||||||
if(array_key_exists($relationship_array_key, $rack_rate_json) && $rack_rate_json[ strtolower($employee['relationship']) ] != 0 && $rack_rate_json[ strtolower($employee['relationship']) ] != 'NA')
|
if (in_array($relationship_array_key, ['son', 'daughter'])) {
|
||||||
|
$relationship_array_key = 'childrens';
|
||||||
|
} elseif (in_array($relationship_array_key, ['father', 'mother'])) {
|
||||||
|
$relationship_array_key = 'parents';
|
||||||
|
} elseif (in_array($relationship_array_key, ['father in law', 'mother in law', 'father-in-law', 'mother-in-law'])) {
|
||||||
|
$relationship_array_key = 'parents-in-law';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(array_key_exists($relationship_array_key, $rack_rate_json) && $rack_rate_json[$relationship_array_key] != 0 && $rack_rate_json[$relationship_array_key] != 'NA')
|
||||||
{
|
{
|
||||||
$applicable_rack_rate_name = $slab_value['rack_rate_name'];
|
$applicable_rack_rate_name = $slab_value['rack_rate_name'];
|
||||||
$applicable_rack_rate_master = $slab_value['grid_master'];
|
$applicable_rack_rate_master = $slab_value['grid_master'];
|
||||||
@ -1623,6 +1631,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->fileModel->where('id', $file_id)->set(['status' => 'success','reason' => ''])->update();
|
$this->fileModel->where('id', $file_id)->set(['status' => 'success','reason' => ''])->update();
|
||||||
$this->myLogger->logme("error",'{file_id} uploaded success',['file_id' => $file_id]);
|
$this->myLogger->logme("error",'{file_id} uploaded success',['file_id' => $file_id]);
|
||||||
//set success msg to pull notifications
|
//set success msg to pull notifications
|
||||||
|
|||||||
@ -127,6 +127,10 @@ class JobWorker extends AdminController
|
|||||||
'type' => 'CC', // Handler Category
|
'type' => 'CC', // Handler Category
|
||||||
'handler' => 'App\Controllers\EmpDataServiceController',
|
'handler' => 'App\Controllers\EmpDataServiceController',
|
||||||
],
|
],
|
||||||
|
'removeBDSPolicyTransactionEntryFromTruncate' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\EmpDataServiceController',
|
||||||
|
],
|
||||||
'employeesEnrollmentInsert' => [
|
'employeesEnrollmentInsert' => [
|
||||||
'type' => 'CC', // Handler Category
|
'type' => 'CC', // Handler Category
|
||||||
'handler' => 'App\Controllers\EmployeeServiceController',
|
'handler' => 'App\Controllers\EmployeeServiceController',
|
||||||
@ -134,7 +138,11 @@ class JobWorker extends AdminController
|
|||||||
'calculateMembersDemography' => [
|
'calculateMembersDemography' => [
|
||||||
'type' => 'CC', // Handler Category
|
'type' => 'CC', // Handler Category
|
||||||
'handler' => 'App\Controllers\LeadsController',
|
'handler' => 'App\Controllers\LeadsController',
|
||||||
]
|
],
|
||||||
|
'updatePolicyTransactionDataWhileClinetPolicyUpdate' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\ClientController',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1769,7 +1769,7 @@ if(!function_exists('check_dup_mobileno'))
|
|||||||
{
|
{
|
||||||
foreach($existing_mobilenos as $k => $value)
|
foreach($existing_mobilenos as $k => $value)
|
||||||
{
|
{
|
||||||
if ($row['12'] == $value['mobile']) {
|
if (strtolower($row['5']) == 'self' && $row['12'] == $value['mobile']) {
|
||||||
return array('status' => false,'error' => "Duplicate Mobile No");
|
return array('status' => false,'error' => "Duplicate Mobile No");
|
||||||
// break;
|
// break;
|
||||||
}
|
}
|
||||||
@ -1784,7 +1784,7 @@ if(!function_exists('check_dup_email'))
|
|||||||
{
|
{
|
||||||
foreach($existing_mobilenos as $k => $value)
|
foreach($existing_mobilenos as $k => $value)
|
||||||
{
|
{
|
||||||
if ($row['13'] == $value['email_corporate']) {
|
if (strtolower($row['5']) == 'self' && $row['13'] == $value['email_corporate']) {
|
||||||
return array('status' => false,'error' => "Duplicate Email");
|
return array('status' => false,'error' => "Duplicate Email");
|
||||||
// break;
|
// break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,6 +24,7 @@ class EndorsementModel extends Model
|
|||||||
'created_at',
|
'created_at',
|
||||||
'updated_by',
|
'updated_by',
|
||||||
'updated_at',
|
'updated_at',
|
||||||
|
'file_id',
|
||||||
'is_active'
|
'is_active'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -149,8 +149,13 @@
|
|||||||
|
|
||||||
// If GST is currently validating, wait for it to complete
|
// If GST is currently validating, wait for it to complete
|
||||||
if (isGSTValidating) {
|
if (isGSTValidating) {
|
||||||
|
if($('#Owner_type').val() == 1){
|
||||||
toastr.info('Please wait while we validate your GST number...', 'Validating');
|
toastr.info('Please wait while we validate your GST number...', 'Validating');
|
||||||
return;
|
return;
|
||||||
|
}else if ($('#client_type').val() == 1){
|
||||||
|
toastr.info('Please wait while we validate your GST number...', 'Validating');
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If GST validation failed, prevent submission
|
// If GST validation failed, prevent submission
|
||||||
@ -171,13 +176,29 @@
|
|||||||
$('#aadhar').attr('data-parsley-required', 'false');
|
$('#aadhar').attr('data-parsley-required', 'false');
|
||||||
$('#aadhar').removeAttr('required');
|
$('#aadhar').removeAttr('required');
|
||||||
|
|
||||||
|
if($('#Owner_type').val() == 2){
|
||||||
|
$('#gst').removeAttr('required');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
isClientFormSubmitting = true;
|
isClientFormSubmitting = true;
|
||||||
var isValid = $('#client_form').parsley().validate();
|
var isValid = $('#client_form').parsley().validate();
|
||||||
|
|
||||||
if (!isValid) {
|
if (!isValid) {
|
||||||
console.log('Form is Empty', 'Warning');
|
var emptyFieldIds = [];
|
||||||
return ;
|
|
||||||
|
$('#client_form').parsley().fields.forEach(function(field) {
|
||||||
|
if (!field.isValid()) {
|
||||||
|
var elem = field.$element;
|
||||||
|
var id = elem.attr('id') || elem.attr('name');
|
||||||
|
emptyFieldIds.push(id);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('Empty/Invalid Fields:', emptyFieldIds);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
form_action = '<?= base_url("util/createClientWithMinimalData"); ?>';
|
form_action = '<?= base_url("util/createClientWithMinimalData"); ?>';
|
||||||
|
|
||||||
@ -212,24 +233,22 @@
|
|||||||
if(form_type != 1){
|
if(form_type != 1){
|
||||||
|
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
|
|
||||||
$('#client_id').val(res.client_id).change();
|
$('#client_id').val(res.client_id).change();
|
||||||
$('#client_id').prepend($('<option>', {
|
$('#client_id').prepend($('<option>', {
|
||||||
value: 'add_client',
|
value: 'add_client',
|
||||||
text: '+ Add Client'
|
text: '+ Add Client'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
$('#client_branch_id').val(res.branch_id).change();
|
$('#client_branch_id').val(res.branch_id).change();
|
||||||
// try {
|
|
||||||
// setTimeout(function () {(res.branch_id)},1000);
|
|
||||||
// }catch (e) {
|
|
||||||
// console.error('Error calling getBranchData:', e); // optional logging
|
|
||||||
// }
|
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
|
||||||
}, 2000)
|
}, 2000)
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
toastr.error("Couldn't Add Client","Error");
|
console.log("Couldn't Add Client","Error");
|
||||||
}
|
}
|
||||||
|
|
||||||
toastr.success(res.message, 'Success');
|
toastr.success(res.message, 'Success');
|
||||||
@ -249,7 +268,16 @@
|
|||||||
$('#client_form').removeAttr('data-id');
|
$('#client_form').removeAttr('data-id');
|
||||||
|
|
||||||
// Load form data into #vehicle_form from localStorage
|
// Load form data into #vehicle_form from localStorage
|
||||||
setFormDataFromLocalStorage("#vehicle_form", "vehicleFormData");
|
setFormDataFromLocalStorage("#vehicle_form", "vehicleFormData", res.client_id);
|
||||||
|
|
||||||
|
setTimeout(function(){
|
||||||
|
$('#owner').val(res.client_id).change();
|
||||||
|
$('#owner_branch').val(res.branch_id).change();
|
||||||
|
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
}, 2000)
|
||||||
}
|
}
|
||||||
|
|
||||||
isClientFormSubmitting = false;
|
isClientFormSubmitting = false;
|
||||||
|
|||||||
@ -1315,10 +1315,12 @@ $(document).ready(function(){
|
|||||||
$('#name').prop('required', false);
|
$('#name').prop('required', false);
|
||||||
$('#mobile').prop('required', false);
|
$('#mobile').prop('required', false);
|
||||||
$('#gst').prop('required', false);
|
$('#gst').prop('required', false);
|
||||||
|
$('#email').prop('required', false);
|
||||||
|
|
||||||
|
|
||||||
$('#dob').prop('required', true);
|
$('#dob').prop('required', true);
|
||||||
$('#phone').prop('required', true);
|
$('#phone').prop('required', true);
|
||||||
$('#email').prop('required', true);
|
$('#email2').prop('required', true);
|
||||||
$('#aadhar').prop('required', true);
|
$('#aadhar').prop('required', true);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -1332,10 +1334,11 @@ $(document).ready(function(){
|
|||||||
$('#name').prop('required', true);
|
$('#name').prop('required', true);
|
||||||
$('#mobile').prop('required', true);
|
$('#mobile').prop('required', true);
|
||||||
$('#gst').prop('required', true);
|
$('#gst').prop('required', true);
|
||||||
|
$('#email').prop('required', true);
|
||||||
|
|
||||||
$('#dob').prop('required', false);
|
$('#dob').prop('required', false);
|
||||||
$('#phone').prop('required', false);
|
$('#phone').prop('required', false);
|
||||||
$('#email').prop('required', false);
|
$('#email2').prop('required', false);
|
||||||
$('#aadhar').prop('required', false);
|
$('#aadhar').prop('required', false);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3601,10 +3604,11 @@ $('#client_type').change(function() {
|
|||||||
$('#name').prop('required', false);
|
$('#name').prop('required', false);
|
||||||
$('#mobile').prop('required', false);
|
$('#mobile').prop('required', false);
|
||||||
$('#gst').prop('required', false);
|
$('#gst').prop('required', false);
|
||||||
|
$('#email').prop('required', false);
|
||||||
|
|
||||||
$('#dob').prop('required', true);
|
$('#dob').prop('required', true);
|
||||||
$('#phone').prop('required', true);
|
$('#phone').prop('required', true);
|
||||||
$('#email').prop('required', true);
|
$('#email2').prop('required', true);
|
||||||
$('#aadhar').prop('required', true);
|
$('#aadhar').prop('required', true);
|
||||||
|
|
||||||
$('#owner_branch').prop('required', false);
|
$('#owner_branch').prop('required', false);
|
||||||
@ -3627,10 +3631,11 @@ $('#client_type').change(function() {
|
|||||||
$('#name').prop('required', true);
|
$('#name').prop('required', true);
|
||||||
$('#mobile').prop('required', true);
|
$('#mobile').prop('required', true);
|
||||||
$('#gst').prop('required', true);
|
$('#gst').prop('required', true);
|
||||||
|
$('#email').prop('required', true);
|
||||||
|
|
||||||
$('#dob').prop('required', false);
|
$('#dob').prop('required', false);
|
||||||
$('#phone').prop('required', false);
|
$('#phone').prop('required', false);
|
||||||
$('#email').prop('required', false);
|
$('#email2').prop('required', false);
|
||||||
$('#aadhar').prop('required', false);
|
$('#aadhar').prop('required', false);
|
||||||
|
|
||||||
$('#owner_branch').prop('required', true);
|
$('#owner_branch').prop('required', true);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user