42 lines
926 B
PHP
42 lines
926 B
PHP
<?php
|
|
|
|
class Agreement extends MY_Controller
|
|
{
|
|
var $db_onedev;
|
|
public function index()
|
|
{
|
|
echo "BAHAN API";
|
|
}
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->db_onedev = $this->load->database("nasional", true);
|
|
}
|
|
|
|
|
|
function checkCompanyNasionalExist($code){
|
|
try {
|
|
$sql = "select count(*) as x
|
|
from m_company
|
|
where
|
|
M_CompanyNatCode = '{$code}' AND M_CompanyIsActive = 'Y'";
|
|
//echo $sql;
|
|
$row = $this->db_onedev->query($sql)->row();
|
|
//echo $this->db_onedev->last_query();
|
|
$rtn = FALSE;
|
|
if($row->x > 0 )
|
|
$rtn = TRUE;
|
|
|
|
$result = array ("exist" => $rtn);
|
|
$this->sys_ok($result);
|
|
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
|
|
|
|
}
|