";
echo $mapimg;
}
if (strpos($mapimg, "
-1) {
$mapimg = substr($mapimg, strpos($mapimg, "
cors();
$sql = "select auto_valid_v2.*, autoVerifImage
from auto_valid_v2
join auto_verif_v2 on AutoValidT_OrderDetailID = AutoVerifT_OrderDetailID
and AutoValidT_OrderDetailID = ?";
$qry = $this->db->query($sql, [$detailID]);
if (!$qry) {
echo json_encode([
"status" => "ERR",
"message" => $this->db->error()["message"],
]);
exit();
}
$rows = $qry->result_array();
if (count($rows) > 0) {
//AutoValid V2
$r = $rows[0];
$note = $this->print_table_style();
$xrows = [];
$isStatusOk = true;
if ($r["AutoValidAutoVerifIsOK"] == "Y") {
$xrows[] = "Auto Verif terpenuhi. " . "";
} else {
$xrows[] = "Auto Verif tidak terpenuhi. " . "";
$isStatusOk = $isStatusOk && false;
}
if ($isStatusOk) {
if ($r["AutoValidIsInReviewRange"] == "Y") {
$xrows[] =
"Masuk dalam review range. " .
$r["AutoValidInReviewRangeNote"] .
"";
$isStatusOk = $isStatusOk && false;
} else {
$xrows[] =
"Tidak masuk dalam review range. " .
$r["AutoValidInReviewRangeNote"] .
"";
}
}
if ($isStatusOk) {
if ($r["AutoValidIsInconsistencyOK"] == "N") {
$xrows[] =
"Inkonsistensi rule tidak terpenuhi. " .
$r["AutoValidInconsistencyNote"] .
"";
$isStatusOk = $isStatusOk && false;
} else {
$xrows[] =
"Inkonsistensi rule terpenuhi. " .
$r["AutoValidInconsistencyNote"] .
"";
}
}
if ($isStatusOk) {
if ($r["AutoValidIsDeltacheckOK"] == "N") {
$xrows[] =
"Delta check tidak terpenuhi. " .
$r["AutoValidDeltaCheckNote"] .
"";
$isStatusOk = $isStatusOk && false;
} else {
$xrows[] =
"Delta check terpenuhi. " .
$r["AutoValidDeltaCheckNote"] .
"";
}
}
if ($isStatusOk) {
if ($r["AutoValidReflexTestIsOK"] == "N") {
$xrows[] =
"Reflex Test tidak terpenuhi. " .
$r["AutoValidReflexTestNote"] .
"";
$isStatusOk = $isStatusOk && false;
} else {
$xrows[] =
"Reflex Test terpenuhi. " .
str_ireplace(
"|",
"
",
$r["AutoValidReflexTestNote"]
) .
"";
}
}
$note = $this->print_table_style();
$note .= $this->print_table_one_column($xrows);
if (false) {
echo "Img : " . $r["autoVerifImage"];
echo "
extract : " .
$this->extract_image($r["autoVerifImage"], "1");
}
echo json_encode([
"status" => "OK",
"note" => $note, //$r["AutoVerifDeltaCheckNote"],
"raw_image" => $r["autoVerifImage"],
"image" => $this->extract_image($r["autoVerifImage"]),
]);
exit();
}
$sql = "select auto_valid.*,
AutoVerifTrendAnalysisImage
from auto_valid
join auto_verif on AutoValidT_OrderDetailID =?
and AutoValidT_OrderDetailID = AutoVerifT_OrderDetailID";
$qry = $this->db->query($sql, [$detailID]);
if (!$qry) {
echo json_encode([
"status" => "ERR",
"message" => $this->db->error()["message"],
]);
exit();
}
$rows = $qry->result_array();
if (count($rows) == 0) {
echo json_encode([
"status" => "ERR",
"message" => "Informasi Auto Valid tidak ada",
]);
exit();
}
$r = $rows[0];
echo json_encode([
"status" => "OK",
"note" => $r["AutoValidNote"],
"raw_image" => $r["AutoVerifTrendAnalysisImage"],
"image" => $this->extract_image($r["AutoVerifTrendAnalysisImage"]),
]);
}
function info_verif($detailID, $debug = "")
{
$this->cors();
$sql = "select * from auto_verif_v2 where AutoVerifT_OrderDetailID = ?";
$qry = $this->db->query($sql, [$detailID]);
if (!$qry) {
echo json_encode([
"status" => "ERR",
"message" => $this->db->error()["message"],
]);
exit();
}
$rows = $qry->result_array();
if (count($rows) > 0) {
//AutoVerif V2
$r = $rows[0];
$note = $this->print_table_style();
$xrows = [];
$isStatusOk = true;
if ($r["autoVerifIsPanicValue"] == "Y") {
$xrows[] =
"Ada Panic Value. " .
$r["autoVerifPanicValueNote"] .
"";
$isStatusOk = $isStatusOk && false;
} else {
$xrows[] =
"Tidak ada Panic Value. " .
$r["autoVerifPanicValueNote"] .
"";
}
if ($isStatusOk) {
if ($r["autoVerifIsPreAnalityc"] == "Y") {
$xrows[] =
"Ada ketidaksesuaian. " .
$r["autoVerifPreAnalitycNote"] .
"";
$isStatusOk = $isStatusOk && false;
} else {
$xrows[] =
"Tidak ada ketidaksesuaian persyaratan preanalitik. " .
$r["autoVerifPreAnalitycNote"] .
"";
}
}
if ($isStatusOk) {
if ($r["autoVerifIsInAmr"] == "N") {
$xrows[] =
"Tidak masuk dalam range AMR. " .
$r["autoVerifAmrNote"] .
"";
$isStatusOk = $isStatusOk && false;
} else {
$xrows[] =
"Masuk dalam range AMR. " .
$r["autoVerifAmrNote"] .
"";
}
}
if ($isStatusOk) {
if ($r["autoVerifIsUjiTrendOK"] == "N") {
$xrows[] =
"Rata-rata harian tidak masuk dalam rentang AON. " .
$r["autoVerifUjiTrendNote"] .
"";
$isStatusOk = $isStatusOk && false;
} else {
$xrows[] =
"Rata-rata harian masuk dalam rentang AON. " .
$r["autoVerifUjiTrendNote"] .
"";
}
}
$note = $this->print_table_style();
$note .= $this->print_table_one_column($xrows);
if ($debug != "") {
echo "Img : " . $r["autoVerifImage"];
echo "
extract : " .
$this->extract_image($r["autoVerifImage"], "1");
}
echo json_encode([
"status" => "OK",
"note" => $note, //$r["AutoVerifDeltaCheckNote"],
"raw_image" => $r["autoVerifImage"],
"image" => $this->extract_image($r["autoVerifImage"]),
]);
exit();
}
$sql = "select * from auto_verif where AutoVerifT_OrderDetailID = ?";
$qry = $this->db->query($sql, [$detailID]);
if (!$qry) {
echo json_encode([
"status" => "ERR",
"message" => $this->db->error()["message"],
]);
exit();
}
$rows = $qry->result_array();
if (count($rows) == 0) {
echo json_encode([
"status" => "ERR",
"message" => "Informasi Auto Verif tidak ada",
]);
exit();
}
$r = $rows[0];
if ($debug != "") {
print_r($r);
}
$note = "";
if ($r["AutoVerifHaveReq"] == "Y") {
$note =
"*) Ada Requirement checklist.
";
} else {
$note =
"*) Tidak ada Requirement checklist.
";
}
if ($r["AutoVerifReviewRangeIsOK"] != "Y") {
if ($note != "") {
$note .= "
";
}
$note .=
"*) Review Range tidak terpenuhi.
";
} else {
if ($note != "") {
$note .= "
";
}
$note .=
"*) Review Range terpenuhi.
";
}
$note .= $r["AutoVerifTrendAnalysisNote"];
echo json_encode([
"status" => "OK",
"note" => $note, //$r["AutoVerifDeltaCheckNote"],
"raw_image" => $r["AutoVerifTrendAnalysisImage"],
"image" => $this->extract_image($r["AutoVerifTrendAnalysisImage"]),
]);
}
function status($orderHeaderID)
{
$this->cors();
$sql = "select auto_verif_v2.* from auto_verif_v2
join t_orderdetail on AutoVerifT_OrderDetailID = T_OrderDetailID
and T_OrderDetailT_OrderHeaderID = ?";
$qry = $this->db->query($sql, [$orderHeaderID]);
if (!$qry) {
echo json_encode([
"status" => "ERR",
"message" => $this->db->error()["message"],
]);
exit();
}
$rows = $qry->result_array();
$result = ["autoVerif" => [], "autoValid" => []];
if (count($rows) > 0) {
// auto Verif v2
foreach ($rows as $r) {
if (
$r["autoVerifIsPanicValue"] == "N" &&
$r["autoVerifIsPreAnalityc"] == "N" &&
$r["autoVerifIsInAmr"] == "Y" &&
$r["autoVerifIsUjiTrendOK"] == "Y"
) {
$result["autoVerif"][] = [
"id" => $r["AutoVerifT_OrderDetailID"],
"status" => true,
];
} else {
$result["autoVerif"][] = [
"id" => $r["AutoVerifT_OrderDetailID"],
"status" => false,
];
}
}
} else {
$sql = "select auto_verif.* from auto_verif
join t_orderdetail on AutoVerifT_OrderDetailID = T_OrderDetailID
and T_OrderDetailT_OrderHeaderID = ?";
$qry = $this->db->query($sql, [$orderHeaderID]);
if (!$qry) {
echo json_encode([
"status" => "ERR",
"message" => $this->db->error()["message"],
]);
exit();
}
$rows = $qry->result_array();
foreach ($rows as $r) {
if (
$r["AutoVerifHaveReq"] == "N" &&
//$r["AutoVerifDeltaCheckStatus"] == "Y" &&
$r["AutoVerifReviewRangeIsOK"] == "Y" &&
$r["AutoVerifTrendAnalysisStatus"] == "Y"
) {
$result["autoVerif"][] = [
"id" => $r["AutoVerifT_OrderDetailID"],
"status" => true,
];
} else {
$result["autoVerif"][] = [
"id" => $r["AutoVerifT_OrderDetailID"],
"status" => false,
];
}
}
}
$sql = "select auto_valid_v2.* from auto_valid_v2
join t_orderdetail on AutoValidT_OrderDetailID = T_OrderDetailID
and T_OrderDetailT_OrderHeaderID = ?";
$qry = $this->db->query($sql, [$orderHeaderID]);
if (!$qry) {
echo json_encode([
"status" => "ERR",
"message" => $this->db->error()["message"],
]);
exit();
}
$rows = $qry->result_array();
if (count($rows) > 0) {
// auto valid v2
foreach ($rows as $r) {
if (
$r["AutoValidAutoVerifIsOK"] == "Y" &&
$r["AutoValidIsInReviewRange"] == "N" &&
$r["AutoValidIsInconsistencyOK"] == "Y" &&
$r["AutoValidReflexTestIsOK"] == "Y" &&
$r["AutoValidIsDeltacheckOK"] == "Y"
) {
$result["autoValid"][] = [
"id" => $r["AutoValidT_OrderDetailID"],
"status" => true,
];
} else {
$result["autoValid"][] = [
"id" => $r["AutoValidT_OrderDetailID"],
"status" => false,
];
}
}
} else {
$sql = "select auto_valid.* from auto_valid
join t_orderdetail on AutoValidT_OrderDetailID = T_OrderDetailID
and T_OrderDetailT_OrderHeaderID = ?";
$qry = $this->db->query($sql, [$orderHeaderID]);
if (!$qry) {
echo json_encode([
"status" => "ERR",
"message" => $this->db->error()["message"],
]);
exit();
}
$rows = $qry->result_array();
foreach ($rows as $r) {
if (
$r["AutoValidHaveReq"] == "N" &&
$r["AutoValidIsOk"] == "Y"
) {
$result["autoValid"][] = [
"id" => $r["AutoValidT_OrderDetailID"],
"status" => true,
];
} else {
$result["autoValid"][] = [
"id" => $r["AutoValidT_OrderDetailID"],
"status" => false,
];
}
}
}
echo json_encode(["status" => "OK", "data" => $result]);
}
function print_table_style()
{
return "
";
}
public function print_table_one_column($rows)
{
$rst = "
";
foreach ($rows as $r) {
$rst .= "";
$rst .= "| " . $r . " | ";
$rst .= "
";
}
$rst .= "
";
return $rst;
}
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 "
";
}
}