Fix MCU report QR
This commit is contained in:
@@ -70,6 +70,7 @@ class MedicalCheckupReportPdf extends FPDF
|
||||
|
||||
class Medical_checkup_report extends MY_Controller
|
||||
{
|
||||
const MCU_REPORT_GROUP_RESULT_ID = 8;
|
||||
const QR_GAP_FROM_FOOTER_MM = 5.0;
|
||||
const QR_SIZE_MM = 22.0;
|
||||
|
||||
@@ -83,16 +84,16 @@ class Medical_checkup_report extends MY_Controller
|
||||
public function index()
|
||||
{
|
||||
$this->sys_ok([
|
||||
'message' => 'Use /tools/medical_checkup_report/pdf?T_OrderHeaderGroupResultDetailsT_OrderDetailID=<id>&username=<username>'
|
||||
'message' => 'Use /tools/medical_checkup_report/pdf?T_OrderHeaderID=<id>&username=<username>'
|
||||
]);
|
||||
}
|
||||
|
||||
public function pdf()
|
||||
{
|
||||
try {
|
||||
$orderDetailId = intval($this->input->get('T_OrderHeaderGroupResultDetailsT_OrderDetailID', true));
|
||||
if ($orderDetailId <= 0) {
|
||||
$this->sys_error('T_OrderHeaderGroupResultDetailsT_OrderDetailID mandatory');
|
||||
$orderHeaderId = intval($this->input->get('T_OrderHeaderID', true));
|
||||
if ($orderHeaderId <= 0) {
|
||||
$this->sys_error('T_OrderHeaderID mandatory');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -101,14 +102,6 @@ class Medical_checkup_report extends MY_Controller
|
||||
$printBy = 'ADMIN';
|
||||
}
|
||||
|
||||
$reportContext = $this->get_report_context($orderDetailId);
|
||||
if (!$reportContext) {
|
||||
$this->sys_error('Mapping order detail / group result tidak ditemukan');
|
||||
return;
|
||||
}
|
||||
|
||||
$orderHeaderId = intval($reportContext['order_header_id']);
|
||||
|
||||
$header = $this->get_header_data($orderHeaderId);
|
||||
if (!$header) {
|
||||
$this->sys_error('Data order tidak ditemukan');
|
||||
@@ -120,8 +113,8 @@ class Medical_checkup_report extends MY_Controller
|
||||
$branch = $this->get_default_branch();
|
||||
$verifyUrl = $this->get_verify_url(
|
||||
$orderHeaderId,
|
||||
intval($reportContext['group_result_id']),
|
||||
intval($reportContext['test_id'])
|
||||
self::MCU_REPORT_GROUP_RESULT_ID,
|
||||
0
|
||||
);
|
||||
|
||||
require_once APPPATH . 'third_party/fpdf/fpdf.php';
|
||||
@@ -315,36 +308,6 @@ class Medical_checkup_report extends MY_Controller
|
||||
return trim((string)$row['saran']);
|
||||
}
|
||||
|
||||
private function get_report_context($orderDetailId)
|
||||
{
|
||||
$sql = "SELECT
|
||||
ogd.T_OrderHeaderGroupResultDetailsT_OrderHeaderID AS order_header_id,
|
||||
ogr.T_OrderHeaderGroupResultGroup_ResultID AS group_result_id,
|
||||
od.T_OrderDetailT_TestID AS test_id
|
||||
FROM t_orderheader_group_result_details ogd
|
||||
JOIN t_orderheader_group_result ogr
|
||||
ON ogr.T_OrderHeaderGroupResultID = ogd.T_OrderHeaderGroupResultDetailsT_OrderHeaderGroupResultID
|
||||
AND ogr.T_OrderHeaderGroupResultIsActive = 'Y'
|
||||
JOIN t_orderdetail od
|
||||
ON od.T_OrderDetailID = ogd.T_OrderHeaderGroupResultDetailsT_OrderDetailID
|
||||
AND od.T_OrderDetailIsActive = 'Y'
|
||||
WHERE ogd.T_OrderHeaderGroupResultDetailsT_OrderDetailID = ?
|
||||
AND ogd.T_OrderHeaderGroupResultDetailsIsActive = 'Y'
|
||||
LIMIT 1";
|
||||
|
||||
$qry = $this->db_onedev->query($sql, [$orderDetailId]);
|
||||
if (!$qry) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$row = $qry->row_array();
|
||||
if (!$row) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
private function get_verify_url($orderHeaderId, $groupResultId, $testId)
|
||||
{
|
||||
$sql = "SELECT IFNULL(QR_PrintOutVerifyURL, '') AS verify_url
|
||||
|
||||
Reference in New Issue
Block a user