update import
This commit is contained in:
@@ -446,8 +446,9 @@ class ClaimRequestController extends Controller
|
||||
$result_headers = array_merge($result_headers, ['Ingest Code', 'Ingest Note']);
|
||||
|
||||
$import->addArrayToRow($result_headers);
|
||||
|
||||
|
||||
$imported_claim_data = 0;
|
||||
$failed_claim_data = [];
|
||||
|
||||
$doc_headers_indexes = [];
|
||||
foreach ($sheet->getRowIterator() as $index => $row) {
|
||||
if ($index == 1) { // First Row Must be Header
|
||||
@@ -477,15 +478,19 @@ class ClaimRequestController extends Controller
|
||||
$dateSubmission = Helper::dateParser($result_headers['date_submission']); // Format tanggal sesuai kebutuhan
|
||||
// Mengubah nilai date_submission menjadi string tanggal
|
||||
$result_headers['date_submission'] = $dateSubmission;
|
||||
// dd($result_headers);
|
||||
$import->addArrayToRow($result_headers, $sheet->getName());
|
||||
$imported_claim_data++;
|
||||
} catch (ImportRowException $e) {
|
||||
// Write Data Validation Error to File
|
||||
// $import->read($fileRead);
|
||||
// $import->write($fileWrite, 'xsls');
|
||||
$import->addArrayToRow(array_merge($row_data, [
|
||||
$new_claim_data = $import->addArrayToRow(array_merge($row_data, [
|
||||
'Ingest Code' => $e->getCode(),
|
||||
'Ingest Note' => $e->getMessage(),
|
||||
]), $sheet->getName());
|
||||
|
||||
$failed_claim_data[] = ['row_number' => $index, 'error' => $e->getMessage(),'data' => $new_claim_data];
|
||||
}
|
||||
// catch (\Exception $e) {
|
||||
// // throw new \Exception($e);
|
||||
@@ -504,14 +509,14 @@ class ClaimRequestController extends Controller
|
||||
$import->reader->close();
|
||||
Storage::delete('temp/' . $file_name);
|
||||
$import->writer->close();
|
||||
|
||||
return [
|
||||
// 'total_successed_row' => $imported_plan_data,
|
||||
// 'total_failed_row' => count($failed_plan_data),
|
||||
// 'failed_row' => $failed_plan_data,
|
||||
|
||||
'result_file' => [
|
||||
'url' => Storage::disk('public')->url('temp/result-' . $file_name),
|
||||
'name' => 'result-' . $file_name,
|
||||
'total_successed_row' => $imported_claim_data,
|
||||
'total_failed_row' => count($failed_claim_data),
|
||||
'failed_row' => $failed_claim_data,
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
@@ -52,23 +52,27 @@ class ClaimRequestService{
|
||||
$statusClaim = null;
|
||||
}
|
||||
|
||||
$claimRequestData = [
|
||||
'code' => $code,
|
||||
'request_log_id' => $requestLogID ?? 0,
|
||||
'member_id' => $member->id,
|
||||
'submission_date' => $submissionDate ?? now(),
|
||||
'status' => $status,
|
||||
'claim_management' => $claimManagement,
|
||||
'status_claim_management' => $statusClaim,
|
||||
'submission_date_claim_management' => $submissionDateClaimManagement,
|
||||
'submission_by_claim_management' => $submissionByClaimManagement,
|
||||
'payment_type' => $paymentType,
|
||||
'service_code' => $serviceCode,
|
||||
'policy_id' => $member->currentPolicy->id ?? null,
|
||||
'organization_id' => $organization ? $organization->id : 0,
|
||||
];
|
||||
if($row['total_billing']) {
|
||||
$data = [
|
||||
'code' => $code,
|
||||
'request_log_id' => $requestLogID ?? 0,
|
||||
'member_id' => $member->id,
|
||||
'submission_date' => $submissionDate ?? now(),
|
||||
'status' => $status,
|
||||
'claim_management' => $claimManagement,
|
||||
'status_claim_management' => $statusClaim,
|
||||
'submission_date_claim_management' => $submissionDateClaimManagement,
|
||||
'submission_by_claim_management' => $submissionByClaimManagement,
|
||||
'payment_type' => $paymentType,
|
||||
'service_code' => $serviceCode,
|
||||
'policy_id' => $member->currentPolicy->id ?? null,
|
||||
'organization_id' => $organization ? $organization->id : 0,
|
||||
];
|
||||
} else {
|
||||
$data = [];
|
||||
}
|
||||
$claimRequest = ClaimRequest::updateOrCreate(['request_log_id' => $requestLogID],$data);
|
||||
|
||||
$claimRequest = ClaimRequest::updateOrCreate(['request_log_id' => $requestLogID],$claimRequestData);
|
||||
if (count($row)>0){
|
||||
$benefitData = Benefit::where('code', $row['benefit_code'])->first();
|
||||
$requestLogData = RequestLogBenefit::updateOrCreate(
|
||||
@@ -194,9 +198,6 @@ class ClaimRequestService{
|
||||
$date = date('ymd');
|
||||
// Menghasilkan kode dengan format yang diinginkan
|
||||
$code = 'CLAIM' . $sparator. 'I' . $sparator. $organization->code . $sparator. $date. $sparator . $member->currentPolicy->code . $sparator. $member->member_id . $sparator. str_pad($next_number, 5, '0', STR_PAD_LEFT);
|
||||
|
||||
// $code = $row['client_claim_id'];
|
||||
// dd($row['date_submission']);
|
||||
$submissionDate = Helper::dateParser($row['date_submission']);
|
||||
$paymentType = $requestLog->payment_type;
|
||||
if ($row['qc'] == 'Y'){
|
||||
@@ -205,7 +206,6 @@ class ClaimRequestService{
|
||||
$status = 'requested';
|
||||
}
|
||||
$serviceCode = $requestLog->service_code;
|
||||
|
||||
$newClaimRequest = $this->storeClaimRequest(
|
||||
row: $row,
|
||||
code: $code,
|
||||
@@ -218,15 +218,6 @@ class ClaimRequestService{
|
||||
organization_code: $organization->code
|
||||
);
|
||||
$newlyCreatedID = $newClaimRequest->id;
|
||||
// $newClaimManangement = $this->storeClaimManagement($row, $member, $newlyCreatedID);
|
||||
// ClaimRequested::dispatch($newClaimRequest);
|
||||
// // Log History
|
||||
// $newClaimRequest->histories()->create([
|
||||
// 'title' => 'New Claim Requested',
|
||||
// 'description' => "Claim Requested for Member : {$member->member_id} - ({$member->full_name})",
|
||||
// 'type' => 'info',
|
||||
// 'system_origin' => 'import-internal-aso'
|
||||
// ]);
|
||||
return $newClaimRequest;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
|
||||
@@ -366,14 +366,32 @@ export default function List() {
|
||||
</Stack>
|
||||
)}
|
||||
{importResult && (
|
||||
// <Stack direction={'row'} sx={{ px: 2, pb: 2 }}>
|
||||
// <Box sx={{ color: 'text.secondary' }}>
|
||||
// Last Import Result Report :{' '}
|
||||
// <a href={importResult.result_file?.url ?? '#'}>
|
||||
// {importResult.result_file?.name ?? '-'}
|
||||
// </a>
|
||||
// </Box>
|
||||
// </Stack>
|
||||
|
||||
<Stack direction={'row'} sx={{ px: 2, pb: 2 }}>
|
||||
<Box sx={{ color: 'text.secondary' }}>
|
||||
Last Import Result Report :{' '}
|
||||
Last Import Result :{' '}
|
||||
<Box sx={{ color: 'success.main', display: 'inline' }}>
|
||||
{importResult.result_file?.total_success_row ?? 0}
|
||||
</Box>{' '}
|
||||
Row Processed,{' '}
|
||||
<Box sx={{ color: 'error.main', display: 'inline' }}>
|
||||
{importResult.result_file?.total_failed_row}
|
||||
</Box>{' '}
|
||||
Failed, Report :{' '}
|
||||
<a href={importResult.result_file?.url ?? '#'}>
|
||||
{importResult.result_file?.name ?? '-'}
|
||||
</a>
|
||||
</Box>
|
||||
</Stack>
|
||||
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user