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 <noreply@anthropic.com>
This commit is contained in:
sas.fajri
2026-04-16 09:50:00 +07:00
parent e8878c89f5
commit daff52ca4e

View File

@@ -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;
}
}
}