41 lines
1.3 KiB
PHP
41 lines
1.3 KiB
PHP
<?php
|
|
class Regonline_extract extends MY_Controller {
|
|
function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
function get_purpose($labNo) {
|
|
//get T_OrderAddOn
|
|
$sql = "select T_OrderHeaderID, T_OnlineTxJsonGz ,T_OnlineOrderT_OrderQrCode
|
|
from t_onlinetx
|
|
join t_onlineorder on T_OnlineTxID = T_OnlineOrderT_OnlineTxID
|
|
join t_orderheader on T_OnlineOrderT_OrderHeaderID = T_OrderHeaderID
|
|
and T_OrderHeaderLabNumber = ?";
|
|
$qry = $this->db->query($sql,array($labNo));
|
|
if (!$qry) {
|
|
echo "ERR : " . $this->db->error()['message'] . " | " . $this->db->last_query();
|
|
exit;
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0) {
|
|
echo "ERR order not found!";
|
|
exit;
|
|
}
|
|
$z_content = $rows[0]["T_OnlineTxJsonGz"];
|
|
$content = gzinflate($z_content);
|
|
$qrcode = $rows[0]["T_OnlineOrderT_OrderQrCode"];
|
|
$orderHeaderID = $rows[0]["T_OrderHeaderID"];
|
|
$json = json_decode($content,true);
|
|
$orders = $json["order"];
|
|
$order = array_filter( $orders, function($o) use($qrcode) {
|
|
if($o["T_OrderQrCode"] == $qrcode) {
|
|
return true;
|
|
}
|
|
return false;
|
|
});
|
|
if ( count($order) > 0 ) {
|
|
echo $qrcode . " : $orderHeaderID : " . $order[0]["Test_PurposeName"] . "\n";
|
|
}
|
|
}
|
|
}
|
|
?>
|