From 5226fde8a00d5af23aa42a5f437abe64f37ff5be Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Tue, 28 Apr 2026 10:59:04 +0530 Subject: [PATCH] Fix OPD appointment datetime display and date filtering --- app/Controllers/Opd.php | 8 ++++---- app/Views/billing/opd_invoice_V.php | 22 +++++++++++++++++----- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/app/Controllers/Opd.php b/app/Controllers/Opd.php index 0d94725..642c735 100644 --- a/app/Controllers/Opd.php +++ b/app/Controllers/Opd.php @@ -833,7 +833,7 @@ class Opd extends BaseController sum(case when o.opd_status = 3 then 1 else 0 end) as count_cancel from opd_master o left join opd_prescription pr on pr.opd_id = o.opd_id - where o.apointment_date = " . $opdDateSql . " + where date(o.apointment_date) = " . $opdDateSql . " group by o.doc_id ) oa join doctor_master d on d.id = oa.doc_id and d.active = 1 @@ -925,7 +925,7 @@ class Opd extends BaseController from opd_master o join patient_master p on o.p_id=p.id left join opd_prescription pr on o.opd_id=pr.opd_id - where o.apointment_date=" . $opdDateSql . " and o.doc_id=" . $docId; + where date(o.apointment_date)=" . $opdDateSql . " and o.doc_id=" . $docId; $query = $this->db->query($sql); $allRows = $query->getResult(); @@ -1107,7 +1107,7 @@ class Opd extends BaseController ) as digest_crc from opd_master o left join opd_prescription pr on o.opd_id = pr.opd_id - where o.apointment_date = " . $opdDateSql . " and o.doc_id = " . $docId; + where date(o.apointment_date) = " . $opdDateSql . " and o.doc_id = " . $docId; $row = $this->db->query($sql)->getRow(); @@ -1176,7 +1176,7 @@ class Opd extends BaseController coalesce(pr.queue_no,0) as queue_no from opd_master o left join opd_prescription pr on o.opd_id = pr.opd_id - where o.apointment_date = " . $opdDateSql . " and o.doc_id = " . $docId; + where date(o.apointment_date) = " . $opdDateSql . " and o.doc_id = " . $docId; $rows = $this->db->query($sql)->getResult(); diff --git a/app/Views/billing/opd_invoice_V.php b/app/Views/billing/opd_invoice_V.php index 4a825e8..83d0d20 100644 --- a/app/Views/billing/opd_invoice_V.php +++ b/app/Views/billing/opd_invoice_V.php @@ -11,6 +11,18 @@ if ($user) { } } $paymentHistoryRows = $payment_history_rows ?? []; +$appointmentDateRaw = trim((string) ($opd_master[0]->apointment_date ?? '')); +$appointmentDateDisplay = ''; +$appointmentDateTimeDisplay = ''; +$appointmentDatePickerValue = ''; +if ($appointmentDateRaw !== '') { + $appointmentTimestamp = strtotime($appointmentDateRaw); + if ($appointmentTimestamp !== false) { + $appointmentDateDisplay = date('d/m/y', $appointmentTimestamp); + $appointmentDateTimeDisplay = date('d/m/y H:i:s', $appointmentTimestamp); + $appointmentDatePickerValue = date('d/m/Y', $appointmentTimestamp); + } +} ?>
@@ -32,7 +44,7 @@ $paymentHistoryRows = $payment_history_rows ?? [];
P_name ?? '')) ?>
p_relative ?? '') ?> : p_rname ?? '') ?>
- OPD Book Date (y-m-d time) : opd_book_date ?? '') ?>
+ OPD Book Time :
Gender : xgender ?? '') ?>
Age : age ?? '') ?>
Phone No : mphone1 ?? '') ?> @@ -40,7 +52,7 @@ $paymentHistoryRows = $payment_history_rows ?? [];
OPD ID: opd_code ?? '') ?>
- Date of Appointment: str_apointment_date ?? '') ?>
+ Date of Appointment: str_apointment_date ?? ''))) ?>
Patient ID : p_code ?? '') ?>
insurance_id ?? 0) > 1 && !empty($insurance)) : ?> Ins. Comp. : ins_company_name ?? '') ?>
@@ -66,7 +78,7 @@ $paymentHistoryRows = $payment_history_rows ?? []; - apointment_date ?? '')) ?> + apointment_date ?? ''))) ?> Dr. doc_name ?? '') ?> doc_spec ?? '') ?> opd_fee_gross_amount ?? '') ?> @@ -341,8 +353,8 @@ $paymentHistoryRows = $payment_history_rows ?? [];
- - + +