76 lines
2.5 KiB
PHP
76 lines
2.5 KiB
PHP
<?php
|
|
|
|
class Re_normal_method extends MY_Controller
|
|
{
|
|
var $db_smartone;
|
|
|
|
public function index()
|
|
{
|
|
echo "RE Normal Methode API";
|
|
}
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->db_smartone = $this->load->database("onedev", true);
|
|
}
|
|
|
|
public function search_method()
|
|
{
|
|
$prm = $this->sys_input;
|
|
|
|
$sql = "SELECT Nat_MethodeID, Nat_MethodeName
|
|
FROM nat_normalvalue
|
|
JOIN nat_methode ON Nat_NormalValueNat_MethodeID = Nat_MethodeID
|
|
WHERE Nat_NormalValueIsActive = 'Y' and Nat_MethodeIsActive = 'Y'
|
|
AND Nat_NormalValueNat_TestID = ?
|
|
GROUP BY Nat_MethodeID
|
|
ORDER BY Nat_MethodeName";
|
|
|
|
$query = $this->db_smartone->query($sql, [$prm['nattest_id']]);
|
|
if ($query)
|
|
{
|
|
$rows = $query->result_array();
|
|
$this->sys_ok(["records" => $rows]);
|
|
|
|
return;
|
|
}
|
|
|
|
$this->sys_error_db("Change Methode", $this->db_smartone);
|
|
}
|
|
|
|
public function save_method()
|
|
{
|
|
$prm = $this->sys_input;
|
|
|
|
$sql = "CALL sp_process_result_method_change(?, ?, ?)";
|
|
$query = $this->db_smartone->query($sql, [$prm['detail_id'], $prm['method_id'], $this->sys_user['M_UserID']]);
|
|
|
|
if ($query)
|
|
{
|
|
$rows = $query->result_array();
|
|
$xdata = json_decode($rows[0]["data"],true);
|
|
$this->clean_mysqli_connection($this->db_smartone->conn_id);
|
|
$sql = "select T_OrderDetailNormalValueNote, T_OrderDetailNormalValueDescription,
|
|
T_OrderDetailNat_MethodeID, T_OrderDetailNat_MethodeName
|
|
from t_orderdetail where T_OrderDetailID = ? ";
|
|
$qry2 = $this->db_smartone->query($sql,array($prm["detail_id"]));
|
|
if ($qry2) {
|
|
$rows = $qry2->result_array();
|
|
if (count($rows) > 0 ) {
|
|
$xdata["normal_note"] = $rows[0]["T_OrderDetailNormalValueNote"];
|
|
$xdata["normal_desc"] = $rows[0]["T_OrderDetailNormalValueDescription"];
|
|
$xdata["method_id"] = $rows[0]["T_OrderDetailNat_MethodeID"];
|
|
$xdata["method_name"] = $rows[0]["T_OrderDetailNat_MethodeName"];
|
|
}
|
|
}
|
|
$this->sys_ok(['data'=>$xdata, 'query'=>$this->db_smartone->last_query()]);
|
|
|
|
return;
|
|
}
|
|
|
|
$this->sys_error_db("Change Methode", $this->db_smartone);
|
|
}
|
|
}
|
|
?>
|