db->query($sql, [$nolab]);
if (!$qry) {
echo "
Error t_orderheader : " .
$this->db->error()["message"] .
"
";
exit();
}
$rows = $qry->result_array();
if (count($rows) == 0) {
echo " Order not found $nolab
";
exit();
}
$orderID = [];
foreach ($rows as $idx => $r) {
$orderID[] = $r["T_OrderHeaderID"];
unset($rows[$idx]["T_OrderHeaderID"]);
}
$this->print_table_style();
$this->print_table($rows, array_keys($rows[0]));
$sids = implode(",", $orderID);
$sql = "select T_OrderHeaderLabNumber, T_OrderDetailID,T_OrderDetailT_TestName,
T_OrderDetailID,T_OrderDetailResult,T_OrderDetailValUserID, T_OrderDetailValDate,T_OrderHeaderID
from
t_orderdetail
join t_orderheader on T_OrderDetailT_OrderHeaderID in ({$sids})
and T_OrderHeaderID = T_OrderDetailT_OrderHeaderID
and T_OrderDetailIsActive = 'Y'
order by T_OrderHeaderLabNumber";
$qry = $this->db->query($sql);
if (!$qry) {
echo " Error Get Order Detail : " .
$this->db->error()["message"] .
"|" .
$this->db->last_query() .
"
";
exit();
}
$rows = $qry->result_array();
$rows = array_filter($rows, function ($d) use ($px) {
return preg_match("/{$px}*/", $d["T_OrderDetailT_TestName"]) == 1;
});
$sql = "select * from auto_valid where AutoValidT_OrderDetailID = ?";
foreach ($rows as $idx => $r) {
echo " {$r["T_OrderHeaderLabNumber"]} | {$r["T_OrderDetailT_TestName"]} |
{$r["T_OrderDetailValUserID"]} | {$r["T_OrderDetailValDate"]} AutoVerif :
\n";
$qry = $this->db->query($sql, [$r["T_OrderDetailID"]]);
if (!$qry) {
echo " Error Get Auto Valid : " .
$this->db->error()["message"] .
"
";
exit();
}
$drows = $qry->result_array();
$this->print_table($drows, array_keys($drows[0]));
$url =
"http://localhost/one-api/process/auto_verif_valid/info_valid/" .
$r["T_OrderDetailID"];
$info = file_get_contents($url);
$ainfo = json_decode($info, true);
echo "INFO: [{$r["T_OrderDetailID"]}] \n";
print_r($ainfo);
echo "";
if ($info["image"] != "") {
$url_img = $ainfo["image"];
echo "
";
}
$url_status =
"http://localhost/one-api/process/auto_verif_valid/status/" .
$r["T_OrderHeaderID"];
$status = file_get_contents($url_status);
$astatus = json_decode($status, true);
echo "STATUS: $url_status \n";
print_r($astatus);
echo "";
}
}
public function print_table_style()
{
echo "
";
}
public function print_table($rows, $keys)
{
echo "";
echo "";
foreach ($keys as $k) {
echo "| $k | ";
}
echo "
\n";
foreach ($rows as $r) {
echo "";
foreach ($keys as $k) {
echo "| " . $r[$k] . " | ";
}
echo "
";
}
echo "
";
}
}