diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 4764e7e1..48c7fbb8 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -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 diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index dea5763b..039f6f99 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -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); diff --git a/app/Controllers/MediAssistApiController.php b/app/Controllers/MediAssistApiController.php index ba21f694..d2b40c67 100644 --- a/app/Controllers/MediAssistApiController.php +++ b/app/Controllers/MediAssistApiController.php @@ -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, + ]); + } + + diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index 4f2fcb49..385a4bff 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -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 ({$policy_no}) not in NHance."; + } + + // Endorsement number mismatch + if (!empty($endorsement_no) && $endorsement_source_found == 0) { + $error_messages[$row_number]['endorsement_no_mismatch'] = + "Endorsement number ({$endorsement_no}) not in NHance."; + } + + // Duplicate check + if ($dublicate_found == 1) { + $error_messages[$row_number]['duplicate'] = + "Duplicate entry found. This policy and endorsement ({$policy_no} '|' {$endorsement_no}) 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); + } } diff --git a/app/Controllers/UserController.php b/app/Controllers/UserController.php index 22451e89..f6b4cc60 100755 --- a/app/Controllers/UserController.php +++ b/app/Controllers/UserController.php @@ -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; diff --git a/app/Controllers/VidalApiController.php b/app/Controllers/VidalApiController.php index 78fc7d57..3fb32afe 100644 --- a/app/Controllers/VidalApiController.php +++ b/app/Controllers/VidalApiController.php @@ -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(){ diff --git a/app/Models/PolicyTransactionModel.php b/app/Models/PolicyTransactionModel.php index 2dc9af06..05a734c1 100644 --- a/app/Models/PolicyTransactionModel.php +++ b/app/Models/PolicyTransactionModel.php @@ -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 = []; diff --git a/app/Views/insurer_statement_list.php b/app/Views/insurer_statement_list.php index 3728bfff..4e4a9192 100644 --- a/app/Views/insurer_statement_list.php +++ b/app/Views/insurer_statement_list.php @@ -174,6 +174,20 @@ } + + + +