Files
BE_IBL/application/controllers/fix/Fixtestpanel.php
2026-04-15 15:23:57 +07:00

41 lines
1.5 KiB
PHP

<?php
class Fixtestpanel extends MY_Controller
{
function __construct() {
parent::__construct();
}
function index() {
$sql = "select * from t_test
join nat_test on T_TestNat_TestID = Nat_TestID
and Nat_TestNat_TestTypeID = 4
and T_TestIsActive = 'Y'";
$qry = $this->db->query($sql);
if ($qry) {
$rows = $qry->result_array();
foreach($rows as $r) {
$sql = "select * from t_test where T_TestSasCode like '" . $r["T_TestSasCode"] . "%'
and T_TestIsActive = 'Y' and T_TestSasCode <> '" . $r["T_TestSasCode"] . "'
and (T_TestIsPrice = 'Y' or T_TestIsPrintNota = 'Y')";
$qry2 = $this->db->query($sql);
if ($qry2) {
$rows2 = $qry2->result_array();
if (count($rows2)) {
echo $r["T_TestSasCode"] . "\t\t" . $r["T_TestName"] . "\n";
}
foreach($rows2 as $r2) {
$price = $r2["T_TestIsPrice"];
$nota = $r2["T_TestIsPrintNota"];
echo "\t" . $r2["T_TestSasCode"] . "\t" . $r2["T_TestName"] . "\t\t" . "|$price|$nota\n";
$sql = "update t_test set T_TestIsPrice = 'N', T_TestIsPrintNota = 'N' where T_TestID = ? ";
$this->db->query($sql, array($r2["T_TestID"]));
}
} else {
print_r($this->db->error());
}
}
} else {
print_r($this->db->error());
}
}
}