100 lines
3.5 KiB
PHP
100 lines
3.5 KiB
PHP
<?php
|
|
class Resendrujukan extends CI_Controller
|
|
{
|
|
function __construct() {
|
|
parent::__construct();
|
|
$this->db = $this->load->database("onedev", true);
|
|
}
|
|
function index() {
|
|
echo "Re-send rujukan";
|
|
}
|
|
function nosj($cabang,$sj) {
|
|
$sql = "select
|
|
from
|
|
";
|
|
}
|
|
function xnolab($nolab) {
|
|
$sql = "select T_OrderHeaderID
|
|
from t_orderheader
|
|
where T_OrderHeaderLabNumber= ?";
|
|
$qry = $this->db->query($sql, array($nolab));
|
|
if ($qry) {
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
$sql = "select T_OrderHeaderID
|
|
from t_orderheader
|
|
where T_OrderHeaderLabNumber= ?";
|
|
$qry = $this->db->query($sql, array($nolab));
|
|
if ($qry) {
|
|
$rows = $qry->result_array();
|
|
}
|
|
}
|
|
if ( count($rows) > 0 ) {
|
|
$orderHeaderID = $rows[0];
|
|
$sql = "select T_OrderDetailID,M_StaffName, T_OrderDetailT_TestName
|
|
from t_orderdetail
|
|
join m_user on T_OrderDetailValUserID= M_UserID
|
|
join m_staff on M_UserM_StaffID = M_StaffID
|
|
where T_OrderDetailT_OrderHeaderID = ?";
|
|
$qry = $this->db->query($sql, array($orderHeaderID));
|
|
$name = "";
|
|
$ids = array();
|
|
$pxs = array();
|
|
if($qry) {
|
|
$rows = $qry->result_array();
|
|
foreach($rows as $r) {
|
|
if ($name == "" ) $name = $r["M_StaffName"];
|
|
$ids[] = $r["T_OrderDetailID"];
|
|
$pxs[] = $r["T_OrderDetailT_TestName"];
|
|
}
|
|
echo "resend : $nolab [" . join($pxs,",") . "]\n";
|
|
$this->load->library("Txbranchstatus");
|
|
$this->txbranchstatus->update_multi("VALIDATION",$ids,$name);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function nolab($nolab) {
|
|
$sql = "select T_OrderHeaderID
|
|
from t_orderheader
|
|
join t_orderheaderaddon on T_OrderHeaderID = T_OrderHeaderAddOnT_OrderHeaderID
|
|
where T_OrderHeaderAddOnLabNumberOrigin = ?";
|
|
$qry = $this->db->query($sql, array($nolab));
|
|
if ($qry) {
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
$sql = "select T_OrderHeaderID
|
|
from t_orderheader
|
|
where T_OrderHeaderLabNumber= ?";
|
|
$qry = $this->db->query($sql, array($nolab));
|
|
if ($qry) {
|
|
$rows = $qry->result_array();
|
|
}
|
|
}
|
|
if ( count($rows) > 0 ) {
|
|
$orderHeaderID = $rows[0];
|
|
$sql = "select T_OrderDetailID,M_StaffName, T_OrderDetailT_TestName
|
|
from t_orderdetail
|
|
join m_user on T_OrderDetailValUserID= M_UserID
|
|
join m_staff on M_UserM_StaffID = M_StaffID
|
|
where T_OrderDetailT_OrderHeaderID = ?";
|
|
$qry = $this->db->query($sql, array($orderHeaderID));
|
|
$name = "";
|
|
$ids = array();
|
|
$pxs = array();
|
|
if($qry) {
|
|
$rows = $qry->result_array();
|
|
foreach($rows as $r) {
|
|
if ($name == "" ) $name = $r["M_StaffName"];
|
|
$ids[] = $r["T_OrderDetailID"];
|
|
$pxs[] = $r["T_OrderDetailT_TestName"];
|
|
}
|
|
echo "resend : $nolab [" . join($pxs,",") . "]\n";
|
|
$this->load->library("Txbranchstatus");
|
|
$this->txbranchstatus->update_multi("VALIDATION",$ids,$name);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|