FHM28052603SAS - commit remaining changes
This commit is contained in:
13
.claude/settings.local.json
Normal file
13
.claude/settings.local.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"permissions": {
|
||||||
|
"allow": [
|
||||||
|
"Bash(ssh devcpone *)",
|
||||||
|
"Bash(git -C /Users/fajrihardhitamurti/REPO_CPONE/BE_CPONE ls-tree -r origin/master --name-only)",
|
||||||
|
"Bash(git *)",
|
||||||
|
"Bash(ssh *)",
|
||||||
|
"Bash(curl -s https://devcpone.aplikasi.web.id/one-api/mockup/resultentrysoelectromedis-v9-cpone/resultentry/search -H 'Accept: application/json, text/plain, */*' -H 'Content-Type: application/json;charset=UTF-8' -b 'cpone_project_mcu_id=1583; token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJNX1VzZXJJRCI6IjIiLCJNX1VzZXJFbWFpbCI6Impva29AZ21haWwuY29tIiwiTV9Vc2VyVXNlcm5hbWUiOiJqb2tvQGdtYWlsLmNvbSIsIk1fVXNlckdyb3VwRGFzaGJvYXJkIjoib25lLXVpXC90ZXN0XC92dWV4XC9vbmUtbWN1LW9mZmxpbmUtcHJlcmVnaXN0ZXItYXBwLWNwb25ldjhcLyIsIk1fVXNlckRlZmF1bHRUX1NhbXBsZVN0YXRpb25JRCI6IjEiLCJNX1N0YWZmTmFtZSI6IkFkbWluIENQT05FIiwiaXNfY291cmllciI6Ik4iLCJNX0JyYW5jaElEIjoiMTAiLCJNX0JyYW5jaE5hbWUiOiJMYWJvcmF0b3JpdW0gTWFrYXNzYXIiLCJ0aW1lX2F1dG9sb2dvdXQiOiIxNSIsImlwIjoiMTI4LjE5OS44Ni43IiwiYWdlbnQiOiJHby1odHRwLWNsaWVudFwvMS4xIiwidmVyc2lvbiI6InYyIiwibGFzdC1sb2dpbiI6IjIwMjYtMDUtMTEgMTM6NTg6MjIifQ.HL_TvRA5GaaL2X5NnJHDMQkRqWlbHE-fssgarBYWZSY' --data-raw '{\"startdate\":\"2026-05-11\",\"companyid\":0,\"switch_exclude\":false,\"search\":\"\",\"stationid\":\"1675\",\"groupid\":2,\"subgroupid\":0,\"current_page\":1,\"lastid\":-1,\"token\":\"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJNX1VzZXJJRCI6IjIiLCJNX1VzZXJFbWFpbCI6Impva29AZ21haWwuY29tIiwiTV9Vc2VyVXNlcm5hbWUiOiJqb2tvQGdtYWlsLmNvbSIsIk1fVXNlckdyb3VwRGFzaGJvYXJkIjoib25lLXVpXC90ZXN0XC92dWV4XC9vbmUtbWN1LW9mZmxpbmUtcHJlcmVnaXN0ZXItYXBwLWNwb25ldjhcLyIsIk1fVXNlckRlZmF1bHRUX1NhbXBsZVN0YXRpb25JRCI6IjEiLCJNX1N0YWZmTmFtZSI6IkFkbWluIENQT05FIiwiaXNfY291cmllciI6Ik4iLCJNX0JyYW5jaElEIjoiMTAiLCJNX0JyYW5jaE5hbWUiOiJMYWJvcmF0b3JpdW0gTWFrYXNzYXIiLCJ0aW1lX2F1dG9sb2dvdXQiOiIxNSIsImlwIjoiMTI4LjE5OS44Ni43IiwiYWdlbnQiOiJHby1odHRwLWNsaWVudFwvMS4xIiwidmVyc2lvbiI6InYyIiwibGFzdC1sb2dpbiI6IjIwMjYtMDUtMTEgMTM6NTg6MjIifQ.HL_TvRA5GaaL2X5NnJHDMQkRqWlbHE-fssgarBYWZSY\"}')",
|
||||||
|
"Bash(python3 -m json.tool)",
|
||||||
|
"Bash(scp *)"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,6 +30,7 @@ while read -r local_ref local_sha remote_ref remote_sha; do
|
|||||||
|
|
||||||
repo_root=$(git rev-parse --show-toplevel)
|
repo_root=$(git rev-parse --show-toplevel)
|
||||||
if ! "$repo_root/scripts/devcpone_sync.sh" "$branch"; then
|
if ! "$repo_root/scripts/devcpone_sync.sh" "$branch"; then
|
||||||
printf '%s\n' "devcpone sync skipped/failed; push kept intact" >&2
|
printf '%s\n' "devcpone sync failed; blocking push" >&2
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
done < "$tmpdir/pushes"
|
done < "$tmpdir/pushes"
|
||||||
|
|||||||
@@ -578,6 +578,7 @@ class Transactionv2 extends MY_Controller
|
|||||||
when Nat_GroupID = 4 then '1303'
|
when Nat_GroupID = 4 then '1303'
|
||||||
when Nat_GroupID = 5 then '1321'
|
when Nat_GroupID = 5 then '1321'
|
||||||
when Nat_GroupID = 6 then '1600'
|
when Nat_GroupID = 6 then '1600'
|
||||||
|
when Nat_GroupID = 7 then '1500'
|
||||||
end as ProfitCostCenterCode,
|
end as ProfitCostCenterCode,
|
||||||
'' as TrxDepartemenID,
|
'' as TrxDepartemenID,
|
||||||
T_OrderDetailCreated as TanggalBuat,
|
T_OrderDetailCreated as TanggalBuat,
|
||||||
@@ -1117,6 +1118,7 @@ class Transactionv2 extends MY_Controller
|
|||||||
when Nat_GroupID = 4 then '1303'
|
when Nat_GroupID = 4 then '1303'
|
||||||
when Nat_GroupID = 5 then '1321'
|
when Nat_GroupID = 5 then '1321'
|
||||||
when Nat_GroupID = 6 then '1600'
|
when Nat_GroupID = 6 then '1600'
|
||||||
|
when Nat_GroupID = 7 then '1500'
|
||||||
end as ProfitCostCenterCode,
|
end as ProfitCostCenterCode,
|
||||||
'' as TrxDepartemenID,
|
'' as TrxDepartemenID,
|
||||||
T_OrderDetailCreated as TanggalBuat,
|
T_OrderDetailCreated as TanggalBuat,
|
||||||
@@ -1913,6 +1915,7 @@ class Transactionv2 extends MY_Controller
|
|||||||
when Nat_GroupID = 4 then '1303'
|
when Nat_GroupID = 4 then '1303'
|
||||||
when Nat_GroupID = 5 then '1321'
|
when Nat_GroupID = 5 then '1321'
|
||||||
when Nat_GroupID = 6 then '1600'
|
when Nat_GroupID = 6 then '1600'
|
||||||
|
when Nat_GroupID = 7 then '1500'
|
||||||
end as ProfitCostCenterCode,
|
end as ProfitCostCenterCode,
|
||||||
'' as TrxDepartemenID,
|
'' as TrxDepartemenID,
|
||||||
T_OrderDetailCreated as TanggalBuat,
|
T_OrderDetailCreated as TanggalBuat,
|
||||||
@@ -2412,6 +2415,7 @@ class Transactionv2 extends MY_Controller
|
|||||||
when Nat_GroupID = 4 then '1303'
|
when Nat_GroupID = 4 then '1303'
|
||||||
when Nat_GroupID = 5 then '1321'
|
when Nat_GroupID = 5 then '1321'
|
||||||
when Nat_GroupID = 6 then '1600'
|
when Nat_GroupID = 6 then '1600'
|
||||||
|
when Nat_GroupID = 7 then '1500'
|
||||||
end as ProfitCostCenterCode,
|
end as ProfitCostCenterCode,
|
||||||
'' as TrxDepartemenID,
|
'' as TrxDepartemenID,
|
||||||
T_OrderDetailCreated as TanggalBuat,
|
T_OrderDetailCreated as TanggalBuat,
|
||||||
@@ -2857,6 +2861,7 @@ class Transactionv2 extends MY_Controller
|
|||||||
when Nat_GroupID = 4 then '1303'
|
when Nat_GroupID = 4 then '1303'
|
||||||
when Nat_GroupID = 5 then '1321'
|
when Nat_GroupID = 5 then '1321'
|
||||||
when Nat_GroupID = 6 then '1600'
|
when Nat_GroupID = 6 then '1600'
|
||||||
|
when Nat_GroupID = 7 then '1500'
|
||||||
end as ProfitCostCenterCode,
|
end as ProfitCostCenterCode,
|
||||||
'' as TrxDepartemenID,
|
'' as TrxDepartemenID,
|
||||||
T_OrderDetailCreated as TanggalBuat,
|
T_OrderDetailCreated as TanggalBuat,
|
||||||
@@ -2904,7 +2909,15 @@ class Transactionv2 extends MY_Controller
|
|||||||
T_OrderDetailIsActive = 'Y'
|
T_OrderDetailIsActive = 'Y'
|
||||||
UNION
|
UNION
|
||||||
SELECT T_OrderDetailID as TrxLayananID,
|
SELECT T_OrderDetailID as TrxLayananID,
|
||||||
Nat_GroupID as ProfitCostCenterCode,
|
case
|
||||||
|
when Nat_GroupID = 1 then '1100'
|
||||||
|
when Nat_GroupID = 2 then '1200'
|
||||||
|
when Nat_GroupID = 3 then '1200'
|
||||||
|
when Nat_GroupID = 4 then '1303'
|
||||||
|
when Nat_GroupID = 5 then '1321'
|
||||||
|
when Nat_GroupID = 6 then '1600'
|
||||||
|
when Nat_GroupID = 7 then '1500'
|
||||||
|
end as ProfitCostCenterCode,
|
||||||
'' as TrxDepartemenID,
|
'' as TrxDepartemenID,
|
||||||
T_OrderDetailCreated as TanggalBuat,
|
T_OrderDetailCreated as TanggalBuat,
|
||||||
T_OrderDetailT_TestSasCode as LayananID,
|
T_OrderDetailT_TestSasCode as LayananID,
|
||||||
|
|||||||
3853
application/controllers/ais/Transactionv2.php--150526
Normal file
3853
application/controllers/ais/Transactionv2.php--150526
Normal file
File diff suppressed because it is too large
Load Diff
@@ -578,6 +578,7 @@ class Transactionv3 extends MY_Controller
|
|||||||
when Nat_GroupID = 4 then '1303'
|
when Nat_GroupID = 4 then '1303'
|
||||||
when Nat_GroupID = 5 then '1321'
|
when Nat_GroupID = 5 then '1321'
|
||||||
when Nat_GroupID = 6 then '1600'
|
when Nat_GroupID = 6 then '1600'
|
||||||
|
when Nat_GroupID = 7 then '1500'
|
||||||
end as ProfitCostCenterCode,
|
end as ProfitCostCenterCode,
|
||||||
'' as TrxDepartemenID,
|
'' as TrxDepartemenID,
|
||||||
T_OrderDetailCreated as TanggalBuat,
|
T_OrderDetailCreated as TanggalBuat,
|
||||||
@@ -1122,6 +1123,7 @@ class Transactionv3 extends MY_Controller
|
|||||||
when Nat_GroupID = 4 then '1303'
|
when Nat_GroupID = 4 then '1303'
|
||||||
when Nat_GroupID = 5 then '1321'
|
when Nat_GroupID = 5 then '1321'
|
||||||
when Nat_GroupID = 6 then '1600'
|
when Nat_GroupID = 6 then '1600'
|
||||||
|
when Nat_GroupID = 7 then '1500'
|
||||||
end as ProfitCostCenterCode,
|
end as ProfitCostCenterCode,
|
||||||
'' as TrxDepartemenID,
|
'' as TrxDepartemenID,
|
||||||
T_OrderDetailCreated as TanggalBuat,
|
T_OrderDetailCreated as TanggalBuat,
|
||||||
@@ -1918,6 +1920,7 @@ class Transactionv3 extends MY_Controller
|
|||||||
when Nat_GroupID = 4 then '1303'
|
when Nat_GroupID = 4 then '1303'
|
||||||
when Nat_GroupID = 5 then '1321'
|
when Nat_GroupID = 5 then '1321'
|
||||||
when Nat_GroupID = 6 then '1600'
|
when Nat_GroupID = 6 then '1600'
|
||||||
|
when Nat_GroupID = 7 then '1500'
|
||||||
end as ProfitCostCenterCode,
|
end as ProfitCostCenterCode,
|
||||||
'' as TrxDepartemenID,
|
'' as TrxDepartemenID,
|
||||||
T_OrderDetailCreated as TanggalBuat,
|
T_OrderDetailCreated as TanggalBuat,
|
||||||
@@ -2417,6 +2420,7 @@ class Transactionv3 extends MY_Controller
|
|||||||
when Nat_GroupID = 4 then '1303'
|
when Nat_GroupID = 4 then '1303'
|
||||||
when Nat_GroupID = 5 then '1321'
|
when Nat_GroupID = 5 then '1321'
|
||||||
when Nat_GroupID = 6 then '1600'
|
when Nat_GroupID = 6 then '1600'
|
||||||
|
when Nat_GroupID = 7 then '1500'
|
||||||
end as ProfitCostCenterCode,
|
end as ProfitCostCenterCode,
|
||||||
'' as TrxDepartemenID,
|
'' as TrxDepartemenID,
|
||||||
T_OrderDetailCreated as TanggalBuat,
|
T_OrderDetailCreated as TanggalBuat,
|
||||||
@@ -2862,6 +2866,7 @@ class Transactionv3 extends MY_Controller
|
|||||||
when Nat_GroupID = 4 then '1303'
|
when Nat_GroupID = 4 then '1303'
|
||||||
when Nat_GroupID = 5 then '1321'
|
when Nat_GroupID = 5 then '1321'
|
||||||
when Nat_GroupID = 6 then '1600'
|
when Nat_GroupID = 6 then '1600'
|
||||||
|
when Nat_GroupID = 7 then '1500'
|
||||||
end as ProfitCostCenterCode,
|
end as ProfitCostCenterCode,
|
||||||
'' as TrxDepartemenID,
|
'' as TrxDepartemenID,
|
||||||
T_OrderDetailCreated as TanggalBuat,
|
T_OrderDetailCreated as TanggalBuat,
|
||||||
@@ -2909,7 +2914,15 @@ class Transactionv3 extends MY_Controller
|
|||||||
T_OrderDetailIsActive = 'Y'
|
T_OrderDetailIsActive = 'Y'
|
||||||
UNION
|
UNION
|
||||||
SELECT T_OrderDetailID as TrxLayananID,
|
SELECT T_OrderDetailID as TrxLayananID,
|
||||||
Nat_GroupID as ProfitCostCenterCode,
|
case
|
||||||
|
when Nat_GroupID = 1 then '1100'
|
||||||
|
when Nat_GroupID = 2 then '1200'
|
||||||
|
when Nat_GroupID = 3 then '1200'
|
||||||
|
when Nat_GroupID = 4 then '1303'
|
||||||
|
when Nat_GroupID = 5 then '1321'
|
||||||
|
when Nat_GroupID = 6 then '1600'
|
||||||
|
when Nat_GroupID = 7 then '1500'
|
||||||
|
end as ProfitCostCenterCode,
|
||||||
'' as TrxDepartemenID,
|
'' as TrxDepartemenID,
|
||||||
T_OrderDetailCreated as TanggalBuat,
|
T_OrderDetailCreated as TanggalBuat,
|
||||||
T_OrderDetailT_TestSasCode as LayananID,
|
T_OrderDetailT_TestSasCode as LayananID,
|
||||||
|
|||||||
3858
application/controllers/ais/Transactionv3.php--150526
Normal file
3858
application/controllers/ais/Transactionv3.php--150526
Normal file
File diff suppressed because it is too large
Load Diff
@@ -12,10 +12,11 @@ class Patient extends MY_Controller
|
|||||||
$this->db_onedev = $this->load->database("onedev", true);
|
$this->db_onedev = $this->load->database("onedev", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function add_notes($orderid){
|
public function add_notes($orderid)
|
||||||
|
{
|
||||||
$sql = " SELECT F_PaymentT_OrderHeaderID as note_order_id,
|
$sql = " SELECT F_PaymentT_OrderHeaderID as note_order_id,
|
||||||
F_PaymentID as note_id,
|
F_PaymentID as note_id,
|
||||||
F_PaymentDate as note_date,
|
DATE_FORMAT(F_PaymentDate,'%d-%m-%Y') as note_date,
|
||||||
F_PaymentNumber as note_number,
|
F_PaymentNumber as note_number,
|
||||||
GROUP_CONCAT(M_PaymentTypeName separator ' , ') as paymenttypes_name,
|
GROUP_CONCAT(M_PaymentTypeName separator ' , ') as paymenttypes_name,
|
||||||
MAX(F_PaymentTotal) as note_amount,
|
MAX(F_PaymentTotal) as note_amount,
|
||||||
@@ -33,7 +34,6 @@ class Patient extends MY_Controller
|
|||||||
if ($query) {
|
if ($query) {
|
||||||
$rows = $query->result_array();
|
$rows = $query->result_array();
|
||||||
return $rows;
|
return $rows;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$this->sys_error_db("get notes", $this->db_onedev);
|
$this->sys_error_db("get notes", $this->db_onedev);
|
||||||
exit;
|
exit;
|
||||||
@@ -53,26 +53,28 @@ class Patient extends MY_Controller
|
|||||||
$search = $prm["search"];
|
$search = $prm["search"];
|
||||||
$status = $prm["status"];
|
$status = $prm["status"];
|
||||||
$company = $prm["company"];
|
$company = $prm["company"];
|
||||||
|
$userid = $this->sys_user["M_UserID"];
|
||||||
$filter_company = '';
|
$filter_company = '';
|
||||||
if($company != '0' || $company != 0)
|
if ($company != '0' || $company != 0)
|
||||||
$filter_company = " AND CorporateID = {$company}";
|
$filter_company = " AND CorporateID = {$company}";
|
||||||
|
|
||||||
$number_limit = 10;
|
$number_limit = 10;
|
||||||
$number_offset = ($prm['current_page'] - 1) * $number_limit ;
|
$number_offset = ($prm['current_page'] - 1) * $number_limit;
|
||||||
$where = " ( DATE(T_OrderHeaderDate) = '{$startdate}' ) AND ";
|
$where = " ( DATE(T_OrderHeaderDate) = '{$startdate}' ) AND ";
|
||||||
if($search != ''){
|
if ($search != '') {
|
||||||
$where = "( M_PatientName LIKE '%{$search}%' OR T_OrderHeaderLabNumber LIKE '%{$search}%' ) AND ";
|
$where = "( M_PatientName LIKE '%{$search}%' OR T_OrderHeaderLabNumber LIKE '%{$search}%' ) AND ";
|
||||||
if(strlen($search) == 10){
|
if (strlen($search) == 10) {
|
||||||
$where = "T_OrderHeaderLabNumber = '{$search}' AND ";
|
$where = "T_OrderHeaderLabNumber = '{$search}' AND ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT count(*) as total
|
$sql = "SELECT count(*) as total
|
||||||
FROM t_orderheader
|
FROM t_orderheader
|
||||||
left join f_bill_detail on F_BillDetailT_OrderHeaderID = T_OrderHeaderID and F_BillDetailIsActive = 'Y'
|
JOIN m_user ON M_UserID = {$userid} AND T_OrderHeaderM_BranchID = M_UserLoginM_BranchID AND M_UserIsActive = 'Y'
|
||||||
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID
|
||||||
JOIN m_title ON M_PatientM_TitleID = M_TitleID
|
JOIN m_title ON M_PatientM_TitleID = M_TitleID
|
||||||
JOIN corporate ON T_OrderHeaderCorporateID = CorporateID $filter_company
|
JOIN corporate ON T_OrderHeaderCorporateID = CorporateID $filter_company
|
||||||
|
left join f_bill_detail on F_BillDetailT_OrderHeaderID = T_OrderHeaderID and F_BillDetailIsActive = 'Y'
|
||||||
LEFT JOIN mgm_mcu ON T_OrderHeaderMgm_McuID = Mgm_McuID
|
LEFT JOIN mgm_mcu ON T_OrderHeaderMgm_McuID = Mgm_McuID
|
||||||
LEFT JOIN last_statuspayment ON Last_StatusPaymentT_OrderHeaderID = T_OrderHeaderID AND Last_StatusPaymentIsActive = 'Y'
|
LEFT JOIN last_statuspayment ON Last_StatusPaymentT_OrderHeaderID = T_OrderHeaderID AND Last_StatusPaymentIsActive = 'Y'
|
||||||
LEFT JOIN x_wa_outbox
|
LEFT JOIN x_wa_outbox
|
||||||
@@ -88,7 +90,7 @@ class Patient extends MY_Controller
|
|||||||
$tot_page = 0;
|
$tot_page = 0;
|
||||||
if ($query) {
|
if ($query) {
|
||||||
$tot_count = $query->result_array()[0]["total"];
|
$tot_count = $query->result_array()[0]["total"];
|
||||||
$tot_page = ceil($tot_count/$number_limit);
|
$tot_page = ceil($tot_count / $number_limit);
|
||||||
} else {
|
} else {
|
||||||
$this->sys_error_db("t_samplestorage count", $this->db_onedev);
|
$this->sys_error_db("t_samplestorage count", $this->db_onedev);
|
||||||
exit;
|
exit;
|
||||||
@@ -118,10 +120,11 @@ class Patient extends MY_Controller
|
|||||||
IFNULL(XWaOutboxIsSent,'') as XWaOutboxIsSent,
|
IFNULL(XWaOutboxIsSent,'') as XWaOutboxIsSent,
|
||||||
IFNULL(XWaOutboxRetry,0) as XWaOutboxRetry
|
IFNULL(XWaOutboxRetry,0) as XWaOutboxRetry
|
||||||
FROM t_orderheader
|
FROM t_orderheader
|
||||||
left join f_bill_detail on F_BillDetailT_OrderHeaderID = T_OrderHeaderID and F_BillDetailIsActive = 'Y'
|
JOIN m_user ON M_UserID = {$userid} AND T_OrderHeaderM_BranchID = M_UserLoginM_BranchID AND M_UserIsActive = 'Y'
|
||||||
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID
|
||||||
JOIN m_title ON M_PatientM_TitleID = M_TitleID
|
JOIN m_title ON M_PatientM_TitleID = M_TitleID
|
||||||
JOIN corporate ON T_OrderHeaderCorporateID = CorporateID $filter_company
|
JOIN corporate ON T_OrderHeaderCorporateID = CorporateID $filter_company
|
||||||
|
left join f_bill_detail on F_BillDetailT_OrderHeaderID = T_OrderHeaderID and F_BillDetailIsActive = 'Y'
|
||||||
LEFT JOIN mgm_mcu ON T_OrderHeaderMgm_McuID = Mgm_McuID
|
LEFT JOIN mgm_mcu ON T_OrderHeaderMgm_McuID = Mgm_McuID
|
||||||
LEFT JOIN last_statuspayment ON Last_StatusPaymentT_OrderHeaderID = T_OrderHeaderID AND Last_StatusPaymentIsActive = 'Y'
|
LEFT JOIN last_statuspayment ON Last_StatusPaymentT_OrderHeaderID = T_OrderHeaderID AND Last_StatusPaymentIsActive = 'Y'
|
||||||
LEFT JOIN x_wa_outbox
|
LEFT JOIN x_wa_outbox
|
||||||
@@ -135,9 +138,10 @@ class Patient extends MY_Controller
|
|||||||
limit $number_limit offset $number_offset";
|
limit $number_limit offset $number_offset";
|
||||||
//echo $sql;
|
//echo $sql;
|
||||||
$query = $this->db_onedev->query($sql, $sql_param);
|
$query = $this->db_onedev->query($sql, $sql_param);
|
||||||
|
//echo $this->db_onedev->last_query();
|
||||||
$rows = $query->result_array();
|
$rows = $query->result_array();
|
||||||
if($rows){
|
if ($rows) {
|
||||||
foreach($rows as $k => $v){
|
foreach ($rows as $k => $v) {
|
||||||
$rows[$k]['notes'] = $this->add_notes($v['T_OrderHeaderID']);
|
$rows[$k]['notes'] = $this->add_notes($v['T_OrderHeaderID']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,19 +149,20 @@ class Patient extends MY_Controller
|
|||||||
$sql = "SELECT * FROM `s_menu` WHERE `S_MenuName` = 'Registration (Walk In)' AND `S_MenuIsActive` = 'Y' ORDER BY `S_MenuID` DESC LIMIT 1";
|
$sql = "SELECT * FROM `s_menu` WHERE `S_MenuName` = 'Registration (Walk In)' AND `S_MenuIsActive` = 'Y' ORDER BY `S_MenuID` DESC LIMIT 1";
|
||||||
$query = $this->db_onedev->query($sql);
|
$query = $this->db_onedev->query($sql);
|
||||||
$menu = $query->row_array();
|
$menu = $query->row_array();
|
||||||
if($menu){
|
if ($menu) {
|
||||||
$menu_url = $menu['S_MenuUrl'];
|
$menu_url = $menu['S_MenuUrl'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$result = array("total" => $tot_page, "records" => $rows, "sql"=> $this->db_onedev->last_query(), "menu_url" => $menu_url);
|
$result = array("total" => $tot_page, "records" => $rows, "sql" => $this->db_onedev->last_query(), "menu_url" => $menu_url);
|
||||||
$this->sys_ok($result);
|
$this->sys_ok($result);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function searchcompany(){
|
function searchcompany()
|
||||||
|
{
|
||||||
if (! $this->isLogin) {
|
if (! $this->isLogin) {
|
||||||
$this->sys_error("Invalid Token");
|
$this->sys_error("Invalid Token");
|
||||||
exit;
|
exit;
|
||||||
@@ -165,18 +170,17 @@ class Patient extends MY_Controller
|
|||||||
$prm = $this->sys_input;
|
$prm = $this->sys_input;
|
||||||
|
|
||||||
$max_rst = 12;
|
$max_rst = 12;
|
||||||
$tot_count =0;
|
$tot_count = 0;
|
||||||
$filter_date = '';
|
$filter_date = '';
|
||||||
if(isset($prm['xdate']))
|
if (isset($prm['xdate']))
|
||||||
$filter_date = " JOIN t_orderheader ON T_OrderHeaderCorporateID = CorporateID AND DATE(T_OrderHeaderDate) = '{$prm['xdate']}' AND T_OrderHeaderIsActive = 'Y' ";
|
$filter_date = " JOIN t_orderheader ON T_OrderHeaderCorporateID = CorporateID AND DATE(T_OrderHeaderDate) = '{$prm['xdate']}' AND T_OrderHeaderIsActive = 'Y' ";
|
||||||
|
|
||||||
$q = [
|
$q = [
|
||||||
'search' => '%'
|
'search' => '%'
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($prm['search'] != '' )
|
if ($prm['search'] != '') {
|
||||||
{
|
if ($prm['search'] == 'Semua')
|
||||||
if($prm['search'] == 'Semua')
|
|
||||||
$prm['search'] = "";
|
$prm['search'] = "";
|
||||||
|
|
||||||
$q['search'] = "%{$prm['search']}%";
|
$q['search'] = "%{$prm['search']}%";
|
||||||
@@ -188,16 +192,15 @@ class Patient extends MY_Controller
|
|||||||
WHERE
|
WHERE
|
||||||
CorporateName like ?
|
CorporateName like ?
|
||||||
AND CorporateIsActive = 'Y'";
|
AND CorporateIsActive = 'Y'";
|
||||||
$query = $this->db_onedev->query($sql,$q['search']);
|
$query = $this->db_onedev->query($sql, $q['search']);
|
||||||
//echo $query;
|
//echo $query;
|
||||||
if ($query) {
|
if ($query) {
|
||||||
$tot_count = $query->result_array()[0]["total"];
|
$tot_count = $query->result_array()[0]["total"];
|
||||||
}
|
} else {
|
||||||
else {
|
$this->sys_error_db("m_city count", $this->db_onedev);
|
||||||
$this->sys_error_db("m_city count",$this->db_onedev);
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$rows = array('id'=>0,'name'=>'Semua');
|
$rows = array('id' => 0, 'name' => 'Semua');
|
||||||
$sql = "
|
$sql = "
|
||||||
SELECT CorporateID as id, CorporateName as name
|
SELECT CorporateID as id, CorporateName as name
|
||||||
FROM corporate
|
FROM corporate
|
||||||
@@ -211,15 +214,13 @@ class Patient extends MY_Controller
|
|||||||
// echo $this->db_onedev->last_query();
|
// echo $this->db_onedev->last_query();
|
||||||
if ($query) {
|
if ($query) {
|
||||||
$rows = $query->result_array();
|
$rows = $query->result_array();
|
||||||
array_push($rows,array('id'=>0,'name'=>'Semua'));
|
array_push($rows, array('id' => 0, 'name' => 'Semua'));
|
||||||
//echo $this->db_onedev->last_query();
|
//echo $this->db_onedev->last_query();
|
||||||
$result = array("total" => $tot_count, "records" => $rows, "total_display" => sizeof($rows));
|
$result = array("total" => $tot_count, "records" => $rows, "total_display" => sizeof($rows));
|
||||||
$this->sys_ok($result);
|
$this->sys_ok($result);
|
||||||
}
|
} else {
|
||||||
else {
|
$this->sys_error_db("corporate rows", $this->db_onedev);
|
||||||
$this->sys_error_db("corporate rows",$this->db_onedev);
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,225 @@
|
|||||||
|
<?php
|
||||||
|
class Patient extends MY_Controller
|
||||||
|
{
|
||||||
|
var $db_onedev;
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
echo "Patient API";
|
||||||
|
}
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->db_onedev = $this->load->database("onedev", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add_notes($orderid){
|
||||||
|
$sql = " SELECT F_PaymentT_OrderHeaderID as note_order_id,
|
||||||
|
F_PaymentID as note_id,
|
||||||
|
F_PaymentDate as note_date,
|
||||||
|
F_PaymentNumber as note_number,
|
||||||
|
GROUP_CONCAT(M_PaymentTypeName separator ' , ') as paymenttypes_name,
|
||||||
|
MAX(F_PaymentTotal) as note_amount,
|
||||||
|
M_StaffName as note_user,
|
||||||
|
F_PaymentDetailIsActive as note_active
|
||||||
|
FROM f_payment
|
||||||
|
JOIN f_paymentdetail ON F_PaymentDetailF_PaymentID = F_PaymentID
|
||||||
|
JOIN m_paymenttype ON F_PaymentDetailM_PaymentTypeID = M_PaymentTypeID
|
||||||
|
LEFT JOIN m_user ON F_PaymentDetailUserID = M_UserID
|
||||||
|
LEFT JOIN m_staff ON M_UserM_StaffID = M_StaffID
|
||||||
|
WHERE
|
||||||
|
F_PaymentT_OrderHeaderID = {$orderid}
|
||||||
|
GROUP BY F_PaymentID";
|
||||||
|
$query = $this->db_onedev->query($sql);
|
||||||
|
if ($query) {
|
||||||
|
$rows = $query->result_array();
|
||||||
|
return $rows;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$this->sys_error_db("get notes", $this->db_onedev);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function search()
|
||||||
|
{
|
||||||
|
if (! $this->isLogin) {
|
||||||
|
$this->sys_error("Invalid Token");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$prm = $this->sys_input;
|
||||||
|
$startdate = $prm['startdate'];
|
||||||
|
$enddate = $prm['enddate'] . " 23:59:59";
|
||||||
|
$search = $prm["search"];
|
||||||
|
$status = $prm["status"];
|
||||||
|
$company = $prm["company"];
|
||||||
|
$filter_company = '';
|
||||||
|
if($company != '0' || $company != 0)
|
||||||
|
$filter_company = " AND CorporateID = {$company}";
|
||||||
|
|
||||||
|
$number_limit = 10;
|
||||||
|
$number_offset = ($prm['current_page'] - 1) * $number_limit ;
|
||||||
|
$where = " ( DATE(T_OrderHeaderDate) = '{$startdate}' ) AND ";
|
||||||
|
if($search != ''){
|
||||||
|
$where = "( M_PatientName LIKE '%{$search}%' OR T_OrderHeaderLabNumber LIKE '%{$search}%' ) AND ";
|
||||||
|
if(strlen($search) == 10){
|
||||||
|
$where = "T_OrderHeaderLabNumber = '{$search}' AND ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT count(*) as total
|
||||||
|
FROM t_orderheader
|
||||||
|
left join f_bill_detail on F_BillDetailT_OrderHeaderID = T_OrderHeaderID and F_BillDetailIsActive = 'Y'
|
||||||
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID
|
||||||
|
JOIN m_title ON M_PatientM_TitleID = M_TitleID
|
||||||
|
JOIN corporate ON T_OrderHeaderCorporateID = CorporateID $filter_company
|
||||||
|
LEFT JOIN mgm_mcu ON T_OrderHeaderMgm_McuID = Mgm_McuID
|
||||||
|
LEFT JOIN last_statuspayment ON Last_StatusPaymentT_OrderHeaderID = T_OrderHeaderID AND Last_StatusPaymentIsActive = 'Y'
|
||||||
|
LEFT JOIN x_wa_outbox
|
||||||
|
ON T_OrderHeaderID = XWaOutboxRefID
|
||||||
|
AND XWaOutboxIsActive = 'Y'
|
||||||
|
WHERE T_OrderHeaderIsActive = 'Y' AND
|
||||||
|
$where
|
||||||
|
( ('{$status}' = 'N' AND (Last_StatusPaymentIsLunas = 'N' OR Last_StatusPaymentID IS NULL)) OR ('{$status}' = 'Y' AND Last_StatusPaymentIsLunas = 'Y') ) and F_BillDetailID is null";
|
||||||
|
|
||||||
|
$query = $this->db_onedev->query($sql);
|
||||||
|
|
||||||
|
$tot_count = 0;
|
||||||
|
$tot_page = 0;
|
||||||
|
if ($query) {
|
||||||
|
$tot_count = $query->result_array()[0]["total"];
|
||||||
|
$tot_page = ceil($tot_count/$number_limit);
|
||||||
|
} else {
|
||||||
|
$this->sys_error_db("t_samplestorage count", $this->db_onedev);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$sql = "SELECT t_orderheader.*,
|
||||||
|
M_PatientNoReg,
|
||||||
|
DATE_FORMAT(T_OrderHeaderDate,'%d-%m-%Y %H:%i') as order_date,
|
||||||
|
CONCAT(M_TitleName,'. ',M_PatientName) as M_PatientName,
|
||||||
|
M_PatientName as M_PatientName_eng,
|
||||||
|
M_TitleName,
|
||||||
|
CorporateName as M_CompanyName,
|
||||||
|
CorporateName as CorporateName,
|
||||||
|
Mgm_McuLabel as M_MouName,
|
||||||
|
Mgm_McuLabel,
|
||||||
|
IFNULL(Last_StatusPaymentBillTotal, T_OrderHeaderTotal) as totalbill,
|
||||||
|
IFNULL(Last_StatusPaymentPaid,0) as paid,
|
||||||
|
(IFNULL(Last_StatusPaymentBillTotal, T_OrderHeaderTotal) - IFNULL(Last_StatusPaymentPaid,0)) as unpaid,
|
||||||
|
Last_StatusPaymentIsLunas as flaglunas,
|
||||||
|
'' as notes,
|
||||||
|
0 as mindp_percent,
|
||||||
|
0 as mindp_amount,
|
||||||
|
F_BillDetailID,
|
||||||
|
IFNULL(M_PatientHp,'') as M_PatientHp,
|
||||||
|
IFNULL(M_PatientID,0) as M_PatientID,
|
||||||
|
IFNULL(XWaOutboxIsSent,'') as XWaOutboxIsSent,
|
||||||
|
IFNULL(XWaOutboxRetry,0) as XWaOutboxRetry
|
||||||
|
FROM t_orderheader
|
||||||
|
left join f_bill_detail on F_BillDetailT_OrderHeaderID = T_OrderHeaderID and F_BillDetailIsActive = 'Y'
|
||||||
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID
|
||||||
|
JOIN m_title ON M_PatientM_TitleID = M_TitleID
|
||||||
|
JOIN corporate ON T_OrderHeaderCorporateID = CorporateID $filter_company
|
||||||
|
LEFT JOIN mgm_mcu ON T_OrderHeaderMgm_McuID = Mgm_McuID
|
||||||
|
LEFT JOIN last_statuspayment ON Last_StatusPaymentT_OrderHeaderID = T_OrderHeaderID AND Last_StatusPaymentIsActive = 'Y'
|
||||||
|
LEFT JOIN x_wa_outbox
|
||||||
|
ON T_OrderHeaderID = XWaOutboxRefID
|
||||||
|
AND XWaOutboxIsActive = 'Y'
|
||||||
|
AND XWaOutboxType = 'KWITANSI'
|
||||||
|
WHERE T_OrderHeaderIsActive = 'Y' AND
|
||||||
|
$where
|
||||||
|
( ('{$status}' = 'N' AND (Last_StatusPaymentIsLunas = 'N' OR Last_StatusPaymentID IS NULL)) OR ('{$status}' = 'Y' AND Last_StatusPaymentIsLunas = 'Y') ) and F_BillDetailID is null
|
||||||
|
ORDER BY T_OrderHeaderID ASC
|
||||||
|
limit $number_limit offset $number_offset";
|
||||||
|
//echo $sql;
|
||||||
|
$query = $this->db_onedev->query($sql, $sql_param);
|
||||||
|
$rows = $query->result_array();
|
||||||
|
if($rows){
|
||||||
|
foreach($rows as $k => $v){
|
||||||
|
$rows[$k]['notes'] = $this->add_notes($v['T_OrderHeaderID']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT * FROM `s_menu` WHERE `S_MenuName` = 'Registration (Walk In)' AND `S_MenuIsActive` = 'Y' ORDER BY `S_MenuID` DESC LIMIT 1";
|
||||||
|
$query = $this->db_onedev->query($sql);
|
||||||
|
$menu = $query->row_array();
|
||||||
|
if($menu){
|
||||||
|
$menu_url = $menu['S_MenuUrl'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$result = array("total" => $tot_page, "records" => $rows, "sql"=> $this->db_onedev->last_query(), "menu_url" => $menu_url);
|
||||||
|
$this->sys_ok($result);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function searchcompany(){
|
||||||
|
if (! $this->isLogin) {
|
||||||
|
$this->sys_error("Invalid Token");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$prm = $this->sys_input;
|
||||||
|
|
||||||
|
$max_rst = 12;
|
||||||
|
$tot_count =0;
|
||||||
|
$filter_date = '';
|
||||||
|
if(isset($prm['xdate']))
|
||||||
|
$filter_date = " JOIN t_orderheader ON T_OrderHeaderCorporateID = CorporateID AND DATE(T_OrderHeaderDate) = '{$prm['xdate']}' AND T_OrderHeaderIsActive = 'Y' ";
|
||||||
|
|
||||||
|
$q = [
|
||||||
|
'search' => '%'
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($prm['search'] != '' )
|
||||||
|
{
|
||||||
|
if($prm['search'] == 'Semua')
|
||||||
|
$prm['search'] = "";
|
||||||
|
|
||||||
|
$q['search'] = "%{$prm['search']}%";
|
||||||
|
}
|
||||||
|
|
||||||
|
// QUERY TOTAL
|
||||||
|
$sql = "SELECT count(*) as total
|
||||||
|
FROM corporate
|
||||||
|
WHERE
|
||||||
|
CorporateName like ?
|
||||||
|
AND CorporateIsActive = 'Y'";
|
||||||
|
$query = $this->db_onedev->query($sql,$q['search']);
|
||||||
|
//echo $query;
|
||||||
|
if ($query) {
|
||||||
|
$tot_count = $query->result_array()[0]["total"];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->sys_error_db("m_city count",$this->db_onedev);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$rows = array('id'=>0,'name'=>'Semua');
|
||||||
|
$sql = "
|
||||||
|
SELECT CorporateID as id, CorporateName as name
|
||||||
|
FROM corporate
|
||||||
|
$filter_date
|
||||||
|
WHERE
|
||||||
|
CorporateName like ?
|
||||||
|
AND CorporateIsActive = 'Y'
|
||||||
|
ORDER BY CorporateName DESC
|
||||||
|
";
|
||||||
|
$query = $this->db_onedev->query($sql, array($q['search']));
|
||||||
|
// echo $this->db_onedev->last_query();
|
||||||
|
if ($query) {
|
||||||
|
$rows = $query->result_array();
|
||||||
|
array_push($rows,array('id'=>0,'name'=>'Semua'));
|
||||||
|
//echo $this->db_onedev->last_query();
|
||||||
|
$result = array("total" => $tot_count, "records" => $rows, "total_display" => sizeof($rows));
|
||||||
|
$this->sys_ok($result);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->sys_error_db("corporate rows",$this->db_onedev);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -47,7 +47,7 @@ class Payment extends MY_Controller
|
|||||||
LIMIT 1";
|
LIMIT 1";
|
||||||
|
|
||||||
$qpid = $this->db_onedev->query($sql_pid, [$T_OrderHeaderID]);
|
$qpid = $this->db_onedev->query($sql_pid, [$T_OrderHeaderID]);
|
||||||
if(!$qpid || !$qpid->row_array()){
|
if (!$qpid || !$qpid->row_array()) {
|
||||||
$this->db_onedev->trans_rollback();
|
$this->db_onedev->trans_rollback();
|
||||||
$this->sys_error_db("error select f_payment", $this->db_onedev);
|
$this->sys_error_db("error select f_payment", $this->db_onedev);
|
||||||
exit;
|
exit;
|
||||||
@@ -63,12 +63,12 @@ class Payment extends MY_Controller
|
|||||||
$XWaOutboxSubject = "Kwitansi WA";
|
$XWaOutboxSubject = "Kwitansi WA";
|
||||||
$XWaOutboxRecipientsNumber = $M_PatientHp;
|
$XWaOutboxRecipientsNumber = $M_PatientHp;
|
||||||
$XWaOutboxRecipientsM_PatientID = $M_PatientID;
|
$XWaOutboxRecipientsM_PatientID = $M_PatientID;
|
||||||
$XWaOutboxResultFileName = "kwitansi_".$T_OrderHeaderLabNumber.".pdf";
|
$XWaOutboxResultFileName = "kwitansi_" . $T_OrderHeaderLabNumber . ".pdf";
|
||||||
$XWaOutboxRefID = $T_OrderHeaderID;
|
$XWaOutboxRefID = $T_OrderHeaderID;
|
||||||
|
|
||||||
$XWaOutboxBody = "";
|
$XWaOutboxBody = "";
|
||||||
|
|
||||||
$XWaOutboxLocalUrl= $urlPrint;
|
$XWaOutboxLocalUrl = $urlPrint;
|
||||||
$XWaOutboxType = "KWITANSI";
|
$XWaOutboxType = "KWITANSI";
|
||||||
|
|
||||||
// Kalau sudah pernah di kirim jangan di INSERT lagi
|
// Kalau sudah pernah di kirim jangan di INSERT lagi
|
||||||
@@ -114,7 +114,7 @@ class Payment extends MY_Controller
|
|||||||
'N', // XWaOutboxIsSent
|
'N', // XWaOutboxIsSent
|
||||||
$existing_record->XWaOutboxID
|
$existing_record->XWaOutboxID
|
||||||
));
|
));
|
||||||
if(!$qinsert){
|
if (!$qinsert) {
|
||||||
$this->db_onedev->trans_rollback();
|
$this->db_onedev->trans_rollback();
|
||||||
$this->sys_error_db("error update wa outbox", $this->db_onedev);
|
$this->sys_error_db("error update wa outbox", $this->db_onedev);
|
||||||
exit;
|
exit;
|
||||||
@@ -144,7 +144,7 @@ class Payment extends MY_Controller
|
|||||||
$XWaOutboxType,
|
$XWaOutboxType,
|
||||||
$XWaOutboxRefID
|
$XWaOutboxRefID
|
||||||
]);
|
]);
|
||||||
if(!$qinsert){
|
if (!$qinsert) {
|
||||||
$this->db_onedev->trans_rollback();
|
$this->db_onedev->trans_rollback();
|
||||||
$this->sys_error_db("error insert wa outbox", $this->db_onedev);
|
$this->sys_error_db("error insert wa outbox", $this->db_onedev);
|
||||||
exit;
|
exit;
|
||||||
@@ -159,14 +159,14 @@ class Payment extends MY_Controller
|
|||||||
);
|
);
|
||||||
|
|
||||||
$this->sys_ok($result);
|
$this->sys_ok($result);
|
||||||
|
|
||||||
} catch (Exception $exc) {
|
} catch (Exception $exc) {
|
||||||
$this->sys_error($exc->getMessage());
|
$this->sys_error($exc->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// * List Outbox yang mau dikirim
|
// * List Outbox yang mau dikirim
|
||||||
public function listOutbox(){
|
public function listOutbox()
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$prm = $this->sys_input;
|
$prm = $this->sys_input;
|
||||||
$status = $prm["statusOutbox"];
|
$status = $prm["statusOutbox"];
|
||||||
@@ -221,7 +221,6 @@ class Payment extends MY_Controller
|
|||||||
|
|
||||||
$result = $query->result_array();
|
$result = $query->result_array();
|
||||||
$this->sys_ok($result);
|
$this->sys_ok($result);
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$msg = $e->getMessage();
|
$msg = $e->getMessage();
|
||||||
$this->sys_error($msg);
|
$this->sys_error($msg);
|
||||||
@@ -230,7 +229,8 @@ class Payment extends MY_Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ** Upload File Kwitansi dari Birt ke CDN Qontak
|
// ** Upload File Kwitansi dari Birt ke CDN Qontak
|
||||||
public function uploadFile(){
|
public function uploadFile()
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$url = "https://service-chat.qontak.com/api/open/v1/file_uploader";
|
$url = "https://service-chat.qontak.com/api/open/v1/file_uploader";
|
||||||
$fileName = $this->sys_input["fileName"];
|
$fileName = $this->sys_input["fileName"];
|
||||||
@@ -347,7 +347,6 @@ class Payment extends MY_Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->db_onedev->trans_complete();
|
$this->db_onedev->trans_complete();
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$msg = $e->getMessage();
|
$msg = $e->getMessage();
|
||||||
$this->db_onedev->trans_rollback();
|
$this->db_onedev->trans_rollback();
|
||||||
@@ -357,7 +356,8 @@ class Payment extends MY_Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// * Send WA Msg Using Qontak
|
// * Send WA Msg Using Qontak
|
||||||
public function qontakSendMsg(){
|
public function qontakSendMsg()
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$url = "https://service-chat.qontak.com/api/open/v1/broadcasts/whatsapp/direct";
|
$url = "https://service-chat.qontak.com/api/open/v1/broadcasts/whatsapp/direct";
|
||||||
|
|
||||||
@@ -521,7 +521,7 @@ class Payment extends MY_Controller
|
|||||||
}
|
}
|
||||||
$this->sys_error($respArray);
|
$this->sys_error($respArray);
|
||||||
}
|
}
|
||||||
}catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$msg = $e->getMessage();
|
$msg = $e->getMessage();
|
||||||
// $this->db_onedev->trans_rollback(); // tidak perlu transaction karena hanya 1 update
|
// $this->db_onedev->trans_rollback(); // tidak perlu transaction karena hanya 1 update
|
||||||
$this->sys_error($msg);
|
$this->sys_error($msg);
|
||||||
@@ -529,7 +529,8 @@ class Payment extends MY_Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function changeStatusOutbox(){
|
public function changeStatusOutbox()
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$this->db_onedev->trans_start();
|
$this->db_onedev->trans_start();
|
||||||
|
|
||||||
@@ -592,6 +593,7 @@ class Payment extends MY_Controller
|
|||||||
'' as selected_card,
|
'' as selected_card,
|
||||||
'' as selected_edc,
|
'' as selected_edc,
|
||||||
'' as selected_account,
|
'' as selected_account,
|
||||||
|
'' as selected_promo,
|
||||||
CASE
|
CASE
|
||||||
WHEN M_PaymentTypeCode = 'CASH' THEN 'Kembali'
|
WHEN M_PaymentTypeCode = 'CASH' THEN 'Kembali'
|
||||||
WHEN M_PaymentTypeCode = 'DEBIT' THEN 'Nomor Kartu'
|
WHEN M_PaymentTypeCode = 'DEBIT' THEN 'Nomor Kartu'
|
||||||
@@ -607,16 +609,17 @@ class Payment extends MY_Controller
|
|||||||
FROM m_paymenttype
|
FROM m_paymenttype
|
||||||
WHERE M_PaymentTypeIsActive = 'Y'";
|
WHERE M_PaymentTypeIsActive = 'Y'";
|
||||||
$rows = $this->db_onedev->query($query)->result_array();
|
$rows = $this->db_onedev->query($query)->result_array();
|
||||||
foreach($rows as $k => $v){
|
foreach ($rows as $k => $v) {
|
||||||
$rows[$k]['selected_card'] = array('id'=>0,'name'=>'');
|
$rows[$k]['selected_card'] = array('id' => 0, 'name' => '');
|
||||||
$rows[$k]['selected_edc'] = array('id'=>0,'name'=>'');
|
$rows[$k]['selected_edc'] = array('id' => 0, 'name' => '');
|
||||||
if($v['chex'] == 'N')
|
$rows[$k]['selected_promo'] = array('id' => 0, 'name' => '', 'type' => '', 'value' => 0);
|
||||||
|
if ($v['chex'] == 'N')
|
||||||
$rows[$k]['chex'] = false;
|
$rows[$k]['chex'] = false;
|
||||||
else
|
else
|
||||||
$rows[$k]['chex'] = true;
|
$rows[$k]['chex'] = true;
|
||||||
}
|
}
|
||||||
$result = array(
|
$result = array(
|
||||||
"total" => count($rows) ,
|
"total" => count($rows),
|
||||||
"records" => $rows,
|
"records" => $rows,
|
||||||
);
|
);
|
||||||
$this->sys_ok($result);
|
$this->sys_ok($result);
|
||||||
@@ -638,7 +641,7 @@ class Payment extends MY_Controller
|
|||||||
$rows = $this->db_onedev->query($query)->result_array();
|
$rows = $this->db_onedev->query($query)->result_array();
|
||||||
|
|
||||||
$result = array(
|
$result = array(
|
||||||
"total" => count($rows) ,
|
"total" => count($rows),
|
||||||
"records" => $rows,
|
"records" => $rows,
|
||||||
);
|
);
|
||||||
$this->sys_ok($result);
|
$this->sys_ok($result);
|
||||||
@@ -661,14 +664,54 @@ class Payment extends MY_Controller
|
|||||||
$rows = $this->db_onedev->query($query)->result_array();
|
$rows = $this->db_onedev->query($query)->result_array();
|
||||||
|
|
||||||
$result = array(
|
$result = array(
|
||||||
"total" => count($rows) ,
|
"total" => count($rows),
|
||||||
"records" => $rows,
|
"records" => $rows,
|
||||||
);
|
);
|
||||||
$this->sys_ok($result);
|
$this->sys_ok($result);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
function searchcard(){
|
function lookup_promos()
|
||||||
|
{
|
||||||
|
//# cek token valid
|
||||||
|
if (! $this->isLogin) {
|
||||||
|
$this->sys_error("Invalid Token");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$prm = $this->sys_input;
|
||||||
|
$bank_id = $prm['bank_id'];
|
||||||
|
$query = "SELECT DISTINCT
|
||||||
|
M_PromoID as id,
|
||||||
|
M_PromoName as name,
|
||||||
|
M_PromoDiscountType as type,
|
||||||
|
M_PromoValue as value
|
||||||
|
FROM m_promo
|
||||||
|
JOIN m_promo_bank ON M_PromoBankM_PromoID = M_PromoID
|
||||||
|
WHERE
|
||||||
|
M_PromoIsActive = 'Y'
|
||||||
|
AND M_PromoBankIsActive = 'Y'
|
||||||
|
AND M_PromoBankNat_BankID = ?
|
||||||
|
AND CURDATE() BETWEEN M_PromoStartDate AND M_PromoEndDate
|
||||||
|
ORDER BY M_PromoName DESC";
|
||||||
|
$qry = $this->db_onedev->query($query, array($bank_id));
|
||||||
|
if (!$qry) {
|
||||||
|
$this->sys_error_db("List Promo", $this->db_onedev);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$rows = $qry->result_array();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$result = array(
|
||||||
|
"total" => count($rows),
|
||||||
|
"records" => $rows,
|
||||||
|
);
|
||||||
|
$this->sys_ok($result);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
function searchcard()
|
||||||
|
{
|
||||||
if (! $this->isLogin) {
|
if (! $this->isLogin) {
|
||||||
$this->sys_error("Invalid Token");
|
$this->sys_error("Invalid Token");
|
||||||
exit;
|
exit;
|
||||||
@@ -676,19 +719,18 @@ class Payment extends MY_Controller
|
|||||||
$prm = $this->sys_input;
|
$prm = $this->sys_input;
|
||||||
|
|
||||||
$max_rst = 12;
|
$max_rst = 12;
|
||||||
$tot_count =0;
|
$tot_count = 0;
|
||||||
|
|
||||||
$q = [
|
$q = [
|
||||||
'search' => '%'
|
'search' => '%'
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($prm['search'] != '')
|
if ($prm['search'] != '') {
|
||||||
{
|
|
||||||
$q['search'] = "%{$prm['search']}%";
|
$q['search'] = "%{$prm['search']}%";
|
||||||
}
|
}
|
||||||
|
|
||||||
// QUERY TOTAL
|
// QUERY TOTAL
|
||||||
if($prm['search'] != ''){
|
if ($prm['search'] != '') {
|
||||||
$sql = "
|
$sql = "
|
||||||
SELECT count(*) as total
|
SELECT count(*) as total
|
||||||
FROM nat_bank
|
FROM nat_bank
|
||||||
@@ -697,8 +739,7 @@ class Payment extends MY_Controller
|
|||||||
AND Nat_BankIsActive = 'Y'
|
AND Nat_BankIsActive = 'Y'
|
||||||
ORDER BY Nat_BankName DESC
|
ORDER BY Nat_BankName DESC
|
||||||
";
|
";
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$sql = "
|
$sql = "
|
||||||
SELECT count(*) as total
|
SELECT count(*) as total
|
||||||
FROM nat_bank
|
FROM nat_bank
|
||||||
@@ -707,16 +748,15 @@ class Payment extends MY_Controller
|
|||||||
ORDER BY Nat_BankName DESC
|
ORDER BY Nat_BankName DESC
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
$query = $this->db_onedev->query($sql,$q['search']);
|
$query = $this->db_onedev->query($sql, $q['search']);
|
||||||
//echo $query;
|
//echo $query;
|
||||||
if ($query) {
|
if ($query) {
|
||||||
$tot_count = $query->result_array()[0]["total"];
|
$tot_count = $query->result_array()[0]["total"];
|
||||||
}
|
} else {
|
||||||
else {
|
$this->sys_error_db("m_city count", $this->db_onedev);
|
||||||
$this->sys_error_db("m_city count",$this->db_onedev);
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
if($prm['search'] != ''){
|
if ($prm['search'] != '') {
|
||||||
$sql = "
|
$sql = "
|
||||||
SELECT Nat_BankID as id, Nat_BankName as name
|
SELECT Nat_BankID as id, Nat_BankName as name
|
||||||
FROM nat_bank
|
FROM nat_bank
|
||||||
@@ -725,8 +765,7 @@ class Payment extends MY_Controller
|
|||||||
AND Nat_BankIsActive = 'Y'
|
AND Nat_BankIsActive = 'Y'
|
||||||
ORDER BY Nat_BankName DESC
|
ORDER BY Nat_BankName DESC
|
||||||
";
|
";
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$sql = "
|
$sql = "
|
||||||
SELECT Nat_BankID as id, Nat_BankName as name
|
SELECT Nat_BankID as id, Nat_BankName as name
|
||||||
FROM nat_bank
|
FROM nat_bank
|
||||||
@@ -743,9 +782,8 @@ class Payment extends MY_Controller
|
|||||||
//echo $this->db_onedev->last_query();
|
//echo $this->db_onedev->last_query();
|
||||||
$result = array("total" => $tot_count, "records" => $rows, "total_display" => sizeof($rows));
|
$result = array("total" => $tot_count, "records" => $rows, "total_display" => sizeof($rows));
|
||||||
$this->sys_ok($result);
|
$this->sys_ok($result);
|
||||||
}
|
} else {
|
||||||
else {
|
$this->sys_error_db("m_city rows", $this->db_onedev);
|
||||||
$this->sys_error_db("m_city rows",$this->db_onedev);
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -832,14 +870,8 @@ class Payment extends MY_Controller
|
|||||||
|
|
||||||
$paid_before = (int)($rowPaidBefore['total_paid'] ?? 0);
|
$paid_before = (int)($rowPaidBefore['total_paid'] ?? 0);
|
||||||
|
|
||||||
$remaining_before_tx = $bill_total - $paid_before;
|
|
||||||
if ($remaining_before_tx < 0) $remaining_before_tx = 0;
|
|
||||||
|
|
||||||
if ($remaining_before_tx === 0) {
|
|
||||||
throw new Exception("Tagihan sudah lunas / 0. Tidak bisa bayar lagi.");
|
|
||||||
}
|
|
||||||
|
|
||||||
$requested_paid = 0;
|
$requested_paid = 0;
|
||||||
|
$promo_bill_total = null;
|
||||||
|
|
||||||
foreach ($payments as $v) {
|
foreach ($payments as $v) {
|
||||||
if (empty($v['chex'])) continue;
|
if (empty($v['chex'])) continue;
|
||||||
@@ -860,17 +892,21 @@ class Payment extends MY_Controller
|
|||||||
} else {
|
} else {
|
||||||
$requested_paid += $left;
|
$requested_paid += $left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($code === 'PROMO') {
|
||||||
|
$promo_bill_total = $left;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($requested_paid <= 0) {
|
if ($promo_bill_total !== null) {
|
||||||
throw new Exception("Nominal pembayaran 0 / tidak valid.");
|
$bill_total = (int)$promo_bill_total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$remaining_before_tx = $bill_total - $paid_before;
|
||||||
|
if ($remaining_before_tx < 0) $remaining_before_tx = 0;
|
||||||
|
|
||||||
$paid_to_record = min($requested_paid, $remaining_before_tx);
|
$paid_to_record = min($requested_paid, $remaining_before_tx);
|
||||||
|
|
||||||
if ($paid_to_record <= 0) {
|
|
||||||
throw new Exception("Nominal pembayaran 0 / tidak valid.");
|
|
||||||
}
|
|
||||||
|
|
||||||
$qHeader = $this->db_onedev->query(
|
$qHeader = $this->db_onedev->query(
|
||||||
"INSERT INTO f_payment(
|
"INSERT INTO f_payment(
|
||||||
@@ -897,7 +933,7 @@ class Payment extends MY_Controller
|
|||||||
|
|
||||||
foreach ($payments as $v) {
|
foreach ($payments as $v) {
|
||||||
if (empty($v['chex'])) continue;
|
if (empty($v['chex'])) continue;
|
||||||
if ($remaining_alloc <= 0) break;
|
//if ($remaining_alloc <= 0) break;
|
||||||
|
|
||||||
$code = (string)($v['code'] ?? '');
|
$code = (string)($v['code'] ?? '');
|
||||||
$typeId = (int)($v['id'] ?? 0);
|
$typeId = (int)($v['id'] ?? 0);
|
||||||
@@ -907,19 +943,12 @@ class Payment extends MY_Controller
|
|||||||
$actual = (int)($v['leftvalue'] ?? 0);
|
$actual = (int)($v['leftvalue'] ?? 0);
|
||||||
$change = (int)($v['rightvalue'] ?? 0);
|
$change = (int)($v['rightvalue'] ?? 0);
|
||||||
|
|
||||||
if ($actual < 0) $actual = 0;
|
if($actual > 0){
|
||||||
if ($change < 0) $change = 0;
|
$amount = intval($v['leftvalue']) - intval($v['rightvalue']);
|
||||||
|
}
|
||||||
$net = $actual;
|
else{
|
||||||
if ($actual > 0) {
|
$amount = $actual;
|
||||||
$net = $actual - max(0, $change);
|
|
||||||
}
|
}
|
||||||
if ($net < 0) $net = 0;
|
|
||||||
|
|
||||||
$amount = min($net, $remaining_alloc);
|
|
||||||
|
|
||||||
$change_new = $actual - $amount;
|
|
||||||
if ($change_new < 0) $change_new = 0;
|
|
||||||
|
|
||||||
$q = $this->db_onedev->query(
|
$q = $this->db_onedev->query(
|
||||||
"INSERT INTO f_paymentdetail(
|
"INSERT INTO f_paymentdetail(
|
||||||
@@ -932,7 +961,7 @@ class Payment extends MY_Controller
|
|||||||
F_PaymentDetailLastUpdated,
|
F_PaymentDetailLastUpdated,
|
||||||
F_PaymentDetailUserID
|
F_PaymentDetailUserID
|
||||||
) VALUES (?,?,?,?,?,NOW(),NOW(),?)",
|
) VALUES (?,?,?,?,?,NOW(),NOW(),?)",
|
||||||
[$headerid, $typeId, $amount, $actual, $change_new, $xuserid]
|
[$headerid, $typeId, $amount, $actual, $change, $xuserid]
|
||||||
);
|
);
|
||||||
|
|
||||||
if (! $q) {
|
if (! $q) {
|
||||||
@@ -952,6 +981,7 @@ class Payment extends MY_Controller
|
|||||||
$selected_card = (int)($v['selected_card']['id'] ?? 0);
|
$selected_card = (int)($v['selected_card']['id'] ?? 0);
|
||||||
$selected_edc = (int)($v['selected_edc']['id'] ?? 0);
|
$selected_edc = (int)($v['selected_edc']['id'] ?? 0);
|
||||||
$selected_account = (int)($v['selected_account']['id'] ?? 0);
|
$selected_account = (int)($v['selected_account']['id'] ?? 0);
|
||||||
|
$selected_promo = (int)($v['selected_promo']['id'] ?? 0);
|
||||||
|
|
||||||
$bankAccountId = 0;
|
$bankAccountId = 0;
|
||||||
if ($code === 'TRANSFER' || $code === 'QRIS') {
|
if ($code === 'TRANSFER' || $code === 'QRIS') {
|
||||||
@@ -984,6 +1014,30 @@ class Payment extends MY_Controller
|
|||||||
|
|
||||||
$paymentDetailId = (int)$this->db_onedev->insert_id();
|
$paymentDetailId = (int)$this->db_onedev->insert_id();
|
||||||
|
|
||||||
|
if ($code === 'PROMO') {
|
||||||
|
if ($selected_promo <= 0) {
|
||||||
|
throw new Exception("Promo tidak valid.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$qPromo = $this->db_onedev->query(
|
||||||
|
"INSERT INTO t_promo(
|
||||||
|
T_PromoT_OrderHeaderID,
|
||||||
|
T_PromoF_PaymentDetailID,
|
||||||
|
T_PromoF_PaymentID,
|
||||||
|
T_PromoM_PromoID,
|
||||||
|
T_PromoIsActive,
|
||||||
|
T_PromoCreated,
|
||||||
|
T_PromoCreatedUserID
|
||||||
|
) VALUES (?,?,?,?, 'Y', NOW(), ?)",
|
||||||
|
[$orderid, $paymentDetailId, $headerid, $selected_promo, $xuserid]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (! $qPromo) {
|
||||||
|
$this->sys_error_db("t_promo insert", $this->db_onedev);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($code === 'VOUCHER') {
|
if ($code === 'VOUCHER') {
|
||||||
$vn = trim((string)($v['rightvalue'] ?? ''));
|
$vn = trim((string)($v['rightvalue'] ?? ''));
|
||||||
if ($vn !== '' && $amount > 0) {
|
if ($vn !== '' && $amount > 0) {
|
||||||
@@ -1003,13 +1057,19 @@ class Payment extends MY_Controller
|
|||||||
$remaining_alloc -= $amount;
|
$remaining_alloc -= $amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
$paid_after = $paid_before + $paid_to_record;
|
$paid_all = 0;
|
||||||
if ($paid_after > $bill_total) $paid_after = $bill_total;
|
$unpaid = 0;
|
||||||
|
$sql = "SELECT SUM(F_PaymentTotal) AS total_paid, T_OrderHeaderTotal AS total_bill
|
||||||
|
FROM
|
||||||
|
f_payment
|
||||||
|
JOIN t_orderheader ON T_OrderHeaderID = F_PaymentT_OrderHeaderID AND T_OrderHeaderIsActive = 'Y'
|
||||||
|
WHERE F_PaymentT_OrderHeaderID = ? AND F_PaymentIsActive = 'Y'
|
||||||
|
GROUP BY F_PaymentT_OrderHeaderID";
|
||||||
|
$row = $this->db_onedev->query($sql, [$orderid])->row_array();
|
||||||
|
$paid_all = (int)($row['total_paid'] ?? 0);
|
||||||
|
$unpaid = (int)($row['total_bill'] ?? 0) - $paid_all;
|
||||||
|
|
||||||
$unpaid = $bill_total - $paid_after;
|
$lunas = ($unpaid <= 0) ? 'Y' : 'N';
|
||||||
if ($unpaid < 0) $unpaid = 0;
|
|
||||||
|
|
||||||
$lunas = ($paid_after >= $bill_total) ? 'Y' : 'N';
|
|
||||||
|
|
||||||
$last = $this->db_onedev->query(
|
$last = $this->db_onedev->query(
|
||||||
"SELECT Last_StatusPaymentID
|
"SELECT Last_StatusPaymentID
|
||||||
@@ -1029,7 +1089,7 @@ class Payment extends MY_Controller
|
|||||||
Last_StatusPaymentIsLunas = ?,
|
Last_StatusPaymentIsLunas = ?,
|
||||||
Last_StatusPaymentLastUpdated = NOW()
|
Last_StatusPaymentLastUpdated = NOW()
|
||||||
WHERE Last_StatusPaymentID = ?",
|
WHERE Last_StatusPaymentID = ?",
|
||||||
[$bill_total, $paid_after, $unpaid, $lunas, (int)$last['Last_StatusPaymentID']]
|
[$row['total_bill'], $paid_all, $unpaid, $lunas, (int)$last['Last_StatusPaymentID']]
|
||||||
);
|
);
|
||||||
if (! $q) {
|
if (! $q) {
|
||||||
$this->sys_error_db("last_statuspayment update", $this->db_onedev);
|
$this->sys_error_db("last_statuspayment update", $this->db_onedev);
|
||||||
@@ -1046,7 +1106,7 @@ class Payment extends MY_Controller
|
|||||||
Last_StatusPaymentCreated,
|
Last_StatusPaymentCreated,
|
||||||
Last_StatusPaymentUserID
|
Last_StatusPaymentUserID
|
||||||
) VALUES (?,?,?,?,?,NOW(),?)",
|
) VALUES (?,?,?,?,?,NOW(),?)",
|
||||||
[$orderid, $bill_total, $paid_after, $unpaid, $lunas, $xuserid]
|
[$orderid, $row['total_bill'], $paid_all, $unpaid, $lunas, $xuserid]
|
||||||
);
|
);
|
||||||
if (! $q) {
|
if (! $q) {
|
||||||
$this->sys_error_db("last_statuspayment insert", $this->db_onedev);
|
$this->sys_error_db("last_statuspayment insert", $this->db_onedev);
|
||||||
@@ -1182,7 +1242,6 @@ class Payment extends MY_Controller
|
|||||||
"menu_walk_in" => $row_menu ? $row_menu['S_MenuUrl'] : ''
|
"menu_walk_in" => $row_menu ? $row_menu['S_MenuUrl'] : ''
|
||||||
]);
|
]);
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->db_onedev->trans_rollback();
|
$this->db_onedev->trans_rollback();
|
||||||
$this->sys_error($e->getMessage());
|
$this->sys_error($e->getMessage());
|
||||||
@@ -1220,8 +1279,8 @@ class Payment extends MY_Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$result = array(
|
$result = array(
|
||||||
"total" => 1 ,
|
"total" => 1,
|
||||||
"records" => array('prm'=>$prm)
|
"records" => array('prm' => $prm)
|
||||||
);
|
);
|
||||||
$this->sys_ok($result);
|
$this->sys_ok($result);
|
||||||
exit;
|
exit;
|
||||||
@@ -1246,33 +1305,25 @@ class Payment extends MY_Controller
|
|||||||
T_OrderDetailT_OrderHeaderID = ? AND T_OrderDetailIsActive = 'Y'
|
T_OrderDetailT_OrderHeaderID = ? AND T_OrderDetailIsActive = 'Y'
|
||||||
|
|
||||||
) x";
|
) x";
|
||||||
$query = $this->db_onedev->query($sql,array($prm['order_id']));
|
$query = $this->db_onedev->query($sql, array($prm['order_id']));
|
||||||
//echo $this->db_onedev->last_query();
|
//echo $this->db_onedev->last_query();
|
||||||
if ($query)
|
if ($query) {
|
||||||
{
|
|
||||||
$datas = $query->result_array();
|
$datas = $query->result_array();
|
||||||
foreach ($datas as $key => $value) {
|
foreach ($datas as $key => $value) {
|
||||||
$sql = "SELECT M_LocationID as location_id, M_LocationName as location_name FROM m_location WHERE M_LocationT_SampleStationID = ? AND M_LocationIsActive = 'Y' ";
|
$sql = "SELECT M_LocationID as location_id, M_LocationName as location_name FROM m_location WHERE M_LocationT_SampleStationID = ? AND M_LocationIsActive = 'Y' ";
|
||||||
$query = $this->db_onedev->query($sql,array($value['station_id']));
|
$query = $this->db_onedev->query($sql, array($value['station_id']));
|
||||||
if ($query)
|
if ($query) {
|
||||||
{
|
|
||||||
$datas[$key]['locations'] = $query->result_array();
|
$datas[$key]['locations'] = $query->result_array();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$datas[$key]['locations'] = [];
|
$datas[$key]['locations'] = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->sys_ok(["datas"=> $datas]);
|
$this->sys_ok(["datas" => $datas]);
|
||||||
|
} else {
|
||||||
}
|
|
||||||
else{
|
|
||||||
echo $this->db_onedev->last_query();
|
echo $this->db_onedev->last_query();
|
||||||
$this->sys_error_db("gagal ambil data", $this->db_onedev);
|
$this->sys_error_db("gagal ambil data", $this->db_onedev);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function save_control()
|
function save_control()
|
||||||
@@ -1283,9 +1334,9 @@ class Payment extends MY_Controller
|
|||||||
}
|
}
|
||||||
$prm = $this->sys_input;
|
$prm = $this->sys_input;
|
||||||
$userid = $this->sys_user['M_UserID'];
|
$userid = $this->sys_user['M_UserID'];
|
||||||
if($prm['data'] && count($prm['data']) > 0){
|
if ($prm['data'] && count($prm['data']) > 0) {
|
||||||
foreach ($prm['data'] as $key => $value) {
|
foreach ($prm['data'] as $key => $value) {
|
||||||
$sql="INSERT INTO t_order_location (
|
$sql = "INSERT INTO t_order_location (
|
||||||
T_OrderLocationT_OrderHeaderID,
|
T_OrderLocationT_OrderHeaderID,
|
||||||
T_OrderLocationM_LocationID,
|
T_OrderLocationM_LocationID,
|
||||||
T_OrderLocationT_SampleStationID,
|
T_OrderLocationT_SampleStationID,
|
||||||
@@ -1300,11 +1351,10 @@ class Payment extends MY_Controller
|
|||||||
T_OrderLocationT_SampleStationID = ?,
|
T_OrderLocationT_SampleStationID = ?,
|
||||||
T_OrderLocationLastUpdated = NOW(),
|
T_OrderLocationLastUpdated = NOW(),
|
||||||
T_OrderLocationUserID = ?";
|
T_OrderLocationUserID = ?";
|
||||||
$query = $this->db_onedev->query($sql,array($value['order_id'],$value['location_id'],$value['station_id'],$userid,$value['order_id'],$value['location_id'],$value['station_id'],$userid));
|
$query = $this->db_onedev->query($sql, array($value['order_id'], $value['location_id'], $value['station_id'], $userid, $value['order_id'], $value['location_id'], $value['station_id'], $userid));
|
||||||
}
|
}
|
||||||
$this->sys_ok(["datas"=> '']);
|
$this->sys_ok(["datas" => '']);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$this->sys_error_db("data not valid", $this->db_onedev);
|
$this->sys_error_db("data not valid", $this->db_onedev);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -1365,7 +1415,7 @@ class Payment extends MY_Controller
|
|||||||
";
|
";
|
||||||
$qDetail = $this->db_onedev->query($sqlDetail, [$voucherNumber]);
|
$qDetail = $this->db_onedev->query($sqlDetail, [$voucherNumber]);
|
||||||
|
|
||||||
if(!$qDetail || !$qDetail->row_array()){
|
if (!$qDetail || !$qDetail->row_array()) {
|
||||||
$this->sys_ok([
|
$this->sys_ok([
|
||||||
"code" => "N",
|
"code" => "N",
|
||||||
"message" => "Voucher tidak ditemukan",
|
"message" => "Voucher tidak ditemukan",
|
||||||
@@ -1407,7 +1457,7 @@ class Payment extends MY_Controller
|
|||||||
";
|
";
|
||||||
$qHeader = $this->db_onedev->query($sqlHeader, [$detail['VoucherDetailVoucherHeaderID']]);
|
$qHeader = $this->db_onedev->query($sqlHeader, [$detail['VoucherDetailVoucherHeaderID']]);
|
||||||
|
|
||||||
if(!$qHeader || !$qHeader->row_array()){
|
if (!$qHeader || !$qHeader->row_array()) {
|
||||||
$this->sys_ok([
|
$this->sys_ok([
|
||||||
"code" => "N",
|
"code" => "N",
|
||||||
"message" => "Voucher header tidak ditemukan",
|
"message" => "Voucher header tidak ditemukan",
|
||||||
@@ -1449,7 +1499,6 @@ class Payment extends MY_Controller
|
|||||||
"headerId" => (int)$header['VoucherHeaderID']
|
"headerId" => (int)$header['VoucherHeaderID']
|
||||||
]);
|
]);
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->sys_error($e->getMessage());
|
$this->sys_error($e->getMessage());
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ tmpdir=$(mktemp -d "${TMPDIR:-/tmp}/devcpone-sync.XXXXXX")
|
|||||||
trap 'rm -rf "$tmpdir"' EXIT HUP INT TERM
|
trap 'rm -rf "$tmpdir"' EXIT HUP INT TERM
|
||||||
|
|
||||||
manifest="$tmpdir/files.list"
|
manifest="$tmpdir/files.list"
|
||||||
|
verify_list="$tmpdir/files.verify"
|
||||||
|
|
||||||
if git rev-parse --verify HEAD^ >/dev/null 2>&1; then
|
if git rev-parse --verify HEAD^ >/dev/null 2>&1; then
|
||||||
git diff -M --name-only -z --diff-filter=ACMR HEAD^ HEAD > "$manifest"
|
git diff -M --name-only -z --diff-filter=ACMR HEAD^ HEAD > "$manifest"
|
||||||
@@ -31,12 +32,20 @@ if [ ! -s "$manifest" ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ssh_cmd="ssh"
|
ssh_args="-o BatchMode=yes"
|
||||||
if [ -f "$ssh_key" ]; then
|
if [ -f "$ssh_key" ]; then
|
||||||
ssh_cmd="$ssh_cmd -i $ssh_key"
|
ssh_args="-i $ssh_key $ssh_args"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ssh_cmd="$ssh_cmd -o BatchMode=yes"
|
ssh $ssh_args "$remote_host" "mkdir -p '$remote_root'" >/dev/null
|
||||||
|
rsync -a --relative --from0 --files-from="$manifest" -e "ssh $ssh_args" "$repo_root"/ "$remote_host:$remote_root"/
|
||||||
|
|
||||||
ssh "$remote_host" "mkdir -p '$remote_root'" >/dev/null
|
tr '\0' '\n' < "$manifest" > "$verify_list"
|
||||||
rsync -a --relative --from0 --files-from="$manifest" -e "$ssh_cmd" "$repo_root"/ "$remote_host:$remote_root"/
|
|
||||||
|
while IFS= read -r relpath; do
|
||||||
|
[ -n "$relpath" ] || continue
|
||||||
|
ssh $ssh_args "$remote_host" "test -e '$remote_root/$relpath'" || {
|
||||||
|
printf '%s\n' "devcpone verify failed: missing $remote_root/$relpath" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
done < "$verify_list"
|
||||||
|
|||||||
Reference in New Issue
Block a user