43 lines
927 B
PHP
43 lines
927 B
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;
|
|
}
|
|
}
|
|
}
|