91 lines
2.8 KiB
PHP
91 lines
2.8 KiB
PHP
<?php
|
|
class Qrcode extends MY_Controller
|
|
{
|
|
function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
function label($orderHeaderID)
|
|
{
|
|
$title = "RSPAD GATOT SUBROTO INSTALASI PATOLOGI KLINIK";
|
|
//User yang validasi
|
|
|
|
$sql = "select T_OrderHeaderDate,
|
|
M_StaffName
|
|
from
|
|
t_orderheader
|
|
join t_orderdetail on T_OrderHeaderID = ?
|
|
and T_OrderHeaderID = T_OrderDetailT_OrderHeaderID
|
|
and T_OrderDetailValidation = 'Y'
|
|
join m_user on T_OrderDetailValUserID = M_UserID
|
|
join m_staff on M_UserM_StaffID = M_StaffID and M_StaffIsActive ='Y'
|
|
order by T_OrderDetailValDate desc
|
|
limit 0,1 ";
|
|
|
|
$qry = $this->db->query($sql, [$orderHeaderID]);
|
|
if (!$qry) {
|
|
echo "Err : " . $this->db->error()["message"];
|
|
exit;
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0) {
|
|
echo "Err : Doctor ID not found.";
|
|
exit;
|
|
}
|
|
$r = $rows[0];
|
|
$sip = "";
|
|
$nama_dokter = $r["M_StaffName"];
|
|
|
|
/* $sip = $r["M_DoctorSIP"]; */
|
|
/* $nama_dokter = ""; */
|
|
/* if ($r["M_DoctorPrefix"] != "") { */
|
|
/* $nama_dokter = $r["M_DoctorPrefix"]; */
|
|
/* } */
|
|
/* if ($r["M_DoctorPrefix2"] != "") { */
|
|
/* if ($nama_dokter != "") $nama_dokter .= " "; */
|
|
/* $nama_dokter = $r["M_DoctorPrefix2"]; */
|
|
/* } */
|
|
/* if ($nama_dokter != "") $nama_dokter .= " "; */
|
|
/* $nama_dokter = $r["M_DoctorName"]; */
|
|
/**/
|
|
/* if ($r["M_DoctorSuffix"] != "") { */
|
|
/* if ($nama_dokter != "") $nama_dokter .= " "; */
|
|
/* $nama_dokter = $r["M_DoctorSuffix"]; */
|
|
/* } */
|
|
/* if ($r["M_DoctorSuffix2"] != "") { */
|
|
/* if ($nama_dokter != "") $nama_dokter .= " "; */
|
|
/* $nama_dokter = $r["M_DoctorSuffix2"]; */
|
|
/* } */
|
|
/* if ($r["M_DoctorSuffix3"] != "") { */
|
|
/* if ($nama_dokter != "") $nama_dokter .= " "; */
|
|
/* $nama_dokter = $r["M_DoctorSuffix3"]; */
|
|
/* } */
|
|
$msg = $title . "\n";
|
|
$msg .= "Tanggal : " . date("d-m-Y H:n", strtotime($r["T_OrderHeaderDate"])) . "\n";
|
|
$msg .= "Nama : " . $nama_dokter . "\n";
|
|
$msg .= "SIP : " . $sip;
|
|
$img_qrcode = $this->post("http://localhost/charts/qrtext.php", $msg);
|
|
header("Content-type: image/png");
|
|
echo $img_qrcode;
|
|
}
|
|
public function post($url, $data)
|
|
{
|
|
$ch = curl_init($url);
|
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
|
|
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
|
"Content-Type: application/text",
|
|
"Content-Length: " . strlen($data),
|
|
]);
|
|
$result = curl_exec($ch);
|
|
if (curl_error($ch) != "") {
|
|
return "ERROR Accessing QrCode : " . curl_error($ch) . "\n";
|
|
}
|
|
curl_close($ch);
|
|
return $result;
|
|
}
|
|
}
|