Update
This commit is contained in:
@@ -26,7 +26,14 @@ class PrescriptionController extends Controller
|
|||||||
{
|
{
|
||||||
// return $request->toArray();
|
// return $request->toArray();
|
||||||
$prescription = Prescription::query()
|
$prescription = Prescription::query()
|
||||||
->with(['livechat', 'user', 'items']);
|
->with(['livechat', 'user', 'items'])
|
||||||
|
->join('tx_prescription_orders', 'tx_prescriptions.nID', '=', 'tx_prescription_orders.nIDPrescription')
|
||||||
|
->select(
|
||||||
|
'tx_prescriptions.*',
|
||||||
|
'tx_prescription_orders.sStatus as status_prescription',
|
||||||
|
'tx_prescription_orders.sAddress as kirim_ke',
|
||||||
|
'tx_prescription_orders.sDeliveryMethod as delivery',
|
||||||
|
);
|
||||||
if ($request->has('search')) {
|
if ($request->has('search')) {
|
||||||
$search = $request->search;
|
$search = $request->search;
|
||||||
$prescription->where(function ($query) use ($search) {
|
$prescription->where(function ($query) use ($search) {
|
||||||
@@ -34,13 +41,13 @@ class PrescriptionController extends Controller
|
|||||||
->orWhere('sKodeResep', 'LIKE', '%' . $search . "%");
|
->orWhere('sKodeResep', 'LIKE', '%' . $search . "%");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($request->has('prescription_start') || $request->has('prescription_end'))
|
if (($request->has('prescription_start') || $request->has('prescription_end'))
|
||||||
&& !empty($request->prescription_start)
|
&& !empty($request->prescription_start)
|
||||||
&& !empty($request->prescription_end)
|
&& !empty($request->prescription_end)
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
|
||||||
$prescription = $prescription->where(function($q) use ($request) {
|
$prescription = $prescription->where(function($q) use ($request) {
|
||||||
$q->where('dTanggalResep', '>=', $request->prescription_start)
|
$q->where('dTanggalResep', '>=', $request->prescription_start)
|
||||||
->where('dTanggalResep', '<=', $request->prescription_end);
|
->where('dTanggalResep', '<=', $request->prescription_end);
|
||||||
@@ -156,6 +163,7 @@ class PrescriptionController extends Controller
|
|||||||
'Date Consultation',
|
'Date Consultation',
|
||||||
'Patient',
|
'Patient',
|
||||||
'Doctor',
|
'Doctor',
|
||||||
|
'Status',
|
||||||
'Jenis Obat (Drugs)',
|
'Jenis Obat (Drugs)',
|
||||||
'Jumlah Obat (QTY)',
|
'Jumlah Obat (QTY)',
|
||||||
'Cara Minum Obat',
|
'Cara Minum Obat',
|
||||||
@@ -178,7 +186,7 @@ class PrescriptionController extends Controller
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->has('prescription_start') && $request->has('prescription_end') &&
|
if ($request->has('prescription_start') && $request->has('prescription_end') &&
|
||||||
!empty($request->prescription_start) && !empty($request->prescription_end)) {
|
!empty($request->prescription_start) && !empty($request->prescription_end)) {
|
||||||
$prescriptionQuery->whereBetween('dTanggalResep', [$request->prescription_start, $request->prescription_end]);
|
$prescriptionQuery->whereBetween('dTanggalResep', [$request->prescription_start, $request->prescription_end]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class ReportPrescriptionResource extends JsonResource
|
|||||||
public function toArray($request)
|
public function toArray($request)
|
||||||
{
|
{
|
||||||
$patientName = $this->user ? $this->user->sFirstName .' '. $this->user->sLastName : '-';
|
$patientName = $this->user ? $this->user->sFirstName .' '. $this->user->sLastName : '-';
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'id' => $this->nID,
|
'id' => $this->nID,
|
||||||
'patient_name' => $patientName,
|
'patient_name' => $patientName,
|
||||||
@@ -25,6 +25,7 @@ class ReportPrescriptionResource extends JsonResource
|
|||||||
'date_consultation' => $this->dTanggalResep ? Carbon::parse($this->dTanggalResep)->format('Y-m-d H:i:s') : null,
|
'date_consultation' => $this->dTanggalResep ? Carbon::parse($this->dTanggalResep)->format('Y-m-d H:i:s') : null,
|
||||||
'doctor_name' => $this->sDokterName ? $this->sDokterName : '-',
|
'doctor_name' => $this->sDokterName ? $this->sDokterName : '-',
|
||||||
'items' => $this->items ? $this->items : [],
|
'items' => $this->items ? $this->items : [],
|
||||||
|
'status_prescription' => $this->status_prescription
|
||||||
];
|
];
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ export default function List() {
|
|||||||
setSearchText(searchParams.get('search') ?? '');
|
setSearchText(searchParams.get('search') ?? '');
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form style={{ width: '100%' }}>
|
<form style={{ width: '100%' }}>
|
||||||
@@ -337,6 +337,7 @@ export default function List() {
|
|||||||
<TableCell align="left">{row.date_consultation ? fDateTime(row.date_consultation) : '-'}</TableCell>
|
<TableCell align="left">{row.date_consultation ? fDateTime(row.date_consultation) : '-'}</TableCell>
|
||||||
<TableCell align="left">{row.patient_name ?? '-'}</TableCell>
|
<TableCell align="left">{row.patient_name ?? '-'}</TableCell>
|
||||||
<TableCell align="left">{row.doctor_name ?? '-'}</TableCell>
|
<TableCell align="left">{row.doctor_name ?? '-'}</TableCell>
|
||||||
|
<TableCell align="left">{row.status_prescription ?? '-'}</TableCell>
|
||||||
{/* <TableCell align="center">
|
{/* <TableCell align="center">
|
||||||
<ButtonGroup variant="text" aria-label="text button group">
|
<ButtonGroup variant="text" aria-label="text button group">
|
||||||
<Link to={'/report/appointments/' + row.id + '/show'}>
|
<Link to={'/report/appointments/' + row.id + '/show'}>
|
||||||
@@ -390,7 +391,7 @@ export default function List() {
|
|||||||
</Collapse>
|
</Collapse>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
{/* END COLLAPSIBLE ROW */}
|
{/* END COLLAPSIBLE ROW */}
|
||||||
|
|
||||||
<Dialog
|
<Dialog
|
||||||
@@ -542,6 +543,9 @@ export default function List() {
|
|||||||
<TableCell style={headStyle} align="left">
|
<TableCell style={headStyle} align="left">
|
||||||
Doctor
|
Doctor
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
<TableCell style={headStyle} align="left">
|
||||||
|
Status
|
||||||
|
</TableCell>
|
||||||
{/* <TableCell style={headStyle} align="center">
|
{/* <TableCell style={headStyle} align="center">
|
||||||
Aksi
|
Aksi
|
||||||
</TableCell> */}
|
</TableCell> */}
|
||||||
|
|||||||
Reference in New Issue
Block a user