db_onedev = $this->load->database("onedev", true); } function selected_sample() { try { //# cek token valid if (! $this->isLogin) { $this->sys_error("Invalid Token"); exit; } $prm = $this->sys_input; $id = $prm['id']; $barcode = $prm['barcode']; $sql = $this->db_onedev->query("SELECT COUNT(*) as semua FROM incoming_ref_detail WHERE incomingRefDetailIncomingRefID = '{$id}'")->row(); $semua = $sql->semua; $sql = $this->db_onedev->query("SELECT COUNT(*) as terima FROM incoming_ref_detail WHERE incomingRefDetailIncomingRefID = '{$id}' AND incomingRefDetailStatus <> 'N'")->row(); $terima = $sql->terima; $sql = $this->db_onedev->query("SELECT incomingRefIsConfirm as konfirmasi FROM incoming_ref WHERE incomingRefID = '{$id}'")->row(); $konfirmasi = $sql->konfirmasi; $sql = "SELECT *, IF(incomingRefDetailStatus = 'N' AND nosample = '{$barcode}', 'R', incomingRefDetailStatus) as ischoose FROM (SELECT incoming_ref_detail.*, incomingRefDetailStatus as ischoose, LEFT(incomingRefDetailT_BarcodeLabBarcode,12) as nosample, '{$semua}' as semua, '{$terima}' as terima from incoming_ref_detail where incomingRefDetailIncomingRefID = '{$id}') a GROUP BY nosample"; // echo $sql; $query = $this->db_onedev->query($sql); if ($query) { $rows = $query->result_array(); } else { $this->sys_error_db( $this->db_onedev->last_query() ); exit; } $result = array ("total" => count($rows), "records" => $rows, "semua" => $semua, "terima" => $terima, "konfirmasi" => $konfirmasi); $this->sys_ok($result); } catch(Exception $exc) { $message = $exc->getMessage(); $this->sys_error($message); } } function confirmdeliveryorder(){ if (! $this->isLogin) { $this->sys_error("Invalid Token"); exit; } $prm = $this->sys_input; $userid = $this->sys_user["M_UserID"]; $incomingRefID = $prm["id"]; $sql = "select M_BranchID, M_BranchIPAddress from m_branch join incoming_ref on M_BranchID = incomingRefM_BranchID where incomingRefID = ?"; $qry = $this->db_onedev->query($sql, array($incomingRefID)); $branchID = 0; if ($qry) { $rows = $qry->result_array(); if(count($rows)>0) { $branchID = $rows[0]["M_BranchID"]; $branchIPAddress = $rows[0]["M_BranchIPAddress"]; } } if ($branchID == 0 ) { $this->sys_errror("Invalid Branch ID"); //file_put_contents("/xtmp/log-confirmdeliveryorder.log","Invalid Branch ID\n", FILE_APPEND); exit; } $a_accept = array(); $a_reject = array(); $s_ids = "0"; foreach($prm["dodetail"] as $idx => $detail) { $orderHeaderID = $detail["incomingRefDetailT_OrderHeaderID"]; if (! isset($a_accept[$orderHeaderID]) ) { $a_accept[$orderHeaderID] = array(); $a_reject[$orderHeaderID] = array(); } if ($detail["ischoose"] == "N" ) { $a_reject[$orderHeaderID][] = $detail["incomingRefDetailID"]; } else { $a_accept[$orderHeaderID][] = $detail["incomingRefDetailID"]; $s_ids .= "," . $detail["incomingRefDetailID"]; } } //all px dengan sampletype yg sama $sql = "select incomingRefDetailID from incoming_ref_detail join t_test on incomingRefDetailT_TestID = T_TestID and T_TestT_SampleTypeID in ( select T_TestT_SampleTypeID from incoming_ref_detail join t_test on IncomingRefDetailT_TestID = T_TestID where incomingRefDetailID in ( $s_ids ) ) where incomingRefDetailIncomingRefID = ?"; $qry = $this->db_onedev->query($sql, array($incomingRefID)); $s_ids = "0"; if ($qry) { $rows = $qry->result_array(); foreach($rows as $r) { $s_ids .= "," . $r["incomingRefDetailID"]; } } if($s_ids != "0" ) { $sql = "update incoming_ref_detail set incomingRefDetailStatus = 'Y' where incomingRefDetailID in ( $s_ids ) "; $qry = $this->db_onedev->query($sql); } //generate order $rst = $this->ref_order($incomingRefID); if ($rst["status"] != "OK" ) { $this->sys_error($rst["message"]); //file_put_contents("/xtmp/log-confirmdeliveryorder.log","Ref Order:" . $rst["message"] . "\n", FILE_APPEND); 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); $note = $rst["message"]; //insert to $sql = "insert into tx_branch_status(TxBranchStatusStage, TxBranchStatusM_BranchID, TxBranchStatusM_BranchIP, TxBranchStatusJson,TxBranchStatusNote ) values ('CONFIRM',?,?,?,?)"; $qry = $this->db_onedev->query($sql, array($branchID, $branchIPAddress, $param, $note)); } $this->clean_mysqli_connection($this->db_onedev->conn_id); $sql = "update incoming_ref set incomingRefIsConfirm = 'Y' where incomingRefID = ?"; $qry = $this->db_onedev->query($sql, array($incomingRefID)); $this->sys_ok($rst["message"]); exit; } function ref_order($incomingRefID) { //$adminUserID = 3; $adminUserID = $this->sys_user["M_UserID"] ; $sql = "select * from incoming_ref where incomingRefID = ?"; $qry = $this->db_onedev->query($sql, array($incomingRefID) ); $rows = array(); $branchID = 0; if ($qry) { $rows = $qry->result_array(); if ( count($rows) > 0 ) $branchID = $rows[0]["incomingRefM_BranchID"]; } if ($branchID == 0 ) { return array( "status" => "ERR", "message" => "Branch belum di set"); } $companyID = 0; if ($branchID > 0 ) { $sql = "select * from m_branch where M_BranchID = ?"; $qry = $this->db_onedev->query($sql, array($branchID) ); if ($qry) { $rows = $qry->result_array(); $companyID = $rows[0]["M_BranchM_CompanyID"]; $mouID = $rows[0]["M_BranchM_MouID"]; $doctorID = $rows[0]["M_BranchM_DoctorID"]; $doctorAddressID = $rows[0]["M_BranchM_DoctorAddressID"]; $branchKelurahanID= $rows[0]["M_BranchM_KelurahanID"]; $branchAddresss = $rows[0]["M_BranchAddress"]; } } if ($companyID == 0 ) { return array( "status" => "ERR", "message" => "Branch / Company/MOU belum di set"); } //create order yg di confirm saja $sql = "select * from incoming_ref_detail where incomingRefDetailIncomingRefID = ? and incomingRefDetailStatus = 'Y' order by incomingRefDetailT_OrderHeaderID"; $qry = $this->db_onedev->query($sql, array($incomingRefID) ); $orders = array(); $ax_test = array(); $a_promise = array(); $a_barcode = array(); if ($qry) { $rows = $qry->result_array(); $prev_oh_id = 0; foreach($rows as $r) { $oh_id = $r["incomingRefDetailT_OrderHeaderID"]; if ( ! isset($orders[$oh_id]) ) { $orders[$oh_id]["patient"] = json_decode($r["incomingRefDetailPatient"],true); $orders[$oh_id]["foNote"] = $r["incomingRefDetailFoNote"]; $orders[$oh_id]["verificationNote"] = $r["incomingRefDetailVefificationNote"]; $orders[$oh_id]["samplingNote"] = $r["incomingRefDetailSamplingNote"]; $orders[$oh_id]["LabNumber"] = $r["incomingRefDetailT_OrderHeaderLabNumber"]; $orders[$oh_id]["test"] = array(); } $orders[$oh_id]["test"][] = array ( "T_TestID" => $r["incomingRefDetailT_TestID"], "Promise" => $r["incomingRefDetailT_OrderPromiseDateTime"], "T_OrderDetailID" => $r["incomingRefDetailT_OrderDetailID"], "T_BarcodeLabBarcode" => $r["incomingRefDetailT_BarcodeLabBarcode"], "Requirements" => json_decode($r["incomingRefDetailRequirements"],true) ); $ax_test[] = $r["incomingRefDetailT_TestID"]; $a_promise[$oh_id][$r["incomingRefDetailT_TestID"]] = $r["incomingRefDetailT_OrderPromiseDateTime"]; $a_barcode[$oh_id][$r["incomingRefDetailT_TestID"]] = $r["incomingRefDetailT_BarcodeLabBarcode"]; } } $s_test = "0," . join(",",$ax_test); $sql = "select * from ss_price_mou where Ss_PriceMouM_MouID = ? and T_TestID in ( $s_test ) "; $qry = $this->db_onedev->query($sql, array($mouID) ); //test primer sama dengan T_TestID $a_test = array(); if ($qry ) { $rows = $qry->result_array(); foreach($rows as $r) { $testID = $r["T_TestID"]; $a_test[$testID] = array( "T_PriceAmount" => $r["T_PriceAmount"], "T_PriceDiscRp" => $r["T_PriceDiscRp"], "T_PriceDisc" => $r["T_PriceDisc"] ); } } //test sekunder dari Nat_Test $a_test_v2 = array(); $sql = "select ss_price_mou.* from ss_price_mou where Ss_PriceMouM_MouID = ? and ss_price_mou.T_TestID in ( select s.T_TestID from t_test s join t_test p on s.T_TestNat_TestID = p.T_TestNat_TestID and p.T_TestID in ( $s_test ) ) "; $qry = $this->db_onedev->query($sql, array($mouID) ); //test primer sama dengan T_TestID if ($qry ) { $rows = $qry->result_array(); foreach($rows as $r) { $testID = $r["T_TestID"]; $a_test_v2[$testID] = array( "T_PriceAmount" => $r["T_PriceAmount"], "T_PriceDiscRp" => $r["T_PriceDiscRp"], "T_PriceDisc" => $r["T_PriceDisc"] ); } } $message = ""; foreach($orders as $oh_id => $o){ $noreg = $o["patient"]["M_PatientNoReg"]; $lab_number= $o["LabNumber"]; //if noreg not exists create patient $sql = "select count(*) tot from m_patient where M_PatientNoReg=? and M_PatientIsActive = 'Y'"; $qry = $this->db_onedev->query($sql, array($noreg)); $patientID = 0; if($qry) { $rows = $qry->result_array(); if ($rows[0]["tot"] == 0 ) { $patientID = $this->create_patient($orders[$oh_id]["patient"], $adminUserID); } else { $patientID = $orders[$oh_id]["patient"]["M_PatientID"]; } } if ($patientID == 0 ) { if ($message != "" ) $message .= ","; $message .= "[ $lab_number, gagal buat pasien $noreg ]"; continue; } $sql = "select fn_global_age_count(M_PatientDOB,now()) age from m_patient where M_PatientID = ? "; $qry = $this->db_onedev->query($sql, array($patientID) ); $patientAge = ""; if ($qry) { $rows = $qry->result_array(); if (count($rows) > 0 ) { $patientAge = $rows[0]["age"]; } } //echo "1. $lab_number : $patientID \n"; //register order $xheader = array( 'patient_id' => $patientID, 'age' => $patientAge, 'sender_doctor_id' => $doctorID, 'sender_address_id' => $doctorAddressID, 'company_id' => $companyID, 'mou_id' => $mouID, 'lang_id' => '1', 'lang_si' => 'N', 'doctor_note' => '', 'fo_note' => $orders[$oh_id]["foNote"], 'queue' => '', 'received_sample' => 'Y', 'lang_id_2' => '2', 'lang_si_2' => 'N', ); $xdel = array( array( 'address_id' => $branchID, 'delivery_id' => '10', 'delivery_type_id' => '2', 'senderdoctorid' => $doctorID, 'senderaddressid' => $doctorAddressID, 'note' => $branchAddresss, 'kelurahan' => $branchKelurahanID )); $xdet = array(); $reqs = array(); foreach($orders[$oh_id]["test"] as $t ) { if ( isset($a_test[$t["T_TestID"]]) ) { $v=$a_test[$t["T_TestID"]]; $xdet[] = array( 't_id' => $t['T_TestID'], 't_cito' => 'N', 't_price' => $v['T_PriceAmount'], 't_disc' => $v['T_PriceDisc'], 't_discrp' => $v['T_PriceDiscRp'], 't_req' => 'Y', 't_reqnote' => '', 't_ispacket' => "N", 't_packettype' => "PX", 't_packetid' => '0' ); } elseif ( isset($a_test_v2["T_TestID"] ) ) { $v=$a_test_v2[$t["T_TestID"]]; $xdet[] = array( 't_id' => $t['T_TestID'], 't_cito' => 'N', 't_price' => $v['T_PriceAmount'], 't_disc' => $v['T_PriceDisc'], 't_discrp' => $v['T_PriceDiscRp'], 't_req' => 'Y', 't_reqnote' => '', 't_ispacket' => "N", 't_packettype' => "PX", 't_packetid' => '0' ); } else { $xdet[] = array( 't_id' => $t['T_TestID'], 't_cito' => 'N', 't_price' => 0, 't_disc' => 0, 't_discrp' => 0, 't_req' => 'Y', 't_reqnote' => '', 't_ispacket' => "N", 't_packettype' => "PX", 't_packetid' => '0' ); } if (count($t["Requirements"]) > 0 ) { $reqs = array_merge($reqs, $t["Requirements"]); } } //requirements $xreq = array( 'status' => 'Y', 'reqs' => '[]' ); $header_json = json_encode($xheader); $delivery_json = json_encode($xdel); $detail_json = json_encode($xdet); $req_json = json_encode($xreq); $sql = "CALL `sp_fo_register_save_v5`( 0, '{$header_json}', '{$delivery_json}', '{$detail_json}', '{$req_json}', '{$userid}' );"; $r = $this->db_onedev->query($sql)->row(); $this->clean_mysqli_connection($this->db_onedev->conn_id); if ($r->status != "OK" ) { if ($message != "" ) $message .= ","; $xmsg = print_r($r, true); $message .= "[ $lab_number, gagal sp_fo_register_save_v5 : $xmsg ]"; continue; } $data = json_decode($r->data,true); $new_oh_id = $data["id"]; $new_lab_number= $data["number"]; //echo "2. $new_oh_id : $lab_number => $new_lab_number \n"; //update incoming_ref $sql = "update incoming_ref_detail set incomingRefDetailNewT_OrderHeaderID=?, incomingRefDetailNewM_PatientID = ? where incomingRefDetailIncomingRefID = ? and incomingRefDetailT_OrderHeaderID=?"; $this->db_onedev->query($sql,array($new_oh_id, $patientID, $incomingRefID, $oh_id)); $sql = "update t_orderheaderaddon set T_OrderHeaderAddOnLabNumberOrigin=? where T_OrderHeaderAddOnT_OrderHeaderID = ?"; $this->db_onedev->query($sql,array($lab_number,$new_oh_id)); //update promise $a_promise_test = array(); $a_promise_date= array(); $a_promise_id= array(); foreach($a_promise[$oh_id] as $testID => $promise ) { if(!isset($a_promise_date[$promise])) { $sql = "insert into t_orderpromise(T_OrderPromiseT_OrderHeaderID, T_OrderPromiseDateTime) values(?,?)"; $this->db_onedev->query($sql, array($new_oh_id,$promise)); $promise_id = $this->db_onedev->insert_id(); $a_promise_test[$testID] = $promise_id; $a_promise_date["$promise"] = $promise_id; } else { $a_promise_test[$testID] = $a_promise_date["$promise"]; } } if ( count($a_promise_test) > 0 ) { $s_test = join(",", array_keys($a_promise_test)); $sql = "update t_orderpromise,t_orderdetail set T_OrderPromiseIsActive = 'N' where T_OrderPromiseID = T_OrderDetailT_OrderPromiseID and T_OrderDetailT_OrderHeaderID = ? and T_OrderDetailT_TestID in ($s_test) "; $this->db_onedev->query($sql, array($new_oh_id)); } foreach($a_promise_test as $testID => $promiseID ) { $sql = "update t_orderdetail set T_OrderDetailT_OrderPromiseID= ? where T_OrderDetailT_OrderHeaderID = ? and T_OrderDetailT_TestID = ? "; $this->db_onedev->query($sql, array($promiseID , $new_oh_id, $testID) ); } //insert requirements foreach($reqs as $r) { $sql ="insert into t_orderreq(T_OrderReqT_OrderHeaderID,T_OrderReqNat_PositionID, T_OrderReqStatus, T_OrderReqT_TestID, T_OrderReqs) values(?,?, ?,?,?)"; $this->db_onedev->query($sql, array($new_oh_id, $r["T_OrderReqNat_PositionID"], $r["T_OrderReqStatus"], $r["T_OrderReqT_TestID"], $r["T_OrderReqs"] )); } //update note $sql = "update t_orderheader set T_OrderHeaderFoNote = ? , T_OrderHeaderFoNoteM_UserID = ?, T_OrderHeaderSamplingNote = ?, T_OrderHeaderSamplingNoteM_UserID = ?, T_OrderHeaderVerificationNote = ?, T_OrderHeaderVerificationNoteM_UserID = ? where T_OrderHeaderID = ? "; $this->db_onedev->query($sql, array( $o["foNote"],$adminUserID, $o["samplingNote"], $adminUserID, $o["verificationNote"], $adminUserID, $new_oh_id)); $result = $this->fo_verify($new_oh_id,$adminUserID); //update t_barcodelab foreach($a_barcode[$oh_id] as $testID => $barcode) { $sql = "update t_barcodelab,t_test set T_BarcodeLabBarcodeOrigin =? where T_BarcodeLabT_OrderHeaderID = ? and T_TestID = ? and T_TestIsActive = 'Y' and T_BarcodeLabT_SampleTypeID = T_TestT_SampleTypeID"; $this->db_onedev->query($sql, array($barcode, $new_oh_id, $testID)); } // update nilai normal $sql = "select distinct T_OrderDetailT_OrderHeaderID id, T_TestT_SampleTypeID sid from t_orderdetail join t_test on T_OrderDetailT_OrderHeaderID = ? and T_OrderDetailIsActive = 'Y' and T_OrderDetailT_TestID = T_TestID and T_TestIsActive = 'Y' "; $qry = $this->db_onedev->query($sql, array($new_oh_id)); if ($qry) { $rows = $qry->result_array(); foreach($rows as $r) { $sql = "call sp_sampling_set_normal(?,?)"; $this->db_onedev->query($sql,array($r["id"],$r["sid"])); } } if ($message != "" ) $message .= ","; $message .= "[ $lab_number -> $new_lab_number Fo Verify : $result ]"; } return array( "status" => "OK", "message" => $message ); } function create_patient($p, $userID) { $sql = "insert into m_patient"; //check title $sql = "select M_TitleID from m_title where M_TitleName = ? and M_TitleIsActive = 'Y'"; $qry = $this->db_onedev->query($sql, array($p["title"]["M_TitleName"])); $titleID = 0; if ($qry) { $rows = $qry->result_array(); if (count($rows) > 0 ) $titleID = $rows[0]["M_TitleID"]; } if ($titleID == 0) { $sql = "insert into m_title(M_TitleName, M_TitleM_SexID) values ( ? , ? )"; $qry = $this->db_onedev->query($sql, array($p["title"]["M_TitleName"], $p["title"]["M_TitleM_SexID"])); if ($qry) { $titleID = $this->db_onedev->insert_id(); } } if ($titleID == 0 ) { return 0; } $pdob = date('Y-m-d',strtotime($p['M_PatientDOB'])); $query ="INSERT INTO m_patient ( M_PatientM_TitleID, M_PatientName, M_PatientDOB, M_PatientM_SexID, M_PatientM_ReligionID, M_PatientEmail, M_PatientPOB, M_PatientHP, M_PatientPhone, M_PatientM_IdTypeID, M_PatientIDNumber, M_PatientNote, M_PatientUserID ) VALUES( '{$titleID}', '{$p['M_PatientName']}', '{$pdob}', '{$p['M_PatientM_SexID']}', '{$p['M_PatientM_ReligionID']}', '{$p['M_PatientEmail']}', '{$p['M_PatientPOB']}', '{$p['M_PatientHP']}', '{$p['M_PatientPhone']}', '{$p['M_PatientM_IdTypeID']}', '{$p['M_PatientIDNumber']}', '{$p['M_PatientNote']}', $userID )"; $qry = $this->db_onedev->query($query); $patientID = 0; if ($qry ) { $patientID = $this->db_onedev->insert_id(); } // $sql = "insert into m_patientaddress(M_PatientAddressM_PatientID, M_PatientAddressNote, M_PatientAddressDescription,M_PatientAddressLocation,M_PatientAddressM_KelurahanID, M_PatientAddressOldCityID, M_PatientAddressPostCodeID, M_PatientAddressFax, M_PatientAddressEmail, M_PatientAddressPhone) values(?,?, ?,?,?, ?,?,?, ?,?) "; foreach($p["address"] as $adr) { $prm = array($patientID , $adr["M_PatientAddressNote"], $adr["M_PatientAddressDescription"],$adr["M_PatientAddressLocation"],$adr["M_PatientAddressM_KelurahanID"], $adr["M_PatientAddressOldCityID"], $adr["M_PatientAddressPostCodeID"], $adr["M_PatientAddressFax"], $adr["M_PatientAddressEmail"], $adr["M_PatientAddressPhone"] ); $this->db_onedev->query($sql,$prm); } return $patientID; } function fo_verify($orderID,$userID) { $sql="INSERT INTO fo_verificationsvalue ( Fo_VerificationsValueT_OrderHeaderID, Fo_VerificationsValueFo_VerificationsLabelID, Fo_VerificationsValueCheck, Fo_VerificationsValueNote, Fo_VerificationsValueUserID, Fo_VerificationsValueCreated ) SELECT {$orderID}, Fo_VerificationsLabelID, 'Y', '', {$userID}, NOW() FROM fo_verificationslabel WHERE Fo_VerificationsLabelIsActive = 'Y' "; $this->db_onedev->query($sql); $sql = "call sp_fo_barcode_generate({$orderID})"; $this->db_onedev->query($sql); $fostatusid = 3; $fologcode = 'FO.VERIFICATION.CONFIRM'; $sql = "insert into fo_status( Fo_StatusDate, Fo_StatusT_OrderHeaderID, Fo_StatusM_StatusID, Fo_StatusM_UserID, Fo_StatusCreated, Fo_StatusUpdated) values( now(), ?, ?, ?, now(),now())"; $query = $this->db_onedev->query($sql, array( $orderID, $fostatusid, $userID ) ); if (!$query) { return "Error Fo Status"; } $sql = "SELECT * FROM fo_verificationsvalue WHERE Fo_VerificationsValueT_OrderHeaderID = {$orderID}"; $data_log = array(); $data_log['orderid'] = $orderID; $data_log['values'] = $this->db_onedev->query($sql)->result_array(); $data_log['note'] = ''; $json_dt_log = json_encode($data_log); $sql = "insert into one_log.log_fo( Log_FoDate, Log_FoCode, Log_FoJson, Log_FoUserID) values( now(), ?, ?, ?)"; $query = $this->db_onedev->query($sql, array( $fologcode, $json_dt_log, $userID ) ); if (!$query) { return "Error Fo Log"; } /* T_OrderSample */ $adminUserID = $userID; $sql = "update t_ordersample set T_OrderSampleSampling='Y', T_OrderSampleSamplingDate = now(), T_OrderSampleSamplingTime = now(),T_OrderSampleSamplingUserID = $adminUserID, T_OrderSampleReceive='Y', T_OrderSampleReceiveDate = now() , T_OrderSampleReceiveTime = now(), T_OrderSampleReceiveUserID = $adminUserID, T_OrderSampleVerification='Y', T_OrderSampleVerificationDate=now(), T_OrderSampleVerificationTime=now(), T_OrderSampleVerificationUserID = $adminUserID, T_OrderSampleSendHandling = 'Y', T_OrderSampleSendHandlingDate =now(), T_OrderSampleSendHandlingTime=now(), T_OrderSampleSendHandlingUserID = $adminUserID, T_OrderSampleReceiveHandling = 'Y', T_OrderSampleReceiveHandlingDate=now(), T_OrderSampleReceiveHandlingTime=now(), T_OrderSampleReceiveHandlingUserID=$adminUserID, T_OrderSampleHandling='Y', T_OrderSampleHandlingDate=now(), T_OrderSampleHandlingTime=now(), T_OrderSampleHandlingUserID=$adminUserID, T_OrderSampleProcessing='Y', T_OrderSampleReadyToProcessDateTime=now(), T_OrderSampleProcessingDate=now(), T_OrderSampleProcessingTime=now(), T_OrderSampleProcessingUserID=$adminUserID, T_OrderSampleUserID=$adminUserID where T_OrderSampleT_OrderHeaderID = ?"; $qry = $this->db_onedev->query($sql, array($orderID) ); if (!$qry) { return "Error T_OrderSample : " . $this->db_onedev->last_query(); } return "OK"; } }