Initial import
This commit is contained in:
60
application/controllers/tools/monitoring/Editpx.php
Normal file
60
application/controllers/tools/monitoring/Editpx.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
class Editpx extends MY_Controller
|
||||
{
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
$this->db = $this->load->database("onedev", true);
|
||||
}
|
||||
function index() {
|
||||
$sql = "select * from m_branch where M_BranchIsActive = 'Y'";
|
||||
$qry = $this->db->query($sql);
|
||||
$branchName = "";
|
||||
if ($qry) {
|
||||
$rows = $qry->result_array();
|
||||
$branchName = $rows[0]["M_BranchName"];
|
||||
} else {
|
||||
print_r($this->db->error());
|
||||
}
|
||||
if ($branchName == "" ) {
|
||||
echo "No Branch";
|
||||
}
|
||||
$date = date("Y-m-d");
|
||||
$s_date = "$date 06:00:00";
|
||||
$e_date = "$date 23:59:59";
|
||||
$sql ="select T_OrderHeaderLabNumber,
|
||||
order_px.*
|
||||
from order_px
|
||||
join t_orderheader on OrderPxCreated >= '$s_date' and OrderPxCreated < '$e_date'
|
||||
and OrderPxT_OrderHeaderID = T_OrderHeaderID";
|
||||
$qry = $this->db->query($sql);
|
||||
if (! $qry) {
|
||||
print_r($this->db->error());
|
||||
exit;
|
||||
}
|
||||
$rows = $qry->result_array();
|
||||
$msg ="";
|
||||
foreach($rows as $r) {
|
||||
try {
|
||||
$a_json = json_decode($r["OrderPxJson"],true);
|
||||
$px_msg = "";
|
||||
foreach($a_json as $json) {
|
||||
if ($json["action"] == "delete" ) {
|
||||
if ($px_msg != "" ) $px_msg .= "\n";
|
||||
$px_msg .= " D [" . $json["pxsascode"] . "] " . $json["pxname"];
|
||||
}
|
||||
if ($json["action"] == "add" ) {
|
||||
if ($px_msg != "" ) $px_msg .= "\n";
|
||||
$px_msg .= " A [" . $json["pxsascode"] . "] " . $json["pxname"];
|
||||
}
|
||||
}
|
||||
if ($px_msg != "") {
|
||||
if ($msg != "" ) $msg .= "\n";
|
||||
$msg .= $r["T_OrderHeaderLabNumber"] . ":\n" ;
|
||||
$msg .= $px_msg;
|
||||
}
|
||||
} catch(Exception $e) {
|
||||
}
|
||||
}
|
||||
echo $msg ."\n";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user