Penambahan kondisi tebus obat atau tidak
This commit is contained in:
@@ -45,7 +45,8 @@ class PrescriptionController extends Controller
|
||||
$startDate = $request->startDate;
|
||||
$endDate = $request->endDate;
|
||||
|
||||
$livechat = Livechat::with('doctor.user', 'doctor.speciality', 'appointment.appointmentDetail', 'healthCare', 'summary');
|
||||
$livechat = Livechat::with('doctor.user', 'doctor.speciality', 'appointment.appointmentDetail', 'healthCare', 'summary')
|
||||
->where('nTebusObat', '=', 1);
|
||||
// ->where('nIDAppointment', '!=', null)
|
||||
// ->where('nIDAppointment', '!=', '');
|
||||
if ($startDate) {
|
||||
@@ -98,14 +99,14 @@ class PrescriptionController extends Controller
|
||||
// Insert ke table tx_prescription di Linksehat
|
||||
$livechat = Livechat::where('nID', $request->id)->first();
|
||||
$livechatSummary = LivechatSummary::where('nIDLivechat', $request->id)->first();
|
||||
|
||||
|
||||
$dokterData = Dokter::where('nIDUser', $livechat->nIDDokter)->first();
|
||||
$nIDDokter = $dokterData ? $dokterData->nID : $livechat->nIDDokter;
|
||||
$userDokter = User::where('nID', $livechat->nIDDokter)->first();
|
||||
$userDetailDokter = UserDetail::where('nIDUser', $userDokter->nID)->first();
|
||||
|
||||
|
||||
$dokter = $userDetailDokter->sTitlePrefix . ' ' . $userDokter->sFirstName . ' ' . $userDokter->sLastName . ' ' . $userDetailDokter->sTitleSuffix;
|
||||
|
||||
|
||||
$kodeResep = 'LMS' . date('ymd') . rand(1,100);
|
||||
$diagnosis = explode(",",$request->diagnosis);
|
||||
|
||||
@@ -172,7 +173,7 @@ class PrescriptionController extends Controller
|
||||
if ($unitData) {
|
||||
$unit = $unitData->name;
|
||||
}
|
||||
|
||||
|
||||
// Insert Data
|
||||
$dataAso = [
|
||||
'prescription_id' => $prescriptionAso->id,
|
||||
@@ -261,19 +262,19 @@ class PrescriptionController extends Controller
|
||||
|
||||
$pdf->setPaper('A4', 'portrait');
|
||||
|
||||
|
||||
|
||||
$livechat = Livechat::with('doctor.user', 'doctor.speciality', 'appointment.appointmentDetail', 'healthCare')
|
||||
->where('nIDAppointment', '!=', null)->where('nIDAppointment', '!=', '')
|
||||
->where('nID', $id)
|
||||
->first();
|
||||
|
||||
|
||||
$prescription = Prescription::where('nIDLivechat', $id)->first();
|
||||
$valid_date = date('d-m-Y', strtotime($prescription->dTanggalResep . ' +3 days'));
|
||||
$prescriptionItem = PrescriptionItem::where('nIDPrescription', $prescription->nID)->get();
|
||||
|
||||
|
||||
$user = User::where('nID', $livechat->nIDUser)->first();
|
||||
$doctor = Dokter::where('nIDUser', $livechat->nIDDokter)->first();
|
||||
|
||||
|
||||
$patient = [
|
||||
'name' => $user->sFirstName. ' '. $user->sMiddleName. ' '. $user->sLastName,
|
||||
'tgl_lahir' => date('d-m-Y', strtotime($user->dTanggalLahir)),
|
||||
@@ -283,7 +284,7 @@ class PrescriptionController extends Controller
|
||||
|
||||
// Memuat view pdf_view.php ke dalam variabel
|
||||
$data = [
|
||||
'doctor' => $doctor,
|
||||
'doctor' => $doctor,
|
||||
'items' => $prescriptionItem,
|
||||
'tanggal_resep' => date('d-m-Y', strtotime($prescription->dTanggalResep)),
|
||||
'pasien' => $patient,
|
||||
|
||||
Reference in New Issue
Block a user