Update
This commit is contained in:
@@ -26,7 +26,14 @@ class PrescriptionController extends Controller
|
||||
{
|
||||
// return $request->toArray();
|
||||
$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')) {
|
||||
$search = $request->search;
|
||||
$prescription->where(function ($query) use ($search) {
|
||||
@@ -34,13 +41,13 @@ class PrescriptionController extends Controller
|
||||
->orWhere('sKodeResep', 'LIKE', '%' . $search . "%");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (($request->has('prescription_start') || $request->has('prescription_end'))
|
||||
&& !empty($request->prescription_start)
|
||||
&& !empty($request->prescription_end)
|
||||
) {
|
||||
|
||||
|
||||
|
||||
|
||||
$prescription = $prescription->where(function($q) use ($request) {
|
||||
$q->where('dTanggalResep', '>=', $request->prescription_start)
|
||||
->where('dTanggalResep', '<=', $request->prescription_end);
|
||||
@@ -156,6 +163,7 @@ class PrescriptionController extends Controller
|
||||
'Date Consultation',
|
||||
'Patient',
|
||||
'Doctor',
|
||||
'Status',
|
||||
'Jenis Obat (Drugs)',
|
||||
'Jumlah Obat (QTY)',
|
||||
'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)) {
|
||||
$prescriptionQuery->whereBetween('dTanggalResep', [$request->prescription_start, $request->prescription_end]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user