diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index b6433edc..6b30ad59 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -6446,12 +6446,12 @@ class ClientController extends AdminController // $response = $ticketServiceController->getClaimExcelErrorData(["file_id" => 41]); // $response = $ticketServiceController->claimDumpOnBoardProcess(["file_id" => 17]); // $response = $ticketServiceController->extractExcelData("claims_dump_form_client.xlsx"); - // $response = $ticketServiceController->tpaClaimDumpImporter(["file_id" => 52]); //reliance - // $response = $ticketServiceController->tpaClaimDumpImporter(["file_id" => 50]); //fhpl // $response = $ticketServiceController->tpaClaimDumpImporter(["file_id" => 51]); //abhi - // $response = $ticketServiceController->tpaClaimDumpImporter(["file_id" => 48]); //vidal + // $response = $ticketServiceController->tpaClaimDumpImporter(["file_id" => 50]); //fhpl // $response = $ticketServiceController->tpaClaimDumpImporter(["file_id" => 53]); //icici // $response = $ticketServiceController->tpaClaimDumpImporter(["file_id" => 54]); //mediassist + // $response = $ticketServiceController->tpaClaimDumpImporter(["file_id" => 52]); //reliance + // $response = $ticketServiceController->tpaClaimDumpImporter(["file_id" => 48]); //vidal // $response = $ticketServiceController->tpaClaimDumpToTicketMasterImporters(["file_id" => 48]); //vidal // $response = $ticketServiceController->tpaClaimDumpToTicketMasterImporters(["file_id" => 54]); //mediassist diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index b2259ac1..a8bd7c44 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -581,6 +581,8 @@ class EmployeeController extends AdminController $filePath = ROOTPATH . 'public/sample_excel/sample_multievent_file.xlsx'; }else if ($actionType == 'bds_upload') { $filePath = ROOTPATH . 'public/sample_excel/sample_bds_bulk_upload_excel.xlsx'; + }else if ($actionType == 'claim_dump_upload') { + $filePath = ROOTPATH . 'public/sample_excel/sample_claim_dump_upload_excel.xlsx'; } // Check if the file exists diff --git a/app/Libraries/TPAClaimsImportServices/AbhiClaimImportService.php b/app/Libraries/TPAClaimsImportServices/AbhiClaimImportService.php index 3ee5c066..8dcfc672 100644 --- a/app/Libraries/TPAClaimsImportServices/AbhiClaimImportService.php +++ b/app/Libraries/TPAClaimsImportServices/AbhiClaimImportService.php @@ -148,20 +148,7 @@ class AbhiClaimImportService extends BaseTpaClaimImportService } $builder = $this->db->table('claims_dump_abhi'); - - foreach ($data as $value) { - - if (!$builder->insert($value)) { - - // 🔍 Debug purpose - log_message('error', print_r($this->db->error(), true)); - log_message('error', $this->db->getLastQuery()); - - return false; - } - } - - return true; + return $builder->insertBatch($data); } @@ -321,8 +308,14 @@ class AbhiClaimImportService extends BaseTpaClaimImportService $item['emp_code'] = $employee_data['emp_code'] ?? null; $item['emp_mail'] = $employee_data['email_corporate'] ?? null; $item['emp_mobile'] = $employee_data['mobile'] ?? null; - $item['insured_emp_id'] = $employee_data['insured_emp_id'] ?? null; - $item['insured_name'] = $employee_data['insured_name'] ?? null; + if (!empty($employee_data['insured_emp_id'])) { + $item['insured_emp_id'] = $employee_data['insured_emp_id'] ?? null; + $item['insured_name'] = $employee_data['insured_name'] ?? null; + }else{ + $reason = 'This Dependent employee not exist in our system.'; + $rejecetd_reason[] = ["id" => $row['id'], "master_reject_reason" => $reason]; + continue; + } } else { $reason = 'This employee not exist in our system.'; diff --git a/app/Libraries/TPAClaimsImportServices/BaseTpaClaimImportService.php b/app/Libraries/TPAClaimsImportServices/BaseTpaClaimImportService.php index f2e94cfa..3a6a5777 100644 --- a/app/Libraries/TPAClaimsImportServices/BaseTpaClaimImportService.php +++ b/app/Libraries/TPAClaimsImportServices/BaseTpaClaimImportService.php @@ -92,6 +92,7 @@ abstract class BaseTpaClaimImportService $message = ''; $hasExecutedTask = false; + $status = true; // Process Mapped Data if (!empty($ticketMasterData['mapped_array'])) { @@ -102,6 +103,8 @@ abstract class BaseTpaClaimImportService } $message .= 'Ticket Master Claim bulk insert success. '; $hasExecutedTask = true; + }else{ + $status = false; } // Process Rejected Reasons @@ -113,7 +116,7 @@ abstract class BaseTpaClaimImportService } $message .= empty($ticketMasterData['mapped_array']) - ? 'Those employees not in our system. ' + ? 'Those employee or dependent not in our system. ' : 'Ticket Master Claim rejected reason updated successfully. '; $hasExecutedTask = true; } @@ -126,7 +129,7 @@ abstract class BaseTpaClaimImportService // 2. Commit the transaction $this->db->transCommit(); - return ['status' => true, 'message' => trim($message)]; + return ['status' => $status, 'message' => trim($message)]; } catch (\Throwable $th) { // 3. Rollback on crash diff --git a/app/Libraries/TPAClaimsImportServices/FhplClaimImportService.php b/app/Libraries/TPAClaimsImportServices/FhplClaimImportService.php index f4410b55..3ad5dde9 100644 --- a/app/Libraries/TPAClaimsImportServices/FhplClaimImportService.php +++ b/app/Libraries/TPAClaimsImportServices/FhplClaimImportService.php @@ -217,12 +217,9 @@ class FhplClaimImportService extends BaseTpaClaimImportService return false; } - $ClaimsDumpFhplModel = new ClaimsDumpFhplModel(); - $result = $ClaimsDumpFhplModel->insertBatch($data); - - return true; - - } + $builder = $this->db->table('claims_dump_fhpl'); + return $builder->insertBatch($data); + } public function importClaimMaster(array $data): bool @@ -381,8 +378,14 @@ class FhplClaimImportService extends BaseTpaClaimImportService $item['emp_code'] = $employee_data['emp_code'] ?? null; $item['emp_mail'] = $employee_data['email_corporate'] ?? null; $item['emp_mobile'] = $employee_data['mobile'] ?? null; - $item['insured_emp_id'] = $employee_data['insured_emp_id'] ?? null; - $item['insured_name'] = $employee_data['insured_name'] ?? null; + if (!empty($employee_data['insured_emp_id'])) { + $item['insured_emp_id'] = $employee_data['insured_emp_id'] ?? null; + $item['insured_name'] = $employee_data['insured_name'] ?? null; + }else{ + $reason = 'This Dependent employee not exist in our system.'; + $rejecetd_reason[] = ["id" => $row['id'], "master_reject_reason" => $reason]; + continue; + } } else { $reason = 'This employee not exist in our system.'; diff --git a/app/Libraries/TPAClaimsImportServices/IciciClaimImportService.php b/app/Libraries/TPAClaimsImportServices/IciciClaimImportService.php index fb1d731f..2cb09e7a 100644 --- a/app/Libraries/TPAClaimsImportServices/IciciClaimImportService.php +++ b/app/Libraries/TPAClaimsImportServices/IciciClaimImportService.php @@ -135,29 +135,8 @@ class IciciClaimImportService extends BaseTpaClaimImportService return false; } - try { - - - $ClaimsDumpFhplModel = new ClaimsDumpFhplModel(); - $result = $ClaimsDumpFhplModel->insertBatch($data); - - return true; - - } 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, - ]; - return false; - } - + $builder = $this->db->table('claims_dump_icici'); + return $builder->insertBatch($data); } @@ -317,8 +296,14 @@ class IciciClaimImportService extends BaseTpaClaimImportService $item['emp_code'] = $employee_data['emp_code'] ?? null; $item['emp_mail'] = $employee_data['email_corporate'] ?? null; $item['emp_mobile'] = $employee_data['mobile'] ?? null; - $item['insured_emp_id'] = $employee_data['insured_emp_id'] ?? null; - $item['insured_name'] = $employee_data['insured_name'] ?? null; + if (!empty($employee_data['insured_emp_id'])) { + $item['insured_emp_id'] = $employee_data['insured_emp_id'] ?? null; + $item['insured_name'] = $employee_data['insured_name'] ?? null; + }else{ + $reason = 'This Dependent employee not exist in our system.'; + $rejecetd_reason[] = ["id" => $row['id'], "master_reject_reason" => $reason]; + continue; + } } else { $reason = 'This employee not exist in our system.'; diff --git a/app/Libraries/TPAClaimsImportServices/MediAssistClaimImportService.php b/app/Libraries/TPAClaimsImportServices/MediAssistClaimImportService.php index 0c68ece9..947775f6 100644 --- a/app/Libraries/TPAClaimsImportServices/MediAssistClaimImportService.php +++ b/app/Libraries/TPAClaimsImportServices/MediAssistClaimImportService.php @@ -334,8 +334,14 @@ class MediAssistClaimImportService extends BaseTpaClaimImportService $item['emp_code'] = $employee_data['emp_code'] ?? null; $item['emp_mail'] = $employee_data['email_corporate'] ?? null; $item['emp_mobile'] = $employee_data['mobile'] ?? null; - $item['insured_emp_id'] = $employee_data['insured_emp_id'] ?? null; - $item['insured_name'] = $employee_data['insured_name'] ?? null; + if (!empty($employee_data['insured_emp_id'])) { + $item['insured_emp_id'] = $employee_data['insured_emp_id'] ?? null; + $item['insured_name'] = $employee_data['insured_name'] ?? null; + }else{ + $reason = 'This Dependent employee not exist in our system.'; + $rejecetd_reason[] = ["id" => $row['id'], "master_reject_reason" => $reason]; + continue; + } } else { $reason = 'This employee not exist in our system.'; diff --git a/app/Libraries/TPAClaimsImportServices/RcareClaimImportService.php b/app/Libraries/TPAClaimsImportServices/RcareClaimImportService.php index a75289a2..30c12e0d 100644 --- a/app/Libraries/TPAClaimsImportServices/RcareClaimImportService.php +++ b/app/Libraries/TPAClaimsImportServices/RcareClaimImportService.php @@ -124,28 +124,8 @@ class RcareClaimImportService extends BaseTpaClaimImportService return false; } - try { - - $builder = $this->db->table('claims_dump_reliance'); - $builder->insertBatch($data); - - return true; - - } 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, - ]; - dd($errorData); - return false; - } + $builder = $this->db->table('claims_dump_reliance'); + return $builder->insertBatch($data); } @@ -305,8 +285,14 @@ class RcareClaimImportService extends BaseTpaClaimImportService $item['emp_code'] = $employee_data['emp_code'] ?? null; $item['emp_mail'] = $employee_data['email_corporate'] ?? null; $item['emp_mobile'] = $employee_data['mobile'] ?? null; - $item['insured_emp_id'] = $employee_data['insured_emp_id'] ?? null; - $item['insured_name'] = $employee_data['insured_name'] ?? null; + if (!empty($employee_data['insured_emp_id'])) { + $item['insured_emp_id'] = $employee_data['insured_emp_id'] ?? null; + $item['insured_name'] = $employee_data['insured_name'] ?? null; + }else{ + $reason = 'This Dependent employee not exist in our system.'; + $rejecetd_reason[] = ["id" => $row['id'], "master_reject_reason" => $reason]; + continue; + } } else { $reason = 'This employee not exist in our system.'; diff --git a/app/Libraries/TPAClaimsImportServices/VidalClaimImportService.php b/app/Libraries/TPAClaimsImportServices/VidalClaimImportService.php index 50ef9924..8fc34700 100644 --- a/app/Libraries/TPAClaimsImportServices/VidalClaimImportService.php +++ b/app/Libraries/TPAClaimsImportServices/VidalClaimImportService.php @@ -364,9 +364,8 @@ class VidalClaimImportService extends BaseTpaClaimImportService } $builder = $this->db->table('claims_dump_vidal'); - $builder->insertBatch($data); + return $builder->insertBatch($data); - return true; } @@ -541,7 +540,7 @@ class VidalClaimImportService extends BaseTpaClaimImportService } // Meta fields - $item['claim_status_id'] = $statusMapping[$row['status']] ?? 61; + $item['claim_status_id'] = $statusMapping[$row['claim_status']] ?? 61; $item['file_id'] = $file_id; $item['claim_dump_ref_id'] = $row['id']; $item['created_by'] = $file_data['created_by'] ?? null; @@ -620,8 +619,14 @@ class VidalClaimImportService extends BaseTpaClaimImportService $item['emp_name'] = $employee_data['id'] ?? null; $item['emp_mail'] = $employee_data['insurer_id'] ?? null; $item['emp_mobile'] = $employee_data['tpa_id'] ?? null; - $item['insured_emp_id'] = $employee_data['insured_emp_id'] ?? null; - $item['insured_name'] = $employee_data['insured_name'] ?? null; + if (!empty($employee_data['insured_emp_id'])) { + $item['insured_emp_id'] = $employee_data['insured_emp_id'] ?? null; + $item['insured_name'] = $employee_data['insured_name'] ?? null; + }else{ + $reason = 'This Dependent employee not exist in our system.'; + $rejecetd_reason[] = ["id" => $row['id'], "master_reject_reason" => $reason]; + continue; + } }else{ $reason = " This policy no ( " . $row['insurer_policy_number'] ." ) does not exist in our system"; $rejecetd_reason[$row['id']] = ["ticket_master_insert_reject_reason" => $reason]; diff --git a/app/Views/claim_dump_file_list.php b/app/Views/claim_dump_file_list.php index 0cf55ed9..e0d66143 100644 --- a/app/Views/claim_dump_file_list.php +++ b/app/Views/claim_dump_file_list.php @@ -185,7 +185,7 @@
-  [ Sample Excel ] +  [ " id="download_sample_file" style="font-size: small; color:red !important;">Download sample file ]
diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php index 73c56916..9a3b72af 100755 --- a/app/Views/layout/header.php +++ b/app/Views/layout/header.php @@ -1863,9 +1863,9 @@
  • Claim Dump Upload
  • -
  • + diff --git a/public/sample_excel/sample_claim_dump_upload_excel.xlsx b/public/sample_excel/sample_claim_dump_upload_excel.xlsx new file mode 100644 index 00000000..93b0d758 Binary files /dev/null and b/public/sample_excel/sample_claim_dump_upload_excel.xlsx differ