From daff52ca4e8f8cc424aedbb078d6fba984f51ac4 Mon Sep 17 00:00:00 2001 From: "sas.fajri" Date: Thu, 16 Apr 2026 09:50:00 +0700 Subject: [PATCH] Add sample_coming endpoint to Patient controller - New endpoint to mark patient sample as coming - Updates T_OrderHeaderAddonIsComing to 'Y' - Sets T_OrderHeaderAddonIsComingDate to NOW() - Includes login validation and error handling Co-Authored-By: Claude Haiku 4.5 --- .../patientlistbarcode-vv-6-cpone/Patient.php | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/application/controllers/mockup/patientlistbarcode-vv-6-cpone/Patient.php b/application/controllers/mockup/patientlistbarcode-vv-6-cpone/Patient.php index ab50433d..f387fde2 100644 --- a/application/controllers/mockup/patientlistbarcode-vv-6-cpone/Patient.php +++ b/application/controllers/mockup/patientlistbarcode-vv-6-cpone/Patient.php @@ -1176,4 +1176,33 @@ class Patient extends MY_Controller $this->sys_ok($result); exit; } + + public function sample_coming() + { + // Check if user is logged in + if (!$this->isLogin) { + $this->sys_error("Invalid Token"); + exit; + } + + $prm = $this->sys_input; + $order_id = $prm['order_id']; + + // Update T_OrderHeaderAddon status to coming + $sql = "UPDATE t_orderheaderaddon + SET T_OrderHeaderAddonIsComing = 'Y', + T_OrderHeaderAddonIsComingDate = NOW() + WHERE T_OrderHeaderAddOnT_OrderHeaderID = {$order_id}"; + + $query = $this->db_onedev->query($sql); + + if ($query) { + $result = array("status" => "OK"); + $this->sys_ok($result); + exit; + } else { + $this->sys_error_db("sample_coming update", $this->db_onedev); + exit; + } + } }