Restrict QR to test-linked group results
This commit is contained in:
@@ -5378,23 +5378,31 @@ class Resultentry extends MY_Controller
|
||||
$this->load->library("Generateqrreport");
|
||||
|
||||
$sql_get = "SELECT DISTINCT
|
||||
T_OrderHeaderGroupResultID,
|
||||
T_OrderHeaderGroupResultGroup_ResultID,
|
||||
T_OrderHeaderGroupResultT_TestID,
|
||||
T_OrderHeaderGroupResultGroup_ResultName,
|
||||
ohgr.T_OrderHeaderGroupResultID,
|
||||
ohgr.T_OrderHeaderGroupResultGroup_ResultID,
|
||||
ohgr.T_OrderHeaderGroupResultT_TestID,
|
||||
ohgr.T_OrderHeaderGroupResultGroup_ResultName,
|
||||
gr.Group_ResultFlagPerTest,
|
||||
T_TestName
|
||||
FROM t_orderheader_group_result
|
||||
tt.T_TestName
|
||||
FROM group_resultdetail grd
|
||||
JOIN group_result gr
|
||||
ON gr.Group_ResultID = T_OrderHeaderGroupResultGroup_ResultID
|
||||
ON grd.Group_ResultDetailGroup_ResultID = gr.Group_ResultID
|
||||
AND gr.Group_ResultIsActive = 'Y'
|
||||
LEFT JOIN t_test
|
||||
ON T_OrderHeaderGroupResultT_TestID = T_TestID
|
||||
AND T_TestIsActive = 'Y'
|
||||
WHERE (T_OrderHeaderGroupResultT_TestID = ? OR T_OrderHeaderGroupResultT_TestID = 0)
|
||||
AND T_OrderHeaderGroupResultT_OrderHeaderID = ?
|
||||
AND T_OrderHeaderGroupResultIsActive = 'Y'";
|
||||
$qry_get = $this->db_onedev->query($sql_get, array($trx['test_id'], $trx['orderid']));
|
||||
JOIN t_orderheader_group_result ohgr
|
||||
ON ohgr.T_OrderHeaderGroupResultGroup_ResultID = gr.Group_ResultID
|
||||
AND ohgr.T_OrderHeaderGroupResultT_OrderHeaderID = ?
|
||||
AND ohgr.T_OrderHeaderGroupResultIsActive = 'Y'
|
||||
LEFT JOIN t_test tt
|
||||
ON grd.Group_ResultDetailT_TestID = tt.T_TestID
|
||||
AND tt.T_TestIsActive = 'Y'
|
||||
WHERE grd.Group_ResultDetailT_TestID = ?
|
||||
AND grd.Group_ResultDetailIsActive = 'Y'
|
||||
AND (
|
||||
(gr.Group_ResultFlagPerTest = 'Y' AND ohgr.T_OrderHeaderGroupResultT_TestID = ?)
|
||||
OR
|
||||
(gr.Group_ResultFlagPerTest = 'N' AND ohgr.T_OrderHeaderGroupResultT_TestID = 0)
|
||||
)";
|
||||
$qry_get = $this->db_onedev->query($sql_get, array($trx['orderid'], $trx['test_id'], $trx['test_id']));
|
||||
if (!$qry_get) {
|
||||
$this->sys_error_db("error t_orderheader_group_result", $this->db_onedev);
|
||||
exit;
|
||||
|
||||
Reference in New Issue
Block a user