ULLYZB - add payment status to patient list

This commit is contained in:
sas.fajri
2026-05-28 14:08:08 +07:00
parent 08d08e6bca
commit 512f649616

View File

@@ -212,6 +212,7 @@ class Patient extends MY_Controller
SELECT T_OrderHeaderID
FROM t_orderheader
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID
LEFT JOIN last_statuspayment ON Last_StatusPaymentT_OrderHeaderID = T_OrderHeaderID AND Last_StatusPaymentIsActive = 'Y'
WHERE
T_OrderHeaderIsActive = 'Y'
@@ -227,9 +228,9 @@ class Patient extends MY_Controller
Mgm_McuLabel AS M_MouName,
DATE(T_OrderHeaderDate) as order_date,
T_OrderHeaderTotal as totalbill,
0 as paid,
'' as unpaid,
'' as flaglunas,
IFNULL(Last_StatusPaymentPaid,0) as paid,
IFNULL(Last_StatusPaymentUnpaid,T_OrderHeaderTotal) as unpaid,
IFNULL(Last_StatusPaymentIsLunas,'N') as flaglunas,
'' as last_status,
'' as notes,
'' as T_OrderHeaderIsCito,
@@ -237,7 +238,10 @@ class Patient extends MY_Controller
'' as test ,
'' as janji,
'' as mindp_amount,
'' as status,
CASE
WHEN IFNULL(Last_StatusPaymentIsLunas,'N') = 'Y' THEN 'LUNAS'
ELSE 'BELUM LUNAS'
END as status,
'' as delivery,
'' as bahan_belum,
'' as external_numbering,
@@ -251,6 +255,7 @@ class Patient extends MY_Controller
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID
JOIN corporate ON T_OrderHeaderCorporateID = CorporateID
LEFT JOIN last_statuspayment ON Last_StatusPaymentT_OrderHeaderID = T_OrderHeaderID AND Last_StatusPaymentIsActive = 'Y'
left JOIN m_title ON M_PatientM_TitleID = M_TitleID
LEFT JOIN mgm_mcu ON T_OrderHeaderMgm_McuID = Mgm_McuID AND Mgm_McuIsActive = 'Y'
@@ -278,6 +283,7 @@ class Patient extends MY_Controller
SELECT T_OrderHeaderID
FROM t_orderheader
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID
LEFT JOIN last_statuspayment ON Last_StatusPaymentT_OrderHeaderID = T_OrderHeaderID AND Last_StatusPaymentIsActive = 'Y'
LEFT JOIN m_branch ON M_BranchID = T_OrderHeaderM_BranchID
$filter_test
WHERE
@@ -312,9 +318,9 @@ class Patient extends MY_Controller
Mgm_McuLabel AS M_MouName,
DATE_FORMAT(T_OrderHeaderDate, '%d-%m-%Y %H:%i') as order_date,
T_OrderHeaderTotal as totalbill,
0 as paid,
'' as unpaid,
'' as flaglunas,
IFNULL(Last_StatusPaymentPaid,0) as paid,
IFNULL(Last_StatusPaymentUnpaid,T_OrderHeaderTotal) as unpaid,
IFNULL(Last_StatusPaymentIsLunas,'N') as flaglunas,
'' as last_status,
'' as notes,
'' as T_OrderHeaderIsCito,
@@ -322,7 +328,10 @@ class Patient extends MY_Controller
'' as test ,
GROUP_CONCAT(distinct CONCAT(DATE_FORMAT(T_OrderPromisesDateTime, '%d-%m-%Y %H:%i'), ' - ', T_OrderPromisesID) SEPARATOR ', ') as promises,
'' as mindp_amount,
'' as status,
CASE
WHEN IFNULL(Last_StatusPaymentIsLunas,'N') = 'Y' THEN 'LUNAS'
ELSE 'BELUM LUNAS'
END as status,
'' as delivery,
'' as bahan_belum,
'' as external_numbering,
@@ -347,6 +356,7 @@ class Patient extends MY_Controller
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID
JOIN corporate ON T_OrderHeaderCorporateID = CorporateID
LEFT JOIN corporate_type ON CorporateCorporateTypeID = CorporateTypeID AND CorporateTypeIsActive = 'Y'
LEFT JOIN last_statuspayment ON Last_StatusPaymentT_OrderHeaderID = T_OrderHeaderID AND Last_StatusPaymentIsActive = 'Y'
LEFT JOIN t_orderheaderaddon ON T_OrderHeaderAddOnT_OrderHeaderID = T_OrderHeaderID AND T_OrderHeaderAddOnIsActive = 'Y'
LEFT JOIN m_title ON M_PatientM_TitleID = M_TitleID
LEFT JOIN mgm_mcu ON T_OrderHeaderMgm_McuID = Mgm_McuID AND Mgm_McuIsActive = 'Y'