FHM09062601IBL - getdefaultmou: support ambil MOU dari order jika orderid dikirim
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -253,6 +253,40 @@ class Patient extends MY_Controller
|
||||
|
||||
$row_results = [];
|
||||
$rtn_mou = [];
|
||||
$orderid = intval($prm['orderid'] ?? 0);
|
||||
|
||||
if ($orderid) {
|
||||
$sql = "SELECT M_CompanyID, M_CompanyName, m.M_MouID as settingM_MouID
|
||||
FROM one_klinik.`order` o
|
||||
JOIN m_mou m ON o.orderM_MouID = m.M_MouID
|
||||
JOIN m_company ON m.M_MouM_CompanyID = M_CompanyID
|
||||
WHERE o.orderID = ?
|
||||
LIMIT 1";
|
||||
$qry_order = $this->db->query($sql, [$orderid]);
|
||||
if ($qry_order && $qry_order->num_rows() > 0) {
|
||||
$order_row = $qry_order->row_array();
|
||||
$mous = $this->db->query(
|
||||
"SELECT M_MouID, M_MouName FROM m_mou
|
||||
WHERE M_MouIsActive = 'Y' AND M_MouIsApproved = 'Y' AND M_MouIsReleased = 'Y'
|
||||
AND M_MouStartDate <= date(now()) AND M_MouEndDate >= date(now())
|
||||
AND M_MouM_CompanyID = ?",
|
||||
[$order_row['M_CompanyID']]
|
||||
)->result_array();
|
||||
$row_results[] = [
|
||||
'M_CompanyID' => $order_row['M_CompanyID'],
|
||||
'M_CompanyName' => $order_row['M_CompanyName'],
|
||||
'mous' => $mous,
|
||||
];
|
||||
foreach ($mous as $v) {
|
||||
if ($v['M_MouID'] == $order_row['settingM_MouID']) {
|
||||
$rtn_mou = $v;
|
||||
}
|
||||
}
|
||||
$this->sys_ok(['total_display' => 1, 'records' => $row_results, 'mou' => $rtn_mou]);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT M_CompanyID,
|
||||
M_CompanyName, '' as mous, settingM_MouID
|
||||
FROM m_company
|
||||
|
||||
Reference in New Issue
Block a user