Merge branch 'staging' of https://dev.sismedika.online/febio/aso into staging
This commit is contained in:
@@ -139,6 +139,7 @@ class ClaimController extends Controller
|
|||||||
$processedData = $this->processCategoryNames($data);
|
$processedData = $this->processCategoryNames($data);
|
||||||
|
|
||||||
$importedRows = 0;
|
$importedRows = 0;
|
||||||
|
$result_rows = [];
|
||||||
$failedRows = [];
|
$failedRows = [];
|
||||||
|
|
||||||
foreach ($processedData as $row) {
|
foreach ($processedData as $row) {
|
||||||
@@ -146,7 +147,7 @@ class ClaimController extends Controller
|
|||||||
$affectedRows = DB::table('claim_requests')
|
$affectedRows = DB::table('claim_requests')
|
||||||
->where('code','=', $row['code'])
|
->where('code','=', $row['code'])
|
||||||
->where('claim_management','=', 1)
|
->where('claim_management','=', 1)
|
||||||
->where('status_claim_management.status', '=', 'received')
|
->where('claim_requests.status_claim_management', '=', 'received')
|
||||||
->update([
|
->update([
|
||||||
'status' => $row['qc'] == 'Y' ? 'approved' : 'declined',
|
'status' => $row['qc'] == 'Y' ? 'approved' : 'declined',
|
||||||
'status_claim_management' => $row['qc'] == 'Y' ? 'approved' : 'declined',
|
'status_claim_management' => $row['qc'] == 'Y' ? 'approved' : 'declined',
|
||||||
@@ -156,11 +157,39 @@ class ClaimController extends Controller
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
if ($affectedRows === 0) {
|
if ($affectedRows === 0) {
|
||||||
|
$check_status = DB::table('claim_requests')
|
||||||
|
->where('code','=', $row['code'])
|
||||||
|
->where('claim_management','=', 1)
|
||||||
|
->select('status_claim_management')
|
||||||
|
->first();
|
||||||
|
if($check_status)
|
||||||
|
{
|
||||||
|
$row['error'] = 'Gagal update karena Status Claim sudah '.$check_status->status_claim_management;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$row['error'] = 'Gagal update karena Code tidak sesuai';
|
||||||
|
}
|
||||||
|
$row['code_error'] = '500';
|
||||||
|
$result_rows[] = $row;
|
||||||
$failedRows[] = $row;
|
$failedRows[] = $row;
|
||||||
} else {
|
} else {
|
||||||
$importedRows += $affectedRows;
|
$importedRows += $affectedRows;
|
||||||
|
$row['code_error'] = '200';
|
||||||
|
$row['error'] = 'Sukses';
|
||||||
|
$result_rows[] = $row;
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
$row['code_error'] = '500';
|
||||||
|
$row['error'] = $e->getMessage();
|
||||||
|
if(!$row['code'])
|
||||||
|
{
|
||||||
|
$row['error'] = 'Kolom Code wajib isi';
|
||||||
|
}
|
||||||
|
if(!$row['qc'])
|
||||||
|
{
|
||||||
|
$row['error'] = 'Kolom QC wajib isi';
|
||||||
|
}
|
||||||
|
$result_rows[] = $row;
|
||||||
$failedRows[] = $row;
|
$failedRows[] = $row;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -170,7 +199,7 @@ class ClaimController extends Controller
|
|||||||
'data' => [
|
'data' => [
|
||||||
'total_success_row' => $importedRows,
|
'total_success_row' => $importedRows,
|
||||||
'total_failed_row' => count($failedRows),
|
'total_failed_row' => count($failedRows),
|
||||||
'failed_rows' => $failedRows,
|
'result_rows' => $result_rows,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -377,11 +406,13 @@ class ClaimController extends Controller
|
|||||||
public function exportFiled(Request $request)
|
public function exportFiled(Request $request)
|
||||||
{
|
{
|
||||||
$writer = WriterEntityFactory::createXLSXWriter();
|
$writer = WriterEntityFactory::createXLSXWriter();
|
||||||
$writer->openToFile(public_path('files/Report-Data-Filed-Import.xlsx'));
|
$writer->openToFile(public_path('files/Report-Data-Result-Import.xlsx'));
|
||||||
$header = [
|
$header = [
|
||||||
'Code*',
|
'Code*',
|
||||||
'QC*',
|
'QC*',
|
||||||
'Reason'
|
'Reason',
|
||||||
|
'Ingest Code',
|
||||||
|
'Ingest Note'
|
||||||
];
|
];
|
||||||
$style = (new StyleBuilder())
|
$style = (new StyleBuilder())
|
||||||
->setFontBold()
|
->setFontBold()
|
||||||
@@ -402,7 +433,9 @@ class ClaimController extends Controller
|
|||||||
$rowData = [
|
$rowData = [
|
||||||
$item['code'],
|
$item['code'],
|
||||||
$item['qc'],
|
$item['qc'],
|
||||||
$item['reason']
|
$item['reason'],
|
||||||
|
$item['code_error'],
|
||||||
|
$item['error']
|
||||||
];
|
];
|
||||||
$style = (new StyleBuilder())
|
$style = (new StyleBuilder())
|
||||||
//->setFontBold()
|
//->setFontBold()
|
||||||
@@ -435,8 +468,8 @@ class ClaimController extends Controller
|
|||||||
$writer->close();
|
$writer->close();
|
||||||
|
|
||||||
return Helper::responseJson([
|
return Helper::responseJson([
|
||||||
'file_name' => 'Report-Data-Filed-Import',
|
'file_name' => 'Report-Data-Result-Import',
|
||||||
"file_url" => url('files/Report-Data-Filed-Import.xlsx')
|
"file_url" => url('files/Report-Data-Result-Import.xlsx')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
public function getProvider(Request $request)
|
public function getProvider(Request $request)
|
||||||
|
|||||||
@@ -397,7 +397,7 @@ const dummyServices = [
|
|||||||
|
|
||||||
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
|
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
|
||||||
const createMenu = Boolean(anchorEl);
|
const createMenu = Boolean(anchorEl);
|
||||||
const importHospital = useRef<HTMLInputElement>(null);
|
const importClaimManagement = useRef<HTMLInputElement>(null);
|
||||||
const [currentImportFileName, setCurrentImportFileName] = useState(null);
|
const [currentImportFileName, setCurrentImportFileName] = useState(null);
|
||||||
const [importLoading, setImportLoading] = useState(false);
|
const [importLoading, setImportLoading] = useState(false);
|
||||||
const [importResult, setImportResult] = useState(null);
|
const [importResult, setImportResult] = useState(null);
|
||||||
@@ -408,18 +408,18 @@ const dummyServices = [
|
|||||||
setAnchorEl(null);
|
setAnchorEl(null);
|
||||||
};
|
};
|
||||||
const handleImportButton = () => {
|
const handleImportButton = () => {
|
||||||
if (importHospital?.current) {
|
if (importClaimManagement?.current) {
|
||||||
handleClose();
|
handleClose();
|
||||||
importHospital.current ? importHospital.current.click() : console.log('No File selected');
|
importClaimManagement.current ? importClaimManagement.current.click() : console.log('No File selected');
|
||||||
} else {
|
} else {
|
||||||
alert('No file selected');
|
alert('No file selected');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleCancelImportButton = () => {
|
const handleCancelImportButton = () => {
|
||||||
if(importHospital.current)
|
if(importClaimManagement.current)
|
||||||
{
|
{
|
||||||
importHospital.current.value = '';
|
importClaimManagement.current.value = '';
|
||||||
importHospital.current.dispatchEvent(new Event('change', { bubbles: true }));
|
importClaimManagement.current.dispatchEvent(new Event('change', { bubbles: true }));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleImportChange = (event: any) => {
|
const handleImportChange = (event: any) => {
|
||||||
@@ -430,11 +430,11 @@ const dummyServices = [
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleUpload = () => {
|
const handleUpload = () => {
|
||||||
if(importHospital.current && importHospital.current.files)
|
if(importClaimManagement.current && importClaimManagement.current.files)
|
||||||
{
|
{
|
||||||
if (importHospital.current?.files.length) {
|
if (importClaimManagement.current?.files.length) {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('file', importHospital.current?.files[0]);
|
formData.append('file', importClaimManagement.current?.files[0]);
|
||||||
setImportLoading(true);
|
setImportLoading(true);
|
||||||
axios
|
axios
|
||||||
.post('claims/import', formData)
|
.post('claims/import', formData)
|
||||||
@@ -443,7 +443,7 @@ const dummyServices = [
|
|||||||
loadDataTableData();
|
loadDataTableData();
|
||||||
setImportResult(response.data);
|
setImportResult(response.data);
|
||||||
setImportLoading(false);
|
setImportLoading(false);
|
||||||
enqueueSnackbar('Success Import Hospitals', { variant: 'success' });
|
enqueueSnackbar('Success Import Claim Managemenet', { variant: 'success' });
|
||||||
})
|
})
|
||||||
.catch((response) => {
|
.catch((response) => {
|
||||||
enqueueSnackbar(
|
enqueueSnackbar(
|
||||||
@@ -474,7 +474,7 @@ const dummyServices = [
|
|||||||
const handleExportReportFiled = async () => {
|
const handleExportReportFiled = async () => {
|
||||||
|
|
||||||
await axios
|
await axios
|
||||||
.post('claims/exportFiled', { params: importResult?.data.failed_rows })
|
.post('claims/exportFiled', { params: importResult?.data.result_rows })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
enqueueSnackbar('Data berhasil di Export', {
|
enqueueSnackbar('Data berhasil di Export', {
|
||||||
variant: 'success',
|
variant: 'success',
|
||||||
@@ -792,7 +792,7 @@ const handleExportReportFiled = async () => {
|
|||||||
<input
|
<input
|
||||||
type="file"
|
type="file"
|
||||||
id="file"
|
id="file"
|
||||||
ref={importHospital}
|
ref={importClaimManagement}
|
||||||
style={{ display: 'none' }}
|
style={{ display: 'none' }}
|
||||||
onChange={handleImportChange}
|
onChange={handleImportChange}
|
||||||
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, text/plain"
|
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, text/plain"
|
||||||
@@ -975,11 +975,12 @@ const handleExportReportFiled = async () => {
|
|||||||
<Box sx={{ color: 'error.main', display: 'inline' }}>
|
<Box sx={{ color: 'error.main', display: 'inline' }}>
|
||||||
{importResult.data.total_failed_row}
|
{importResult.data.total_failed_row}
|
||||||
</Box>{' '}
|
</Box>{' '}
|
||||||
Failed
|
Failed,
|
||||||
{/* {importResult.data.failed_rows.map((row, index) => (
|
{/* {importResult.data.failed_rows.map((row, index) => (
|
||||||
<Typography variant='body' key={index} color="error"> [Code={row.code ? row.code : 'Required'}]</Typography>
|
<Typography variant='body' key={index} color="error"> [Code={row.code ? row.code : 'Required'}]</Typography>
|
||||||
))} */}
|
))} */}
|
||||||
<u onClick={handleExportReportFiled} style={{cursor:'pointer'}}>Download Data Filed</u>
|
Report:
|
||||||
|
<u onClick={handleExportReportFiled} style={{cursor:'pointer'}}>Download Data Result Import</u>
|
||||||
</Box>
|
</Box>
|
||||||
</Stack>
|
</Stack>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user