Add QR generation on val1
This commit is contained in:
@@ -3906,18 +3906,19 @@ class Resultentry extends MY_Controller
|
||||
}
|
||||
|
||||
|
||||
if ($prm['act'] === 'val1') {
|
||||
$sql = "UPDATE so_resultentry SET
|
||||
So_ResultEntryValidation1 = 'Y',
|
||||
So_ResultEntryStatus = 'VAL1',
|
||||
if ($prm['act'] === 'val1') {
|
||||
$sql = "UPDATE so_resultentry SET
|
||||
So_ResultEntryValidation1 = 'Y',
|
||||
So_ResultEntryStatus = 'VAL1',
|
||||
So_ResultEntryLastUpdated = NOW(),So_ResultEntryLastUpdatedUserID = {$userid}
|
||||
WHERE
|
||||
So_ResultEntryID = {$prm['trx']['trx_id']}";
|
||||
|
||||
$this->db_onedev->query($sql);
|
||||
|
||||
|
||||
}
|
||||
|
||||
$this->db_onedev->query($sql);
|
||||
$this->generate_qr_nonlab_for_val1($prm['trx'], $userid);
|
||||
|
||||
|
||||
}
|
||||
if ($prm['act'] === 'unval1') {
|
||||
$sql = "SELECT IFNULL(Mcu_ResumeValidation, 'N') as status, COUNT(Mcu_ResumeID)
|
||||
FROM mcu_resume
|
||||
@@ -4948,12 +4949,13 @@ class Resultentry extends MY_Controller
|
||||
So_ResultEntryLastUpdatedUserID = ?
|
||||
WHERE
|
||||
So_ResultEntryID = ?";
|
||||
$rst = $this->db_onedev->query($sql, array($userid, $prm['trx']['re_id']));
|
||||
if (!$rst) {
|
||||
$this->db_onedev->trans_rollback();
|
||||
$this->sys_error("Error update form validation");
|
||||
exit;
|
||||
}
|
||||
$rst = $this->db_onedev->query($sql, array($userid, $prm['trx']['re_id']));
|
||||
if (!$rst) {
|
||||
$this->db_onedev->trans_rollback();
|
||||
$this->sys_error("Error update form validation");
|
||||
exit;
|
||||
}
|
||||
$this->generate_qr_nonlab_for_val1($prm['trx'], $userid);
|
||||
|
||||
$sql = "SELECT T_OrderHeaderAddOnSecondM_LangID as langid
|
||||
FROM t_orderheaderaddon
|
||||
@@ -5314,6 +5316,145 @@ class Resultentry extends MY_Controller
|
||||
exit;
|
||||
}
|
||||
|
||||
private function generate_qr_nonlab_for_val1($trx, $userid)
|
||||
{
|
||||
$sql_get = "SELECT DISTINCT
|
||||
T_OrderHeaderGroupResultID,
|
||||
T_OrderHeaderGroupResultGroup_ResultID,
|
||||
T_OrderHeaderGroupResultT_TestID,
|
||||
T_OrderHeaderGroupResultGroup_ResultName,
|
||||
T_TestName
|
||||
FROM t_orderheader_group_result
|
||||
JOIN t_test
|
||||
ON T_OrderHeaderGroupResultT_TestID = T_TestID
|
||||
AND T_TestIsActive = 'Y'
|
||||
WHERE T_OrderHeaderGroupResultT_TestID = ?
|
||||
AND T_OrderHeaderGroupResultT_OrderHeaderID = ?
|
||||
AND T_OrderHeaderGroupResultIsActive = 'Y'";
|
||||
$qry_get = $this->db_onedev->query($sql_get, array($trx['test_id'], $trx['orderid']));
|
||||
if (!$qry_get) {
|
||||
$this->sys_error_db("error t_orderheader_group_result", $this->db_onedev);
|
||||
exit;
|
||||
}
|
||||
$data = $qry_get->result_array();
|
||||
|
||||
$map = array(
|
||||
'fisik' => 'FISIK-RESULT-P-01',
|
||||
'fisik_eng' => 'FISIK-RESULT-EN-P-01',
|
||||
'srq' => 'SRQ-RESULT-P-01'
|
||||
);
|
||||
|
||||
$sql_branch = "SELECT
|
||||
M_BranchID,
|
||||
M_BranchCode,
|
||||
M_BranchName,
|
||||
M_BranchIPAddress
|
||||
FROM m_branch
|
||||
WHERE M_BranchIsDefault = 'Y'
|
||||
AND M_BranchIsActive = 'Y'";
|
||||
$qry_branch = $this->db_onedev->query($sql_branch);
|
||||
if (!$qry_branch) {
|
||||
$this->sys_error_db('error m_branch', $this->db_onedev);
|
||||
exit;
|
||||
}
|
||||
$branch = $qry_branch->row_array();
|
||||
$base = "http://" . $branch['M_BranchIPAddress'] . "/";
|
||||
|
||||
$sql_url = "SELECT QR_ReportEndpointID,
|
||||
QR_ReportEndpointUrl,
|
||||
QR_ReportEndpointIsActive
|
||||
FROM qr_report_endpoint
|
||||
WHERE QR_ReportEndpointIsActive = 'Y' LIMIT 1";
|
||||
$qry_url = $this->db_onedev->query($sql_url);
|
||||
if (!$qry_url) {
|
||||
$this->sys_error_db("Error Query Endpoint URL", $this->db_onedev);
|
||||
exit;
|
||||
}
|
||||
|
||||
$endpoint_url = "";
|
||||
$data_url = $qry_url->result_array();
|
||||
if (count($data_url) > 0) {
|
||||
$endpoint_url = $data_url[0]['QR_ReportEndpointUrl'];
|
||||
}
|
||||
$verify_url = $endpoint_url . 'rpt/';
|
||||
|
||||
$template_name = isset($trx['template_name']) ? strtolower(trim($trx['template_name'])) : '';
|
||||
$lang = isset($trx['lang']) ? strtoupper(trim($trx['lang'])) : '';
|
||||
$report_key = 'fisik';
|
||||
if (strpos($template_name, 'srq') !== false) {
|
||||
$report_key = 'srq';
|
||||
}
|
||||
else if ($lang === 'ENG' || strpos($template_name, 'eng') !== false) {
|
||||
$report_key = 'fisik_eng';
|
||||
}
|
||||
|
||||
if (!isset($map[$report_key])) {
|
||||
return;
|
||||
}
|
||||
$printCode = $map[$report_key];
|
||||
|
||||
foreach ($data as $value) {
|
||||
$sql_pt = "SELECT Print_TransactionUrlWatermark
|
||||
FROM print_transaction
|
||||
WHERE Print_TransactionCode = ?
|
||||
LIMIT 1";
|
||||
$qry_pt = $this->db_onedev->query($sql_pt, array($printCode));
|
||||
if (!$qry_pt) {
|
||||
$this->sys_error_db('error print_transaction', $this->db_onedev);
|
||||
exit;
|
||||
}
|
||||
|
||||
$rst_url = $qry_pt->row_array();
|
||||
if (!$rst_url || !isset($rst_url['Print_TransactionUrlWatermark'])) {
|
||||
continue;
|
||||
}
|
||||
$template_url = $rst_url['Print_TransactionUrlWatermark'];
|
||||
|
||||
$full_url = $base . ltrim($template_url, '/');
|
||||
$full_url = str_replace('.rptdesign', '_watermark.rptdesign', $full_url);
|
||||
$full_url = str_replace(
|
||||
array('PUsername', 'PT_OrderHeaderID', 'TS'),
|
||||
array(
|
||||
trim($this->sys_user['M_UserUsername']),
|
||||
$trx['orderid'],
|
||||
time()
|
||||
),
|
||||
$full_url
|
||||
);
|
||||
|
||||
$sql_check = "SELECT QR_PrintOutID
|
||||
FROM qr_printout
|
||||
WHERE QR_PrintOutT_OrderHeaderID = ?
|
||||
AND QR_PrintOutGroup_ResultID = ?
|
||||
AND QR_PrintOutT_TestID = ?
|
||||
AND QR_PrintOutIsActive = 1
|
||||
LIMIT 1";
|
||||
$qry_check = $this->db_onedev->query($sql_check, array(
|
||||
$trx['orderid'],
|
||||
$value['T_OrderHeaderGroupResultGroup_ResultID'],
|
||||
$value['T_OrderHeaderGroupResultT_TestID']
|
||||
));
|
||||
if (!$qry_check) {
|
||||
$this->sys_error_db("error qr_printout", $this->db_onedev);
|
||||
exit;
|
||||
}
|
||||
$exist = $qry_check->row_array();
|
||||
|
||||
if (empty($exist)) {
|
||||
$params = array(
|
||||
'orderHeaderID' => $trx['orderid'],
|
||||
'groupResultID' => $value['T_OrderHeaderGroupResultGroup_ResultID'],
|
||||
'testID' => $value['T_OrderHeaderGroupResultT_TestID'],
|
||||
'groupResultName' => $value['T_OrderHeaderGroupResultGroup_ResultName'],
|
||||
'verifyBaseURL' => $verify_url,
|
||||
'QR_PrintOutReportURL' => $full_url,
|
||||
'createdByUserID' => $userid
|
||||
);
|
||||
$this->generateqrreport->saveQRPrintout($params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function alias_resultentry_status_name($status)
|
||||
{
|
||||
if ($status === 'NEW') {
|
||||
|
||||
Reference in New Issue
Block a user