Files
2026-04-27 10:31:17 +07:00

67 lines
1.5 KiB
PHP

<?php
class Company extends MY_Controller
{
var $db_smartone;
public function index()
{
echo "RE Company API";
}
public function __construct()
{
parent::__construct();
$this->db_smartone = $this->load->database("onedev", true);
}
public function search()
{
$prm = $this->sys_input;
$qry = "%" . $prm["qry"] . '%';
$sql = "Select M_CompanyID, M_CompanyName
from m_company
where M_CompanyName like ?
and M_CompanyIsActive = 'Y'
limit 0,30";
$query = $this->db_smartone->query($sql, array($qry) );
if ($query) {
$rows = $query->result_array();
$rows[] = array("M_CompanyID" => 0, "M_CompanyName" => "Semua");
$result = array("data" => $rows );
$this->sys_ok($result);
}
else {
$this->sys_error_db("", $this->db_smartone);
exit;
}
}
function getstatus(){
if (! $this->isLogin) {
$this->sys_error("Invalid Token");
exit;
}
$rows = [];
$query ="
SELECT 'A' as M_StatusID, 'Semua' as M_StatusName
UNION
SELECT 'Y' as M_StatusID, 'Full Validasi' as M_StatusName
UNION
SELECT 'P' as M_StatusID, 'Sebagian Validasi' as M_StatusName
";
//echo $query;
$rows['f_statuss'] = $this->db_onedev->query($query)->result_array();
$result = array(
"total" => count($rows) ,
"records" => $rows,
);
$this->sys_ok($result);
exit;
}
}