FHM28052603SAS - commit remaining changes
This commit is contained in:
@@ -578,6 +578,7 @@ class Transactionv2 extends MY_Controller
|
||||
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,
|
||||
T_OrderDetailCreated as TanggalBuat,
|
||||
@@ -1117,6 +1118,7 @@ class Transactionv2 extends MY_Controller
|
||||
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,
|
||||
T_OrderDetailCreated as TanggalBuat,
|
||||
@@ -1913,6 +1915,7 @@ class Transactionv2 extends MY_Controller
|
||||
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,
|
||||
T_OrderDetailCreated as TanggalBuat,
|
||||
@@ -2412,6 +2415,7 @@ class Transactionv2 extends MY_Controller
|
||||
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,
|
||||
T_OrderDetailCreated as TanggalBuat,
|
||||
@@ -2857,6 +2861,7 @@ class Transactionv2 extends MY_Controller
|
||||
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,
|
||||
T_OrderDetailCreated as TanggalBuat,
|
||||
@@ -2904,7 +2909,15 @@ class Transactionv2 extends MY_Controller
|
||||
T_OrderDetailIsActive = 'Y'
|
||||
UNION
|
||||
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,
|
||||
T_OrderDetailCreated as TanggalBuat,
|
||||
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 = 5 then '1321'
|
||||
when Nat_GroupID = 6 then '1600'
|
||||
when Nat_GroupID = 7 then '1500'
|
||||
end as ProfitCostCenterCode,
|
||||
'' as TrxDepartemenID,
|
||||
T_OrderDetailCreated as TanggalBuat,
|
||||
@@ -1122,6 +1123,7 @@ class Transactionv3 extends MY_Controller
|
||||
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,
|
||||
T_OrderDetailCreated as TanggalBuat,
|
||||
@@ -1918,6 +1920,7 @@ class Transactionv3 extends MY_Controller
|
||||
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,
|
||||
T_OrderDetailCreated as TanggalBuat,
|
||||
@@ -2417,6 +2420,7 @@ class Transactionv3 extends MY_Controller
|
||||
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,
|
||||
T_OrderDetailCreated as TanggalBuat,
|
||||
@@ -2862,6 +2866,7 @@ class Transactionv3 extends MY_Controller
|
||||
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,
|
||||
T_OrderDetailCreated as TanggalBuat,
|
||||
@@ -2909,7 +2914,15 @@ class Transactionv3 extends MY_Controller
|
||||
T_OrderDetailIsActive = 'Y'
|
||||
UNION
|
||||
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,
|
||||
T_OrderDetailCreated as TanggalBuat,
|
||||
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
@@ -1,21 +1,22 @@
|
||||
<?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,
|
||||
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,
|
||||
DATE_FORMAT(F_PaymentDate,'%d-%m-%Y') as note_date,
|
||||
F_PaymentNumber as note_number,
|
||||
GROUP_CONCAT(M_PaymentTypeName separator ' , ') as paymenttypes_name,
|
||||
MAX(F_PaymentTotal) as note_amount,
|
||||
@@ -33,19 +34,18 @@ class Patient extends MY_Controller
|
||||
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) {
|
||||
public function search()
|
||||
{
|
||||
if (! $this->isLogin) {
|
||||
$this->sys_error("Invalid Token");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$prm = $this->sys_input;
|
||||
$startdate = $prm['startdate'];
|
||||
@@ -53,26 +53,28 @@ class Patient extends MY_Controller
|
||||
$search = $prm["search"];
|
||||
$status = $prm["status"];
|
||||
$company = $prm["company"];
|
||||
$userid = $this->sys_user["M_UserID"];
|
||||
$filter_company = '';
|
||||
if($company != '0' || $company != 0)
|
||||
if ($company != '0' || $company != 0)
|
||||
$filter_company = " AND CorporateID = {$company}";
|
||||
|
||||
|
||||
$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 ";
|
||||
if($search != ''){
|
||||
if ($search != '') {
|
||||
$where = "( M_PatientName LIKE '%{$search}%' OR T_OrderHeaderLabNumber LIKE '%{$search}%' ) AND ";
|
||||
if(strlen($search) == 10){
|
||||
if (strlen($search) == 10) {
|
||||
$where = "T_OrderHeaderLabNumber = '{$search}' AND ";
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT count(*) as total
|
||||
$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_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_title ON M_PatientM_TitleID = M_TitleID
|
||||
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 last_statuspayment ON Last_StatusPaymentT_OrderHeaderID = T_OrderHeaderID AND Last_StatusPaymentIsActive = 'Y'
|
||||
LEFT JOIN x_wa_outbox
|
||||
@@ -83,18 +85,18 @@ class Patient extends MY_Controller
|
||||
( ('{$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);
|
||||
$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,
|
||||
@@ -118,10 +120,11 @@ class Patient extends MY_Controller
|
||||
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_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_title ON M_PatientM_TitleID = M_TitleID
|
||||
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 last_statuspayment ON Last_StatusPaymentT_OrderHeaderID = T_OrderHeaderID AND Last_StatusPaymentIsActive = 'Y'
|
||||
LEFT JOIN x_wa_outbox
|
||||
@@ -135,9 +138,10 @@ class Patient extends MY_Controller
|
||||
limit $number_limit offset $number_offset";
|
||||
//echo $sql;
|
||||
$query = $this->db_onedev->query($sql, $sql_param);
|
||||
//echo $this->db_onedev->last_query();
|
||||
$rows = $query->result_array();
|
||||
if($rows){
|
||||
foreach($rows as $k => $v){
|
||||
if ($rows) {
|
||||
foreach ($rows as $k => $v) {
|
||||
$rows[$k]['notes'] = $this->add_notes($v['T_OrderHeaderID']);
|
||||
}
|
||||
}
|
||||
@@ -145,59 +149,58 @@ 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";
|
||||
$query = $this->db_onedev->query($sql);
|
||||
$menu = $query->row_array();
|
||||
if($menu){
|
||||
if ($menu) {
|
||||
$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);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function searchcompany(){
|
||||
|
||||
|
||||
function searchcompany()
|
||||
{
|
||||
if (! $this->isLogin) {
|
||||
$this->sys_error("Invalid Token");
|
||||
exit;
|
||||
}
|
||||
$this->sys_error("Invalid Token");
|
||||
exit;
|
||||
}
|
||||
$prm = $this->sys_input;
|
||||
|
||||
$max_rst = 12;
|
||||
$tot_count =0;
|
||||
$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' ";
|
||||
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'] = "";
|
||||
if ($prm['search'] != '') {
|
||||
if ($prm['search'] == 'Semua')
|
||||
$prm['search'] = "";
|
||||
|
||||
$q['search'] = "%{$prm['search']}%";
|
||||
$q['search'] = "%{$prm['search']}%";
|
||||
}
|
||||
|
||||
// QUERY TOTAL
|
||||
// QUERY TOTAL
|
||||
$sql = "SELECT count(*) as total
|
||||
FROM corporate
|
||||
WHERE
|
||||
CorporateName like ?
|
||||
AND CorporateIsActive = 'Y'";
|
||||
$query = $this->db_onedev->query($sql,$q['search']);
|
||||
$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);
|
||||
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');
|
||||
$rows = array('id' => 0, 'name' => 'Semua');
|
||||
$sql = "
|
||||
SELECT CorporateID as id, CorporateName as name
|
||||
FROM corporate
|
||||
@@ -207,19 +210,17 @@ class Patient extends MY_Controller
|
||||
AND CorporateIsActive = 'Y'
|
||||
ORDER BY CorporateName DESC
|
||||
";
|
||||
$query = $this->db_onedev->query($sql, array($q['search']));
|
||||
$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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user