MERGE_TEST_BDS_CHANGES
This commit is contained in:
commit
45565d8b40
@ -523,6 +523,8 @@ $routes->cli('cli/update-emp-policy-status', 'ClientController::updateEmpAndPoli
|
||||
$routes->cli('cli/update-emp-policy-status', 'ClientController::updateEmpAndPolicyStatus');
|
||||
$routes->cli('cli/insurerRFQRemainder', 'LeadsController::remainderForQcr');
|
||||
$routes->cli('cli/sendMailWithAutoQuery','TicketController::sendMailWithAutoQuery');
|
||||
$routes->cli('cli/ClaimStatusUpdate','MediAssistApiController::ClaimStatusUpdate');
|
||||
|
||||
|
||||
|
||||
|
||||
@ -764,10 +766,11 @@ $routes->get('claimStatus','VidalApiController::claimStatus');
|
||||
$routes->get('EcardRequest','MediAssistApiController::EcardRequest');
|
||||
$routes->get('HospitalNetwork','MediAssistApiController::HospitalNetwork');
|
||||
$routes->get('GetBenefDetails','MediAssistApiController::GetBenefDetails');
|
||||
$routes->get('ClaimDetail','MediAssistApiController::ClaimDetail');
|
||||
$routes->get('ClaimDetail','VidalApiController::ClaimDetail');
|
||||
$routes->get('SubmitClaim','MediAssistApiController::SubmitClaim');
|
||||
$routes->get('IntimateClaim','MediAssistApiController::IntimateClaim');
|
||||
$routes->get('IRSubmission','MediAssistApiController::IRSubmission');
|
||||
$routes->get('ClaimStatusUpdate','MediAssistApiController::ClaimStatusUpdate');
|
||||
|
||||
|
||||
// API service
|
||||
|
||||
@ -5998,7 +5998,7 @@ class ClientController extends AdminController
|
||||
// ---------- POLICY TRANSACTION CONTROLLER --------------------------------------------------------------------------------
|
||||
|
||||
$policyTransactionController = new PolicyTransactionController();
|
||||
// $res = $policyTransactionController->validateInsurerStatement(['file_id' => '62']);
|
||||
// $res = $policyTransactionController->validateInsurerStatement(['file_id' => '281']);
|
||||
// $res = $policyTransactionController->updateInsurerStatement(['file_id' => '62']);
|
||||
// dd('-----', $res);
|
||||
|
||||
|
||||
@ -16,10 +16,12 @@ class MediAssistApiController extends BaseController
|
||||
{
|
||||
use ResponseTrait;
|
||||
protected $db;
|
||||
protected $mediAssistTpaId;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->db = \Config\Database::connect();
|
||||
$this->mediAssistTpaId = getenv('MEDI_ASSIST_PRIMARY_KEY_CONSTANT');
|
||||
}
|
||||
|
||||
|
||||
@ -620,7 +622,7 @@ class MediAssistApiController extends BaseController
|
||||
$this->db->table('ticket_master')->where('id', $claimId)->update($updateArray);
|
||||
|
||||
// LOG UPDATE
|
||||
log_message('info', "CLAIM STATUS SUCCESS | Updated ticket ID $claimId with claim status: $currentStatus");
|
||||
log_message('error', "CLAIM STATUS SUCCESS | Updated ticket ID $claimId with claim status: $currentStatus");
|
||||
|
||||
return $this->response->setJSON([
|
||||
'status' => true,
|
||||
@ -632,7 +634,7 @@ class MediAssistApiController extends BaseController
|
||||
|
||||
public function IRSubmission($claimId = null) // 585 this id for test
|
||||
{
|
||||
log_message('info', "IRSubmission INIT for ticket_id={$claimId}");
|
||||
log_message('error', "IRSubmission INIT for ticket_id={$claimId}");
|
||||
|
||||
// 1. FETCH TICKET DETAILS
|
||||
$ticket = $this->db->table('ticket_master tm')
|
||||
@ -685,7 +687,7 @@ class MediAssistApiController extends BaseController
|
||||
log_message('error', "File NOT FOUND on server → {$fileDir}");
|
||||
}
|
||||
|
||||
log_message('info', "IRSubmission Attachment Ready: {$filename} | URL={$downloadUrl}");
|
||||
log_message('error', "IRSubmission Attachment Ready: {$filename} | URL={$downloadUrl}");
|
||||
|
||||
$Attachments[] = [
|
||||
"AttachmentName" => $filename,
|
||||
@ -703,7 +705,7 @@ class MediAssistApiController extends BaseController
|
||||
"Attachments" => $Attachments
|
||||
];
|
||||
|
||||
log_message('info', "IRSubmission Request Body => " . json_encode($body));
|
||||
log_message('error', "IRSubmission Request Body => " . json_encode($body));
|
||||
|
||||
// 4. SEND API CALL
|
||||
helper('api');
|
||||
@ -719,7 +721,7 @@ class MediAssistApiController extends BaseController
|
||||
|
||||
$response = call_third_party_api($url, $method, $headers, $body);
|
||||
|
||||
log_message('info', "IRSubmission API Response => " . json_encode($response));
|
||||
log_message('error', "IRSubmission API Response => " . json_encode($response));
|
||||
|
||||
// 5. HANDLE RESPONSE
|
||||
if (!$response['status']) {
|
||||
@ -735,7 +737,7 @@ class MediAssistApiController extends BaseController
|
||||
];
|
||||
}
|
||||
|
||||
log_message('info', "IRSubmission SUCCESS → ClaimID={$ticket['ClaimID']}");
|
||||
log_message('error', "IRSubmission SUCCESS → ClaimID={$ticket['ClaimID']}");
|
||||
|
||||
return [
|
||||
'status' => true,
|
||||
@ -793,6 +795,161 @@ class MediAssistApiController extends BaseController
|
||||
}
|
||||
|
||||
|
||||
public function ClaimStatusUpdate()
|
||||
{
|
||||
helper('api');
|
||||
|
||||
$url = getenv('MEDI_ASSIST_API_BASE_URL_CLAIMSTATUS');
|
||||
$method = 'POST';
|
||||
|
||||
$headers = [
|
||||
'Content-Type: application/json',
|
||||
'Username:' . getenv('MEDI_ASSIST_API_USERNAME'),
|
||||
'Password:' . getenv('MEDI_ASSIST_API_PASSWORD'),
|
||||
];
|
||||
|
||||
// Fetch ticket master details
|
||||
$TicketData = $this->db->table('ticket_master tm')
|
||||
->select("
|
||||
tm.id,
|
||||
tm.tpa_no as memberId,
|
||||
tm.tpa_claim_push_reference_no as claimRefNo,
|
||||
cp.policy_no as policyNo,
|
||||
cp.policy_start_date as startDate,
|
||||
cp.policy_end_date as endDate,
|
||||
e.emp_code as employeeCode
|
||||
")
|
||||
->join('employees e', 'e.id = tm.emp_id', 'left')
|
||||
->join('client_policy cp', 'tm.client_policy_id = cp.id', 'left')
|
||||
->where('tm.tpa_claim_push_reference_no IS NOT NULL')
|
||||
->where('tm.is_active', 1)
|
||||
->whereNotIn('tm.claim_status_id', [8, 11, 12, 13, 66, 22, 24, 47, 49, 32, 34, 53, 55, 42, 44, 58, 60])
|
||||
->where('tm.tpa_id', $this->mediAssistTpaId)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
// dd($TicketData);
|
||||
|
||||
if (!$TicketData) {
|
||||
log_message('error', "Claims not found to update status");
|
||||
return $this->response->setJSON(['status' => false,'message' => 'Claims not found' ]);
|
||||
}
|
||||
|
||||
$error_data = [];
|
||||
$status_updated_count = 0;
|
||||
|
||||
foreach ($TicketData as $key => $ticket)
|
||||
{
|
||||
$claimId = $ticket['id'];
|
||||
|
||||
// REQUEST BODY
|
||||
if($ticket['claimRefNo'] != null)
|
||||
{
|
||||
$body = [
|
||||
"policyNo" => $ticket['policyNo'] ?? "",
|
||||
"startDate" => "",
|
||||
"endDate" => "",
|
||||
"employeeCode" => $ticket['employeeCode'] ?? "",
|
||||
"memberID" => "",
|
||||
"claimNo" => "",
|
||||
"claimRefNo" => $ticket['claimRefNo'] ?? "",
|
||||
];
|
||||
|
||||
}else{
|
||||
|
||||
$body = [
|
||||
"policyNo" => $ticket['policyNo'] ?? "",
|
||||
"startDate" => "",
|
||||
"endDate" => "",
|
||||
"employeeCode" => $ticket['employeeCode'] ?? "",
|
||||
"memberID" => "",
|
||||
"claimNo" => "",
|
||||
"claimRefNo" => "",
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
// CALL API
|
||||
$response = call_third_party_api($url, $method, $headers, $body);
|
||||
|
||||
if ($response['status'] != true || empty($response['data']['claimsData'][0])) {
|
||||
log_message('error', 'CLAIM STATUS FAILED | for ticket ID: ' . $claimId.' | response: '.json_encode($response));
|
||||
$error_data[$claimId][['status' => false,'message' => 'API call failed.','data' => $response]];
|
||||
}
|
||||
|
||||
// Extract claim status
|
||||
$claimData = $response['data']['claimsData'][0];
|
||||
$currentStatus = $claimData['claim_Current_Status'] ?? '';
|
||||
$tpa_claim_no = $claimData['tpA_CLAIM_NO'] ?? '';
|
||||
|
||||
// VALID STATUS LIST
|
||||
$validStatuses = [
|
||||
|
||||
"Claim Received" => 1,
|
||||
"In Progress" => 5,
|
||||
"Processed" => 11,
|
||||
"Claim Paid" => 11,
|
||||
"Denied" => 13,
|
||||
"Cancelled" => 13,
|
||||
|
||||
"Information Awaited" => 4,
|
||||
"Confirmation Awaited" => 4,
|
||||
"Information Awaited Reminder" => 4,
|
||||
"Information Awaited Final Reminder" => 4,
|
||||
"Insurer Concurrence Awaited" => 6,
|
||||
"Closed" => 12,
|
||||
|
||||
"Physical Documents Awaited" => 9,
|
||||
"Processed - Payment Initiated" => 10,
|
||||
"Processed - Transaction Failed" => 10,
|
||||
"Processed - Account Details Updated" => 10,
|
||||
"Processed - Debit Note Raised With Insurer for Payment"=> 10,
|
||||
"Processed - Payment Initiated by Insurer" => 10,
|
||||
"Payment - Refunded to Insurer" => 14,
|
||||
"Processed - Processing Payment" => 10,
|
||||
"Processed - Physical Documents Awaited" => 9,
|
||||
|
||||
// Extra Mappings (based on your DB list)
|
||||
"NON ID" => 1,
|
||||
"ID NOT GENERATED" => 2,
|
||||
"CDA" => 3,
|
||||
"REJECTED" => 8,
|
||||
"APPROVED" => 9,
|
||||
"PAYMENT INITIATED" => 10,
|
||||
"SETTLED" => 11,
|
||||
"RETURNED" => 14,
|
||||
"UNDER PROCESS - TPA" => 61,
|
||||
"DENIAL REVIEW AWAITED" => 66,
|
||||
];
|
||||
|
||||
// Maping tpa claim status with local claim Status
|
||||
if (isset($validStatuses[$currentStatus]))
|
||||
{
|
||||
$updateArray = ['claim_status_id' => $validStatuses[$currentStatus] , 'tpa_claim_status' => $currentStatus , 'tpa_claim_id' => $tpa_claim_no , 'updated_at' => date('Y-m-d H:i:s')];
|
||||
}else{
|
||||
$updateArray = ['tpa_claim_status' => $currentStatus , 'tpa_claim_id' => $tpa_claim_no , 'updated_at' => date('Y-m-d H:i:s')];
|
||||
}
|
||||
|
||||
// UPDATE ticket_master
|
||||
$this->db->table('ticket_master')->where('id', $claimId)->update($updateArray);
|
||||
$status_updated_count ++;
|
||||
|
||||
// LOG UPDATE
|
||||
log_message('error', "CLAIM STATUS SUCCESS | Updated ticket ID $claimId with claim status: $currentStatus");
|
||||
|
||||
}
|
||||
|
||||
return $this->response->setJSON([
|
||||
'status' => true,
|
||||
'message' => 'Claim status updated.',
|
||||
'updated_status' => $currentStatus,
|
||||
'api_response' => $response,
|
||||
'count' => $status_updated_count,
|
||||
'error_data' => $error_data,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -3628,7 +3628,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
public function validateInsurerStatement($params)
|
||||
public function validateInsurerStatementOld($params)
|
||||
{
|
||||
helper('excel_util_helper');
|
||||
//get file info
|
||||
@ -3742,101 +3742,160 @@
|
||||
return array('status' => $ret_status, 'error_code' => $error_data['error_code'], 'error_data' => $error_data['error_data']);
|
||||
}
|
||||
|
||||
public function validateInsurerStatementNew($params)
|
||||
public function validateInsurerStatement($params)
|
||||
{
|
||||
helper('excel_util_helper');
|
||||
|
||||
//get file info
|
||||
$file_id = $params['file_id'];
|
||||
$file = $this->insurerStatements->find($file_id);
|
||||
// dd($file);
|
||||
|
||||
$date = new \DateTime($file['month']);
|
||||
try {
|
||||
|
||||
$month = $date->format('m');
|
||||
$year = $date->format('Y');
|
||||
//get file info
|
||||
$file = $this->insurerStatements->find($file_id);
|
||||
// dd($file);
|
||||
|
||||
$error_data = ['error_code' => '', 'error_data' => []];
|
||||
$status = 'success';
|
||||
$ret_status = true;
|
||||
|
||||
$return = [];
|
||||
if (!isset($file)) {
|
||||
//file not found in DB
|
||||
return array('status' => false, 'msg' => 'statement file not found in DB');
|
||||
}
|
||||
$file_name_with_path = WRITEPATH . "/uploads/statements/" . $file['file_name'];
|
||||
$date = new \DateTime($file['month']);
|
||||
|
||||
//check physical file
|
||||
if (!file_exists($file_name_with_path)) {
|
||||
//file not found update status and reason
|
||||
$message = "Physcial file not found";
|
||||
// echo $message;
|
||||
$this->myLogger->logme('error', ($message . ' for statement file id ' . $file_id));
|
||||
$this->insurerStatements->where('id', $file_id)->set(['file_status' => 'failed', 'reason' => json_encode(['error_code' => 0, 'error_data' => $message])])->update();
|
||||
return array('status' => false, 'error_code' => 0); //0 - Physcial file not found
|
||||
}
|
||||
$month = $date->format('m');
|
||||
$year = $date->format('Y');
|
||||
|
||||
//get excel data to php array
|
||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path);
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
$error_data = ['error_code' => '', 'error_data' => []];
|
||||
$status = 'success';
|
||||
$ret_status = true;
|
||||
|
||||
$highestRow = $sheet->getHighestRow();
|
||||
$highestColumn = $sheet->getHighestColumn();
|
||||
$return = [];
|
||||
if (!isset($file)) {
|
||||
//file not found in DB
|
||||
$this->insurerStatements->where('id', $file_id)->set(['file_status' => 'failed', 'reason' => json_encode(['error_code' => 0, 'error_data' => 'statement file not found in DB'])])->update();
|
||||
return array('status' => false, 'msg' => 'statement file not found in DB');
|
||||
}
|
||||
$file_name_with_path = WRITEPATH . "/uploads/statements/" . $file['file_name'];
|
||||
|
||||
$excel_data = $sheet->rangeToArray('A1:' . $highestColumn . $highestRow, null, true, true, true);
|
||||
unset($excel_data[0]);
|
||||
$excel_data = ExcelSanitizeHelper::sanitizeArrayData($excel_data);
|
||||
//check physical file
|
||||
if (!file_exists($file_name_with_path)) {
|
||||
//file not found update status and reason
|
||||
$message = "Physcial file not found";
|
||||
// echo $message;
|
||||
$this->myLogger->logme('error', ($message . ' for statement file id ' . $file_id));
|
||||
$this->insurerStatements->where('id', $file_id)->set(['file_status' => 'failed', 'reason' => json_encode(['error_code' => 0, 'error_data' => $message])])->update();
|
||||
return array('status' => false, 'error_code' => 0, 'error_data' => $message); //0 - Physcial file not found
|
||||
}
|
||||
|
||||
//get no of line items and update in DB
|
||||
$line_items = 0;
|
||||
//get excel data to php array
|
||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path);
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
// get uploaded month transactions data
|
||||
$source_data = $this->PTCOShareDetailsModel->getNonReconcileredPolicyTransactions(insurer_id: $file['insurer_id'], insurer_branch_id: $file['branch_id']);
|
||||
$highestRow = $sheet->getHighestRow();
|
||||
$highestColumn = $sheet->getHighestColumn();
|
||||
|
||||
// check policy no,insurer and etc in DB for this month
|
||||
// if all good return true, otherwise return false with messssage
|
||||
foreach ($excel_data as $excel_key => $excel_row) {
|
||||
$excel_data = $sheet->rangeToArray('A1:' . $highestColumn . $highestRow);
|
||||
unset($excel_data[0]);
|
||||
$excel_data = ExcelSanitizeHelper::sanitizeArrayData($excel_data);
|
||||
// dd($excel_data);
|
||||
|
||||
$is_row_empty = check_row_is_empty_or_null($excel_row);
|
||||
//get no of line items and update in DB
|
||||
$line_items = 0;
|
||||
|
||||
if (!$is_row_empty) {
|
||||
// get uploaded month transactions data
|
||||
$source_data = $this->PTCOShareDetailsModel->getNonReconcileredPolicyTransactions(insurer_id: $file['insurer_id'], insurer_branch_id: $file['branch_id']);
|
||||
// dd($source_data);
|
||||
|
||||
$is_source_found = 0;
|
||||
// check policy no,insurer and etc in DB for this month
|
||||
// if all good return true, otherwise return false with messssage
|
||||
$matched_entry = [];
|
||||
$error_messages = []; // row-wise error storage
|
||||
|
||||
$policy_no = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[1]); //policy_number from excel
|
||||
$policy_no = preg_replace( '/[\x{200B}\x{200C}\x{200D}\x{FEFF}\x{00A0}\x{200E}\x{200F}\x{202A}-\x{202E}]/u', '', $excel_row[1]); //policy_number from excel
|
||||
|
||||
$endorsement_no = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[2]??''); //endorsement number from excel
|
||||
$endorsement_no = preg_replace( '/[\x{200B}\x{200C}\x{200D}\x{FEFF}\x{00A0}\x{200E}\x{200F}\x{202A}-\x{202E}]/u', '', $excel_row[2]??''); //endorsement number from excel
|
||||
foreach ($excel_data as $excel_key => $excel_row) {
|
||||
|
||||
foreach ($source_data as $source_key => $source_row) {
|
||||
$row_number = $excel_key;
|
||||
$is_row_empty = check_row_is_empty_or_null($excel_row);
|
||||
$policy_source_found = 0;
|
||||
$endorsement_source_found = 0;
|
||||
$dublicate_found = 0;
|
||||
|
||||
$source_endorsement_no = $source_row['endorsement_no'] !== null ? $source_row['endorsement_no'] : null;
|
||||
|
||||
if (($policy_no == $source_row['policy_no']) && $endorsement_no == $source_endorsement_no) {
|
||||
$is_source_found = 1;
|
||||
$line_items = $line_items + 1;
|
||||
unset($source_data[$source_key]);
|
||||
continue 2;
|
||||
if (!$is_row_empty) {
|
||||
|
||||
$policy_no = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[1]); //policy_number from excel
|
||||
$policy_no = preg_replace('/[\x{200B}\x{200C}\x{200D}\x{FEFF}\x{00A0}\x{200E}\x{200F}\x{202A}-\x{202E}]/u', '', $excel_row[1]); //policy_number from excel
|
||||
|
||||
$endorsement_no = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[2] ?? ''); //endorsement number from excel
|
||||
$endorsement_no = preg_replace('/[\x{200B}\x{200C}\x{200D}\x{FEFF}\x{00A0}\x{200E}\x{200F}\x{202A}-\x{202E}]/u', '', $excel_row[2] ?? ''); //endorsement number from excel
|
||||
|
||||
foreach ($source_data as $source_key => $source_row) {
|
||||
|
||||
$source_endorsement_no = $source_row['endorsement_no'] !== null ? $source_row['endorsement_no'] : null;
|
||||
|
||||
if (($policy_no == $source_row['policy_no']) ){
|
||||
$policy_source_found = 1;
|
||||
}
|
||||
|
||||
if( $endorsement_no == $source_endorsement_no) {
|
||||
$endorsement_source_found = 1;
|
||||
}
|
||||
|
||||
// Duplicate check
|
||||
if (isset($matched_entry[$policy_no . '|' . $endorsement_no])) {
|
||||
$dublicate_found = 1;
|
||||
continue 2;
|
||||
}
|
||||
|
||||
if (($policy_no == $source_row['policy_no']) && $endorsement_no == $source_endorsement_no) {
|
||||
$line_items = $line_items + 1;
|
||||
$matched_entry[] = $policy_no . '|' . $endorsement_no;
|
||||
unset($source_data[$source_key]);
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Policy number mismatch
|
||||
if ($policy_source_found == 0) {
|
||||
$error_messages[$row_number]['policy_no_mismatch'] =
|
||||
"Policy number <strong>({$policy_no}) </strong> not in NHance.";
|
||||
}
|
||||
|
||||
// Endorsement number mismatch
|
||||
if (!empty($endorsement_no) && $endorsement_source_found == 0) {
|
||||
$error_messages[$row_number]['endorsement_no_mismatch'] =
|
||||
"Endorsement number <strong>({$endorsement_no})</strong> not in NHance.";
|
||||
}
|
||||
|
||||
// Duplicate check
|
||||
if ($dublicate_found == 1) {
|
||||
$error_messages[$row_number]['duplicate'] =
|
||||
"Duplicate entry found. This policy and endorsement <strong>({$policy_no} '|' {$endorsement_no})</strong> combination has already been matched.";
|
||||
}
|
||||
}
|
||||
|
||||
if ($is_source_found == 0) {
|
||||
$error_data['error_code'] = 1; //match not found
|
||||
$error_data['error_data'] = array_merge($error_data['error_data'], [$excel_row[0]]); //match not found
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// print_rr($error_messages);die;
|
||||
|
||||
if ($error_data['error_code']) {
|
||||
$status = 'failed';
|
||||
$ret_status = false;
|
||||
}
|
||||
if (!empty($error_messages)) {
|
||||
$error_data['error_code'] = 2;
|
||||
$error_data['error_data'] = $error_messages;
|
||||
$status = 'failed';
|
||||
$ret_status = false;
|
||||
}
|
||||
|
||||
//update in DB
|
||||
$this->insurerStatements->where('id', $file_id)->set(['line_items' => $line_items, 'file_status' => $status, 'reason' => json_encode($error_data)])->update();
|
||||
return array('status' => $ret_status, 'error_code' => $error_data['error_code'], 'error_data' => $error_data['error_data']);
|
||||
//update in DB
|
||||
$this->insurerStatements->where('id', $file_id)->set(['line_items' => $line_items, 'file_status' => $status, 'reason' => json_encode($error_data)])->update();
|
||||
return array('status' => $ret_status, 'error_code' => $error_data['error_code'], 'error_data' => $error_data['error_data']);
|
||||
} catch (\Throwable $th) {
|
||||
|
||||
$errorData = [
|
||||
'message' => $th->getMessage(),
|
||||
'file' => $th->getFile(),
|
||||
'line' => $th->getLine(),
|
||||
'code' => $th->getCode(),
|
||||
'trace' => $th->getTraceAsString(),
|
||||
'trace_array' => $th->getTrace(), // full array version (optional)
|
||||
'function' => $th->getTrace()[0]['function'] ?? null,
|
||||
'class' => $th->getTrace()[0]['class'] ?? null,
|
||||
];
|
||||
|
||||
$this->myLogger->logme("error", "POLICY-TRANSACTION-CONTROLLER - validateInsurerStatement: Exception: " . json_encode($errorData ?? []));
|
||||
$this->insurerStatements->where('id', $file_id)->set(['line_items' => 0, 'file_status' => 'failed', 'reason' => json_encode($errorData)])->update();
|
||||
return array('status' => false, 'error_code' => [], 'error_data' => $errorData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -634,7 +634,7 @@ class UserController extends AdminController
|
||||
$text = "update";
|
||||
$data['updated_by'] = get_session_userid();
|
||||
|
||||
$result = $this->partnerStaffModel->update($updateID, $data);
|
||||
$result = $this->partnerStaffModel->update($id, $data);
|
||||
} else {
|
||||
$text = "create";
|
||||
$data['role_id'] = 1;
|
||||
|
||||
@ -400,6 +400,58 @@ class VidalApiController extends BaseController
|
||||
return ['status' => 'success','data' => $decryptedData["redirectUrl"]];
|
||||
}
|
||||
|
||||
public function ClaimDetail($claimId = null)
|
||||
{
|
||||
helper('api');
|
||||
|
||||
$url = getenv('VIDAL_API_BASE_URL').'/claims/claim-dependent-info';
|
||||
$method = 'POST';
|
||||
|
||||
$headers = [
|
||||
'Content-Type: application/json',
|
||||
'Ocp-Apim-Subscription-Key:' .getenv('VIDAL_API_SUBSCRIPTION_KEY').'',
|
||||
];
|
||||
|
||||
// Fetch ticket master details
|
||||
$ticket = $this->db->table('ticket_master tm')
|
||||
->select("
|
||||
tm.id,
|
||||
tm.tpa_no as memberId,
|
||||
tm.tpa_claim_push_reference_no as claimRefNo,
|
||||
cp.policy_no as policyNo,
|
||||
cp.policy_start_date as startDate,
|
||||
cp.policy_end_date as endDate,
|
||||
e.emp_code as employeeCode
|
||||
")
|
||||
->join('employees e', 'e.id = tm.emp_id', 'left')
|
||||
->join('client_policy cp', 'tm.client_policy_id = cp.id', 'left')
|
||||
->where('tm.id', $claimId)
|
||||
->get()
|
||||
->getRowArray();
|
||||
|
||||
$body = [
|
||||
'empNO' => "",
|
||||
'tpaCardID' => "",
|
||||
'claimID' => "BLR-0284-CL-9349459",
|
||||
'emailID' => "",
|
||||
'mobileNO' => "",
|
||||
];
|
||||
|
||||
|
||||
|
||||
$response = call_third_party_api($url, $method, $headers, $body);
|
||||
|
||||
if($response['status'] != true){
|
||||
return $this->response->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'failed.',
|
||||
'data' => $response
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->response->setJSON($response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//----------yet to start only submit claim given
|
||||
@ -452,40 +504,7 @@ class VidalApiController extends BaseController
|
||||
|
||||
}
|
||||
|
||||
public function claimStatus ($claimId = null)
|
||||
{
|
||||
helper('api');
|
||||
|
||||
$url = getenv('VIDAL_API_BASE_URL').'/claims/claim-dependent-info';
|
||||
$method = 'POST';
|
||||
|
||||
$headers = [
|
||||
'Content-Type: application/json',
|
||||
'Ocp-Apim-Subscription-Key:' .getenv('VIDAL_API_SUBSCRIPTION_KEY').'',
|
||||
];
|
||||
|
||||
$body = [
|
||||
'empNO' => "",
|
||||
'tpaCardID' => "",
|
||||
'claimID' => "BLR-0284-CL-9349459",
|
||||
'emailID' => "",
|
||||
'mobileNO' => "",
|
||||
];
|
||||
|
||||
|
||||
|
||||
$response = call_third_party_api($url, $method, $headers, $body);
|
||||
|
||||
if($response['status'] != true){
|
||||
return $this->response->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'failed.',
|
||||
'data' => $response
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->response->setJSON($response);
|
||||
}
|
||||
|
||||
public function hospitalNetwork(){
|
||||
|
||||
|
||||
@ -3649,8 +3649,8 @@
|
||||
|
||||
if ($reward > 0 && ($row['billed_amt'] ?? 0) == 0.00) {
|
||||
$row['total_irda_amt'] = '0.00';
|
||||
$row['billed_amt'] =
|
||||
$reward; $rewardFlag = 'R'; // Reward row
|
||||
$row['billed_amt'] = $reward;
|
||||
$rewardFlag = 'R'; // Reward row
|
||||
} else {
|
||||
$rewardFlag = 'N'; // Normal row
|
||||
}
|
||||
@ -3689,15 +3689,20 @@
|
||||
$key = $row['pt_id'].'-'.$row['insurer_id'];
|
||||
|
||||
// Sum billed amount
|
||||
$totalBilled[$key] = ($totalBilled[$key] ?? 0)
|
||||
+ (float) ($row['billed_amt'] ?? 0);
|
||||
$totalBilled[$key] = ($totalBilled[$key] ?? 0) + (float) ($row['billed_amt'] ?? 0);
|
||||
|
||||
// Store total_irda_amt once
|
||||
if (!isset($totalIrdaMap[$key]) && ($row['total_irda_amt'] ?? 0) > 0) {
|
||||
$totalIrdaMap[$key] = (float) $row['total_irda_amt'];
|
||||
}
|
||||
|
||||
if(($row['reward'] ?? 0) > 0){
|
||||
$totalIrdaMap[$key] = ($totalIrdaMap[$key] ?? 0) + (float) $row['reward'];
|
||||
}
|
||||
}
|
||||
|
||||
// dd($totalIrdaMap);
|
||||
|
||||
$ptSeen = [];
|
||||
$final = [];
|
||||
|
||||
|
||||
@ -174,6 +174,20 @@
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<style>
|
||||
#file-err-modal .modal-body {
|
||||
max-height: 400px;
|
||||
overflow-y: auto;
|
||||
scrollbar-width: thin; /* Firefox */
|
||||
}
|
||||
|
||||
#file-err-modal .modal-body::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<div class="container-fluid-min">
|
||||
<div class="row" id="inception_list">
|
||||
<div class="col-12">
|
||||
@ -1325,7 +1339,7 @@
|
||||
|
||||
});
|
||||
|
||||
function fetchFileError(file_id) {
|
||||
function fetchFileErrorOld(file_id) {
|
||||
$('#loader').show();
|
||||
var apiURL = 'getFileErr/' + file_id;
|
||||
// console.log('fetchFileError');
|
||||
@ -1370,6 +1384,69 @@
|
||||
$('#loader').hide();
|
||||
}
|
||||
|
||||
function fetchFileError(file_id) {
|
||||
$('#loader').show();
|
||||
var apiURL = 'getFileErr/' + file_id;
|
||||
// console.log('fetchFileError');
|
||||
// console.log(apiURL);
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
$(this).find(".modal-body").html("");
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
try {
|
||||
var file_error_data = JSON.parse(response.data);
|
||||
var file_error_html = "";
|
||||
|
||||
// Handle only error_code = 1 (row-wise errors)
|
||||
if (file_error_data.error_code == 2) {
|
||||
|
||||
Object.keys(file_error_data.error_data).forEach(function (rowNo) {
|
||||
|
||||
file_error_html += `<div">
|
||||
<strong>Row ${rowNo} :</strong><br><br>`;
|
||||
|
||||
Object.values(file_error_data.error_data[rowNo]).forEach(function (message, index) {
|
||||
file_error_html += ` <strong>${index + 1}.</strong> ${message}<br>`;
|
||||
});
|
||||
|
||||
file_error_html += `</div> <hr>`;
|
||||
});
|
||||
|
||||
} else if (file_error_data.error_code == 1) {
|
||||
|
||||
file_error_html += 'The following row no(s) from excel are <span style="font-weight:bold">not found with policy transactions / duplicates.</span>';
|
||||
file_error_html += ' : ' + '<span style="font-weight:bolder">' + file_error_data.error_data.join(',') + '</span>';
|
||||
}
|
||||
// All other error codes → plain text message
|
||||
else {
|
||||
file_error_html = `<strong>${file_error_data.error_data}</strong>`;
|
||||
}
|
||||
|
||||
$('#file-err-modal').find(".modal-body").html(file_error_html);
|
||||
return file_error_html;
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error parsing API response data:', error);
|
||||
}
|
||||
} else if (response.code === 404 && response.dataStatus === false) {
|
||||
console.error('no data found', response);
|
||||
} else {
|
||||
console.error('Something went wrong!');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error fetching data from API:', error);
|
||||
}
|
||||
});
|
||||
|
||||
$('#loader').hide();
|
||||
}
|
||||
|
||||
function checkInvAmont(event = null) {
|
||||
var total = 0;
|
||||
@ -1404,7 +1481,6 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function switchRequired(elementId, isRequired, type = 'id') {
|
||||
// console.log('switchRequired: ' + elementId+' - '+' - '+ type);
|
||||
if (type == 'id') //id attribute
|
||||
|
||||
@ -993,7 +993,7 @@
|
||||
/* Common modal Title styles */
|
||||
.modal .modal-title {
|
||||
font-weight: 500;
|
||||
font-size: 27px;
|
||||
font-size: 23px;
|
||||
line-height: 100%;
|
||||
letter-spacing: 0;
|
||||
text-align: center;
|
||||
|
||||
@ -2080,6 +2080,9 @@
|
||||
|
||||
if ($(this).is(':checked')) {
|
||||
// Hide all
|
||||
$('[name="cd_ac_no_for_child[]"]').val('');
|
||||
$('[id^="cd_current_balance_"]').val('');
|
||||
|
||||
$('[name="cd_ac_no_for_child[]"]').hide();
|
||||
$('[id^="cd_current_balance_"]').hide();
|
||||
|
||||
@ -2087,6 +2090,10 @@
|
||||
$('#cd_ac_no_' + uniqueid).show();
|
||||
$('#cd_current_balance_' + uniqueid).show();
|
||||
} else {
|
||||
|
||||
$('[name="cd_ac_no_for_child[]"]').val('');
|
||||
$('[id^="cd_current_balance_"]').val('');
|
||||
|
||||
// Show all back
|
||||
$('[name="cd_ac_no_for_child[]"]').show();
|
||||
$('[id^="cd_current_balance_"]').show();
|
||||
@ -3365,8 +3372,16 @@
|
||||
$('input[name="co_ter_premium[]"]').addClass('readonly-select');
|
||||
$('#co_ter_premium_' + value).removeClass('readonly-select');
|
||||
|
||||
$('input[name="cd_ac_no_for_child[]"]').addClass('readonly-select');
|
||||
$('#cd_ac_no_' + value).removeClass('readonly-select');
|
||||
|
||||
$('[name="cd_ac_no_for_child[]"]').hide();
|
||||
$('[id^="cd_current_balance_"]').hide();
|
||||
|
||||
// Show only current one
|
||||
$('#cd_ac_no_' + value).show();
|
||||
$('#cd_current_balance_' + value).show();
|
||||
|
||||
// $('input[name="cd_ac_no_for_child[]"]').addClass('readonly-select');
|
||||
// $('#cd_ac_no_' + value).removeClass('readonly-select');
|
||||
|
||||
}
|
||||
}
|
||||
@ -3722,11 +3737,11 @@
|
||||
|
||||
const selectedValue = $(currentSelect).val();
|
||||
|
||||
if (selectedValue) {
|
||||
$('.follow_insurer_cd').not(currentSelect).prop('disabled', true);
|
||||
} else {
|
||||
$('.follow_insurer_cd').prop('disabled', false);
|
||||
}
|
||||
// if (selectedValue) {
|
||||
// $('.follow_insurer_cd').not(currentSelect).prop('disabled', true);
|
||||
// } else {
|
||||
// $('.follow_insurer_cd').prop('disabled', false);
|
||||
// }
|
||||
}
|
||||
|
||||
function removeAllColumnsExceptFirst(tableId) {
|
||||
|
||||
@ -109,7 +109,7 @@ table.dataTable tbody td {
|
||||
<th style="display: none;">Total Premium</th>
|
||||
<th>Agreed BP %</th>
|
||||
<th>Agreed TP %</th>
|
||||
<th style="display: none;">Rewards</th>
|
||||
<th style="display: true;">Rewards</th>
|
||||
<th>Agreed Amount</th>
|
||||
<th>Invoiced Amount</th>
|
||||
<th>Outstanding Amount</th>
|
||||
@ -197,7 +197,7 @@ table.dataTable tbody td {
|
||||
<td class="right-align-input" style="display: none;"><?php echo ($row['total_irda_amt'] != 0.00) ? ($row['total_premium'] ?: '0.00') : '0.00'; ?></td>
|
||||
<td class="right-align-input"><?php echo ($row['total_irda_amt'] != 0.00) ? ($row['agreed_bp_per'] ?: '0.00') : '0.00'; ?>%</td>
|
||||
<td class="right-align-input"><?php echo ($row['total_irda_amt'] != 0.00) ? ($row['agreed_tp_or_ter_per'] ?: '0.00') : '0.00'; ?>%</td>
|
||||
<td class="right-align-input" style="display: none;"><?php echo isset($row['reward']) ? $row['reward'] : '0.00'; ?></td>
|
||||
<td class="right-align-input" style="display: true;"><?php echo isset($row['reward']) ? $row['reward'] : '0.00'; ?></td>
|
||||
|
||||
<?php
|
||||
// Below Line its old version i am removed. reason no value ['total_irda_amt'] means taken as ['exp_amt'] so.
|
||||
@ -215,7 +215,7 @@ table.dataTable tbody td {
|
||||
$total_irda_amt = $row['total_irda_amt'] ?? '0.00';
|
||||
?>
|
||||
<td class="right-align-input" onclick="showCoShareStatementDetails(this)" data-id="<?= $row['pt_id'] ?>"><?php echo $total_irda_amt; ?></td>
|
||||
<td class="right-align-input"><?php echo empty($row['billed_amt']) ? '0.00' : $row['billed_amt'] ?></td>
|
||||
<td class="right-align-input" data-id="<?php echo strtolower($row['action_type']) ?: '-'; ?>"><?php echo empty($row['billed_amt']) ? '0.00' : $row['billed_amt'] ?></td>
|
||||
<!-- <td class="right-align-input"><?php echo empty($row['unbilled_amt']) ? '0.00' : $row['unbilled_amt']?></td> -->
|
||||
<?php
|
||||
// Below Line its old version so commanded reason they direct taken as ['total_irda_amt'] from array.
|
||||
@ -686,18 +686,18 @@ $(document).ready(function() {
|
||||
var totalIrda = getTotal(25);
|
||||
var totalBilled = getTotal(26);
|
||||
var totalRevenue = parseFloat(totalIrda) + parseFloat(totalRewards);
|
||||
// var totalUnbilled = getTotal(27);
|
||||
var totalUnbilled = getTotal(27);
|
||||
|
||||
// Update the totals section above the table
|
||||
$('#total_premium').text(totalPremium.toFixed(2));
|
||||
$('#total_rewards').text(totalRewards.toFixed(2));
|
||||
$('#total_irda').text(totalIrda.toFixed(2));
|
||||
// $('#total_revenue').text(totalRevenue.toFixed(2));
|
||||
$('#total_revenue').text(totalIrda.toFixed(2));
|
||||
$('#total_revenue').text(totalRevenue.toFixed(2));
|
||||
// $('#total_revenue').text(totalIrda.toFixed(2));
|
||||
$('#total_billed').text(totalBilled.toFixed(2));
|
||||
// $('#total_unbilled').text(totalUnbilled.toFixed(2));
|
||||
var totalUnbilled = getUniqueUnbilled(27);
|
||||
$('#total_unbilled').text(totalUnbilled.toFixed(2));
|
||||
// var totalUnbilled = getUniqueUnbilled(27);
|
||||
// $('#total_unbilled').text(totalUnbilled.toFixed(2));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
@ -163,8 +163,8 @@
|
||||
<tr>
|
||||
<th>S.No </th>
|
||||
<th>Client </th>
|
||||
<!-- <th>Client Branch </th> -->
|
||||
<!-- <th>Insurer </th> -->
|
||||
<th style="display: none;">Client Branch </th>
|
||||
<th style="display: none;">Insurer </th>
|
||||
<th>Insurer Branch </th>
|
||||
<th>Policy Type </th>
|
||||
<th>Policy No </th>
|
||||
@ -183,8 +183,8 @@
|
||||
<tr>
|
||||
<td class="text-center"><?= $index + 1 ?></td>
|
||||
<td><?php echo $row['client_name']; ?></td>
|
||||
<!-- <td><?php //echo $row['client_branch_name']; ?></td>
|
||||
<td><?php //echo $row['insurer_name']; ?></td> -->
|
||||
<td style="display: none;"><?php echo $row['client_branch_name']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['insurer_name']; ?></td>
|
||||
<td><?php echo $row['insurer_branch_name']; ?></td>
|
||||
<td><?php echo $row['policy_type']; ?></td>
|
||||
<td><?php echo $row['policy_no']; ?></td>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user