update konfrimasi penerimaan rujukan

This commit is contained in:
Hanan Askarim
2026-06-11 15:10:42 +07:00
parent 9430b00ee6
commit 2978ecc93d
3 changed files with 1144 additions and 410 deletions

View File

@@ -1,21 +1,23 @@
<?php
class OutgoingRef_v4 extends MY_Controller
{
function __construct() {
function __construct()
{
parent::__construct();
$this->db = $this->load->database("onedev", true);
}
function get_nonlab($type,$xid) {
function get_nonlab($type, $xid)
{
//mikro
if ($type == "mikro") {
$sql = "select * from other_mikro where Other_MikroID=? ";
$qry = $this->db->query($sql, array($xid));
$result = array() ;
if ($qry ) {
$result = array();
if ($qry) {
$result["type"] = "mikro";
$rows = $qry->result_array();
if (count($rows) > 0 ) {
$result["header"]= $rows[0];
$rows = $qry->result_array();
if (count($rows) > 0) {
$result["header"] = $rows[0];
} else {
return array();
}
@@ -23,8 +25,8 @@ class OutgoingRef_v4 extends MY_Controller
Other_MikroDetailsIsActive = 'Y' ";
$qry = $this->db->query($sql, array($xid));
if ($qry) {
$result["detail"] = $qry->result_array();
}
$result["detail"] = $qry->result_array();
}
}
return $result;
}
@@ -33,12 +35,12 @@ class OutgoingRef_v4 extends MY_Controller
if ($type == "cytologi") {
$sql = "select * from other_cytologi where Other_CytologiID=? ";
$qry = $this->db->query($sql, array($xid));
$result = array() ;
if ($qry ) {
$result = array();
if ($qry) {
$result["type"] = "cytologi";
$rows = $qry->result_array();
if (count($rows) > 0 ) {
$result["header"]= $rows[0];
$rows = $qry->result_array();
if (count($rows) > 0) {
$result["header"] = $rows[0];
} else {
return array();
}
@@ -46,8 +48,8 @@ class OutgoingRef_v4 extends MY_Controller
Other_CytologiDetailsIsActive = 'Y' ";
$qry = $this->db->query($sql, array($xid));
if ($qry) {
$result["detail"] = $qry->result_array();
}
$result["detail"] = $qry->result_array();
}
}
return $result;
}
@@ -56,12 +58,12 @@ class OutgoingRef_v4 extends MY_Controller
if ($type == "fna") {
$sql = "select * from other_fna where Other_FnaID=? ";
$qry = $this->db->query($sql, array($xid));
$result = array() ;
if ($qry ) {
$result = array();
if ($qry) {
$result["type"] = "fna";
$rows = $qry->result_array();
if (count($rows) > 0 ) {
$result["header"]= $rows[0];
$rows = $qry->result_array();
if (count($rows) > 0) {
$result["header"] = $rows[0];
} else {
return array();
}
@@ -69,8 +71,8 @@ class OutgoingRef_v4 extends MY_Controller
Other_FnaDetailsIsActive = 'Y' ";
$qry = $this->db->query($sql, array($xid));
if ($qry) {
$result["detail"] = $qry->result_array();
}
$result["detail"] = $qry->result_array();
}
}
return $result;
}
@@ -80,12 +82,12 @@ class OutgoingRef_v4 extends MY_Controller
if ($type == "papsmear") {
$sql = "select * from other_papsmear where Other_PapSmearID=? ";
$qry = $this->db->query($sql, array($xid));
$result = array() ;
if ($qry ) {
$result = array();
if ($qry) {
$result["type"] = "papsmear";
$rows = $qry->result_array();
if (count($rows) > 0 ) {
$result["header"]= $rows[0];
$rows = $qry->result_array();
if (count($rows) > 0) {
$result["header"] = $rows[0];
} else {
return array();
}
@@ -95,40 +97,40 @@ class OutgoingRef_v4 extends MY_Controller
and Other_PapSmearBahanIsActive='Y'";
$qry = $this->db->query($sql, array($xid));
if ($qry) {
$result["detail"]["bahan"] = $qry->result_array();
}
$result["detail"]["bahan"] = $qry->result_array();
}
//category
$sql = "select * from other_papsmearcategory
where Other_PapsmearCategoryOther_PapSmearID = ?
and Other_PapsmearCategoryIsActive='Y'";
$qry = $this->db->query($sql, array($xid));
if ($qry) {
$result["detail"]["category"] = $qry->result_array();
$result["detail"]["category"] = $qry->result_array();
}
// check
// check
$sql = "select * from other_papsmearcheck
where Other_PapSmearCheckOther_PapSmearID= ?
and Other_PapSmearCheckIsActive='Y'";
$qry = $this->db->query($sql, array($xid));
if ($qry) {
$result["detail"]["check"] = $qry->result_array();
}
$result["detail"]["check"] = $qry->result_array();
}
// details
$sql = "select * from other_papsmeardetails
where Other_PapSmearDetailsOther_PapSmearID= ?
and Other_PapSmearDetailsIsActive='Y'";
$qry = $this->db->query($sql, array($xid));
if ($qry) {
$result["detail"]["details"] = $qry->result_array();
}
$result["detail"]["details"] = $qry->result_array();
}
// maturasi
$sql = "select * from other_papsmearmaturasi
where Other_PapSmearMaturasiOther_PapSmearID = ?
and Other_PapSmearMaturasiIsActive='Y'";
$qry = $this->db->query($sql, array($xid));
if ($qry) {
$result["detail"]["maturasi"] = $qry->result_array();
}
$result["detail"]["maturasi"] = $qry->result_array();
}
}
return $result;
}
@@ -138,12 +140,12 @@ class OutgoingRef_v4 extends MY_Controller
if ($type == "lcprep") {
$sql = "select * from other_lcprep where Other_LcprepID=? ";
$qry = $this->db->query($sql, array($xid));
$result = array() ;
if ($qry ) {
$result = array();
if ($qry) {
$result["type"] = "lcprep";
$rows = $qry->result_array();
if (count($rows) > 0 ) {
$result["header"]= $rows[0];
$rows = $qry->result_array();
if (count($rows) > 0) {
$result["header"] = $rows[0];
} else {
return array();
}
@@ -153,15 +155,15 @@ class OutgoingRef_v4 extends MY_Controller
and Other_LcprepAdekuasiIsActive='Y'";
$qry = $this->db->query($sql, array($xid));
if ($qry) {
$result["detail"]["adekuasi"] = $qry->result_array();
}
$result["detail"]["adekuasi"] = $qry->result_array();
}
//interpretasi
$sql = "select * from other_lcprepinterpretasi
where Other_PapsmearInterpretasiOther_LcprepID = ?
and Other_PapsmearInterpretasiIsActive='Y'";
$qry = $this->db->query($sql, array($xid));
if ($qry) {
$result["detail"]["interpretasi"] = $qry->result_array();
$result["detail"]["interpretasi"] = $qry->result_array();
}
// details
$sql = "select * from other_lcprepdetails
@@ -169,23 +171,24 @@ class OutgoingRef_v4 extends MY_Controller
and Other_LcprepDetailsIsActive='Y'";
$qry = $this->db->query($sql, array($xid));
if ($qry) {
$result["detail"]["details"] = $qry->result_array();
}
$result["detail"]["details"] = $qry->result_array();
}
// kategoriumum
$sql = "select * from other_lcprepkategoriumum
where Other_LcprepKategoriUmumOther_LcprepID = ?
and Other_LcprepKategoriUmumIsActive='Y'";
$qry = $this->db->query($sql, array($xid));
if ($qry) {
$result["detail"]["kategoriumum"] = $qry->result_array();
}
$result["detail"]["kategoriumum"] = $qry->result_array();
}
}
return $result;
}
return array();
}
function process_nonlab($incomingRefDetailID) {
function process_nonlab($incomingRefDetailID)
{
//mikro
$sql = "select ifnull(Other_MikroID,0) mikroID
from incoming_ref_detail
@@ -194,19 +197,19 @@ class OutgoingRef_v4 extends MY_Controller
left join other_mikro on T_OrderDetailID = Other_MikroT_OrderDetailID and
Other_MikroIsActive = 'Y'
where incomingRefDetailID = ? ";
$qry = $this->db->query($sql,array($incomingRefDetailID));
if ( ! $qry ) {
echo "ERR : process_nonlab : $incomingRefDetailID : " . print_r($this->db->error(),true) . "\n";
$qry = $this->db->query($sql, array($incomingRefDetailID));
if (! $qry) {
echo "ERR : process_nonlab : $incomingRefDetailID : " . print_r($this->db->error(), true) . "\n";
return "";
}
$rows = $qry->result_array();
if ( count($rows) > 0 ) {
if (count($rows) > 0) {
$mikroID = $rows[0]["mikroID"];
$nl = "";
if ($mikroID > 0 ) {
if ($mikroID > 0) {
$nl = $this->get_nonlab("mikro", $mikroID);
return $nl;
}
}
}
//papsmear
@@ -217,19 +220,19 @@ class OutgoingRef_v4 extends MY_Controller
left join other_papsmear on T_OrderDetailID = Other_PapSmearT_OrderDetailID and
Other_PapSmearIsActive = 'Y'
where incomingRefDetailID = ? ";
$qry = $this->db->query($sql,array($incomingRefDetailID));
if ( ! $qry ) {
echo "ERR : process_nonlab : $incomingRefDetailID : " . print_r($this->db->error(),true) . "\n";
$qry = $this->db->query($sql, array($incomingRefDetailID));
if (! $qry) {
echo "ERR : process_nonlab : $incomingRefDetailID : " . print_r($this->db->error(), true) . "\n";
return "";
}
$rows = $qry->result_array();
if ( count($rows) > 0 ) {
if (count($rows) > 0) {
$papsmearID = $rows[0]["papsmearID"];
$nl = "";
if ($papsmear> 0 ) {
if ($papsmear > 0) {
$nl = $this->get_nonlab("papsmear", $papsmearID);
return $nl;
}
}
}
//lcprep
@@ -240,19 +243,19 @@ class OutgoingRef_v4 extends MY_Controller
left join other_lcprep on T_OrderDetailID = Other_LcprepT_OrderDetailID and
Other_LcprepIsActive = 'Y'
where incomingRefDetailID = ? ";
$qry = $this->db->query($sql,array($incomingRefDetailID));
if ( ! $qry ) {
echo "ERR : process_nonlab : $incomingRefDetailID : " . print_r($this->db->error(),true) . "\n";
$qry = $this->db->query($sql, array($incomingRefDetailID));
if (! $qry) {
echo "ERR : process_nonlab : $incomingRefDetailID : " . print_r($this->db->error(), true) . "\n";
return "";
}
$rows = $qry->result_array();
if ( count($rows) > 0 ) {
if (count($rows) > 0) {
$lcprepID = $rows[0]["lcprepID"];
$nl = "";
if ($lcprepID > 0 ) {
if ($lcprepID > 0) {
$nl = $this->get_nonlab("lcprep", $lcprepID);
return $nl;
}
}
}
//fna
@@ -263,19 +266,19 @@ class OutgoingRef_v4 extends MY_Controller
left join other_fna on T_OrderDetailID = Other_FnaT_OrderDetailID and
Other_FnaIsActive = 'Y'
where incomingRefDetailID = ? ";
$qry = $this->db->query($sql,array($incomingRefDetailID));
if ( ! $qry ) {
echo "ERR : process_nonlab : $incomingRefDetailID : " . print_r($this->db->error(),true) . "\n";
$qry = $this->db->query($sql, array($incomingRefDetailID));
if (! $qry) {
echo "ERR : process_nonlab : $incomingRefDetailID : " . print_r($this->db->error(), true) . "\n";
return "";
}
$rows = $qry->result_array();
if ( count($rows) > 0 ) {
if (count($rows) > 0) {
$fnaID = $rows[0]["fnaID"];
$nl = "";
if ($fnaID > 0 ) {
if ($fnaID > 0) {
$nl = $this->get_nonlab("fna", $fnaID);
return $nl;
}
}
}
//
//cytology
@@ -286,22 +289,23 @@ class OutgoingRef_v4 extends MY_Controller
left join other_cytologi on T_OrderDetailID = Other_CytologiT_OrderDetailID and
Other_CytologiIsActive = 'Y'
where incomingRefDetailID = ? ";
$qry = $this->db->query($sql,array($incomingRefDetailID));
if ( ! $qry ) {
echo "ERR : process_nonlab : $incomingRefDetailID : " . print_r($this->db->error(),true) . "\n";
$qry = $this->db->query($sql, array($incomingRefDetailID));
if (! $qry) {
echo "ERR : process_nonlab : $incomingRefDetailID : " . print_r($this->db->error(), true) . "\n";
return "";
}
$rows = $qry->result_array();
if ( count($rows) > 0 ) {
if (count($rows) > 0) {
$cytologiID = $rows[0]["cytologiID"];
$nl = "";
if ($cytologiID > 0 ) {
if ($cytologiID > 0) {
$nl = $this->get_nonlab("cytologi", $cytologiID);
return $nl;
}
}
}
}
function cek() {
function cek()
{
$sql = "select tx_branch_status.*, M_BranchName
from tx_branch_status
join m_branch on TxBranchStatusM_BranchID = M_BranchID
@@ -318,7 +322,8 @@ class OutgoingRef_v4 extends MY_Controller
print_r($rows);
}
}
function process() {
function process()
{
$sql = "select tx_branch_status.*, M_BranchName
from tx_branch_status
join m_branch on TxBranchStatusM_BranchID = M_BranchID
@@ -338,7 +343,7 @@ class OutgoingRef_v4 extends MY_Controller
where TxBranchStatusID = ?";
if ($qry) {
$rows = $qry->result_array();
foreach($rows as $r) {
foreach ($rows as $r) {
$param = $r["TxBranchStatusJson"];
$stage = $r["TxBranchStatusStage"];
$ipAddress = $r["TxBranchStatusM_BranchIP"];
@@ -346,57 +351,69 @@ class OutgoingRef_v4 extends MY_Controller
$txID = $r["TxBranchStatusID"];
if ($stage == "VALIDATION") {
//cek nonlab
$j_param = json_decode($param,true);
foreach($j_param as $idx => $j ) {
$j_param = json_decode($param, true);
foreach ($j_param as $idx => $j) {
if (isset($j["incomingRefDetailID"])) {
$nonlab_result = $this->process_nonlab( $j["incomingRefDetailID"] );
if ($nonlab_result != array() ) {
$nonlab_result = $this->process_nonlab($j["incomingRefDetailID"]);
if ($nonlab_result != array()) {
$j_param[$idx]["nonlab_result"] = $nonlab_result;
$param = json_encode($j_param);
}
}
}
}
$url = "http://$ipAddress/one-api/tools/xstatusbranch_v4/update";
$rst = $this->post($url,$param);
if ($rst["status"] == "OK" ) {
$url = "http://$ipAddress/one-api-lab/tools/xstatusbranch_v4/update";
$rst = $this->post($url, $param);
if ($rst["status"] == "OK") {
$this->xlog("Update status $stage to $branchName @ $ipAddress [OK]");
$this->db->query($sql_update, array('Y',$txID));
$this->db->query($sql_update, array('Y', $txID));
} else {
$err_msg = print_r($rst,true);
$err_msg = print_r($rst, true);
$this->xlog("Update status $stage to $branchName @ $ipAddress [ERR] : $err_msg");
$this->db->query($sql_update, array('N',$txID));
}
$this->db->query($sql_update, array('N', $txID));
}
}
} else {
$this->xlog("Err: " . print_r($this->db->error(),true));
$this->xlog("Err: " . print_r($this->db->error(), true));
}
}
function xlog($message) {
function xlog($message)
{
$dt = date("Y-m-d H:i:s");
echo "$dt $message\n";
}
function post($url,$data) {
$zdata = gzdeflate($data,9);
$ch = curl_init($url);
$this->xlog("Post to : " . $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $zdata);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($zdata))
);
function post($url, $data)
{
$zdata = gzdeflate($data, 9);
$ch = curl_init($url);
$this->xlog("Post to : " . $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $zdata);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt(
$ch,
CURLOPT_HTTPHEADER,
array(
'Content-Type: application/json',
'Content-Length: ' . strlen($zdata)
)
);
$result = curl_exec($ch);
$curl_error = curl_error($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($result === false ) {
return array("status" => "ERR" ,
"message" => curl_error($ch)
if ($result === false) {
return array(
"status" => "ERR",
"message" => $curl_error,
"http_code" => $http_code
);
}
$rst = json_decode($result,true);
return $rst;
}
}
$rst = json_decode($result, true);
return $rst;
}
}

View File

@@ -0,0 +1,639 @@
<?php
class Xstatusbranch_v3 extends MY_Controller
{
function __construct() {
parent::__construct();
$this->db = $this->load->database("onedev", true);
}
function index() {
echo "API";
}
//mikro
function update_mikro($detailID, $header, $detail ) {
$sql = "select * from t_orderdetail where T_OrderDetailID = ? ";
$qry = $this->db->query($sql, array($detailID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Mikro cek Validation " . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$rows = $qry->result_array();
if (count($rows) == 0 ) return;
if ($rows[0]["T_OrderDetailValidation"] == "Y" ) return;
$sql = "select Other_MikroID from other_mikro where Other_MikroT_OrderDetailID = ? and Other_MikroIsActive = 'Y'";
$qry = $this->db->query($sql, array($detailID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Mikro cek Existence " . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$rows = $qry->result_array();
$mikroID = 0;
if (count($rows) > 0 ) $mikroID = $rows[0]["Other_MikroID"];
if ( $mikroID > 0 ) {
$sql = "update other_mikro set Other_MikroIsActive = 'N' where Other_MikroID = ? ";
$qry = $this->db->query($sql, array($mikroID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Mikro set Inactive" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$sql = "update other_mikrodetails set Other_MikroDetailsIsActive = 'N' where Other_MikroDetailsOther_MikroID= ? ";
$qry = $this->db->query($sql, array($mikroID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Mikro Details set Inactive" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
}
unset($header["Other_MikroID"]);
$header["Other_MikroCreated"] = date("Y-m-d h:i:s");
$header["Other_MikroLastUpdated"] =date("Y-m-d h:i:s");
$header["Other_MikroUserID"] = 3;
$header["Other_MikroIsActive"] = "Y";
$header["Other_MikroT_OrderDetailID"] = $detailID;
$qry = $this->db->insert("other_mikro",$header);
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Mikro Add Header" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$mikroID = $this->db->insert_id();
if ($mikroID == 0 ) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Mikro ID Header" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
foreach($detail as $idx => $d ) {
$detail[$idx]["Other_MikroDetailsOther_MikroID"] = $mikroID ;
$detail[$idx]["Other_MikroDetailsUserID"] = 3;
$detail[$idx]["Other_MikroDetailsIsActive"] = "Y";
unset($detail[$idx]["Other_MikroDetailsID"]);
unset($detail[$idx]["Other_MikroDetailsCreated"]);
unset($detail[$idx]["Other_MikroDetailsLastUpdated"]);
}
$qry = $this->db->insert_batch("other_mikrodetails",$detail);
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Mikro Add Detail" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
}
//cytologi
function update_cytologi($detailID, $header, $detail ) {
$sql = "select * from t_orderdetail where T_OrderDetailID = ? ";
$qry = $this->db->query($sql, array($detailID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Cytologi cek Validation " . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$rows = $qry->result_array();
if (count($rows) == 0 ) return;
if ($rows[0]["T_OrderDetailValidation"] == "Y" ) return;
$sql = "select Other_CytologiID from other_cytologi where Other_CytologiT_OrderDetailID = ? and Other_CytologiIsActive = 'Y'";
$qry = $this->db->query($sql, array($detailID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Cytologi cek Existence " . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$rows = $qry->result_array();
$cytologiID = 0;
if (count($rows) > 0 ) $cytologiID = $rows[0]["Other_CytologiID"];
if ( $cytologiID > 0 ) {
$sql = "update other_cytologi set Other_CytologiIsActive = 'N' where Other_CytologiID = ? ";
$qry = $this->db->query($sql, array($cytologiID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Cytologi set Inactive" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$sql = "update other_cytologidetails set Other_CytologiDetailsIsActive = 'N' where Other_CytologiDetailsOther_CytologiID= ? ";
$qry = $this->db->query($sql, array($cytologiID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Cytologi Details set Inactive" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
}
unset($header["Other_CytologiID"]);
$header["Other_CytologiCreated"] = date("Y-m-d h:i:s");
$header["Other_CytologiLastUpdated"] =date("Y-m-d h:i:s");
$header["Other_CytologiUserID"] = 3;
$header["Other_CytologiIsActive"] = "Y";
$header["Other_CytologiT_OrderDetailID"] = $detailID;
$qry = $this->db->insert("other_cytologi",$header);
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Cytologi Add Header" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$cytologiID = $this->db->insert_id();
if ($cytologiID == 0 ) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Cytologi ID Header" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
foreach($detail as $idx => $d ) {
$detail[$idx]["Other_CytologiDetailsOther_CytologiID"] = $cytologiID ;
$detail[$idx]["Other_CytologiDetailsUserID"] = 3;
$detail[$idx]["Other_CytologiDetailsIsActive"] = "Y";
unset($detail[$idx]["Other_CytologiDetailsID"]);
unset($detail[$idx]["Other_CytologiDetailsCreated"]);
unset($detail[$idx]["Other_CytologiDetailsLastUpdated"]);
}
$qry = $this->db->insert_batch("other_cytologidetails",$detail);
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Cytologi Add Detail" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
}
//fna
function update_fna($detailID, $header, $detail ) {
$sql = "select * from t_orderdetail where T_OrderDetailID = ? ";
$qry = $this->db->query($sql, array($detailID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError FNA cek Validation " . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$rows = $qry->result_array();
if (count($rows) == 0 ) return;
if ($rows[0]["T_OrderDetailValidation"] == "Y" ) return;
$sql = "select Other_FNAID from other_fna where Other_FNAT_OrderDetailID = ? and Other_FNAIsActive = 'Y'";
$qry = $this->db->query($sql, array($detailID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError FNA cek Existence " . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$rows = $qry->result_array();
$fnaID = 0;
if (count($rows) > 0 ) $fnaID = $rows[0]["Other_FNAID"];
if ( $fnaID > 0 ) {
$sql = "update other_fna set Other_FNAIsActive = 'N' where Other_FNAID = ? ";
$qry = $this->db->query($sql, array($fnaID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError FNA set Inactive" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$sql = "update other_fnadetails set Other_FNADetailsIsActive = 'N' where Other_FNADetailsOther_FNAID= ? ";
$qry = $this->db->query($sql, array($fnaID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError FNA Details set Inactive" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
}
unset($header["Other_FNAID"]);
$header["Other_FNACreated"] = date("Y-m-d h:i:s");
$header["Other_FNALastUpdated"] =date("Y-m-d h:i:s");
$header["Other_FNAUserID"] = 3;
$header["Other_FNAIsActive"] = "Y";
$header["Other_FNAT_OrderDetailID"] = $detailID;
$qry = $this->db->insert("other_fna",$header);
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError FNA Add Header" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$fnaID = $this->db->insert_id();
if ($fnaID == 0 ) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError FNA ID Header" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
foreach($detail as $idx => $d ) {
$detail[$idx]["Other_FNADetailsOther_FNAID"] = $fnaID ;
$detail[$idx]["Other_FNADetailsUserID"] = 3;
$detail[$idx]["Other_FNADetailsIsActive"] = "Y";
unset($detail[$idx]["Other_FNADetailsID"]);
unset($detail[$idx]["Other_FNADetailsCreated"]);
unset($detail[$idx]["Other_FNADetailsLastUpdated"]);
}
$qry = $this->db->insert_batch("other_fnadetails",$detail);
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError FNA Add Detail" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
}
// update papsmear
function update_papsmear ($detailID, $header, $detail ) {
$sql = "select * from t_orderdetail where T_OrderDetailID = ? ";
$qry = $this->db->query($sql, array($detailID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError PapSmear cek Validation " . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$rows = $qry->result_array();
if (count($rows) == 0 ) return;
if ($rows[0]["T_OrderDetailValidation"] == "Y" ) return;
$sql = "select Other_PapSmearID from other_papsmear where Other_PapSmearT_OrderDetailID = ? and Other_PapSmearIsActive = 'Y'";
$qry = $this->db->query($sql, array($detailID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError PapSmear cek Existence " . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$rows = $qry->result_array();
$papsmearID = 0;
if (count($rows) > 0 ) $papsmearID = $rows[0]["Other_PapSmearID"];
if ( $papsmearID > 0 ) {
$sql = "update other_papsmear set Other_PapSmearIsActive = 'N' where Other_PapSmearID = ? ";
$qry = $this->db->query($sql, array($papsmearID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError PapSmear set Inactive" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$sql = "update other_papsmearbahan set Other_PapSmearBahanIsActive = 'N' where Other_PapSmearBahanOther_PapSmearID= ? ";
$qry = $this->db->query($sql, array($papsmearID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError PapSmear Details set Inactive" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$sql = "update other_papsmearcategory set Other_PapSmearCategoryIsActive = 'N' where Other_PapSmearCategoryOther_PapSmearID= ? ";
$qry = $this->db->query($sql, array($papsmearID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError PapSmear Category set Inactive" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$sql = "update other_papsmearcheck set Other_PapSmearCheckIsActive = 'N' where Other_PapSmearCheckOther_PapSmearID= ? ";
$qry = $this->db->query($sql, array($papsmearID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError PapSmear Check set Inactive" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$sql = "update other_papsmeardetails set Other_PapSmearDetailsIsActive = 'N' where Other_PapSmearDetailsOther_PapSmearID= ? ";
$qry = $this->db->query($sql, array($papsmearID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError PapSmear Details set Inactive" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$sql = "update other_papsmearmaturasi set Other_PapSmearMaturasiIsActive = 'N' where Other_PapSmearMaturasiOther_PapSmearID= ? ";
$qry = $this->db->query($sql, array($papsmearID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError PapSmear Details set Inactive" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
}
unset($header["Other_PapSmearID"]);
$header["Other_PapSmearCreated"] = date("Y-m-d h:i:s");
$header["Other_PapSmearLastUpdated"] =date("Y-m-d h:i:s");
$header["Other_PapSmearUserID"] = 3;
$header["Other_PapSmearIsActive"] = "Y";
$header["Other_PapSmearT_OrderDetailID"] = $detailID;
$qry = $this->db->insert("other_papsmear",$header);
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError PapSmear Add Header" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$papsmearID= $this->db->insert_id();
if ($papsmearID == 0 ) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError PapSmear ID Header" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
foreach($detail as $key => $d ) {
if ($key == "bahan") {
foreach($d as $idx => $xd) {
$detail[$key][$idx]["Other_PapSmearBahanOther_PapSmearID"] = $papsmearID ;
$detail[$key][$idx]["Other_PapSmearBahanUserID"] = 3;
$detail[$key][$idx]["Other_PapSmearBahanIsActive"] = "Y";
unset($detail[$key][$idx]["Other_PapSmearBahanID"]);
unset($detail[$key][$idx]["Other_PapSmearBahanCreated"]);
unset($detail[$key][$idx]["Other_PapSmearBahanLastUpdated"]);
}
$qry = $this->db->insert_batch("other_papsmearbahan",$detail[$key]);
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError PapSmear Add Bahan " . print_r($this->db->error(),true),FILE_APPEND);
return;
}
}
if ($key == "category") {
foreach($d as $idx => $xd) {
$detail[$key][$idx]["Other_PapSmearCategoryOther_PapSmearID"] = $papsmearID ;
$detail[$key][$idx]["Other_PapSmearCategoryUserID"] = 3;
$detail[$key][$idx]["Other_PapSmearCategoryIsActive"] = "Y";
unset($detail[$key][$idx]["Other_PapSmearCategoryID"]);
unset($detail[$key][$idx]["Other_PapSmearCategoryCreated"]);
unset($detail[$key][$idx]["Other_PapSmearCategoryLastUpdated"]);
}
$qry = $this->db->insert_batch("other_papsmearcategory",$detail[$key]);
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError PapSmear Add Category " . print_r($this->db->error(),true),FILE_APPEND);
return;
}
}
if ($key == "check") {
foreach($d as $idx => $xd) {
$detail[$key][$idx]["Other_PapSmearCheckOther_PapSmearID"] = $papsmearID ;
$detail[$key][$idx]["Other_PapSmearCheckUserID"] = 3;
$detail[$key][$idx]["Other_PapSmearCheckIsActive"] = "Y";
unset($detail[$key][$idx]["Other_PapSmearCheckID"]);
unset($detail[$key][$idx]["Other_PapSmearCheckCreated"]);
unset($detail[$key][$idx]["Other_PapSmearCheckLastUpdated"]);
}
$qry = $this->db->insert_batch("other_papsmearcheck",$detail[$key]);
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError PapSmear Add Check " . print_r($this->db->error(),true),FILE_APPEND);
return;
}
}
if ($key == "details") {
foreach($d as $idx => $xd) {
$detail[$key][$idx]["Other_PapSmearDetailsOther_PapSmearID"] = $papsmearID ;
$detail[$key][$idx]["Other_PapSmearDetailsUserID"] = 3;
$detail[$key][$idx]["Other_PapSmearDetailsIsActive"] = "Y";
unset($detail[$key][$idx]["Other_PapSmearDetailsID"]);
unset($detail[$key][$idx]["Other_PapSmearDetailsCreated"]);
unset($detail[$key][$idx]["Other_PapSmearDetailsLastUpdated"]);
}
$qry = $this->db->insert_batch("other_papsmeardetails",$detail[$key]);
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError PapSmear Add Details " . print_r($this->db->error(),true),FILE_APPEND);
return;
}
}
if ($key == "maturasi") {
foreach($d as $idx => $xd) {
$detail[$key][$idx]["Other_PapSmearMaturasiOther_PapSmearID"] = $papsmearID ;
$detail[$key][$idx]["Other_PapSmearMaturasiUserID"] = 3;
$detail[$key][$idx]["Other_PapSmearMaturasiIsActive"] = "Y";
unset($detail[$key][$idx]["Other_PapSmearMaturasiID"]);
unset($detail[$key][$idx]["Other_PapSmearMaturasiCreated"]);
unset($detail[$key][$idx]["Other_PapSmearMaturasiLastUpdated"]);
}
$qry = $this->db->insert_batch("other_papsmearmaturasi",$detail[$key]);
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError PapSmear Add Maturasi " . print_r($this->db->error(),true),FILE_APPEND);
return;
}
}
}
}
function update_lcprep($detailID, $header, $detail ) {
$sql = "select * from t_orderdetail where T_OrderDetailID = ? ";
$qry = $this->db->query($sql, array($detailID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Lcprep cek Validation " . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$rows = $qry->result_array();
if (count($rows) == 0 ) return;
if ($rows[0]["T_OrderDetailValidation"] == "Y" ) return;
$sql = "select Other_LcprepID from other_lcprep where Other_LcprepT_orderDetailID = ? and Other_LcprepIsActive = 'Y'";
$qry = $this->db->query($sql, array($detailID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Lcprep cek Existence " . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$rows = $qry->result_array();
$lcprepID = 0;
if (count($rows) > 0 ) $lcprepID = $rows[0]["Other_LcprepID"];
if ( $lcprepID > 0 ) {
$sql = "update other_lcprep set Other_LcprepIsActive = 'N' where Other_LcprepID = ? ";
$qry = $this->db->query($sql, array($lcprepID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Lcprep set Inactive" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$sql = "update other_lcprepadekuasi set Other_LcprepAdekuasiIsActive = 'N' where Other_LcprepAdekuasiOther_LcprepID= ? ";
$qry = $this->db->query($sql, array($lcprepID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Lcprep Adekuasi set Inactive" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$sql = "update other_lcprepinterpretasi set Other_LcprepInterpretasiIsActive = 'N' where Other_LcprepInterpretasiOther_LcprepID= ? ";
$qry = $this->db->query($sql, array($lcprepID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Lcprep Interpretasi set Inactive" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$sql = "update other_lcprepdetails set Other_LcprepDetailsIsActive = 'N' where Other_LcprepDetailsOther_LcprepID= ? ";
$qry = $this->db->query($sql, array($lcprepID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Lcprep Details set Inactive" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$sql = "update other_lcprepkategoriumum set Other_LcprepKategoriUmumIsActive = 'N' where Other_LcprepKategoriUmumOther_LcprepID= ? ";
$qry = $this->db->query($sql, array($lcprepID));
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Lcprep KategoriUmum set Inactive" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
}
unset($header["Other_LcprepID"]);
$header["Other_LcprepCreated"] = date("Y-m-d h:i:s");
$header["Other_LcprepLastUpdated"] =date("Y-m-d h:i:s");
$header["Other_LcprepUserID"] = 3;
$header["Other_LcprepIsActive"] = "Y";
$header["Other_LcprepT_orderDetailID"] = $detailID;
$qry = $this->db->insert("other_lcprep",$header);
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Lcprep Add Header" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
$lcprepID= $this->db->insert_id();
if ($lcprepID == 0 ) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Lcprep ID Header" . print_r($this->db->error(),true),FILE_APPEND);
return;
}
foreach($detail as $key => $d ) {
if ($key == "adekuasi") {
foreach($d as $idx => $xd) {
$detail[$key][$idx]["Other_LcprepAdekuasiOther_LcprepID"] = $lcprepID ;
$detail[$key][$idx]["Other_LcprepAdekuasiUserID"] = 3;
$detail[$key][$idx]["Other_LcprepAdekuasiIsActive"] = "Y";
unset($detail[$key][$idx]["Other_LcprepAdekuasiID"]);
unset($detail[$key][$idx]["Other_LcprepAdekuasiCreated"]);
unset($detail[$key][$idx]["Other_LcprepAdekuasiLastUpdated"]);
}
$qry = $this->db->insert_batch("other_lcprepadekuasi",$detail[$key]);
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Lcprep Add Adekuasi " . print_r($this->db->error(),true),FILE_APPEND);
return;
}
}
if ($key == "interpretasi") {
foreach($d as $idx => $xd) {
$detail[$key][$idx]["Other_LcprepInterpretasiOther_LcprepID"] = $lcprepID ;
$detail[$key][$idx]["Other_LcprepInterpretasiUserID"] = 3;
$detail[$key][$idx]["Other_LcprepInterpretasiIsActive"] = "Y";
unset($detail[$key][$idx]["Other_LcprepInterpretasiID"]);
unset($detail[$key][$idx]["Other_LcprepInterpretasiCreated"]);
unset($detail[$key][$idx]["Other_LcprepInterpretasiLastUpdated"]);
}
$qry = $this->db->insert_batch("other_lcprepinterpretasi",$detail[$key]);
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Lcprep Add Interpretasi " . print_r($this->db->error(),true),FILE_APPEND);
return;
}
}
if ($key == "details") {
foreach($d as $idx => $xd) {
$detail[$key][$idx]["Other_LcprepDetailsOther_LcprepID"] = $lcprepID ;
$detail[$key][$idx]["Other_LcprepDetailsUserID"] = 3;
$detail[$key][$idx]["Other_LcprepDetailsIsActive"] = "Y";
unset($detail[$key][$idx]["Other_LcprepDetailsID"]);
unset($detail[$key][$idx]["Other_LcprepDetailsCreated"]);
unset($detail[$key][$idx]["Other_LcprepDetailsLastUpdated"]);
}
$qry = $this->db->insert_batch("other_lcprepdetails",$detail[$key]);
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Lcprep Add Details " . print_r($this->db->error(),true),FILE_APPEND);
return;
}
}
if ($key == "kategoriumum") {
foreach($d as $idx => $xd) {
$detail[$key][$idx]["Other_LcprepKategoriUmumOther_LcprepID"] = $lcprepID ;
$detail[$key][$idx]["Other_LcprepKategoriUmumUserID"] = 3;
$detail[$key][$idx]["Other_LcprepKategoriUmumIsActive"] = "Y";
unset($detail[$key][$idx]["Other_LcprepKategoriUmumID"]);
unset($detail[$key][$idx]["Other_LcprepKategoriUmumCreated"]);
unset($detail[$key][$idx]["Other_LcprepKategoriUmumLastUpdated"]);
}
$qry = $this->db->insert_batch("other_lcprepkategoriumum",$detail[$key]);
if(!$qry) {
file_put_contents("/xtmp/dbg-xstatus_branch-v3.log", "\nError Lcprep Add KategoriUmum " . print_r($this->db->error(),true),FILE_APPEND);
return;
}
}
}
}
function update() {
$prm = $this->sys_input;
foreach($prm as $p) {
$deliveryOrderID = $p["incomingRefT_RefDeliveryOrderID"];
$detailID = $p["incomingRefDetailT_OrderDetailID"];
$normalValueID = $p["T_OrderDetailNat_NormalValueID"];
$result = $p["T_OrderDetailResult"];
$resultnote = $p["T_OrderDetailNote"];
$validation = $p["T_OrderDetailValidation"];
$verification = $p["T_OrderDetailVerification"];
$status = $p["incomingRefDetailStatus"];
$note = '';
if (isset($p["note"])) $note = $p["note"];
if ($validation == "Y") {
$ret = $this->update_delivery($deliveryOrderID,$detailID,"$result","VALIDATION",$note);
if ($ret) $ret = $this->update_order($detailID,$result,$resultnote,$normalValueID);
if (isset($p["nonlab_result"])) {
$type = $p["nonlab_result"]["type"];
$header = $p["nonlab_result"]["header"];
$detail = $p["nonlab_result"]["detail"];
if ($type == "mikro" ) {
$this->update_mikro($detailID,$header,$detail);
}
if ($type == "papsmear" ) {
$this->update_papsmear($detailID,$header,$detail);
}
if ($type == "lcprep" ) {
$this->update_lcprep($detailID,$header,$detail);
}
if ($type == "fna" ) {
$this->update_fna($detailID,$header,$detail);
}
if ($type == "cytologi" ) {
$this->update_cytologi($detailID,$header,$detail);
}
}
} elseif($verification == "Y") {
$ret = $this->update_delivery($deliveryOrderID,$detailID,"$result","VERIFICATION",$note);
} elseif($status != "N") {
$ret = $this->update_delivery($deliveryOrderID,$detailID,"Diterima");
} else {
$ret = $this->update_delivery($deliveryOrderID,$detailID,"Ditolak");
}
if (! $ret ) {
echo json_encode( array("status"=>"ERR", "message"=> print_r($this->db->error(),true) ));
exit;
}
}
echo json_encode( array("status"=>"OK", "message"=>""));
}
function update_delivery($deliveryOrderID,$detailID,$value,$stage = "", $note = "" ) {
$sql = "select T_RefDeliveryOrderDetailT_OrderDetailID ,
T_RefDeliveryOrderDetailID,
T_RefDeliveryOrderChildID
from t_ref_deliveryorder_child
join t_ref_deliveryorder_detail on
T_RefDeliveryOrderChildT_RefDeliveryOrderDetailID = T_RefDeliveryOrderDetailID
where T_RefDeliveryOrderDetailT_RefDeliveryOrderID = ?
and T_RefDeliveryOrderChildT_OrderDetailID = ?";
$qry = $this->db->query($sql, array($deliveryOrderID, $detailID));
$flag_child = false;
$child_id = 0;
$refDeliveryOrderDetailID = 0;
if ($qry) {
$rows = $qry->result_array();
if (count($rows) > 0 ) {
$flag_child = true;
$child_id = $rows[0]["T_RefDeliveryOrderChildID"];
$parentDetailID = $rows[0]["T_RefDeliveryOrderDetailID"];
}
}
if ($flag_child) {
$sql = "update t_ref_deliveryorder_child
set T_RefDeliveryOrderChildResult = ?,
T_RefDeliveryOrderChildStage= ? ,
T_RefDeliveryOrderChildNote = ?
where T_RefDeliveryOrderChildID=?";
$qry = $this->db->query($sql, array($value, $state, $note, $child_id));
$value = "...";
$detailID = $parentDetailID;
}
if ($flag_child) {
$sql = "update t_ref_deliveryorder_detail
set T_RefDeliveryOrderDetailResult = ?,
T_RefDeliveryOrderDetailStage = ?,
T_RefDeliveryOrderDetailNote = ?
where T_RefDeliveryOrderDetailT_RefDeliveryOrderID = ?
and T_RefDeliveryOrderDetailID = ?";
} else {
$sql = "update t_ref_deliveryorder_detail
set T_RefDeliveryOrderDetailResult = ?,
T_RefDeliveryOrderDetailStage = ?,
T_RefDeliveryOrderDetailNote = ?
where T_RefDeliveryOrderDetailT_RefDeliveryOrderID = ?
and T_RefDeliveryOrderDetailT_OrderDetailID = ?";
}
$qry = $this->db->query($sql, array($value, $stage, $note, $deliveryOrderID, $detailID));
return $qry;
}
function update_order($detailID,$value,$resultnote,$normalValueID) {
$verUserID = 3;
$sql = "update t_orderdetail
set T_OrderDetailResult = ?,
T_OrderDetailNote = ?,
T_OrderDetailNat_NormalValueID = ?,
T_OrderDetailVerification = 'Y',
T_OrderDetailVerDate = now(),
T_OrderDetailVerUserID = $verUserID
where T_OrderDetailID = ?";
$qry = $this->db->query($sql, array($value,$resultnote, $normalValueID, $detailID));
if ( $qry) {
$sql = "update t_orderdetail, nat_normalvalue, nat_methode
set T_OrderDetailNat_MethodeID = Nat_NormalValueNat_MethodeID ,
T_OrderDetailNat_MethodeName = Nat_MethodeName,
T_OrderDetailNormalValueNote = Nat_NormalValueNote,
T_OrderDetailNormalValueDescription = Nat_NormalValueDescription,
T_OrderDetailMinValue = Nat_NormalValueMinValue,
T_OrderDetailMaxValue = Nat_NormalValueMaxValue,
T_OrderDetailMinValueInclusive = Nat_NormalValueMinValueInclusive,
T_OrderDetailMaxValueInclusive = Nat_NormalValueMaxValueInclusive
where T_OrderDetailID = ?
and T_OrderDetailNat_NormalValueID = Nat_NormalValueID
and Nat_NormalValueNat_MethodeID = Nat_MethodeID";
$qryn = $this->db->query($sql, array($detailID));
//if (! $qryn ) print_r($this->db->error());
if (! $qryn ) return false;
$sql = "call sp_set_normal_value_flag(?)";
$qryu = $this->db->query($sql, array($detailID));
//if (! $qryu ) print_r($this->db->error());
if (! $qryu ) return false;
$this->clean_mysqli_connection($this->db->conn_id);
}
return $qry;
}
}