add api file from used in s_menu fe accone
This commit is contained in:
@@ -139,7 +139,9 @@ class Journalcashv2 extends MY_Controller
|
||||
LEFT JOIN m_branch ON jurnalM_BranchCode = M_BranchCode AND M_BranchIsActive = 'Y'
|
||||
WHERE $where_sql
|
||||
GROUP BY jurnalID
|
||||
ORDER BY jurnalID DESC";
|
||||
ORDER BY jurnalID DESC
|
||||
";
|
||||
|
||||
// Ambil total count
|
||||
$sql_total = "SELECT COUNT(*) AS total FROM ($sql) AS x";
|
||||
$qry_total = $this->db->query($sql_total, $params);
|
||||
@@ -163,6 +165,7 @@ class Journalcashv2 extends MY_Controller
|
||||
// Tambahkan LIMIT OFFSET
|
||||
$sql_paginated = $sql . " LIMIT ? OFFSET ?";
|
||||
$params_paginated = array_merge($params, [$number_limit, $number_offset]);
|
||||
|
||||
$qry = $this->db->query($sql_paginated, $params_paginated);
|
||||
|
||||
if ($qry) {
|
||||
@@ -361,7 +364,6 @@ class Journalcashv2 extends MY_Controller
|
||||
$this->sys_error($message);
|
||||
}
|
||||
}
|
||||
|
||||
function getUserApproveLevel()
|
||||
{
|
||||
try {
|
||||
|
||||
@@ -118,6 +118,19 @@ class Journalgoodreceive extends MY_Controller
|
||||
exit;
|
||||
}
|
||||
|
||||
// if ($loginLevel == "branch") {
|
||||
// $where_conditions[] = "jurnalM_BranchCode = ?";
|
||||
// $params[] = $branchCode;
|
||||
// } elseif ($loginLevel == "regional") {
|
||||
// $where_conditions[] = "jurnalS_RegionalID = ?";
|
||||
// $params[] = $regionalId;
|
||||
|
||||
// if (!empty($branchCode)) {
|
||||
// $where_conditions[] = "jurnalM_BranchCode = ?";
|
||||
// $params[] = $branchCode;
|
||||
// }
|
||||
// }
|
||||
|
||||
// Gabungkan WHERE SQL
|
||||
$where_sql = implode(" AND ", $where_conditions);
|
||||
|
||||
|
||||
@@ -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