add api file from used in s_menu fe accone
This commit is contained in:
@@ -12,6 +12,77 @@ class Ruangan extends MY_Controller
|
||||
echo "API Ruangan";
|
||||
}
|
||||
|
||||
function listingRegional()
|
||||
{
|
||||
try {
|
||||
if (!$this->isLogin) {
|
||||
throw new Exception('Invalid token');
|
||||
}
|
||||
|
||||
$sql = "SELECT
|
||||
S_RegionalID,
|
||||
S_RegionalName
|
||||
FROM s_regional
|
||||
WHERE S_RegionalIsActive = 'Y'";
|
||||
$que = $this->db->query($sql);
|
||||
if (!$que) {
|
||||
throw new Exception('failed to query list regional', 1);
|
||||
}
|
||||
$data = $que->result_array();
|
||||
|
||||
$this->sys_ok([
|
||||
"records" => $data,
|
||||
"total" => count($data)
|
||||
]);
|
||||
} catch (Exception $e) {
|
||||
$msg = '[Error] ' . $e->getMessage();
|
||||
$code = $e->getCode();
|
||||
if ($code == 0) {
|
||||
$this->sys_error($msg);
|
||||
} else {
|
||||
$this->sys_error_db($msg);
|
||||
}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
function listingCabang()
|
||||
{
|
||||
try {
|
||||
if (!$this->isLogin) {
|
||||
throw new Exception('Invalid token');
|
||||
}
|
||||
|
||||
$para = $this->sys_input;
|
||||
|
||||
$sql = "SELECT
|
||||
M_BranchID,
|
||||
M_BranchName
|
||||
FROM m_branch
|
||||
WHERE M_BranchS_RegionalID = ?
|
||||
AND M_BranchIsActive = 'Y'";
|
||||
$que = $this->db->query($sql, [$para['regionalID']]);
|
||||
if (!$que) {
|
||||
throw new Exception('failed to query list cabang', 1);
|
||||
}
|
||||
$data = $que->result_array();
|
||||
|
||||
$this->sys_ok([
|
||||
"records" => $data,
|
||||
"total" => count($data)
|
||||
]);
|
||||
} catch (Exception $e) {
|
||||
$msg = '[Error] ' . $e->getMessage();
|
||||
$code = $e->getCode();
|
||||
if ($code == 0) {
|
||||
$this->sys_error($msg);
|
||||
} else {
|
||||
$this->sys_error_db($msg);
|
||||
}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
function lookupRuangan()
|
||||
{
|
||||
try {
|
||||
@@ -39,9 +110,8 @@ class Ruangan extends MY_Controller
|
||||
b.M_BranchCode AS branch_code,
|
||||
r.M_RuanganCode AS code,
|
||||
r.M_RuanganName AS name,
|
||||
r.M_RuanganUserID AS user_id,
|
||||
r.M_RuanganCreated AS created,
|
||||
r.M_RuanganLastUpdated AS last_updated
|
||||
s.S_RegionalID AS regional_id,
|
||||
s.S_RegionalName AS regional_name
|
||||
FROM m_ruangan r
|
||||
JOIN m_branch b
|
||||
ON b.M_BranchID = r.M_RuanganM_BranchID
|
||||
|
||||
Reference in New Issue
Block a user