diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index d6e26ff4..cf511080 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -1341,7 +1341,7 @@ class ClientController extends AdminController 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)->countAllResult(); + $policy_transaction_data = $this->policyTransactionModel->where('is_active', 1)->where('client_policy_id', $id)->countAllResults(); $clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($client_id); $clientPoliceData['role'] = get_role_id(); @@ -1820,7 +1820,7 @@ class ClientController extends AdminController } } - public function updatePolicyTransactionWhileClinetPolicyUpdate($params) + public function updatePolicyTransactionDataWhileClinetPolicyUpdate($params) { try { // Basic validation diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php index 26671199..28a3416a 100755 --- a/app/Controllers/EmpDataServiceController.php +++ b/app/Controllers/EmpDataServiceController.php @@ -447,7 +447,7 @@ class EmpDataServiceController extends BaseController ]; //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[] = [ 'column_index' => 18, 'column_name' => 'ENDORSEMENT NO', @@ -1404,7 +1404,7 @@ class EmpDataServiceController extends BaseController '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'; } @@ -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]) { $errors[$key][] = [ @@ -1900,6 +1911,10 @@ class EmpDataServiceController extends BaseController $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]; + } + //for addition and dependent_addition endorsement , endorsement_id update functionality if(in_array($file['event_type'], ['addition', 'dependent_addition']) && isset($value[18])){ @@ -1947,7 +1962,6 @@ class EmpDataServiceController extends BaseController 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 @@ -1964,6 +1978,11 @@ class EmpDataServiceController extends BaseController //update CD transaction entry if only 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'); $policy_name = $this->getPolicyNameUsingClientPolicyId($client_policy_id); @@ -4827,6 +4846,11 @@ class EmpDataServiceController extends BaseController 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 = [ 'issuer' => 2, @@ -4858,7 +4882,7 @@ class EmpDataServiceController extends BaseController 'client_type_id' => 0, 'status' => "co_insurer_pending", - 'action_type' => $params['action_type'] ?? null, + 'action_type' => $action_type_string ?? null, 'endorsement_no' => $params['endorsement_no'] ?? null, 'issue_type' => $lead_data['lead_type'] ?? 1, @@ -4964,17 +4988,26 @@ class EmpDataServiceController extends BaseController return ['status' => "Failed", 'message' => "Action type is missing or empty", 'data' => ['params' => $params]]; } - $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($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]]; + 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 @@ -4986,7 +5019,7 @@ class EmpDataServiceController extends BaseController } $policy_transaction_data = $policy_transaction_data - ->where('action_type', $params['action_type']) + ->where('action_type', $action_type_string) ->first(); diff --git a/app/Controllers/JobWorker.php b/app/Controllers/JobWorker.php index c8127620..4cbf5350 100755 --- a/app/Controllers/JobWorker.php +++ b/app/Controllers/JobWorker.php @@ -139,7 +139,7 @@ class JobWorker extends AdminController 'type' => 'CC', // Handler Category 'handler' => 'App\Controllers\LeadsController', ], - 'updatePolicyTransactionWhileClinetPolicyUpdate' => [ + 'updatePolicyTransactionDataWhileClinetPolicyUpdate' => [ 'type' => 'CC', // Handler Category 'handler' => 'App\Controllers\ClientController', ],