update data

This commit is contained in:
2023-09-10 07:11:10 +07:00
parent f021d672a0
commit 78e3211bdd
2 changed files with 14 additions and 9 deletions

View File

@@ -26,9 +26,9 @@ class LivechatController extends Controller
$startDate = $request->startDate;
$endDate = $request->endDate;
$livechat = Livechat::with('doctor.user', 'doctor.speciality', 'appointment.appointmentDetail', 'healthCare')
->where('nIDAppointment', '!=', null)
->where('nIDAppointment', '!=', '');
$livechat = Livechat::with('doctor.user', 'doctor.speciality', 'appointment.appointmentDetail', 'healthCare');
// ->where('nIDAppointment', '!=', null)
// ->where('nIDAppointment', '!=', '');
if ($startDate) {
@@ -74,6 +74,7 @@ class LivechatController extends Controller
$query->where('dCreateOn', '<=', $endDate);
}
})
->orderBy('nID', 'desc')
->get(['nID', 'nIDUser', 'nIDDokter', 'nIDHealthCare', 'nIDAppointment', 'sStatus', 'sMediaDokter', 'sMedia', 'dCreateOn']);
$headers = [
@@ -116,7 +117,8 @@ class LivechatController extends Controller
$phone = $liveChat->user->sPhone ?? '-';
$status = $liveChat->sStatus;
$nIDUser = $liveChat->user->nIDUser ?? 0; // Principal or Dependent
$paymentMethod = $liveChat->appointment ? Helper::sPaymentMethod($liveChat->appointment->sPaymentMethod) : 'Belum ada Pembayaran';
$paymentMethod = $liveChat->appointment ? Helper::sPaymentMethod($liveChat->appointment->sPaymentMethod) : 'N/A';
$fullNameDoctor = $liveChat->doctor->user->full_name ? $liveChat->doctor->user->detail->sTitlePrefix . ' ' . $liveChat->doctor->user->full_name . ' ' . $liveChat->doctor->user->detail->sTitleSuffix : '-' ;
$recordType = 'P';
if ($nIDUser){
$recordType = 'D';
@@ -147,7 +149,7 @@ class LivechatController extends Controller
$sheet->setCellValue('D' . $startFrom, Carbon::parse($liveChat->dCreateOn)->format('H:m:i'));
// $sheet->setCellValue('D' . $startFrom, Carbon::parse($liveChat->dRequestTime)->format('H:i:s'));
$sheet->setCellValue('E' . $startFrom, $liveChat->healthCare->sHealthCare ?? '-');
$sheet->setCellValue('F' . $startFrom, $liveChat->doctor->user->full_name ?? '-');
$sheet->setCellValue('F' . $startFrom, $fullNameDoctor);
$sheet->setCellValue('G' . $startFrom, $liveChat->doctor->speciality->sSpesialis ?? '-');
$sheet->setCellValue('H' . $startFrom, $liveChat->sMedia ?? '-');
$sheet->setCellValue('I' . $startFrom, $liveChat->sMediaDokter ?? '-');