Update metode pembayaran
This commit is contained in:
@@ -4,6 +4,7 @@ namespace Modules\Internal\Http\Controllers\Api;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\OLDLMS\Livechat;
|
||||
use App\Models\OLDLMS\Appointment;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -62,7 +63,7 @@ class LivechatController extends Controller
|
||||
$startDate = $request->has('startDate') ? $request->input('startDate') : '';
|
||||
$endDate = $request->has('endDate') ? $request->input('endDate') : '';
|
||||
|
||||
$liveChats = Livechat::with('user:nID,sFirstName,sLastName,sEmail,sPhone,nIDUser', 'doctor:nID,nIDSpesialis,nIDUser', 'doctor.user:nID,sFirstName,sLastName', 'appointment:nID,sPaymentStatus', 'appointment.appointmentDetail:nID,nIDAppointment,dTanggalAppointment,tTimeAppointment', 'healthCare:nID,sHealthCare')
|
||||
$liveChats = Livechat::with('user:nID,sFirstName,sLastName,sEmail,sPhone,nIDUser', 'doctor:nID,nIDSpesialis,nIDUser', 'doctor.user:nID,sFirstName,sLastName', 'appointment:nID,sPaymentStatus,sPaymentMethod', 'appointment.appointmentDetail:nID,nIDAppointment,dTanggalAppointment,tTimeAppointment', 'healthCare:nID,sHealthCare')
|
||||
->where(function (Builder $query) use ($startDate, $endDate) {
|
||||
// $query->where('nIDAppointment', '!=', null);
|
||||
// $query->where('nIDAppointment', '!=', '');
|
||||
@@ -93,6 +94,7 @@ class LivechatController extends Controller
|
||||
['value' => 'Status', 'cell' => 'N1', 'mergeCell' => true, 'mergeToCell' => 'N2'],
|
||||
['value' => 'Record Type', 'cell' => 'O1', 'mergeCell' => true, 'mergeToCell' => 'O2'],
|
||||
['value' => 'nID Principal', 'cell' => 'P1', 'mergeCell' => true, 'mergeToCell' => 'P2'],
|
||||
['value' => 'Metode Pembayaran', 'cell' => 'Q1', 'mergeCell' => true, 'mergeToCell' => 'Q2'],
|
||||
];
|
||||
|
||||
$spreadsheet = new Spreadsheet();
|
||||
@@ -112,11 +114,9 @@ class LivechatController extends Controller
|
||||
$startFrom = 3;
|
||||
foreach ($liveChats as $indexLiveChat => $liveChat) {
|
||||
$phone = $liveChat->user->sPhone ?? '-';
|
||||
// $phone = str_replace(' ', '', $phone) ?? '-';
|
||||
$status = $liveChat->sStatus;
|
||||
$nIDUser = $liveChat->user->nIDUser ?? 0; // Principal or Dependent
|
||||
|
||||
// dd($nIDUser);
|
||||
$paymentMethod = $liveChat->appointment ? Helper::sPaymentMethod($liveChat->appointment->sPaymentMethod) : 'Belum ada Pembayaran';
|
||||
$recordType = 'P';
|
||||
if ($nIDUser){
|
||||
$recordType = 'D';
|
||||
@@ -141,8 +141,6 @@ class LivechatController extends Controller
|
||||
$statusLivechat = "Cancel by Patient";
|
||||
}
|
||||
|
||||
|
||||
|
||||
$sheet->setCellValue('A' . $startFrom, $indexLiveChat + 1);
|
||||
$sheet->setCellValue('B' . $startFrom, $liveChat->nID ?? '-');
|
||||
$sheet->setCellValue('C' . $startFrom, Carbon::parse($liveChat->dRequestTime)->format('d-m-Y'));
|
||||
@@ -159,6 +157,7 @@ class LivechatController extends Controller
|
||||
$sheet->setCellValue('N' . $startFrom, $statusLivechat);
|
||||
$sheet->setCellValue('O' . $startFrom, $recordType);
|
||||
$sheet->setCellValue('P' . $startFrom, $nIDUser ?? '-');
|
||||
$sheet->setCellValue('Q' . $startFrom, $paymentMethod ?? '-');
|
||||
$startFrom++;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user