From 0f54702aa7afa1f29ae90189b40e126d1ecaa413 Mon Sep 17 00:00:00 2001 From: Hanan Askarim Date: Wed, 10 Jun 2026 15:47:03 +0700 Subject: [PATCH] update rujukan internal --- .../controllers/tools/Outgoingref_v3.php | 430 ++++++++++++++++++ .../controllers/tools/Xferbranch_v4.php | 145 +++--- 2 files changed, 507 insertions(+), 68 deletions(-) create mode 100644 application/controllers/tools/Outgoingref_v3.php diff --git a/application/controllers/tools/Outgoingref_v3.php b/application/controllers/tools/Outgoingref_v3.php new file mode 100644 index 00000000..7cadcc32 --- /dev/null +++ b/application/controllers/tools/Outgoingref_v3.php @@ -0,0 +1,430 @@ +db = $this->load->database("onedev", true); + } + 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["type"] = "mikro"; + $rows = $qry->result_array(); + if (count($rows) > 0) { + $result["header"] = $rows[0]; + } else { + return array(); + } + $sql = "select * from other_mikrodetails where Other_MikroDetailsOther_MikroID=? and + Other_MikroDetailsIsActive = 'Y' "; + $qry = $this->db->query($sql, array($xid)); + if ($qry) { + $result["detail"] = $qry->result_array(); + } + } + return $result; + } + + //cytologi + if ($type == "cytologi") { + $sql = "select * from other_cytologi where Other_CytologiID=? "; + $qry = $this->db->query($sql, array($xid)); + $result = array(); + if ($qry) { + $result["type"] = "cytologi"; + $rows = $qry->result_array(); + if (count($rows) > 0) { + $result["header"] = $rows[0]; + } else { + return array(); + } + $sql = "select * from other_cytologidetails where Other_CytologiDetailsOther_CytologiID=? and + Other_CytologiDetailsIsActive = 'Y' "; + $qry = $this->db->query($sql, array($xid)); + if ($qry) { + $result["detail"] = $qry->result_array(); + } + } + return $result; + } + + //fna + if ($type == "fna") { + $sql = "select * from other_fna where Other_FnaID=? "; + $qry = $this->db->query($sql, array($xid)); + $result = array(); + if ($qry) { + $result["type"] = "fna"; + $rows = $qry->result_array(); + if (count($rows) > 0) { + $result["header"] = $rows[0]; + } else { + return array(); + } + $sql = "select * from other_fnadetails where Other_FnaDetailsOther_FnaID=? and + Other_FnaDetailsIsActive = 'Y' "; + $qry = $this->db->query($sql, array($xid)); + if ($qry) { + $result["detail"] = $qry->result_array(); + } + } + return $result; + } + + //papsmear + // + if ($type == "papsmear") { + $sql = "select * from other_papsmear where Other_PapSmearID=? "; + $qry = $this->db->query($sql, array($xid)); + $result = array(); + if ($qry) { + $result["type"] = "papsmear"; + $rows = $qry->result_array(); + if (count($rows) > 0) { + $result["header"] = $rows[0]; + } else { + return array(); + } + $result["detail"] = array(); + //bahan + $sql = "select * from other_papsmearbahan where Other_PapSmearBahanOther_PapSmearID = ? + and Other_PapSmearBahanIsActive='Y'"; + $qry = $this->db->query($sql, array($xid)); + if ($qry) { + $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(); + } + // 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(); + } + // 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(); + } + // 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(); + } + } + return $result; + } + + //lcprep + // + if ($type == "lcprep") { + $sql = "select * from other_lcprep where Other_LcprepID=? "; + $qry = $this->db->query($sql, array($xid)); + $result = array(); + if ($qry) { + $result["type"] = "lcprep"; + $rows = $qry->result_array(); + if (count($rows) > 0) { + $result["header"] = $rows[0]; + } else { + return array(); + } + $result["detail"] = array(); + //adekuasi + $sql = "select * from other_lcprepadekuasi where Other_LcprepAdekuasiOther_LcprepID = ? + and Other_LcprepAdekuasiIsActive='Y'"; + $qry = $this->db->query($sql, array($xid)); + if ($qry) { + $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(); + } + // details + $sql = "select * from other_lcprepdetails + where Other_LcprepDetailsOther_LcprepID= ? + and Other_LcprepDetailsIsActive='Y'"; + $qry = $this->db->query($sql, array($xid)); + if ($qry) { + $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(); + } + } + return $result; + } + + return array(); + } + function process_nonlab($incomingRefDetailID) + { + //mikro + $sql = "select ifnull(Other_MikroID,0) mikroID + from incoming_ref_detail + join t_orderdetail on T_OrderDetailT_OrderHeaderID = incomingRefDetailNewT_OrderHeaderID + and T_OrderDetailT_TestID = incomingRefDetailT_TestID and T_OrderDetailIsActive = 'Y' + 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"; + return ""; + } + $rows = $qry->result_array(); + if (count($rows) > 0) { + $mikroID = $rows[0]["mikroID"]; + $nl = ""; + if ($mikroID > 0) { + $nl = $this->get_nonlab("mikro", $mikroID); + return $nl; + } + } + + //papsmear + $sql = "select ifnull(Other_PapSmearID,0) papsmearID + from incoming_ref_detail + join t_orderdetail on T_OrderDetailT_OrderHeaderID = incomingRefDetailNewT_OrderHeaderID + and T_OrderDetailT_TestID = incomingRefDetailT_TestID and T_OrderDetailIsActive = 'Y' + 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"; + return ""; + } + $rows = $qry->result_array(); + if (count($rows) > 0) { + $papsmearID = $rows[0]["papsmearID"]; + $nl = ""; + if ($papsmear > 0) { + $nl = $this->get_nonlab("papsmear", $papsmearID); + return $nl; + } + } + + //lcprep + $sql = "select ifnull(Other_LcprepID,0) lcprepID + from incoming_ref_detail + join t_orderdetail on T_OrderDetailT_OrderHeaderID = incomingRefDetailNewT_OrderHeaderID + and T_OrderDetailT_TestID = incomingRefDetailT_TestID and T_OrderDetailIsActive = 'Y' + 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"; + return ""; + } + $rows = $qry->result_array(); + if (count($rows) > 0) { + $lcprepID = $rows[0]["lcprepID"]; + $nl = ""; + if ($lcprepID > 0) { + $nl = $this->get_nonlab("lcprep", $lcprepID); + return $nl; + } + } + + //fna + $sql = "select ifnull(Other_FnaID,0) fnaID + from incoming_ref_detail + join t_orderdetail on T_OrderDetailT_OrderHeaderID = incomingRefDetailNewT_OrderHeaderID + and T_OrderDetailT_TestID = incomingRefDetailT_TestID and T_OrderDetailIsActive = 'Y' + 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"; + return ""; + } + $rows = $qry->result_array(); + if (count($rows) > 0) { + $fnaID = $rows[0]["fnaID"]; + $nl = ""; + if ($fnaID > 0) { + $nl = $this->get_nonlab("fna", $fnaID); + return $nl; + } + } + // + //cytology + $sql = "select ifnull(Other_CytologiID,0) cytologiID + from incoming_ref_detail + join t_orderdetail on T_OrderDetailT_OrderHeaderID = incomingRefDetailNewT_OrderHeaderID + and T_OrderDetailT_TestID = incomingRefDetailT_TestID and T_OrderDetailIsActive = 'Y' + 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"; + return ""; + } + $rows = $qry->result_array(); + if (count($rows) > 0) { + $cytologiID = $rows[0]["cytologiID"]; + $nl = ""; + if ($cytologiID > 0) { + $nl = $this->get_nonlab("cytologi", $cytologiID); + return $nl; + } + } + } + function process() + { + $sql = "select tx_branch_status.*, M_BranchName + from tx_branch_status + join m_branch on TxBranchStatusM_BranchID = M_BranchID + where TxBranchStatusIsSent = 'N' and TxBranchStatusRetry < 5 + limit 0,20"; + $qry = $this->db->query($sql); + $sql_update = "update tx_branch_status set TxBranchStatusIsSent=?, + TxBranchStatusRetry = TxBranchStatusRetry + 1 + where TxBranchStatusID = ?"; + if ($qry) { + $rows = $qry->result_array(); + foreach ($rows as $r) { + $param = $r["TxBranchStatusJson"]; + $stage = $r["TxBranchStatusStage"]; + $ipAddress = $r["TxBranchStatusM_BranchIP"]; + $branchName = $r["M_BranchName"]; + $txID = $r["TxBranchStatusID"]; + if ($stage == "VALIDATION") { + //cek nonlab + $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()) { + $j_param[$idx]["nonlab_result"] = $nonlab_result; + $param = json_encode($j_param); + } + } + } + } + $url = "http://$ipAddress/one-api-lab/tools/xstatusbranch_v3/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)); + } else { + $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)); + } + } + } else { + $this->xlog("Err: " . print_r($this->db->error(), true)); + } + } + function xlog($message) + { + $dt = date("Y-m-d H:i:s"); + echo "$dt $message\n"; + } + function status($incomingRefID) + { + $sql = "select * from incoming_ref where incomingRefID = ?"; + $qry = $this->db->query($sql, array($incomingRefID)); + $rows = array(); + $branchID = 0; + if ($qry) { + $rows = $qry->result_array(); + if (count($rows) > 0) $branchID = $rows[0]["incomingRefM_BranchID"]; + } + $ip_address = ""; + if ($branchID > 0) { + $sql = "select * + from m_branch where M_BranchID = ?"; + $qry = $this->db->query($sql, array($branchID)); + if ($qry) { + $rows = $qry->result_array(); + if (count($rows) > 0) $ip_address = $rows[0]["M_BranchIPAddress"]; + } + } + if ($ip_address == "") { + echo "No IP Address from $branchID "; + exit; + } + $sql = "select + incomingRefT_RefDeliveryOrderID, + incomingRefDetailT_OrderDetailID, + incomingRefDetailStatus, + T_OrderDetailResult, + T_OrderDetailNat_NormalValueID, + T_OrderDetailVerification, + T_OrderDetailValidation + from incoming_ref_detail + join incoming_ref on incomingRefID = incomingRefDetailIncomingRefID + and incomingRefID = ? + left join t_orderdetail on incomingRefDetailNewT_OrderHeaderID = T_OrderDetailT_OrderHeaderID + and T_OrderDetailIsActive = 'Y' and incomingRefDetailT_TestID = T_OrderDetailT_TestID"; + $qry = $this->db->query($sql, array($incomingRefID)); + if ($qry) { + $rows = $qry->result_array(); + $param = json_encode($rows); + $url = "http://$ip_address/one-api/tools/xstatusbranch_v2/update"; + $result = $this->post($url, $param); + } + } + function post($url, $data) + { + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); + curl_setopt($ch, CURLOPT_POSTFIELDS, $data); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + //curl_setopt($ch, CURLOPT_VERBOSE, true); + curl_setopt( + $ch, + CURLOPT_HTTPHEADER, + array( + 'Content-Type: application/json', + 'Content-Length: ' . strlen($data) + ) + ); + $result = curl_exec($ch); + curl_close($ch); + if ($result === false) { + return array( + "status" => "ERR", + "message" => curl_error($ch) + ); + } + $rst = json_decode($result, true); + return $rst; + } +} diff --git a/application/controllers/tools/Xferbranch_v4.php b/application/controllers/tools/Xferbranch_v4.php index d095be3c..ffe326d9 100644 --- a/application/controllers/tools/Xferbranch_v4.php +++ b/application/controllers/tools/Xferbranch_v4.php @@ -1,15 +1,18 @@ db = $this->load->database("onedev", true); } - function index() { + function index() + { echo "Xfer Branch API"; } - function batch() { + function batch() + { $this->fix(); $sql = "select T_RefDeliveryOrderID, T_RefDeliveryOrderNumber, @@ -25,13 +28,13 @@ class Xferbranch_v4 extends CI_Controller $tot_upload = 0; if ($qry) { $rows = $qry->result_array(); - foreach($rows as $r) { + foreach ($rows as $r) { $date = date("Y-m-d H:i:s "); $branch = $r["M_BranchName"]; $ip_address = $r["M_BranchIPAddress"]; $number = $r["T_RefDeliveryOrderNumber"]; - if ( $this->do($r["T_RefDeliveryOrderID"])) { + if ($this->do($r["T_RefDeliveryOrderID"])) { echo "$date [OK] uploaded {$number} to {$branch} @ $ip_address\n"; } else { echo "$date [ERR] uploaded {$number} to {$branch} @ $ip_address\n"; @@ -39,13 +42,14 @@ class Xferbranch_v4 extends CI_Controller $tot_upload++; } } - if ($tot_upload == 0 ) { + if ($tot_upload == 0) { $date = date("Y-m-d H:i:s "); echo "$date [OK] No upload data\n"; } } - function do($deliveryID) { + function do($deliveryID) + { $sql = "select distinct T_RefDeliveryOrderID, T_RefDeliveryOrderDate, @@ -81,20 +85,20 @@ class Xferbranch_v4 extends CI_Controller where T_RefDeliveryOrderID = ? and T_RefDeliveryOrderDetailIsConfirm = 'Y' "; - $qry = $this->db->query($sql, array($deliveryID) ); + $qry = $this->db->query($sql, array($deliveryID)); $rows = array(); $branch_ip_address = ""; - if($qry) { + if ($qry) { $rows = $qry->result_array(); - if (count($rows) == 0 ) { - echo "No Detail Records. => "; - $this->db->query("update t_ref_deliveryorder set T_RefDeliveryOrderIsConfirm = 'Z' where T_RefDeliveryOrderID = ?", array($deliveryID)); + if (count($rows) == 0) { + echo "No Detail Records. => "; + $this->db->query("update t_ref_deliveryorder set T_RefDeliveryOrderIsConfirm = 'Z' where T_RefDeliveryOrderID = ?", array($deliveryID)); return false; } - $sqlp = "select * from m_patient where M_PatientID = ?"; - $sqlpa = "select * from m_patientaddress where M_PatientAddressM_PatientID = ?"; - $sqlpt = "select * from m_title where M_TitleID = ?"; + $sqlp = "select * from m_patient where M_PatientID = ?"; + $sqlpa = "select * from m_patientaddress where M_PatientAddressM_PatientID = ?"; + $sqlpt = "select * from m_title where M_TitleID = ?"; $sqlt = "select T_OrderDetailT_TestID T_TestID, @@ -124,88 +128,88 @@ class Xferbranch_v4 extends CI_Controller left join t_orderpromise on T_OrderDetailT_OrderPromiseID = T_OrderPromiseID"; $arr_price_test = array(); - foreach($rows as $idx => $r) { + foreach ($rows as $idx => $r) { //patient & address $branch_ip_address = $r["DestinationIPAddress"]; $patientID = $r["T_OrderHeaderM_PatientID"]; $headerID = $r["T_OrderHeaderID"]; - $detailID= $r["T_OrderDetailID"]; + $detailID = $r["T_OrderDetailID"]; $deliveryDetailID = $r["T_RefDeliveryOrderDetailID"]; $qryp = $this->db->query($sqlp, array($patientID)); $patient = array(); if ($qryp) { $rowsp = $qryp->result_array(); - if( count($rowsp) > 0 ) { + if (count($rowsp) > 0) { $patient = $rowsp[0]; $titleID = $patient["M_PatientM_TitleID"]; $qrypa = $this->db->query($sqlpa, array($patientID)); if ($qrypa) { - $patient["address"] = $qrypa->result_array(); + $patient["address"] = $qrypa->result_array(); } $qrypt = $this->db->query($sqlpt, array($titleID)); if ($qrypt) { - $rowspt = $qrypt->result_array(); - if (count($rowspt) > 0 ) $patient["title"] = $rowspt[0]; + $rowspt = $qrypt->result_array(); + if (count($rowspt) > 0) $patient["title"] = $rowspt[0]; } - } + } } $rows[$idx]["patient"] = $patient; // test - $qryt = $this->db->query($sqlt,array($detailID)); + $qryt = $this->db->query($sqlt, array($detailID)); $arr_test = array(); - + if ($qryt) { $rowst = $qryt->result_array(); if (! isset($arr_price_test[$headerID])) { $arr_price_test[$headerID] = array(); } - foreach($rowst as $r ) { - $sasCode = substr($r["T_TestSasCode"],0,8); + foreach ($rowst as $r) { + $sasCode = substr($r["T_TestSasCode"], 0, 8); $curSasCode = $r["T_TestSasCode"]; - if ( ! isset($arr_price_test[$headerID][$sasCode]) ) { - if(strlen($curSasCode) == 8) $arr_price_test[$headerID][$sasCode] = true; + if (! isset($arr_price_test[$headerID][$sasCode])) { + if (strlen($curSasCode) == 8) $arr_price_test[$headerID][$sasCode] = true; $rows[$idx]["test"][] = $r; - $arr_test[]=$r["T_TestID"]; + $arr_test[] = $r["T_TestID"]; } } } // $child_test - $qryct = $this->db->query($sqlct,array($deliveryDetailID)); + $qryct = $this->db->query($sqlct, array($deliveryDetailID)); if ($qryct) { $rowsct = $qryct->result_array(); $rows[$idx]["child_test"] = $rowsct; } $reqs = array(); - if (count($arr_test) > 0 ) { + if (count($arr_test) > 0) { $sqlr = "select * from t_orderreq where T_OrderReqT_OrderHeaderID = ?"; $qryr = $this->db->query($sqlr, array($headerID)); if ($qryr) { $rowsr = $qryr->result_array(); - foreach($rowsr as $r) { + foreach ($rowsr as $r) { $a_test_r = json_decode($r["T_OrderReqT_TestID"]); - $a_x = array_intersect($arr_test,$a_test_r); - if( count($a_x) > 0 ) $reqs[] = $r; + $a_x = array_intersect($arr_test, $a_test_r); + if (count($a_x) > 0) $reqs[] = $r; } } } $rows[$idx]["requirements"] = $reqs; } - $o_rows=$rows; + $o_rows = $rows; $rows = array(); - foreach($o_rows as $r) { - if (isset($r["test"]) ) { + foreach ($o_rows as $r) { + if (isset($r["test"])) { $rows[] = $r; } } $param = json_encode($rows); - $url = "http://$branch_ip_address/one-api/tools/incomingref_v4/receive"; - - $result = $this->post($url,$param); - echo "to $url \nresponse : $result\n"; - $result = json_decode($result,true); - if ($result["status"] == "OK" ) { + $url = "http://$branch_ip_address/one-api-lab/tools/incomingref_v4/receive"; + + $result = $this->post($url, $param); + echo "to $url \nresponse : $result\n"; + $result = json_decode($result, true); + if ($result["status"] == "OK") { $sqlu = "update t_ref_deliveryorder set T_RefDeliveryOrderIsConfirm = 'S' where T_RefDeliveryOrderID = ?"; $this->db->query($sqlu, array($deliveryID)); @@ -214,13 +218,13 @@ class Xferbranch_v4 extends CI_Controller print_r($result); } } else { - print_r($this->db->error()); + print_r($this->db->error()); } return false; } public function fix() - { - $sql = "SELECT + { + $sql = "SELECT T_RefDeliveryOrderID, T_RefDeliveryOrderDetailT_WorklistRefConfirmDetailID, T_RefDeliveryOrderDate, @@ -242,34 +246,39 @@ WHERE T_RefDeliveryOrderDetailIsActive = 'Y' AND T_RefDeliveryOrderDetailT_BarcodeLabBarcode <> T_BarcodeLabBarcode AND T_RefDeliveryOrderDate >= '2024-08-01'"; - $qry = $this->db->query($sql); - $rows = $qry->result_array(); - - if (count($rows) > 0) { - foreach ($rows as $k => $v) { - $sql = "UPDATE t_ref_deliveryorder_detail + $qry = $this->db->query($sql); + $rows = $qry->result_array(); + + if (count($rows) > 0) { + foreach ($rows as $k => $v) { + $sql = "UPDATE t_ref_deliveryorder_detail SET T_RefDeliveryOrderDetailT_BarcodeLabBarcode = '{$v['T_BarcodeLabBarcode']}' WHERE T_RefDeliveryOrderDetailID = {$v['T_RefDeliveryOrderDetailID']}"; - $qry = $this->db->query($sql); - - $sql = "UPDATE t_worklist_ref_confirmdetail + $qry = $this->db->query($sql); + + $sql = "UPDATE t_worklist_ref_confirmdetail SET T_WorklistRefConfirmDetailT_BarcodeLabBarcode = '{$v['T_BarcodeLabBarcode']}' WHERE T_WorklistRefConfirmDetailID = {$v['T_RefDeliveryOrderDetailT_WorklistRefConfirmDetailID']}"; - $qry = $this->db->query($sql); - } - } - } - function post($url,$data) { + $qry = $this->db->query($sql); + } + } + } + function post($url, $data) + { $zdata = gzdeflate($data); - $ch = curl_init($url); - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); - curl_setopt($ch, CURLOPT_POSTFIELDS, $zdata); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); + curl_setopt($ch, CURLOPT_POSTFIELDS, $zdata); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //curl_setopt($ch, CURLOPT_VERBOSE, true); - curl_setopt($ch, CURLOPT_HTTPHEADER, array( - 'Content-Type: application/json', - 'Content-Length: ' . strlen($zdata)) - ); + curl_setopt( + $ch, + CURLOPT_HTTPHEADER, + array( + 'Content-Type: application/json', + 'Content-Length: ' . strlen($zdata) + ) + ); $result = curl_exec($ch); //echo "RST : $result "; return $result;