add qr code report
This commit is contained in:
@@ -5,7 +5,7 @@ class The_qr extends MY_Controller
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function get_one_row($sql, $param=false)
|
||||
public function get_one_row($sql, $param = false)
|
||||
{
|
||||
if ($param) {
|
||||
$qry = $this->db->query($sql, $param);
|
||||
@@ -19,9 +19,9 @@ class The_qr extends MY_Controller
|
||||
if (count($rows) == 0) {
|
||||
return array("status" => 0);
|
||||
}
|
||||
return array("status" => 1 , "data" => $rows[0]);
|
||||
return array("status" => 1, "data" => $rows[0]);
|
||||
}
|
||||
public function get_rows($sql, $param=false)
|
||||
public function get_rows($sql, $param = false)
|
||||
{
|
||||
if ($param) {
|
||||
$qry = $this->db->query($sql, $param);
|
||||
@@ -35,7 +35,7 @@ class The_qr extends MY_Controller
|
||||
if (count($rows) == 0) {
|
||||
return array("status" => 0);
|
||||
}
|
||||
return array("status" => 1 , "data" => $rows);
|
||||
return array("status" => 1, "data" => $rows);
|
||||
}
|
||||
public function v1($orderHeaderID, $date = "")
|
||||
{
|
||||
@@ -52,11 +52,10 @@ class The_qr extends MY_Controller
|
||||
}
|
||||
$rows = $rs["data"];
|
||||
$r = $rows[0];
|
||||
$msg =<<<EOF
|
||||
$msg = <<<EOF
|
||||
{$r['T_OrderHeaderLabNumber']}
|
||||
{$r['M_PatientName']}
|
||||
EOF
|
||||
;
|
||||
EOF;
|
||||
$msg = trim($msg);
|
||||
$msg .= "\n";
|
||||
foreach ($rows as $r) {
|
||||
@@ -77,8 +76,9 @@ EOF
|
||||
$ch,
|
||||
CURLOPT_HTTPHEADER,
|
||||
array(
|
||||
'Content-Type: application/text',
|
||||
'Content-Length: ' . strlen($data))
|
||||
'Content-Type: application/text',
|
||||
'Content-Length: ' . strlen($data)
|
||||
)
|
||||
);
|
||||
$result = curl_exec($ch);
|
||||
if (curl_error($ch) != "") {
|
||||
@@ -122,4 +122,58 @@ EOF
|
||||
echo $img_qrcode;
|
||||
exit;
|
||||
}
|
||||
public function v3($orderHeaderID)
|
||||
{
|
||||
$sql = "SELECT QR_PrintOutReportURL
|
||||
FROM qr_printout
|
||||
WHERE QR_PrintOutT_OrderHeaderID = ?
|
||||
AND QR_PrintOutIsActive = 1
|
||||
ORDER BY QR_PrintOutID DESC
|
||||
LIMIT 1";
|
||||
$rs = $this->get_one_row($sql, array($orderHeaderID));
|
||||
if ($rs["status"] == -1) {
|
||||
echo "Error : qr_printout | " . $this->db->error()["message"];
|
||||
exit;
|
||||
}
|
||||
if ($rs["status"] == 0) {
|
||||
echo "Error : No QR Printout found.";
|
||||
exit;
|
||||
}
|
||||
|
||||
$reportUrl = $rs["data"]["QR_PrintOutReportURL"];
|
||||
$img_qrcode = $this->post("http://localhost/charts/qrtext.php", $reportUrl);
|
||||
header("Content-type: image/png");
|
||||
echo $img_qrcode;
|
||||
exit;
|
||||
}
|
||||
public function v3_nonlab($resultEntryID)
|
||||
{
|
||||
$sql = " SELECT
|
||||
qp.QR_PrintOutReportURL
|
||||
FROM one_lab.so_resultentry se
|
||||
JOIN one_lab.t_orderheader oh
|
||||
ON oh.T_OrderHeaderID = se.SO_ResultEntryT_OrderHeaderID
|
||||
AND oh.T_OrderHeaderIsActive = 'Y'
|
||||
JOIN one_lab.qr_printout qp
|
||||
ON qp.QR_PrintOutT_OrderHeaderID = oh.T_OrderHeaderID
|
||||
AND qp.QR_PrintOutIsActive = 1
|
||||
WHERE se.SO_ResultEntryID = ?
|
||||
ORDER BY qp.QR_PrintOutID DESC
|
||||
LIMIT 1";
|
||||
$rs = $this->get_one_row($sql, array($resultEntryID));
|
||||
if ($rs["status"] == -1) {
|
||||
echo "Error : qr_printout | " . $this->db->error()["message"];
|
||||
exit;
|
||||
}
|
||||
if ($rs["status"] == 0) {
|
||||
echo "Error : No QR Printout found.";
|
||||
exit;
|
||||
}
|
||||
|
||||
$reportUrl = $rs["data"]["QR_PrintOutReportURL"];
|
||||
$img_qrcode = $this->post("http://localhost/charts/qrtext.php", $reportUrl);
|
||||
header("Content-type: image/png");
|
||||
echo $img_qrcode;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user