3281 lines
111 KiB
PHP
3281 lines
111 KiB
PHP
<?php
|
|
|
|
class Province extends MY_Controller
|
|
{
|
|
var $db_onedev;
|
|
public function index()
|
|
{
|
|
echo "PROVINCE API";
|
|
}
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->db_onedev = $this->load->database("onedev", true);
|
|
}
|
|
|
|
|
|
function lookupcity(){
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
$prm = $this->sys_input;
|
|
$id = $prm['id'];
|
|
$search = $prm['search'];
|
|
$all = $prm['all'];
|
|
$limit = '';
|
|
if($all == 'N'){
|
|
$limit = ' LIMIT 10';
|
|
}
|
|
$number_limit = 10;
|
|
$number_offset = ($prm['current_page'] - 1) * $number_limit ;
|
|
$sql = "select COUNT(*) as total
|
|
from m_city
|
|
JOIN m_province ON M_CityM_ProvinceID = M_ProvinceID AND M_ProvinceIsActive = 'Y'
|
|
WHERE
|
|
( M_CityName LIKE CONCAT('%','{$search}','%')) AND
|
|
($id = 0 or ($id > 0 and M_CityM_ProvinceID = $id))
|
|
AND M_CityIsActive = 'Y'";
|
|
$sql_param = array($search);
|
|
// $total = $this->db_onedev->query($sql,$sql_param)->row()->total;
|
|
$query = $this->db_onedev->query($sql);
|
|
$tot_count = 0;
|
|
$tot_page = 0;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
$tot_page = ceil($tot_count/$number_limit);
|
|
} else {
|
|
$this->sys_error_db("m_city count", $this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "select M_CityID as id,
|
|
M_CityName as name,
|
|
M_CityCode as code,
|
|
IF(M_CityCode = '',M_CityName,CONCAT(M_CityName, ' [',M_CityCode,']')) as namex,
|
|
M_ProvinceID,
|
|
M_ProvinceName,
|
|
IF(M_CityIsDefault = 'N','Tidak','Ya') as isdefault,
|
|
m_city.*
|
|
from m_city
|
|
JOIN m_province ON M_CityM_ProvinceID = M_ProvinceID AND M_ProvinceIsActive = 'Y'
|
|
WHERE
|
|
( M_CityName LIKE CONCAT('%','{$search}','%') OR
|
|
M_CityCode LIKE CONCAT('%','{$search}','%') OR
|
|
M_ProvinceName LIKE CONCAT('%','{$search}','%')
|
|
) AND
|
|
($id = 0 or ($id > 0 and M_CityM_ProvinceID = $id))
|
|
AND M_CityIsActive = 'Y'
|
|
ORDER BY M_CityName ASC
|
|
limit $number_limit offset $number_offset";
|
|
$sql_param = array($search);
|
|
$query = $this->db_onedev->query($sql);
|
|
// echo $this->db_onedev->last_query();
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
|
|
|
|
} else {
|
|
$this->sys_error_db("m_city select");
|
|
exit;
|
|
}
|
|
|
|
$result = array ("total" => $tot_page, "total_filter"=>count($rows),"records" => $rows);
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
function lookupcitybyprovince(){
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
$prm = $this->sys_input;
|
|
$id = $prm['id'];
|
|
$search = $prm['search'];
|
|
$all = $prm['all'];
|
|
$limit = '';
|
|
if($all == 'N'){
|
|
$limit = ' LIMIT 10';
|
|
}
|
|
$number_limit = 10;
|
|
$number_offset = ($prm['current_page'] - 1) * $number_limit ;
|
|
$sql = "select COUNT(*) as total
|
|
from m_city
|
|
JOIN m_province ON M_CityM_ProvinceID = M_ProvinceID AND M_ProvinceIsActive = 'Y'
|
|
WHERE
|
|
M_ProvinceName LIKE CONCAT('%','{$search}','%')
|
|
AND M_CityIsActive = 'Y'";
|
|
$sql_param = array($search);
|
|
// $total = $this->db_onedev->query($sql,$sql_param)->row()->total;
|
|
$query = $this->db_onedev->query($sql);
|
|
$tot_count = 0;
|
|
$tot_page = 0;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
$tot_page = ceil($tot_count/$number_limit);
|
|
} else {
|
|
$this->sys_error_db("m_city count", $this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "select M_CityID as id,
|
|
M_CityName as name,
|
|
M_CityCode as code,
|
|
IF(M_CityCode = '',M_CityName,CONCAT(M_CityName, ' [',M_CityCode,']')) as namex,
|
|
M_ProvinceID,
|
|
M_ProvinceName,
|
|
IF(M_CityIsDefault = 'N','Tidak','Ya') as isdefault,
|
|
m_city.*
|
|
from m_city
|
|
JOIN m_province ON M_CityM_ProvinceID = M_ProvinceID AND M_ProvinceIsActive = 'Y'
|
|
WHERE
|
|
M_ProvinceName LIKE CONCAT('%','{$search}','%')
|
|
AND M_CityIsActive = 'Y'
|
|
ORDER BY M_CityName ASC
|
|
limit $number_limit offset $number_offset";
|
|
$sql_param = array($search);
|
|
$query = $this->db_onedev->query($sql);
|
|
// echo $this->db_onedev->last_query();
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
|
|
|
|
} else {
|
|
$this->sys_error_db("m_city select");
|
|
exit;
|
|
}
|
|
|
|
$result = array ("total" => $tot_page, "total_filter"=>count($rows),"records" => $rows);
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
function lookupcitybydistrict(){
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
$prm = $this->sys_input;
|
|
$id = $prm['id'];
|
|
$search = $prm['search'];
|
|
$all = $prm['all'];
|
|
$limit = '';
|
|
if($all == 'N'){
|
|
$limit = ' LIMIT 10';
|
|
}
|
|
$number_limit = 10;
|
|
$number_offset = ($prm['current_page'] - 1) * $number_limit ;
|
|
$sql = "select COUNT(*) as total
|
|
from m_city
|
|
JOIN m_province ON M_CityM_ProvinceID = M_ProvinceID AND M_ProvinceIsActive = 'Y'
|
|
JOIN m_district ON M_CityID = M_DistrictM_CityID AND M_DistrictIsActive = 'Y'
|
|
WHERE
|
|
M_DistrictName LIKE CONCAT('%','{$search}','%')
|
|
AND M_CityIsActive = 'Y'";
|
|
$sql_param = array($search);
|
|
// $total = $this->db_onedev->query($sql,$sql_param)->row()->total;
|
|
$query = $this->db_onedev->query($sql);
|
|
$tot_count = 0;
|
|
$tot_page = 0;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
$tot_page = ceil($tot_count/$number_limit);
|
|
} else {
|
|
$this->sys_error_db("m_city count", $this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "select M_CityID as id,
|
|
M_CityName as name,
|
|
M_CityCode as code,
|
|
IF(M_CityCode = '',M_CityName,CONCAT(M_CityName, ' [',M_CityCode,']')) as namex,
|
|
M_ProvinceID,
|
|
M_ProvinceName,
|
|
IF(M_CityIsDefault = 'N','Tidak','Ya') as isdefault,
|
|
m_city.*
|
|
from m_city
|
|
JOIN m_province ON M_CityM_ProvinceID = M_ProvinceID AND M_ProvinceIsActive = 'Y'
|
|
JOIN m_district ON M_CityID = M_DistrictM_CityID AND M_DistrictIsActive = 'Y'
|
|
WHERE
|
|
M_DistrictName LIKE CONCAT('%','{$search}','%')
|
|
AND M_CityIsActive = 'Y'
|
|
ORDER BY M_CityName ASC
|
|
limit $number_limit offset $number_offset";
|
|
$sql_param = array($search);
|
|
$query = $this->db_onedev->query($sql);
|
|
// echo $this->db_onedev->last_query();
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
|
|
|
|
} else {
|
|
$this->sys_error_db("m_city select");
|
|
exit;
|
|
}
|
|
|
|
$result = array ("total" => $tot_page, "total_filter"=>count($rows),"records" => $rows);
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
function lookupcitybykelurahan(){
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
$prm = $this->sys_input;
|
|
$id = $prm['id'];
|
|
$search = $prm['search'];
|
|
$all = $prm['all'];
|
|
$limit = '';
|
|
if($all == 'N'){
|
|
$limit = ' LIMIT 10';
|
|
}
|
|
$number_limit = 10;
|
|
$number_offset = ($prm['current_page'] - 1) * $number_limit ;
|
|
$sql = "select COUNT(*) as total
|
|
from m_city
|
|
JOIN m_province ON M_CityM_ProvinceID = M_ProvinceID AND M_ProvinceIsActive = 'Y'
|
|
JOIN m_district ON M_CityID = M_DistrictM_CityID AND M_DistrictIsActive = 'Y'
|
|
JOIN m_kelurahan ON M_DistrictID = M_KelurahanM_DistrictID AND M_KelurahanIsActive = 'Y'
|
|
WHERE
|
|
M_KelurahanName LIKE CONCAT('%','{$search}','%')
|
|
AND M_CityIsActive = 'Y'";
|
|
$sql_param = array($search);
|
|
// $total = $this->db_onedev->query($sql,$sql_param)->row()->total;
|
|
$query = $this->db_onedev->query($sql);
|
|
$tot_count = 0;
|
|
$tot_page = 0;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
$tot_page = ceil($tot_count/$number_limit);
|
|
} else {
|
|
$this->sys_error_db("m_city count", $this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "select M_CityID as id,
|
|
M_CityName as name,
|
|
M_CityCode as code,
|
|
IF(M_CityCode = '',M_CityName,CONCAT(M_CityName, ' [',M_CityCode,']')) as namex,
|
|
M_ProvinceID,
|
|
M_ProvinceName,
|
|
IF(M_CityIsDefault = 'N','Tidak','Ya') as isdefault,
|
|
m_city.*
|
|
from m_city
|
|
JOIN m_province ON M_CityM_ProvinceID = M_ProvinceID AND M_ProvinceIsActive = 'Y'
|
|
JOIN m_district ON M_CityID = M_DistrictM_cityID AND M_DistrictIsActive = 'Y'
|
|
JOIN m_kelurahan ON M_DistrictID = M_KelurahanM_DistrictID AND M_KelurahanIsActive = 'Y'
|
|
WHERE
|
|
M_KelurahanName LIKE CONCAT('%','{$search}','%')
|
|
AND M_CityIsActive = 'Y'
|
|
ORDER BY M_CityName ASC
|
|
limit $number_limit offset $number_offset";
|
|
$sql_param = array($search);
|
|
$query = $this->db_onedev->query($sql);
|
|
// echo $this->db_onedev->last_query();
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
|
|
|
|
} else {
|
|
$this->sys_error_db("m_city select");
|
|
exit;
|
|
}
|
|
|
|
$result = array ("total" => $tot_page, "total_filter"=>count($rows),"records" => $rows);
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
function lookupdistrict(){
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
$prm = $this->sys_input;
|
|
$id = $prm['id'];
|
|
$search = $prm['search'];
|
|
$all = $prm['all'];
|
|
$limit = '';
|
|
if($all == 'N'){
|
|
$limit = ' LIMIT 10';
|
|
}
|
|
$number_limit = 10;
|
|
$number_offset = ($prm['current_page'] - 1) * $number_limit ;
|
|
$sql = "select COUNT(*) as total
|
|
from m_district
|
|
JOIN m_city ON M_DistrictM_CityID = M_CityID AND M_CityIsActive = 'Y'
|
|
WHERE
|
|
( M_DistrictName LIKE CONCAT('%','{$search}','%')) AND
|
|
($id = 0 or ($id > 0 and M_DistrictM_CityID = $id))
|
|
AND M_DistrictIsActive = 'Y'";
|
|
$sql_param = array($search);
|
|
// $total = $this->db_onedev->query($sql,$sql_param)->row()->total;
|
|
$query = $this->db_onedev->query($sql);
|
|
$tot_count = 0;
|
|
$tot_page = 0;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
$tot_page = ceil($tot_count/$number_limit);
|
|
} else {
|
|
$this->sys_error_db("m_district count", $this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "select M_DistrictID as id,
|
|
M_DistrictName as name,
|
|
M_DistrictCode as code,
|
|
IF(M_DistrictCode = '',M_DistrictName,CONCAT(M_DistrictName, ' [',M_DistrictCode,']')) as namex,
|
|
M_CityID,
|
|
M_CityName,
|
|
IF(M_DistrictIsDefault = 'N','Tidak','Ya') as isdefault,
|
|
m_district.*
|
|
from m_district
|
|
JOIN m_city ON M_DistrictM_CityID = M_CityID AND M_CityIsActive = 'Y'
|
|
WHERE
|
|
( M_DistrictName LIKE CONCAT('%','{$search}','%') OR
|
|
M_DistrictCode LIKE CONCAT('%','{$search}','%') OR
|
|
M_CityName LIKE CONCAT('%','{$search}','%')
|
|
) AND
|
|
($id = 0 or ($id > 0 and M_DistrictM_CityID = $id))
|
|
AND M_DistrictIsActive = 'Y'
|
|
ORDER BY M_DistrictName ASC
|
|
limit $number_limit offset $number_offset";
|
|
$sql_param = array($search);
|
|
$query = $this->db_onedev->query($sql);
|
|
// echo $this->db_onedev->last_query();
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
|
|
|
|
} else {
|
|
$this->sys_error_db("m_district select");
|
|
exit;
|
|
}
|
|
|
|
$result = array ("total" => $tot_page, "total_filter"=>count($rows),"records" => $rows);
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
function lookupdistrictbycity(){
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
$prm = $this->sys_input;
|
|
$id = $prm['id'];
|
|
$search = $prm['search'];
|
|
$all = $prm['all'];
|
|
$limit = '';
|
|
if($all == 'N'){
|
|
$limit = ' LIMIT 10';
|
|
}
|
|
$number_limit = 10;
|
|
$number_offset = ($prm['current_page'] - 1) * $number_limit ;
|
|
$sql = "select COUNT(*) as total
|
|
from m_district
|
|
JOIN m_city ON M_DistrictM_CityID = M_CityID AND M_CityIsActive = 'Y'
|
|
WHERE
|
|
M_CityName LIKE CONCAT('%','{$search}','%')
|
|
AND M_DistrictIsActive = 'Y'";
|
|
$sql_param = array($search);
|
|
// $total = $this->db_onedev->query($sql,$sql_param)->row()->total;
|
|
$query = $this->db_onedev->query($sql);
|
|
$tot_count = 0;
|
|
$tot_page = 0;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
$tot_page = ceil($tot_count/$number_limit);
|
|
} else {
|
|
$this->sys_error_db("m_district count", $this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "select M_DistrictID as id,
|
|
M_DistrictName as name,
|
|
M_DistrictCode as code,
|
|
IF(M_DistrictCode = '',M_DistrictName,CONCAT(M_DistrictName, ' [',M_DistrictCode,']')) as namex,
|
|
M_CityID,
|
|
M_CityName,
|
|
IF(M_DistrictIsDefault = 'N','Tidak','Ya') as isdefault,
|
|
m_district.*
|
|
from m_district
|
|
JOIN m_city ON M_DistrictM_CityID = M_CityID AND M_CityIsActive = 'Y'
|
|
WHERE
|
|
M_CityName LIKE CONCAT('%','{$search}','%')
|
|
AND M_DistrictIsActive = 'Y'
|
|
ORDER BY M_DistrictName ASC
|
|
limit $number_limit offset $number_offset";
|
|
$sql_param = array($search);
|
|
$query = $this->db_onedev->query($sql);
|
|
// echo $this->db_onedev->last_query();
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
|
|
|
|
} else {
|
|
$this->sys_error_db("m_district select");
|
|
exit;
|
|
}
|
|
|
|
$result = array ("total" => $tot_page, "total_filter"=>count($rows),"records" => $rows);
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
function lookupdistrictbyprovince(){
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
$prm = $this->sys_input;
|
|
$id = $prm['id'];
|
|
$search = $prm['search'];
|
|
$all = $prm['all'];
|
|
$limit = '';
|
|
if($all == 'N'){
|
|
$limit = ' LIMIT 10';
|
|
}
|
|
$number_limit = 10;
|
|
$number_offset = ($prm['current_page'] - 1) * $number_limit ;
|
|
$sql = "select COUNT(*) as total
|
|
from m_district
|
|
JOIN m_city ON M_DistrictM_CityID = M_CityID AND M_CityIsActive = 'Y'
|
|
JOIN m_province ON M_CityM_ProvinceID = M_ProvinceID AND M_ProvinceIsActive = 'Y'
|
|
WHERE
|
|
M_ProvinceName LIKE CONCAT('%','{$search}','%')
|
|
AND M_DistrictIsActive = 'Y'";
|
|
$sql_param = array($search);
|
|
// $total = $this->db_onedev->query($sql,$sql_param)->row()->total;
|
|
$query = $this->db_onedev->query($sql);
|
|
$tot_count = 0;
|
|
$tot_page = 0;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
$tot_page = ceil($tot_count/$number_limit);
|
|
} else {
|
|
$this->sys_error_db("m_district count", $this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "select M_DistrictID as id,
|
|
M_DistrictName as name,
|
|
M_DistrictCode as code,
|
|
IF(M_DistrictCode = '',M_DistrictName,CONCAT(M_DistrictName, ' [',M_DistrictCode,']')) as namex,
|
|
M_CityID,
|
|
M_CityName,
|
|
IF(M_DistrictIsDefault = 'N','Tidak','Ya') as isdefault,
|
|
m_district.*
|
|
from m_district
|
|
JOIN m_city ON M_DistrictM_CityID = M_CityID AND M_CityIsActive = 'Y'
|
|
JOIN m_province ON M_CityM_ProvinceID = M_ProvinceID AND M_ProvinceIsActive = 'Y'
|
|
WHERE
|
|
M_ProvinceName LIKE CONCAT('%','{$search}','%')
|
|
AND M_DistrictIsActive = 'Y'
|
|
ORDER BY M_DistrictName ASC
|
|
limit $number_limit offset $number_offset";
|
|
$sql_param = array($search);
|
|
$query = $this->db_onedev->query($sql);
|
|
// echo $this->db_onedev->last_query();
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
|
|
|
|
} else {
|
|
$this->sys_error_db("m_district select");
|
|
exit;
|
|
}
|
|
|
|
$result = array ("total" => $tot_page, "total_filter"=>count($rows),"records" => $rows);
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
function lookupdistrictbykelurahan(){
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
$prm = $this->sys_input;
|
|
$id = $prm['id'];
|
|
$search = $prm['search'];
|
|
$all = $prm['all'];
|
|
$limit = '';
|
|
if($all == 'N'){
|
|
$limit = ' LIMIT 10';
|
|
}
|
|
$number_limit = 10;
|
|
$number_offset = ($prm['current_page'] - 1) * $number_limit ;
|
|
$sql = "select COUNT(*) as total
|
|
from m_district
|
|
JOIN m_city ON M_DistrictM_CityID = M_CityID AND M_CityIsActive = 'Y'
|
|
JOIN m_kelurahan ON M_DistrictID = M_KelurahanM_DistrictID AND M_KelurahanIsActive = 'Y'
|
|
WHERE
|
|
M_KelurahanName LIKE CONCAT('%','{$search}','%')
|
|
AND M_DistrictIsActive = 'Y'";
|
|
$sql_param = array($search);
|
|
// $total = $this->db_onedev->query($sql,$sql_param)->row()->total;
|
|
$query = $this->db_onedev->query($sql);
|
|
$tot_count = 0;
|
|
$tot_page = 0;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
$tot_page = ceil($tot_count/$number_limit);
|
|
} else {
|
|
$this->sys_error_db("m_district count", $this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "select M_DistrictID as id,
|
|
M_DistrictName as name,
|
|
M_DistrictCode as code,
|
|
IF(M_DistrictCode = '',M_DistrictName,CONCAT(M_DistrictName, ' [',M_DistrictCode,']')) as namex,
|
|
M_CityID,
|
|
M_CityName,
|
|
IF(M_DistrictIsDefault = 'N','Tidak','Ya') as isdefault,
|
|
m_district.*
|
|
from m_district
|
|
JOIN m_city ON M_DistrictM_CityID = M_CityID AND M_CityIsActive = 'Y'
|
|
JOIN m_kelurahan ON M_DistrictID = M_KelurahanM_DistrictID AND M_KelurahanIsActive = 'Y'
|
|
WHERE
|
|
M_KelurahanName LIKE CONCAT('%','{$search}','%')
|
|
AND M_DistrictIsActive = 'Y'
|
|
ORDER BY M_DistrictName ASC
|
|
limit $number_limit offset $number_offset";
|
|
$sql_param = array($search);
|
|
$query = $this->db_onedev->query($sql);
|
|
// echo $this->db_onedev->last_query();
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
|
|
|
|
} else {
|
|
$this->sys_error_db("m_district select");
|
|
exit;
|
|
}
|
|
|
|
$result = array ("total" => $tot_page, "total_filter"=>count($rows),"records" => $rows);
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
function lookupcitybyname(){
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
$prm = $this->sys_input;
|
|
$province = $prm['province'];
|
|
$city = $prm['city'];
|
|
$district = $prm['district'];
|
|
$kelurahan = $prm['kelurahan'];
|
|
$all = $prm['all'];
|
|
$limit = '';
|
|
if($all == 'N'){
|
|
$limit = ' LIMIT 10';
|
|
}
|
|
$number_limit = 10;
|
|
$number_offset = ($prm['current_page'] - 1) * $number_limit ;
|
|
$sql = "select COUNT(*) as total
|
|
FROM(SELECT *
|
|
from m_city
|
|
JOIN m_province ON M_CityM_ProvinceID = M_ProvinceID AND M_ProvinceIsActive = 'Y'
|
|
LEFT JOIN m_district ON M_CityID = M_DistrictM_CityID AND M_DistrictIsActive = 'Y'
|
|
LEFT JOIN m_kelurahan ON M_DistrictID = M_KelurahanM_DistrictID AND M_KelurahanIsActive = 'Y'
|
|
WHERE
|
|
M_ProvinceName LIKE CONCAT('%','{$province}','%') AND
|
|
M_CityName LIKE CONCAT('%','{$city}','%') AND
|
|
IFNULL(M_DistrictName,'') LIKE CONCAT('%','{$district}','%') AND
|
|
IFNULL(M_KelurahanName,'') LIKE CONCAT('%','{$kelurahan}','%') AND
|
|
M_CityIsActive = 'Y' GROUP BY M_CityID) a";
|
|
$sql_param = array($search);
|
|
// $total = $this->db_onedev->query($sql,$sql_param)->row()->total;
|
|
$query = $this->db_onedev->query($sql);
|
|
$tot_count = 0;
|
|
$tot_page = 0;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
$tot_page = ceil($tot_count/$number_limit);
|
|
} else {
|
|
$this->sys_error_db("m_city count", $this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "select M_CityID as id,
|
|
M_CityName as name,
|
|
M_CityCode as code,
|
|
IF(M_CityCode = '',M_CityName,CONCAT(M_CityName, ' [',M_CityCode,']')) as namex,
|
|
M_ProvinceID,
|
|
M_ProvinceName,
|
|
IF(M_CityIsDefault = 'N','Tidak','Ya') as isdefault,
|
|
m_city.*
|
|
from m_city
|
|
JOIN m_province ON M_CityM_ProvinceID = M_ProvinceID AND M_ProvinceIsActive = 'Y'
|
|
LEFT JOIN m_district ON M_CityID = M_DistrictM_cityID AND M_DistrictIsActive = 'Y'
|
|
LEFT JOIN m_kelurahan ON M_DistrictID = M_KelurahanM_DistrictID AND M_KelurahanIsActive = 'Y'
|
|
WHERE
|
|
M_ProvinceName LIKE CONCAT('%','{$province}','%') AND
|
|
M_CityName LIKE CONCAT('%','{$city}','%') AND
|
|
IFNULL(M_DistrictName,'') LIKE CONCAT('%','{$district}','%') AND
|
|
IFNULL(M_KelurahanName,'') LIKE CONCAT('%','{$kelurahan}','%') AND
|
|
M_CityIsActive = 'Y'
|
|
GROUP BY M_CityID
|
|
ORDER BY M_CityName ASC
|
|
limit $number_limit offset $number_offset";
|
|
$sql_param = array($search);
|
|
$query = $this->db_onedev->query($sql);
|
|
// echo $this->db_onedev->last_query();
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
|
|
|
|
} else {
|
|
$this->sys_error_db("m_city select");
|
|
exit;
|
|
}
|
|
|
|
$result = array ("total" => $tot_page, "total_filter"=>count($rows),"records" => $rows);
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
function lookupdistrictbyname(){
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
$prm = $this->sys_input;
|
|
$id = $prm['id'];
|
|
$province = $prm['province'];
|
|
$city = $prm['city'];
|
|
$district = $prm['district'];
|
|
$kelurahan = $prm['kelurahan'];
|
|
$all = $prm['all'];
|
|
$limit = '';
|
|
if($all == 'N'){
|
|
$limit = ' LIMIT 10';
|
|
}
|
|
$number_limit = 10;
|
|
$number_offset = ($prm['current_page'] - 1) * $number_limit ;
|
|
$sql = "select COUNT(*) as total
|
|
FROM(SELECT *
|
|
from m_district
|
|
JOIN m_city ON M_DistrictM_CityID = M_CityID AND M_CityIsActive = 'Y'
|
|
JOIN m_province ON M_CityM_ProvinceID = M_ProvinceID AND M_ProvinceIsActive = 'Y'
|
|
LEFT JOIN m_kelurahan ON M_DistrictID = M_KelurahanM_DistrictID AND M_KelurahanIsActive = 'Y'
|
|
WHERE
|
|
M_ProvinceName LIKE CONCAT('%','{$province}','%') AND
|
|
M_CityName LIKE CONCAT('%','{$city}','%') AND
|
|
M_DistrictName LIKE CONCAT('%','{$district}','%') AND
|
|
IFNULL(M_KelurahanName,'') LIKE CONCAT('%','{$kelurahan}','%') AND
|
|
M_DistrictIsActive = 'Y' GROUP BY M_DistrictID) a";
|
|
$sql_param = array($search);
|
|
// $total = $this->db_onedev->query($sql,$sql_param)->row()->total;
|
|
$query = $this->db_onedev->query($sql);
|
|
$tot_count = 0;
|
|
$tot_page = 0;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
$tot_page = ceil($tot_count/$number_limit);
|
|
} else {
|
|
$this->sys_error_db("m_district count", $this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "select M_DistrictID as id,
|
|
M_DistrictName as name,
|
|
M_DistrictCode as code,
|
|
IF(M_DistrictCode = '',M_DistrictName,CONCAT(M_DistrictName, ' [',M_DistrictCode,']')) as namex,
|
|
M_CityID,
|
|
M_CityName,
|
|
IF(M_DistrictIsDefault = 'N','Tidak','Ya') as isdefault,
|
|
m_district.*
|
|
from m_district
|
|
JOIN m_city ON M_DistrictM_CityID = M_CityID AND M_CityIsActive = 'Y'
|
|
JOIN m_province ON M_CityM_ProvinceID = M_ProvinceID AND M_ProvinceIsActive = 'Y'
|
|
LEFT JOIN m_kelurahan ON M_DistrictID = M_KelurahanM_DistrictID AND M_KelurahanIsActive = 'Y'
|
|
WHERE
|
|
M_ProvinceName LIKE CONCAT('%','{$province}','%') AND
|
|
M_CityName LIKE CONCAT('%','{$city}','%') AND
|
|
M_DistrictName LIKE CONCAT('%','{$district}','%') AND
|
|
IFNULL(M_KelurahanName,'') LIKE CONCAT('%','{$kelurahan}','%') AND
|
|
M_DistrictIsActive = 'Y'
|
|
GROUP BY M_DistrictID
|
|
ORDER BY M_DistrictName ASC
|
|
limit $number_limit offset $number_offset";
|
|
$sql_param = array($search);
|
|
$query = $this->db_onedev->query($sql);
|
|
// echo $this->db_onedev->last_query();
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
|
|
|
|
} else {
|
|
$this->sys_error_db("m_district select");
|
|
exit;
|
|
}
|
|
|
|
$result = array ("total" => $tot_page, "total_filter"=>count($rows),"records" => $rows);
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
public function lookup()
|
|
{
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
$prm = $this->sys_input;
|
|
$search = $prm['search'];
|
|
$all = $prm['all'];
|
|
$limit = '';
|
|
if($all == 'N'){
|
|
$limit = ' LIMIT 10';
|
|
}
|
|
$number_limit = 10;
|
|
$number_offset = ($prm['current_page'] - 1) * $number_limit ;
|
|
$sql = "select COUNT(*) as total
|
|
from m_province
|
|
where
|
|
( M_ProvinceName LIKE CONCAT('%','{$search}','%'))AND
|
|
M_ProvinceIsActive = 'Y'";
|
|
$sql_param = array($search);
|
|
// $total = $this->db_onedev->query($sql,$sql_param)->row()->total;
|
|
$query = $this->db_onedev->query($sql);
|
|
$tot_count = 0;
|
|
$tot_page = 0;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
$tot_page = ceil($tot_count/$number_limit);
|
|
} else {
|
|
$this->sys_error_db("m_province count", $this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "select M_ProvinceID as id,
|
|
M_ProvinceName as name,
|
|
M_ProvinceCode as code,
|
|
IF(M_ProvinceCode = '',M_ProvinceName,CONCAT(M_ProvinceName, ' [',M_ProvinceCode,']')) as namex,
|
|
IF(M_ProvinceIsDefault = 'N','Tidak','Ya') as isdefault,
|
|
m_province.*
|
|
from m_province
|
|
where
|
|
( M_ProvinceName LIKE CONCAT('%','{$search}','%') OR
|
|
M_ProvinceCode LIKE CONCAT('%','{$search}','%')
|
|
)AND
|
|
M_ProvinceIsActive = 'Y'
|
|
ORDER BY M_ProvinceName ASC
|
|
limit $number_limit offset $number_offset";
|
|
$sql_param = array($search);
|
|
$query = $this->db_onedev->query($sql);
|
|
//echo $this->db_onedev->last_query();
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
|
|
|
|
} else {
|
|
$this->sys_error_db("m_province select");
|
|
exit;
|
|
}
|
|
|
|
$result = array ("total" => $tot_page, "total_filter"=>count($rows),"records" => $rows);
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
public function lookupprovincebyname()
|
|
{
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
$prm = $this->sys_input;
|
|
$province = $prm['province'];
|
|
$city = $prm['city'];
|
|
$district = $prm['district'];
|
|
$kelurahan = $prm['kelurahan'];
|
|
$limit = '';
|
|
if($all == 'N'){
|
|
$limit = ' LIMIT 10';
|
|
}
|
|
$number_limit = 10;
|
|
$number_offset = ($prm['current_page'] - 1) * $number_limit ;
|
|
$sql = "select COUNT(*) as total
|
|
FROM(SELECT *
|
|
from m_province
|
|
LEFT JOIN m_city ON M_ProvinceID = M_CityM_ProvinceID AND M_CityIsActive = 'Y'
|
|
LEFT JOIN m_district ON M_CityID = M_DistrictM_CityID AND M_DistrictIsActive = 'Y'
|
|
LEFT JOIN m_kelurahan ON M_DistrictID = M_KelurahanM_DistrictID AND M_KelurahanIsActive = 'Y'
|
|
where
|
|
M_ProvinceName LIKE CONCAT('%','{$province}','%') AND
|
|
IFNULL(M_CityName,'') LIKE CONCAT('%','{$city}','%') AND
|
|
IFNULL(M_DistrictName,'') LIKE CONCAT('%','{$district}','%') AND
|
|
IFNULL(M_KelurahanName,'') LIKE CONCAT('%','{$kelurahan}','%') AND
|
|
M_ProvinceIsActive = 'Y'
|
|
GROUP BY M_ProvinceID) a";
|
|
$sql_param = array($search);
|
|
// $total = $this->db_onedev->query($sql,$sql_param)->row()->total;
|
|
$query = $this->db_onedev->query($sql);
|
|
$tot_count = 0;
|
|
$tot_page = 0;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
$tot_page = ceil($tot_count/$number_limit);
|
|
} else {
|
|
$this->sys_error_db("m_province count", $this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "select M_ProvinceID as id,
|
|
M_ProvinceName as name,
|
|
M_ProvinceCode as code,
|
|
IF(M_ProvinceCode = '',M_ProvinceName,CONCAT(M_ProvinceName, ' [',M_ProvinceCode,']')) as namex,
|
|
IF(M_ProvinceIsDefault = 'N','Tidak','Ya') as isdefault,
|
|
m_province.*
|
|
from m_province
|
|
LEFT JOIN m_city ON M_ProvinceID = M_CityM_ProvinceID AND M_CityIsActive = 'Y'
|
|
LEFT JOIN m_district ON M_CityID = M_DistrictM_CityID AND M_DistrictIsActive = 'Y'
|
|
LEFT JOIN m_kelurahan ON M_DistrictID = M_KelurahanM_DistrictID AND M_KelurahanIsActive = 'Y'
|
|
where
|
|
M_ProvinceName LIKE CONCAT('%','{$province}','%') AND
|
|
IFNULL(M_CityName,'') LIKE CONCAT('%','{$city}','%') AND
|
|
IFNULL(M_DistrictName,'') LIKE CONCAT('%','{$district}','%') AND
|
|
IFNULL(M_KelurahanName,'') LIKE CONCAT('%','{$kelurahan}','%') AND
|
|
M_ProvinceIsActive = 'Y'
|
|
GROUP BY M_ProvinceID
|
|
ORDER BY M_ProvinceName ASC
|
|
limit $number_limit offset $number_offset";
|
|
$sql_param = array($search);
|
|
$query = $this->db_onedev->query($sql);
|
|
//echo $this->db_onedev->last_query();
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
|
|
|
|
} else {
|
|
$this->sys_error_db("m_province select");
|
|
exit;
|
|
}
|
|
|
|
$result = array ("total" => $tot_page, "total_filter"=>count($rows),"records" => $rows);
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
public function lookupprovincebykelurahan()
|
|
{
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
$prm = $this->sys_input;
|
|
$search = $prm['search'];
|
|
$all = $prm['all'];
|
|
$limit = '';
|
|
if($all == 'N'){
|
|
$limit = ' LIMIT 10';
|
|
}
|
|
$number_limit = 10;
|
|
$number_offset = ($prm['current_page'] - 1) * $number_limit ;
|
|
$sql = "select COUNT(*) as total
|
|
from m_province
|
|
JOIN m_city ON M_ProvinceID = M_CityM_ProvinceID AND M_CityIsActive = 'Y'
|
|
JOIN m_district ON M_CityID = M_DistrictM_CityID AND M_DistrictIsActive = 'Y'
|
|
JOIN m_kelurahan ON M_DistrictID = M_KelurahanM_DistrictID AND M_KelurahanIsActive = 'Y'
|
|
where
|
|
M_KelurahanName LIKE CONCAT('%','{$search}','%')
|
|
AND
|
|
M_ProvinceIsActive = 'Y'";
|
|
$sql_param = array($search);
|
|
// $total = $this->db_onedev->query($sql,$sql_param)->row()->total;
|
|
$query = $this->db_onedev->query($sql);
|
|
$tot_count = 0;
|
|
$tot_page = 0;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
$tot_page = ceil($tot_count/$number_limit);
|
|
} else {
|
|
$this->sys_error_db("m_province count", $this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "select M_ProvinceID as id,
|
|
M_ProvinceName as name,
|
|
M_ProvinceCode as code,
|
|
IF(M_ProvinceCode = '',M_ProvinceName,CONCAT(M_ProvinceName, ' [',M_ProvinceCode,']')) as namex,
|
|
IF(M_ProvinceIsDefault = 'N','Tidak','Ya') as isdefault,
|
|
m_province.*
|
|
from m_province
|
|
JOIN m_city ON M_ProvinceID = M_CityM_ProvinceID AND M_CityIsActive = 'Y'
|
|
JOIN m_district ON M_CityID = M_DistrictM_CityID AND M_DistrictIsActive = 'Y'
|
|
JOIN m_kelurahan ON M_DistrictID = M_KelurahanM_DistrictID AND M_KelurahanIsActive = 'Y'
|
|
where
|
|
M_KelurahanName LIKE CONCAT('%','{$search}','%')
|
|
AND
|
|
M_ProvinceIsActive = 'Y'
|
|
ORDER BY M_ProvinceName ASC
|
|
limit $number_limit offset $number_offset";
|
|
$sql_param = array($search);
|
|
$query = $this->db_onedev->query($sql);
|
|
//echo $this->db_onedev->last_query();
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
|
|
|
|
} else {
|
|
$this->sys_error_db("m_province select");
|
|
exit;
|
|
}
|
|
|
|
$result = array ("total" => $tot_page, "total_filter"=>count($rows),"records" => $rows);
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
public function lookupprovincebydistrict()
|
|
{
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
$prm = $this->sys_input;
|
|
$search = $prm['search'];
|
|
$all = $prm['all'];
|
|
$limit = '';
|
|
if($all == 'N'){
|
|
$limit = ' LIMIT 10';
|
|
}
|
|
$number_limit = 10;
|
|
$number_offset = ($prm['current_page'] - 1) * $number_limit ;
|
|
$sql = "select COUNT(*) as total
|
|
from m_province
|
|
JOIN m_city ON M_ProvinceID = M_CityM_ProvinceID AND M_CityIsActive = 'Y'
|
|
JOIN m_district ON M_CityID = M_DistrictM_CityID AND M_DistrictIsActive = 'Y'
|
|
where
|
|
M_DistrictName LIKE CONCAT('%','{$search}','%')
|
|
AND
|
|
M_ProvinceIsActive = 'Y'";
|
|
$sql_param = array($search);
|
|
// $total = $this->db_onedev->query($sql,$sql_param)->row()->total;
|
|
$query = $this->db_onedev->query($sql);
|
|
$tot_count = 0;
|
|
$tot_page = 0;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
$tot_page = ceil($tot_count/$number_limit);
|
|
} else {
|
|
$this->sys_error_db("m_province count", $this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "select M_ProvinceID as id,
|
|
M_ProvinceName as name,
|
|
M_ProvinceCode as code,
|
|
IF(M_ProvinceCode = '',M_ProvinceName,CONCAT(M_ProvinceName, ' [',M_ProvinceCode,']')) as namex,
|
|
IF(M_ProvinceIsDefault = 'N','Tidak','Ya') as isdefault,
|
|
m_province.*
|
|
from m_province
|
|
JOIN m_city ON M_ProvinceID = M_CityM_ProvinceID AND M_CityIsActive = 'Y'
|
|
JOIN m_district ON M_CityID = M_DistrictM_CityID AND M_DistrictIsActive = 'Y'
|
|
where
|
|
M_DistrictName LIKE CONCAT('%','{$search}','%')
|
|
AND
|
|
M_ProvinceIsActive = 'Y'
|
|
ORDER BY M_ProvinceName ASC
|
|
limit $number_limit offset $number_offset";
|
|
$sql_param = array($search);
|
|
$query = $this->db_onedev->query($sql);
|
|
//echo $this->db_onedev->last_query();
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
|
|
|
|
} else {
|
|
$this->sys_error_db("m_province select");
|
|
exit;
|
|
}
|
|
|
|
$result = array ("total" => $tot_page, "total_filter"=>count($rows),"records" => $rows);
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
public function lookupprovincebycity()
|
|
{
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
$prm = $this->sys_input;
|
|
$search = $prm['search'];
|
|
$all = $prm['all'];
|
|
$limit = '';
|
|
if($all == 'N'){
|
|
$limit = ' LIMIT 10';
|
|
}
|
|
$number_limit = 10;
|
|
$number_offset = ($prm['current_page'] - 1) * $number_limit ;
|
|
$sql = "select COUNT(*) as total
|
|
from m_province
|
|
JOIN m_city ON M_ProvinceID = M_CityM_ProvinceID AND M_CityIsActive = 'Y'
|
|
where
|
|
M_CityName LIKE CONCAT('%','{$search}','%')
|
|
AND
|
|
M_ProvinceIsActive = 'Y'";
|
|
$sql_param = array($search);
|
|
// $total = $this->db_onedev->query($sql,$sql_param)->row()->total;
|
|
$query = $this->db_onedev->query($sql);
|
|
$tot_count = 0;
|
|
$tot_page = 0;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
$tot_page = ceil($tot_count/$number_limit);
|
|
} else {
|
|
$this->sys_error_db("m_province count", $this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "select M_ProvinceID as id,
|
|
M_ProvinceName as name,
|
|
M_ProvinceCode as code,
|
|
IF(M_ProvinceCode = '',M_ProvinceName,CONCAT(M_ProvinceName, ' [',M_ProvinceCode,']')) as namex,
|
|
IF(M_ProvinceIsDefault = 'N','Tidak','Ya') as isdefault,
|
|
m_province.*
|
|
from m_province
|
|
JOIN m_city ON M_ProvinceID = M_CityM_ProvinceID AND M_CityIsActive = 'Y'
|
|
where
|
|
M_CityName LIKE CONCAT('%','{$search}','%')
|
|
AND
|
|
M_ProvinceIsActive = 'Y'
|
|
ORDER BY M_ProvinceName ASC
|
|
limit $number_limit offset $number_offset";
|
|
$sql_param = array($search);
|
|
$query = $this->db_onedev->query($sql);
|
|
//echo $this->db_onedev->last_query();
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
|
|
|
|
} else {
|
|
$this->sys_error_db("m_province select");
|
|
exit;
|
|
}
|
|
|
|
$result = array ("total" => $tot_page, "total_filter"=>count($rows),"records" => $rows);
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
public function addnewprovince()
|
|
{
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
//# ambil parameter input
|
|
$prm = $this->sys_input;
|
|
$name = $prm['name'];
|
|
$code = $prm['code'];
|
|
$isdefault = $prm['isdefault'];
|
|
$sql = "insert into m_province(
|
|
M_ProvinceName,
|
|
M_ProvinceCode,
|
|
M_ProvinceIsDefault,
|
|
M_ProvinceCreated,
|
|
M_ProvinceLastUpdated
|
|
)
|
|
values( ?, ?, ?, now(), now())";
|
|
$query = $this->db_onedev->query($sql,
|
|
array(
|
|
$name,
|
|
$code,
|
|
$isdefault
|
|
)
|
|
);
|
|
//echo $query;
|
|
if (!$query) {
|
|
$this->sys_error_db("m_province insert");
|
|
exit;
|
|
}
|
|
$last_id = $this->db_onedev->insert_id();
|
|
if ($isdefault == "Y" ) {
|
|
$sql = "update m_province set M_ProvinceIsDefault= 'N'
|
|
where M_ProvinceID <> ? ";
|
|
$this->db_onedev->query($sql,array($last_id));
|
|
}
|
|
$result = array ("total" => 1, "records" => array("xid" => 0));
|
|
$this->sys_ok($result);
|
|
$last_id = $this->db_onedev->insert_id();
|
|
|
|
|
|
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
|
|
public function editprovince()
|
|
{
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
//# ambil parameter input
|
|
$prm = $this->sys_input;
|
|
$id = $prm['id'];
|
|
$name = $prm['name'];
|
|
$code = $prm['code'];
|
|
$isdefault = $prm['isdefault'];
|
|
$userid = $this->sys_user["M_UserID"];
|
|
$sqlcompany = "update m_province SET
|
|
M_ProvinceName = ?,
|
|
M_ProvinceCode = ?,
|
|
M_ProvinceIsDefault = ?,
|
|
M_ProvinceLastUpdated = now()
|
|
where
|
|
M_ProvinceID = ?
|
|
";
|
|
$querycompany = $this->db_onedev->query($sqlcompany,
|
|
array(
|
|
$name,
|
|
$code,
|
|
$isdefault,
|
|
$id
|
|
)
|
|
);
|
|
// echo $query;
|
|
if (!$querycompany) {
|
|
$this->sys_error_db("m_province update");
|
|
exit;
|
|
}
|
|
if ($isdefault == "Y" ) {
|
|
$sql = "update m_province set M_ProvinceIsDefault= 'N'
|
|
where M_ProvinceID <> ? ";
|
|
$this->db_onedev->query($sql,array($id));
|
|
}
|
|
$result = array ("total" => 1, "records" => array("xid" => $id));
|
|
$this->sys_ok($result);
|
|
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
public function addnewcity()
|
|
{
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
//# ambil parameter input
|
|
$prm = $this->sys_input;
|
|
$provinceid = $prm['provinceid'];
|
|
$code = $prm['code'];
|
|
$name = $prm['name'];
|
|
$isdefault = $prm['isdefault'];
|
|
$userid = $this->sys_user["M_UserID"];
|
|
if($prm['xid'] == 0){
|
|
|
|
$sql = "insert into m_city(
|
|
M_CityM_ProvinceID,
|
|
M_CityCode,
|
|
M_CityName,
|
|
M_CityIsDefault,
|
|
M_CityLastUpdated,
|
|
M_CityCreated)
|
|
values(?,?,?,?,now(),now())";
|
|
$query = $this->db_onedev->query($sql,
|
|
array(
|
|
$provinceid,
|
|
$code,
|
|
$name,
|
|
$isdefault
|
|
)
|
|
);
|
|
if (!$query) {
|
|
$this->sys_error_db("m_city insert",$this->db_onedev);
|
|
exit;
|
|
}
|
|
$last_id = $this->db_onedev->insert_id();
|
|
if ($isdefault == "Y" ) {
|
|
$sql = "update m_city set M_CityIsDefault= 'N'
|
|
where M_CityID <> ? ";
|
|
$this->db_onedev->query($sql,array($last_id));
|
|
}
|
|
$result = array ("total" => 1, "records" => array("xid" => 0));
|
|
$this->sys_ok($result);
|
|
}else{
|
|
|
|
//echo $query;
|
|
$sql = "UPDATE m_city SET M_CityM_ProvinceID = '{$provinceid}',
|
|
M_CityCode = '{$code}',
|
|
M_CityName = '{$name}',
|
|
M_CityIsDefault = '{$isdefault}'
|
|
WHERE M_CityID = '{$prm['xid']}'";
|
|
//echo $sql;
|
|
$query = $this->db_onedev->query($sql);
|
|
if ($isdefault == "Y" ) {
|
|
$sql = "update m_city set M_CityIsDefault= 'N'
|
|
where M_CityID <> ? ";
|
|
$this->db_onedev->query($sql,array($prm['xid']));
|
|
}
|
|
$result = array ("total" => 1, "records" => array("xid" => 0));
|
|
$this->sys_ok($result);
|
|
|
|
}
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
public function addnewdistrict()
|
|
{
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
//# ambil parameter input
|
|
$prm = $this->sys_input;
|
|
$cityid = $prm['cityid'];
|
|
$code = $prm['code'];
|
|
$name = $prm['name'];
|
|
$isdefault = $prm['isdefault'];
|
|
$userid = $this->sys_user["M_UserID"];
|
|
if($prm['xid'] == 0){
|
|
|
|
$sql = "insert into m_district(
|
|
M_DistrictM_CityID,
|
|
M_DistrictCode,
|
|
M_DistrictName,
|
|
M_DistrictIsDefault,
|
|
M_DistrictLastUpdated,
|
|
M_DistrictCreated)
|
|
values(?,?,?,?,now(),now())";
|
|
$query = $this->db_onedev->query($sql,
|
|
array(
|
|
$cityid,
|
|
$code,
|
|
$name,
|
|
$isdefault
|
|
)
|
|
);
|
|
if (!$query) {
|
|
$this->sys_error_db("m_district insert",$this->db_onedev);
|
|
exit;
|
|
}
|
|
$last_id = $this->db_onedev->insert_id();
|
|
if ($isdefault == "Y" ) {
|
|
$sql = "update m_district set M_DistrictIsDefault= 'N'
|
|
where M_DistrictID <> ? ";
|
|
$this->db_onedev->query($sql,array($last_id));
|
|
}
|
|
$result = array ("total" => 1, "records" => array("xid" => 0));
|
|
$this->sys_ok($result);
|
|
}else{
|
|
|
|
//echo $query;
|
|
$sql = "UPDATE m_district SET M_DistrictM_CityID = '{$cityid}',
|
|
M_DistrictCode = '{$code}',
|
|
M_DistrictName = '{$name}',
|
|
M_DistrictIsDefault = '{$isdefault}'
|
|
WHERE M_DistrictID = '{$prm['xid']}'";
|
|
//echo $sql;
|
|
$query = $this->db_onedev->query($sql);
|
|
if ($isdefault == "Y" ) {
|
|
$sql = "update m_district set M_DistrictIsDefault= 'N'
|
|
where M_DistrictID <> ? ";
|
|
$this->db_onedev->query($sql,array($prm['xid']));
|
|
}
|
|
$result = array ("total" => 1, "records" => array("xid" => 0));
|
|
$this->sys_ok($result);
|
|
|
|
}
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
public function addnewconvert()
|
|
{
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
//# ambil parameter input
|
|
$prm = $this->sys_input;
|
|
$code = $prm['code'];
|
|
$resultorigin = $prm['resultorigin'];
|
|
$resultconvert = $prm['resultconvert'];
|
|
$userid = $this->sys_user["M_UserID"];
|
|
if($prm['xid'] == 0){
|
|
|
|
$sql = "insert into m_instrumentconvert(
|
|
M_InstrumentConvertCode,
|
|
M_InstrumentConvertResultOrigin,
|
|
M_InstrumentConvertResultConvert,
|
|
M_InstrumentConvertUserID,
|
|
M_InstrumentConvertCreated,
|
|
M_InstrumentConvertLastUpdated
|
|
|
|
)
|
|
values( ?,?,?,?,now(),now())";
|
|
$query = $this->db_onedev->query($sql,
|
|
array(
|
|
$code,
|
|
$resultorigin,
|
|
$resultconvert,
|
|
$userid
|
|
)
|
|
);
|
|
if (!$query) {
|
|
$this->sys_error_db("m_instrumentconvert insert",$this->db_onedev);
|
|
exit;
|
|
}
|
|
$result = array ("total" => 1, "records" => array("xid" => 0));
|
|
$this->sys_ok($result);
|
|
}else{
|
|
|
|
//echo $query;
|
|
$sql = "UPDATE m_instrumentconvert SET M_InstrumentConvertResultOrigin = '{$resultorigin}',
|
|
M_InstrumentConvertResultConvert = '{$resultconvert}',
|
|
M_InstrumentConvertUserID = '{$userid}' WHERE M_InstrumentConvertID = '{$prm['xid']}'";
|
|
//echo $sql;
|
|
$query = $this->db_onedev->query($sql);
|
|
$result = array ("total" => 1, "records" => array("xid" => 0));
|
|
$this->sys_ok($result);
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
public function deleteuser()
|
|
{
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
//# ambil parameter input
|
|
$prm = $this->sys_input;
|
|
|
|
$sql = "update m_user SET
|
|
M_UserIsActive = 'N',
|
|
M_UserLastUpdated = now()
|
|
WHERE
|
|
M_UserID = ?
|
|
|
|
";
|
|
|
|
$query = $this->db_onedev->query($sql,
|
|
array(
|
|
$prm['id']
|
|
)
|
|
);
|
|
// echo $query;
|
|
if (!$query) {
|
|
$this->sys_error_db("m_user delete");
|
|
exit;
|
|
}
|
|
$result = array ("total" => 1, "records" => array("xid" => 0));
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
public function confirmmou()
|
|
{
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
//# ambil parameter input
|
|
$prm = $this->sys_input;
|
|
|
|
$sql = "update m_mou SET
|
|
M_MouIsApproved = 'Y',
|
|
M_MouLastUpdated = now()
|
|
WHERE
|
|
M_MouID = ?
|
|
|
|
";
|
|
|
|
$query = $this->db_onedev->query($sql,
|
|
array(
|
|
$prm['id']
|
|
)
|
|
);
|
|
// echo $query;
|
|
if (!$query) {
|
|
$this->sys_error_db("m_mou update");
|
|
exit;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$result = array ("total" => 1, "records" => array("xid" => 0));
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
public function verifymou()
|
|
{
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
//# ambil parameter input
|
|
$prm = $this->sys_input;
|
|
$userid = $this->sys_user["M_UserID"];
|
|
$id = $prm['id'];
|
|
$sql = "update m_mou SET
|
|
M_MouIsVerified = 'Y',
|
|
M_MouVerifyDate = now(),
|
|
M_MouStatus = 'V',
|
|
M_MouVerifyUserID = '{$userid}',
|
|
M_MouLastUpdated = now()
|
|
WHERE
|
|
M_MouID = ?
|
|
|
|
";
|
|
|
|
$query = $this->db_onedev->query($sql,
|
|
array(
|
|
$prm['id']
|
|
)
|
|
);
|
|
// echo $query;
|
|
if (!$query) {
|
|
$this->sys_error_db("m_mou update");
|
|
exit;
|
|
}
|
|
|
|
$querystatus ="INSERT g_moustatuslog
|
|
(G_MouStatusLogDate,
|
|
G_MouStatusLogM_MouID,
|
|
G_MouStatusLogStatus,
|
|
G_MouStatusLogUserID,
|
|
G_MouStatusLogCreated,
|
|
G_MouStatusLogLastUpdated)
|
|
VALUES(
|
|
date(now()),
|
|
'{$id}',
|
|
'V',
|
|
'{$userid}',
|
|
now(),
|
|
now())
|
|
";
|
|
$rows = $this->db_onedev->query($querystatus);
|
|
|
|
|
|
|
|
$result = array ("total" => 1, "records" => array("xid" => 0));
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
public function unverifymou()
|
|
{
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
//# ambil parameter input
|
|
$prm = $this->sys_input;
|
|
$userid = $this->sys_user["M_UserID"];
|
|
$id = $prm['id'];
|
|
$sql = "update m_mou SET
|
|
M_MouIsVerified = 'N',
|
|
M_MouStatus = 'UV',
|
|
M_MouVerifyDate = now(),
|
|
M_MouVerifyUserID = '{$userid}',
|
|
M_MouLastUpdated = now()
|
|
WHERE
|
|
M_MouID = ?
|
|
|
|
";
|
|
|
|
$query = $this->db_onedev->query($sql,
|
|
array(
|
|
$prm['id']
|
|
)
|
|
);
|
|
// echo $query;
|
|
if (!$query) {
|
|
$this->sys_error_db("m_mou update");
|
|
exit;
|
|
}
|
|
$querystatus ="INSERT g_moustatuslog
|
|
(G_MouStatusLogDate,
|
|
G_MouStatusLogM_MouID,
|
|
G_MouStatusLogStatus,
|
|
G_MouStatusLogUserID,
|
|
G_MouStatusLogCreated,
|
|
G_MouStatusLogLastUpdated)
|
|
VALUES(
|
|
date(now()),
|
|
'{$id}',
|
|
'UV',
|
|
'{$userid}',
|
|
now(),
|
|
now())
|
|
";
|
|
$rows = $this->db_onedev->query($querystatus);
|
|
|
|
|
|
|
|
|
|
$result = array ("total" => 1, "records" => array("xid" => 0));
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
public function releasemou()
|
|
{
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
//# ambil parameter input
|
|
$prm = $this->sys_input;
|
|
$userid = $this->sys_user["M_UserID"];
|
|
$id = $prm['id'];
|
|
$sql = "update m_mou SET
|
|
M_MouIsReleased = 'Y',
|
|
M_MouStatus = 'R',
|
|
M_MouReleaseDate = now(),
|
|
M_MouReleaseUserID = '{$userid}',
|
|
M_MouIsApproved = 'Y',
|
|
M_MouLastUpdated = now()
|
|
WHERE
|
|
M_MouID = ?
|
|
|
|
";
|
|
|
|
$query = $this->db_onedev->query($sql,
|
|
array(
|
|
$prm['id']
|
|
)
|
|
);
|
|
// echo $query;
|
|
if (!$query) {
|
|
$this->sys_error_db("m_mou update");
|
|
exit;
|
|
}
|
|
$querystatus ="INSERT g_moustatuslog
|
|
(G_MouStatusLogDate,
|
|
G_MouStatusLogM_MouID,
|
|
G_MouStatusLogStatus,
|
|
G_MouStatusLogUserID,
|
|
G_MouStatusLogCreated,
|
|
G_MouStatusLogLastUpdated)
|
|
VALUES(
|
|
date(now()),
|
|
'{$id}',
|
|
'R',
|
|
'{$userid}',
|
|
now(),
|
|
now())
|
|
";
|
|
$rows = $this->db_onedev->query($querystatus);
|
|
|
|
|
|
|
|
|
|
$result = array ("total" => 1, "records" => array("xid" => 0));
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
public function unreleasemou()
|
|
{
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
//# ambil parameter input
|
|
$prm = $this->sys_input;
|
|
$userid = $this->sys_user["M_UserID"];
|
|
$id = $prm['id'];
|
|
$sql = "update m_mou SET
|
|
M_MouIsReleased = 'N',
|
|
M_MouStatus = 'UR',
|
|
M_MouReleaseDate = now(),
|
|
M_MouReleaseUserID = '{$userid}',
|
|
M_MouIsApproved = 'N',
|
|
M_MouLastUpdated = now()
|
|
WHERE
|
|
M_MouID = ?
|
|
|
|
";
|
|
|
|
$query = $this->db_onedev->query($sql,
|
|
array(
|
|
$prm['id']
|
|
)
|
|
);
|
|
// echo $query;
|
|
if (!$query) {
|
|
$this->sys_error_db("m_mou update");
|
|
exit;
|
|
}
|
|
$querystatus ="INSERT g_moustatuslog
|
|
(G_MouStatusLogDate,
|
|
G_MouStatusLogM_MouID,
|
|
G_MouStatusLogStatus,
|
|
G_MouStatusLogUserID,
|
|
G_MouStatusLogCreated,
|
|
G_MouStatusLogLastUpdated)
|
|
VALUES(
|
|
date(now()),
|
|
'{$id}',
|
|
'UR',
|
|
'{$userid}',
|
|
now(),
|
|
now())
|
|
";
|
|
$rows = $this->db_onedev->query($querystatus);
|
|
|
|
|
|
|
|
|
|
$result = array ("total" => 1, "records" => array("xid" => 0));
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
public function deleteprovince()
|
|
{
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
//# ambil parameter input
|
|
$prm = $this->sys_input;
|
|
$userid = $this->sys_user["M_UserID"];
|
|
$sql = "update m_province SET
|
|
M_ProvinceIsActive = 'N',
|
|
M_ProvinceLastUpdated = now()
|
|
WHERE
|
|
M_ProvinceID = ?
|
|
|
|
";
|
|
|
|
$query = $this->db_onedev->query($sql,
|
|
array(
|
|
$prm['id']
|
|
)
|
|
);
|
|
// echo $query;
|
|
if (!$query) {
|
|
$this->sys_error_db("m_province delete");
|
|
exit;
|
|
}
|
|
$sql = "update m_city SET
|
|
M_CityIsActive = 'N',
|
|
M_CityLastUpdated = now()
|
|
WHERE
|
|
M_CityM_ProvinceID = ?
|
|
|
|
";
|
|
|
|
$query = $this->db_onedev->query($sql,
|
|
array(
|
|
$prm['id']
|
|
)
|
|
);
|
|
// echo $query;
|
|
if (!$query) {
|
|
$this->sys_error_db("m_city delete");
|
|
exit;
|
|
}
|
|
$sql = "update m_district
|
|
JOIN m_city ON M_DistrictM_CityID = M_CityID SET
|
|
M_DistrictIsActive = 'N',
|
|
M_DistrictLastUpdated = now()
|
|
WHERE
|
|
M_CityM_ProvinceID = ?
|
|
|
|
";
|
|
|
|
$query = $this->db_onedev->query($sql,
|
|
array(
|
|
$prm['id']
|
|
)
|
|
);
|
|
if (!$query) {
|
|
$this->sys_error_db("m_district delete");
|
|
exit;
|
|
}
|
|
$sql = "update m_kelurahan
|
|
JOIN m_district ON M_KelurahanM_DistrictID = M_DistrictID
|
|
JOIN m_city ON M_DistrictM_CityID = M_CityID
|
|
SET
|
|
M_KelurahanIsActive = 'N',
|
|
M_KelurahanLastUpdated = now()
|
|
WHERE
|
|
M_CityM_ProvinceID = ?
|
|
|
|
";
|
|
|
|
$query = $this->db_onedev->query($sql,
|
|
array(
|
|
$prm['id']
|
|
)
|
|
);
|
|
if (!$query) {
|
|
$this->sys_error_db("m_kelurahan delete");
|
|
exit;
|
|
}
|
|
$result = array ("total" => 1, "records" => array("xid" => 0));
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
public function deletecity()
|
|
{
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
//# ambil parameter input
|
|
$prm = $this->sys_input;
|
|
$userid = $this->sys_user["M_UserID"];
|
|
$sql = "update m_city SET
|
|
M_CityIsActive = 'N',
|
|
M_CityLastUpdated = now()
|
|
WHERE
|
|
M_CityID = ?
|
|
|
|
";
|
|
|
|
$query = $this->db_onedev->query($sql,
|
|
array(
|
|
$prm['id']
|
|
)
|
|
);
|
|
// echo $query;
|
|
if (!$query) {
|
|
$this->sys_error_db("m_city delete");
|
|
exit;
|
|
}
|
|
|
|
$sql = "update m_district SET
|
|
M_DistrictIsActive = 'N',
|
|
M_DistrictLastUpdated = now()
|
|
WHERE
|
|
M_DistrictM_CityID = ?
|
|
|
|
";
|
|
|
|
$query = $this->db_onedev->query($sql,
|
|
array(
|
|
$prm['id']
|
|
)
|
|
);
|
|
|
|
$sql = "update m_kelurahan
|
|
JOIN m_district ON M_KelurahanM_DistrictID = M_DistrictID SET
|
|
M_KelurahanIsActive = 'N',
|
|
M_KelurahanLastUpdated = now()
|
|
WHERE
|
|
M_DistrictM_CityID = ?
|
|
|
|
";
|
|
|
|
$query = $this->db_onedev->query($sql,
|
|
array(
|
|
$prm['id']
|
|
)
|
|
);
|
|
// echo $query;
|
|
if (!$query) {
|
|
$this->sys_error_db("m_kelurahan delete");
|
|
exit;
|
|
}
|
|
$result = array ("total" => 1, "records" => array("xid" => 0));
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
public function deletedistrict()
|
|
{
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
//# ambil parameter input
|
|
$prm = $this->sys_input;
|
|
$userid = $this->sys_user["M_UserID"];
|
|
$sql = "update m_district SET
|
|
M_DistrictIsActive = 'N',
|
|
M_DistrictLastUpdated = now()
|
|
WHERE
|
|
M_DistrictID = ?
|
|
|
|
";
|
|
|
|
$query = $this->db_onedev->query($sql,
|
|
array(
|
|
$prm['id']
|
|
)
|
|
);
|
|
// echo $query;
|
|
if (!$query) {
|
|
$this->sys_error_db("m_district delete");
|
|
exit;
|
|
}
|
|
|
|
$sql = "update m_kelurahan SET
|
|
M_KelurahanIsActive = 'N',
|
|
M_KelurahanLastUpdated = now()
|
|
WHERE
|
|
M_KelurahanM_DistrictID = ?
|
|
|
|
";
|
|
|
|
$query = $this->db_onedev->query($sql,
|
|
array(
|
|
$prm['id']
|
|
)
|
|
);
|
|
// echo $query;
|
|
if (!$query) {
|
|
$this->sys_error_db("m_kelurahan delete");
|
|
exit;
|
|
}
|
|
$result = array ("total" => 1, "records" => array("xid" => 0));
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
function selectnonlab(){
|
|
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$rows = [];
|
|
$rows['nonlabs'] = array(array("T_TestIsNonLabID"=>"","T_TestIsNonLabName"=>"LAB"),array("T_TestIsNonLabID"=>"RADIODIAGNOSTIC","T_TestIsNonLabName"=>"RADIODIAGNOSTIC"), array("T_TestIsNonLabID"=>"ELEKTROMEDIS","T_TestIsNonLabName"=>"ELEKTROMEDIS"),array("T_TestIsNonLabID"=>"OTHERS","T_TestIsNonLabName"=>"OTHERS"));
|
|
|
|
$result = array(
|
|
"total" => count($rows) ,
|
|
"records" => $rows,
|
|
);
|
|
$this->sys_ok($result);
|
|
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
|
|
}
|
|
function selectcompanybusiness(){
|
|
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$rows = [];
|
|
$query =" SELECT *, COUNT(M_CompanyID) as used
|
|
FROM (SELECT m_companybusiness.*,M_CompanyID
|
|
FROM
|
|
m_companybusiness
|
|
LEFT JOIN m_company ON M_CompanyBusinessID = M_CompanyM_CompanyBusinessID AND M_CompanyIsActive = 'Y'
|
|
WHERE M_CompanyBusinessIsActive = 'Y') a
|
|
GROUP BY M_CompanyBusinessID
|
|
";
|
|
//echo $query;
|
|
$rows['companybusinesss'] = $this->db_onedev->query($query)->result_array();
|
|
|
|
|
|
$result = array(
|
|
"total" => count($rows) ,
|
|
"records" => $rows,
|
|
);
|
|
$this->sys_ok($result);
|
|
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
|
|
}
|
|
function selectcompanylevel(){
|
|
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$prm = $this->sys_input;
|
|
$id = $prm['id'];
|
|
$rows = [];
|
|
$query =" SELECT *,CONCAT(Nat_CompanyLevelName,' [',M_CompanyName,']') as Nat_CompanyLevelName, COUNT(M_CompanyID) as used
|
|
FROM (SELECT nat_companylevel.*,M_CompanyID,M_CompanyName
|
|
FROM
|
|
nat_companylevel
|
|
LEFT JOIN m_company ON Nat_CompanyLevelNat_CompanyID = M_CompanyID AND M_CompanyIsActive = 'Y'
|
|
WHERE Nat_CompanyLevelIsActive = 'Y') a
|
|
GROUP BY Nat_CompanyLevelID
|
|
";
|
|
//echo $query;
|
|
$rows['companylevels'] = $this->db_onedev->query($query)->result_array();
|
|
|
|
|
|
$result = array(
|
|
"total" => count($rows) ,
|
|
"records" => $rows,
|
|
);
|
|
$this->sys_ok($result);
|
|
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
|
|
}
|
|
function selecthierarchy(){
|
|
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$rows = [];
|
|
$query =" SELECT *, COUNT(M_CompanyID) as used
|
|
FROM (SELECT nat_hierarchy.*,M_CompanyID
|
|
FROM
|
|
nat_hierarchy
|
|
LEFT JOIN m_company ON Nat_HierarchyID = M_CompanyNat_HierarchyID AND M_CompanyIsActive = 'Y'
|
|
WHERE Nat_HierarchyIsActive = 'Y') a
|
|
GROUP BY Nat_HierarchyID
|
|
";
|
|
//echo $query;
|
|
$rows['hierarchys'] = $this->db_onedev->query($query)->result_array();
|
|
|
|
|
|
$result = array(
|
|
"total" => count($rows) ,
|
|
"records" => $rows,
|
|
);
|
|
$this->sys_ok($result);
|
|
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
|
|
}
|
|
function selectdoctor(){
|
|
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$rows = [];
|
|
$query =" SELECT *
|
|
FROM m_doctor
|
|
WHERE
|
|
M_DoctorIsActive = 'Y'
|
|
";
|
|
//echo $query;
|
|
$rows['doctors'] = $this->db_onedev->query($query)->result_array();
|
|
|
|
|
|
$result = array(
|
|
"total" => count($rows) ,
|
|
"records" => $rows,
|
|
);
|
|
$this->sys_ok($result);
|
|
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
|
|
}
|
|
function searchdoctor(){
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$prm = $this->sys_input;
|
|
|
|
$max_rst = 12;
|
|
$tot_count =0;
|
|
|
|
$q = [
|
|
'search' => '%'
|
|
];
|
|
|
|
if ($prm['search'] != '')
|
|
{
|
|
$q['search'] = "%{$prm['search']}%";
|
|
}
|
|
|
|
// QUERY TOTAL
|
|
$sql = "SELECT count(*) as total
|
|
FROM
|
|
m_doctor
|
|
WHERE
|
|
M_DoctorName like ?
|
|
AND M_DoctorIsActive = 'Y'";
|
|
$query = $this->db_onedev->query($sql,$q['search']);
|
|
//echo $query;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
}
|
|
else {
|
|
$this->sys_error_db("m_doctor count",$this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "
|
|
SELECT * FROM(
|
|
SELECT 0 as M_DoctorID, 'Semua Dokter' as M_DoctorName, 'Semua Dokter' as M_DoctorNames
|
|
UNION
|
|
SELECT M_DoctorID, M_DoctorName, CONCAT(IFNULL(M_DoctorPrefix,''),IFNULL(M_DoctorPrefix2,''),' ',M_DoctorName,' ',IFNULL(M_DoctorSufix,''),IFNULL(M_DoctorSufix2,''),IFNULL(M_DoctorSufix3,'')) as M_DoctorNames
|
|
FROM m_doctor
|
|
WHERE M_DoctorIsActive = 'Y') a
|
|
WHERE
|
|
M_DoctorNames like ?
|
|
ORDER BY M_DoctorName DESC
|
|
";
|
|
$query = $this->db_onedev->query($sql, array($q['search']));
|
|
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
//echo $this->db_onedev->last_query();
|
|
$result = array("total" => $tot_count, "records" => $rows, "total_display" => sizeof($rows));
|
|
$this->sys_ok($result);
|
|
}
|
|
else {
|
|
$this->sys_error_db("m_doctor rows",$this->db_onedev);
|
|
exit;
|
|
}
|
|
}
|
|
function searchprovince(){
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$prm = $this->sys_input;
|
|
|
|
$max_rst = 12;
|
|
$tot_count =0;
|
|
|
|
$q = [
|
|
'search' => '%'
|
|
];
|
|
|
|
if ($prm['search'] != '')
|
|
{
|
|
$q['search'] = "%{$prm['search']}%";
|
|
}
|
|
|
|
// QUERY TOTAL
|
|
$sql = "SELECT count(*) as total
|
|
FROM m_province
|
|
WHERE
|
|
M_ProvinceName like ?
|
|
AND M_ProvinceIsActive = 'Y'";
|
|
$query = $this->db_onedev->query($sql,$q['search']);
|
|
//echo $query;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
}
|
|
else {
|
|
$this->sys_error_db("m_province count",$this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "
|
|
SELECT M_ProvinceID, M_ProvinceName
|
|
FROM m_province
|
|
WHERE
|
|
M_ProvinceName like ?
|
|
AND M_ProvinceIsActive = 'Y'
|
|
ORDER BY M_ProvinceName ASC
|
|
";
|
|
$query = $this->db_onedev->query($sql, array($q['search']));
|
|
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
//echo $this->db_onedev->last_query();
|
|
$result = array("total" => $tot_count, "records" => $rows, "total_display" => sizeof($rows));
|
|
$this->sys_ok($result);
|
|
}
|
|
else {
|
|
$this->sys_error_db("m_province rows",$this->db_onedev);
|
|
exit;
|
|
}
|
|
}
|
|
function searchprovincebyname(){
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$prm = $this->sys_input;
|
|
|
|
$max_rst = 12;
|
|
$tot_count =0;
|
|
|
|
$q = [
|
|
'search' => '%'
|
|
];
|
|
|
|
if ($prm['search'] != '')
|
|
{
|
|
$q['search'] = "%{$prm['search']}%";
|
|
}
|
|
|
|
// QUERY TOTAL
|
|
$sql = "SELECT count(*) as total
|
|
FROM m_province
|
|
WHERE
|
|
M_ProvinceName like ?
|
|
AND M_ProvinceIsActive = 'Y'";
|
|
$query = $this->db_onedev->query($sql,$q['search']);
|
|
//echo $query;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
}
|
|
else {
|
|
$this->sys_error_db("m_province count",$this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "
|
|
SELECT M_ProvinceID, M_ProvinceName
|
|
FROM m_province
|
|
WHERE
|
|
M_ProvinceName like ?
|
|
AND M_ProvinceIsActive = 'Y'
|
|
ORDER BY M_ProvinceName ASC
|
|
";
|
|
$query = $this->db_onedev->query($sql, array($q['search']));
|
|
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
//echo $this->db_onedev->last_query();
|
|
$result = array("total" => $tot_count, "records" => $rows, "total_display" => sizeof($rows));
|
|
$this->sys_ok($result);
|
|
}
|
|
else {
|
|
$this->sys_error_db("m_province rows",$this->db_onedev);
|
|
exit;
|
|
}
|
|
}
|
|
function searchtest(){
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$prm = $this->sys_input;
|
|
|
|
$max_rst = 12;
|
|
$tot_count =0;
|
|
|
|
$q = [
|
|
'search' => '%'
|
|
];
|
|
|
|
if ($prm['search'] != '')
|
|
{
|
|
$q['search'] = "%{$prm['search']}%";
|
|
}
|
|
|
|
// QUERY TOTAL
|
|
$sql = "SELECT count(*) as total
|
|
FROM t_test
|
|
WHERE
|
|
T_TestName like ?
|
|
AND T_TestIsActive = 'Y'";
|
|
$query = $this->db_onedev->query($sql,$q['search']);
|
|
//echo $query;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
}
|
|
else {
|
|
$this->sys_error_db("t_test count",$this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "
|
|
SELECT T_TestID, T_TestName
|
|
FROM t_test
|
|
WHERE
|
|
T_TestName like ?
|
|
AND T_TestIsActive = 'Y'
|
|
GROUP BY T_TestID
|
|
ORDER BY T_TestName ASC
|
|
";
|
|
$query = $this->db_onedev->query($sql, array($q['search']));
|
|
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
//echo $this->db_onedev->last_query();
|
|
$result = array("total" => $tot_count, "records" => $rows, "total_display" => sizeof($rows));
|
|
$this->sys_ok($result);
|
|
}
|
|
else {
|
|
$this->sys_error_db("t_test rows",$this->db_onedev);
|
|
exit;
|
|
}
|
|
}
|
|
function searchcompanylevel(){
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$prm = $this->sys_input;
|
|
|
|
$max_rst = 12;
|
|
$tot_count =0;
|
|
|
|
|
|
$name = $prm['name'];
|
|
$hirarkiid = intval($prm['id']) - 1;
|
|
|
|
// QUERY TOTAL
|
|
$sql = "SELECT count(*) as total
|
|
FROM nat_companylevel
|
|
WHERE
|
|
Nat_CompanyLevelName like '%{$name}%'
|
|
AND
|
|
Nat_CompanyLevelNat_HierarchyID = '{$hirarkiid}'
|
|
AND Nat_CompanyLevelIsActive = 'Y'";
|
|
$query = $this->db_onedev->query($sql);
|
|
//echo $query;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
}
|
|
else {
|
|
$this->sys_error_db("nat_companylevel count",$this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "
|
|
SELECT * FROM(SELECT *, CONCAT(Nat_CompanyLevelName, ' [',M_CompanyName,']') as Nat_CompanyLevelNames
|
|
FROM nat_companylevel
|
|
LEFT JOIN m_company ON Nat_CompanyLevelNat_CompanyID = M_CompanyID
|
|
WHERE Nat_CompanyLevelIsActive = 'Y') a
|
|
WHERE
|
|
Nat_CompanyLevelName like '%{$name}%'
|
|
AND
|
|
Nat_CompanyLevelNat_HierarchyID = '{$hirarkiid}'
|
|
AND Nat_CompanyLevelIsActive = 'Y'
|
|
ORDER BY Nat_CompanyLevelName DESC
|
|
";
|
|
$query = $this->db_onedev->query($sql);
|
|
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
//echo $this->db_onedev->last_query();
|
|
$result = array("total" => $tot_count, "records" => $rows, "total_display" => sizeof($rows));
|
|
$this->sys_ok($result);
|
|
}
|
|
else {
|
|
$this->sys_error_db("nat_companylevel rows",$this->db_onedev);
|
|
exit;
|
|
}
|
|
}
|
|
function searchcity(){
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$prm = $this->sys_input;
|
|
|
|
$max_rst = 12;
|
|
$tot_count =0;
|
|
|
|
$q = [
|
|
'search' => '%'
|
|
];
|
|
|
|
if ($prm['search'] != '')
|
|
{
|
|
$q['search'] = "%{$prm['search']}%";
|
|
}
|
|
|
|
// QUERY TOTAL
|
|
$sql = "SELECT count(*) as total
|
|
FROM m_city
|
|
WHERE
|
|
M_CityName like ?
|
|
AND M_CityIsActive = 'Y'";
|
|
$query = $this->db_onedev->query($sql,$q['search']);
|
|
//echo $query;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
}
|
|
else {
|
|
$this->sys_error_db("m_city count",$this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "
|
|
SELECT *
|
|
FROM m_city
|
|
WHERE
|
|
M_CityName like ?
|
|
AND M_CityIsActive = 'Y'
|
|
ORDER BY M_CityName DESC
|
|
";
|
|
$query = $this->db_onedev->query($sql, array($q['search']));
|
|
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
//echo $this->db_onedev->last_query();
|
|
$result = array("total" => $tot_count, "records" => $rows, "total_display" => sizeof($rows));
|
|
$this->sys_ok($result);
|
|
}
|
|
else {
|
|
$this->sys_error_db("m_city rows",$this->db_onedev);
|
|
exit;
|
|
}
|
|
}
|
|
function searchdistrict(){
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$prm = $this->sys_input;
|
|
|
|
$max_rst = 12;
|
|
$tot_count =0;
|
|
|
|
$q = [
|
|
'search' => '%'
|
|
];
|
|
|
|
if ($prm['search'] != '')
|
|
{
|
|
$q['search'] = "%{$prm['search']}%";
|
|
}
|
|
|
|
// QUERY TOTAL
|
|
$sql = "SELECT count(*) as total
|
|
FROM m_district
|
|
WHERE
|
|
M_DistrictName like ?
|
|
AND M_DistrictIsActive = 'Y'";
|
|
$query = $this->db_onedev->query($sql,$q['search']);
|
|
//echo $query;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
}
|
|
else {
|
|
$this->sys_error_db("m_district count",$this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "
|
|
SELECT *
|
|
FROM m_district
|
|
WHERE
|
|
M_DistrictName like ?
|
|
AND M_DistrictIsActive = 'Y'
|
|
ORDER BY M_DistrictName DESC
|
|
";
|
|
$query = $this->db_onedev->query($sql, array($q['search']));
|
|
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
//echo $this->db_onedev->last_query();
|
|
$result = array("total" => $tot_count, "records" => $rows, "total_display" => sizeof($rows));
|
|
$this->sys_ok($result);
|
|
}
|
|
else {
|
|
$this->sys_error_db("m_district rows",$this->db_onedev);
|
|
exit;
|
|
}
|
|
}
|
|
function lookupkelurahan(){
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
$prm = $this->sys_input;
|
|
$id = $prm['id'];
|
|
$search = $prm['search'];
|
|
$all = $prm['all'];
|
|
$limit = '';
|
|
if($all == 'N'){
|
|
$limit = ' LIMIT 10';
|
|
}
|
|
$number_limit = 10;
|
|
$number_offset = ($prm['current_page'] - 1) * $number_limit ;
|
|
$sql = "select COUNT(*) as total
|
|
from m_kelurahan
|
|
JOIN m_district ON M_KelurahanM_DistrictID = M_DistrictID AND M_DistrictIsActive = 'Y'
|
|
WHERE
|
|
( M_KelurahanName LIKE CONCAT('%','{$search}','%')
|
|
) AND
|
|
($id = 0 or ($id > 0 and M_KelurahanM_DistrictID = $id))
|
|
AND M_KelurahanIsActive = 'Y'";
|
|
$sql_param = array($search);
|
|
// $total = $this->db_onedev->query($sql,$sql_param)->row()->total;
|
|
$query = $this->db_onedev->query($sql);
|
|
$tot_count = 0;
|
|
$tot_page = 0;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
$tot_page = ceil($tot_count/$number_limit);
|
|
} else {
|
|
$this->sys_error_db("m_kelurahan count", $this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "select M_KelurahanID as id,
|
|
M_KelurahanName as name,
|
|
M_KelurahanCode as code,
|
|
IF(M_KelurahanCode = '', M_KelurahanName,CONCAT(M_KelurahanName, ' [',M_KelurahanCode,']')) as namex,
|
|
M_DistrictID,
|
|
M_DistrictName,
|
|
IF(M_KelurahanIsDefault = 'N','Tidak','Ya') as isdefault,
|
|
m_kelurahan.*
|
|
from m_kelurahan
|
|
JOIN m_district ON M_KelurahanM_DistrictID = M_DistrictID AND M_DistrictIsActive = 'Y'
|
|
WHERE
|
|
( M_KelurahanName LIKE CONCAT('%','{$search}','%') OR
|
|
M_KelurahanCode LIKE CONCAT('%','{$search}','%') OR
|
|
M_DistrictName LIKE CONCAT('%','{$search}','%')
|
|
) AND
|
|
($id = 0 or ($id > 0 and M_KelurahanM_DistrictID = $id))
|
|
AND M_KelurahanIsActive = 'Y'
|
|
ORDER BY M_KelurahanName ASC
|
|
limit $number_limit offset $number_offset";
|
|
$sql_param = array($search);
|
|
$query = $this->db_onedev->query($sql);
|
|
// echo $this->db_onedev->last_query();
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
|
|
|
|
} else {
|
|
$this->sys_error_db("m_kelurahan select");
|
|
exit;
|
|
}
|
|
|
|
$result = array ("total" => $tot_page, "total_filter"=>count($rows),"records" => $rows);
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
function lookupkelurahanbyprovince(){
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
$prm = $this->sys_input;
|
|
$search = $prm['search'];
|
|
$all = $prm['all'];
|
|
$limit = '';
|
|
if($all == 'N'){
|
|
$limit = ' LIMIT 10';
|
|
}
|
|
$number_limit = 10;
|
|
$number_offset = ($prm['current_page'] - 1) * $number_limit ;
|
|
$sql = "select COUNT(*) as total
|
|
from m_kelurahan
|
|
JOIN m_district ON M_KelurahanM_DistrictID = M_DistrictID AND M_DistrictIsActive = 'Y'
|
|
JOIN m_city ON M_DistrictM_CityID = M_CityID AND M_CityIsActive = 'Y'
|
|
JOIN m_province ON M_CityM_ProvinceID = M_ProvinceID AND M_ProvinceIsActive = 'Y'
|
|
WHERE
|
|
M_ProvinceName LIKE CONCAT('%','{$search}','%')
|
|
AND M_KelurahanIsActive = 'Y'";
|
|
$sql_param = array($search);
|
|
// $total = $this->db_onedev->query($sql,$sql_param)->row()->total;
|
|
$query = $this->db_onedev->query($sql);
|
|
$tot_count = 0;
|
|
$tot_page = 0;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
$tot_page = ceil($tot_count/$number_limit);
|
|
} else {
|
|
$this->sys_error_db("m_kelurahan count", $this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "select M_KelurahanID as id,
|
|
M_KelurahanName as name,
|
|
M_KelurahanCode as code,
|
|
IF(M_KelurahanCode = '', M_KelurahanName,CONCAT(M_KelurahanName, ' [',M_KelurahanCode,']')) as namex,
|
|
M_DistrictID,
|
|
M_DistrictName,
|
|
IF(M_KelurahanIsDefault = 'N','Tidak','Ya') as isdefault,
|
|
m_kelurahan.*
|
|
from m_kelurahan
|
|
JOIN m_district ON M_KelurahanM_DistrictID = M_DistrictID AND M_DistrictIsActive = 'Y'
|
|
JOIN m_city ON M_DistrictM_CityID = M_CityID AND M_CityIsActive = 'Y'
|
|
JOIN m_province ON M_CityM_ProvinceID = M_ProvinceID AND M_ProvinceIsActive = 'Y'
|
|
WHERE
|
|
M_ProvinceName LIKE CONCAT('%','{$search}','%')
|
|
AND M_KelurahanIsActive = 'Y'
|
|
ORDER BY M_KelurahanName ASC
|
|
limit $number_limit offset $number_offset";
|
|
$sql_param = array($search);
|
|
$query = $this->db_onedev->query($sql);
|
|
// echo $this->db_onedev->last_query();
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
|
|
|
|
} else {
|
|
$this->sys_error_db("m_kelurahan select");
|
|
exit;
|
|
}
|
|
|
|
$result = array ("total" => $tot_page, "total_filter"=>count($rows),"records" => $rows);
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
function lookupkelurahanbyname(){
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
$prm = $this->sys_input;
|
|
$province = $prm['province'];
|
|
$city = $prm['city'];
|
|
$district = $prm['district'];
|
|
$kelurahan = $prm['kelurahan'];
|
|
$all = $prm['all'];
|
|
$limit = '';
|
|
if($all == 'N'){
|
|
$limit = ' LIMIT 10';
|
|
}
|
|
$number_limit = 10;
|
|
$number_offset = ($prm['current_page'] - 1) * $number_limit ;
|
|
$sql = "select COUNT(*) as total
|
|
FROM( SELECT *
|
|
from m_kelurahan
|
|
JOIN m_district ON M_KelurahanM_DistrictID = M_DistrictID AND M_DistrictIsActive = 'Y'
|
|
JOIN m_city ON M_DistrictM_CityID = M_CityID AND M_CityIsActive = 'Y'
|
|
JOIN m_province ON M_CityM_ProvinceID = M_ProvinceID AND M_ProvinceIsActive = 'Y'
|
|
WHERE
|
|
M_ProvinceName LIKE CONCAT('%','{$province}','%') AND
|
|
M_CityName LIKE CONCAT('%','{$city}','%') AND
|
|
M_DistrictName LIKE CONCAT('%','{$district}','%') AND
|
|
M_KelurahanName LIKE CONCAT('%','{$kelurahan}','%') AND
|
|
M_KelurahanIsActive = 'Y'
|
|
GROUP BY M_KelurahanID) a";
|
|
$sql_param = array($search);
|
|
// $total = $this->db_onedev->query($sql,$sql_param)->row()->total;
|
|
$query = $this->db_onedev->query($sql);
|
|
$tot_count = 0;
|
|
$tot_page = 0;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
$tot_page = ceil($tot_count/$number_limit);
|
|
} else {
|
|
$this->sys_error_db("m_kelurahan count", $this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "select M_KelurahanID as id,
|
|
M_KelurahanName as name,
|
|
M_KelurahanCode as code,
|
|
IF(M_KelurahanCode = '', M_KelurahanName,CONCAT(M_KelurahanName, ' [',M_KelurahanCode,']')) as namex,
|
|
M_DistrictID,
|
|
M_DistrictName,
|
|
IF(M_KelurahanIsDefault = 'N','Tidak','Ya') as isdefault,
|
|
m_kelurahan.*
|
|
from m_kelurahan
|
|
JOIN m_district ON M_KelurahanM_DistrictID = M_DistrictID AND M_DistrictIsActive = 'Y'
|
|
JOIN m_city ON M_DistrictM_CityID = M_CityID AND M_CityIsActive = 'Y'
|
|
JOIN m_province ON M_CityM_ProvinceID = M_ProvinceID AND M_ProvinceIsActive = 'Y'
|
|
WHERE
|
|
M_ProvinceName LIKE CONCAT('%','{$province}','%') AND
|
|
M_CityName LIKE CONCAT('%','{$city}','%') AND
|
|
M_DistrictName LIKE CONCAT('%','{$district}','%') AND
|
|
M_KelurahanName LIKE CONCAT('%','{$kelurahan}','%') AND
|
|
M_KelurahanIsActive = 'Y'
|
|
GROUP BY M_KelurahanID
|
|
ORDER BY M_KelurahanName ASC
|
|
limit $number_limit offset $number_offset";
|
|
$sql_param = array($search);
|
|
$query = $this->db_onedev->query($sql);
|
|
// echo $this->db_onedev->last_query();
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
|
|
|
|
} else {
|
|
$this->sys_error_db("m_kelurahan select");
|
|
exit;
|
|
}
|
|
|
|
$result = array ("total" => $tot_page, "total_filter"=>count($rows),"records" => $rows);
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
function lookupkelurahanbycity(){
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
$prm = $this->sys_input;
|
|
$search = $prm['search'];
|
|
$all = $prm['all'];
|
|
$limit = '';
|
|
if($all == 'N'){
|
|
$limit = ' LIMIT 10';
|
|
}
|
|
$number_limit = 10;
|
|
$number_offset = ($prm['current_page'] - 1) * $number_limit ;
|
|
$sql = "select COUNT(*) as total
|
|
from m_kelurahan
|
|
JOIN m_district ON M_KelurahanM_DistrictID = M_DistrictID AND M_DistrictIsActive = 'Y'
|
|
JOIN m_city ON M_DistrictM_CityID = M_CityID AND M_CityIsActive = 'Y'
|
|
WHERE
|
|
M_CityName LIKE CONCAT('%','{$search}','%')
|
|
AND M_KelurahanIsActive = 'Y'";
|
|
$sql_param = array($search);
|
|
// $total = $this->db_onedev->query($sql,$sql_param)->row()->total;
|
|
$query = $this->db_onedev->query($sql);
|
|
$tot_count = 0;
|
|
$tot_page = 0;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
$tot_page = ceil($tot_count/$number_limit);
|
|
} else {
|
|
$this->sys_error_db("m_kelurahan count", $this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "select M_KelurahanID as id,
|
|
M_KelurahanName as name,
|
|
M_KelurahanCode as code,
|
|
IF(M_KelurahanCode = '', M_KelurahanName,CONCAT(M_KelurahanName, ' [',M_KelurahanCode,']')) as namex,
|
|
M_DistrictID,
|
|
M_DistrictName,
|
|
IF(M_KelurahanIsDefault = 'N','Tidak','Ya') as isdefault,
|
|
m_kelurahan.*
|
|
from m_kelurahan
|
|
JOIN m_district ON M_KelurahanM_DistrictID = M_DistrictID AND M_DistrictIsActive = 'Y'
|
|
JOIN m_city ON M_DistrictM_CityID = M_CityID AND M_CityIsActive = 'Y'
|
|
WHERE
|
|
M_CityName LIKE CONCAT('%','{$search}','%')
|
|
AND M_KelurahanIsActive = 'Y'
|
|
ORDER BY M_KelurahanName ASC
|
|
limit $number_limit offset $number_offset";
|
|
$sql_param = array($search);
|
|
$query = $this->db_onedev->query($sql);
|
|
// echo $this->db_onedev->last_query();
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
|
|
|
|
} else {
|
|
$this->sys_error_db("m_kelurahan select");
|
|
exit;
|
|
}
|
|
|
|
$result = array ("total" => $tot_page, "total_filter"=>count($rows),"records" => $rows);
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
function lookupkelurahanbydistrict(){
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
$prm = $this->sys_input;
|
|
$search = $prm['search'];
|
|
$all = $prm['all'];
|
|
$limit = '';
|
|
if($all == 'N'){
|
|
$limit = ' LIMIT 10';
|
|
}
|
|
$number_limit = 10;
|
|
$number_offset = ($prm['current_page'] - 1) * $number_limit ;
|
|
$sql = "select COUNT(*) as total
|
|
from m_kelurahan
|
|
JOIN m_district ON M_KelurahanM_DistrictID = M_DistrictID AND M_DistrictIsActive = 'Y'
|
|
WHERE
|
|
M_DistrictName LIKE CONCAT('%','{$search}','%')
|
|
AND M_KelurahanIsActive = 'Y'";
|
|
$sql_param = array($search);
|
|
// $total = $this->db_onedev->query($sql,$sql_param)->row()->total;
|
|
$query = $this->db_onedev->query($sql);
|
|
$tot_count = 0;
|
|
$tot_page = 0;
|
|
if ($query) {
|
|
$tot_count = $query->result_array()[0]["total"];
|
|
$tot_page = ceil($tot_count/$number_limit);
|
|
} else {
|
|
$this->sys_error_db("m_kelurahan count", $this->db_onedev);
|
|
exit;
|
|
}
|
|
|
|
$sql = "select M_KelurahanID as id,
|
|
M_KelurahanName as name,
|
|
M_KelurahanCode as code,
|
|
IF(M_KelurahanCode = '', M_KelurahanName,CONCAT(M_KelurahanName, ' [',M_KelurahanCode,']')) as namex,
|
|
M_DistrictID,
|
|
M_DistrictName,
|
|
IF(M_KelurahanIsDefault = 'N','Tidak','Ya') as isdefault,
|
|
m_kelurahan.*
|
|
from m_kelurahan
|
|
JOIN m_district ON M_KelurahanM_DistrictID = M_DistrictID AND M_DistrictIsActive = 'Y'
|
|
WHERE
|
|
M_DistrictName LIKE CONCAT('%','{$search}','%')
|
|
AND M_KelurahanIsActive = 'Y'
|
|
ORDER BY M_KelurahanName ASC
|
|
limit $number_limit offset $number_offset";
|
|
$sql_param = array($search);
|
|
$query = $this->db_onedev->query($sql);
|
|
// echo $this->db_onedev->last_query();
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
|
|
|
|
} else {
|
|
$this->sys_error_db("m_kelurahan select");
|
|
exit;
|
|
}
|
|
|
|
$result = array ("total" => $tot_page, "total_filter"=>count($rows),"records" => $rows);
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
public function addnewkelurahan()
|
|
{
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
//# ambil parameter input
|
|
$prm = $this->sys_input;
|
|
$districtid = $prm['districtid'];
|
|
$code = $prm['code'];
|
|
$name = $prm['name'];
|
|
$isdefault = $prm['isdefault'];
|
|
$userid = $this->sys_user["M_UserID"];
|
|
if($prm['xid'] == 0){
|
|
|
|
$sql = "insert into m_kelurahan(
|
|
M_KelurahanM_DistrictID,
|
|
M_KelurahanCode,
|
|
M_KelurahanName,
|
|
M_KelurahanIsDefault,
|
|
M_KelurahanLastUpdated,
|
|
M_KelurahanCreated)
|
|
values(?,?,?,?,now(),now())";
|
|
$query = $this->db_onedev->query($sql,
|
|
array(
|
|
$districtid,
|
|
$code,
|
|
$name,
|
|
$isdefault
|
|
)
|
|
);
|
|
if (!$query) {
|
|
$this->sys_error_db("m_kelurahan insert",$this->db_onedev);
|
|
exit;
|
|
}
|
|
$last_id = $this->db_onedev->insert_id();
|
|
if ($isdefault == "Y" ) {
|
|
$sql = "update m_kelurahan set M_KelurahanIsDefault= 'N'
|
|
where M_KelurahanID <> ? ";
|
|
$this->db_onedev->query($sql,array($last_id));
|
|
}
|
|
$result = array ("total" => 1, "records" => array("xid" => 0));
|
|
$this->sys_ok($result);
|
|
}else{
|
|
|
|
//echo $query;
|
|
$sql = "UPDATE m_kelurahan SET M_KelurahanM_DistrictID = '{$districtid}',
|
|
M_KelurahanCode = '{$code}',
|
|
M_KelurahanName = '{$name}',
|
|
M_KelurahanIsDefault = '{$isdefault}'
|
|
WHERE M_KelurahanID = '{$prm['xid']}'";
|
|
//echo $sql;
|
|
$query = $this->db_onedev->query($sql);
|
|
if ($isdefault == "Y" ) {
|
|
$sql = "update m_kelurahan set M_KelurahanIsDefault= 'N'
|
|
where M_KelurahanID <> ? ";
|
|
$this->db_onedev->query($sql,array($prm['xid']));
|
|
}
|
|
$result = array ("total" => 1, "records" => array("xid" => 0));
|
|
$this->sys_ok($result);
|
|
|
|
}
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
public function deletekelurahan()
|
|
{
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
//# ambil parameter input
|
|
$prm = $this->sys_input;
|
|
$userid = $this->sys_user["M_UserID"];
|
|
$sql = "update m_kelurahan SET
|
|
M_KelurahanIsActive = 'N',
|
|
M_KelurahanLastUpdated = now()
|
|
WHERE
|
|
M_KelurahanID = ?
|
|
|
|
";
|
|
|
|
$query = $this->db_onedev->query($sql,
|
|
array(
|
|
$prm['id']
|
|
)
|
|
);
|
|
// echo $query;
|
|
if (!$query) {
|
|
$this->sys_error_db("m_kelurahan delete");
|
|
exit;
|
|
}
|
|
$result = array ("total" => 1, "records" => array("xid" => 0));
|
|
$this->sys_ok($result);
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
function getstaff(){
|
|
$prm = $this->sys_input;
|
|
$query =" SELECT *
|
|
FROM m_staff
|
|
WHERE
|
|
M_StaffIsActive = 'Y' AND M_StaffM_PositionID = 2";
|
|
//echo $query;
|
|
$rows = $this->db_onedev->query($query,array($prm['id']))->result_array();
|
|
|
|
$result = array(
|
|
"total" => count($rows) ,
|
|
"records" => $rows,
|
|
);
|
|
$this->sys_ok($result);
|
|
exit;
|
|
}
|
|
function getprovince(){
|
|
$prm = $this->sys_input;
|
|
$query =" SELECT *
|
|
FROM m_province
|
|
WHERE
|
|
M_ProvinceIsActive = 'Y'";
|
|
//echo $query;
|
|
$rows = $this->db_onedev->query($query,array($prm['id']))->result_array();
|
|
|
|
$result = array(
|
|
"total" => count($rows) ,
|
|
"records" => $rows,
|
|
);
|
|
$this->sys_ok($result);
|
|
exit;
|
|
}
|
|
function getcity(){
|
|
$prm = $this->sys_input;
|
|
$query =" SELECT *
|
|
FROM m_city
|
|
WHERE
|
|
M_CityIsActive = 'Y' AND M_CityM_ProvinceID = ?
|
|
";
|
|
//echo $query;
|
|
$rows = $this->db_onedev->query($query,array($prm['id']))->result_array();
|
|
|
|
$result = array(
|
|
"total" => count($rows) ,
|
|
"records" => $rows,
|
|
);
|
|
$this->sys_ok($result);
|
|
exit;
|
|
}
|
|
function getdistrict(){
|
|
$prm = $this->sys_input;
|
|
$query =" SELECT *
|
|
FROM m_district
|
|
WHERE
|
|
M_DistrictIsActive = 'Y' AND M_DistrictM_CityID = ?
|
|
";
|
|
//echo $query;
|
|
$rows = $this->db_onedev->query($query,array($prm['id']))->result_array();
|
|
|
|
$result = array(
|
|
"total" => count($rows) ,
|
|
"records" => $rows,
|
|
);
|
|
$this->sys_ok($result);
|
|
exit;
|
|
}
|
|
|
|
function getkelurahan(){
|
|
$prm = $this->sys_input;
|
|
$query =" SELECT *
|
|
FROM m_kelurahan
|
|
WHERE
|
|
M_KelurahanIsActive = 'Y' AND M_KelurahanM_DistrictID = ?
|
|
";
|
|
//echo $query;
|
|
$rows = $this->db_onedev->query($query,array($prm['id']))->result_array();
|
|
|
|
$result = array(
|
|
"total" => count($rows) ,
|
|
"records" => $rows,
|
|
);
|
|
$this->sys_ok($result);
|
|
exit;
|
|
}
|
|
function selectbase(){
|
|
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$rows = [];
|
|
$query =" SELECT 'SPK' as baseid, 'SPK' as basename
|
|
UNION SELECT 'MOU' as baseid, 'MOU' as basename
|
|
";
|
|
//echo $query;
|
|
$rows['bases'] = $this->db_onedev->query($query)->result_array();
|
|
|
|
|
|
$result = array(
|
|
"total" => count($rows) ,
|
|
"records" => $rows,
|
|
);
|
|
$this->sys_ok($result);
|
|
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
|
|
}
|
|
function selectomzettype(){
|
|
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$rows = [];
|
|
$query =" SELECT *
|
|
FROM m_omzettype
|
|
WHERE
|
|
M_OmzetTypeIsActive = 'Y'
|
|
";
|
|
//echo $query;
|
|
$rows['omzettypes'] = $this->db_onedev->query($query)->result_array();
|
|
|
|
|
|
$result = array(
|
|
"total" => count($rows) ,
|
|
"records" => $rows,
|
|
);
|
|
$this->sys_ok($result);
|
|
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
|
|
}
|
|
function selectmoutype(){
|
|
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$rows = [];
|
|
$query =" SELECT *
|
|
FROM m_moutype
|
|
WHERE
|
|
M_MouTypeIsActive = 'Y'
|
|
";
|
|
//echo $query;
|
|
$rows['moutypes'] = $this->db_onedev->query($query)->result_array();
|
|
|
|
|
|
$result = array(
|
|
"total" => count($rows) ,
|
|
"records" => $rows,
|
|
);
|
|
$this->sys_ok($result);
|
|
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
|
|
}
|
|
function selectagingtype(){
|
|
|
|
try {
|
|
//# cek token valid
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$rows = [];
|
|
$query =" SELECT *
|
|
FROM m_agingtype
|
|
WHERE
|
|
M_AgingIsActive = 'Y'
|
|
";
|
|
//echo $query;
|
|
$rows['agingtypes'] = $this->db_onedev->query($query)->result_array();
|
|
|
|
|
|
$result = array(
|
|
"total" => count($rows) ,
|
|
"records" => $rows,
|
|
);
|
|
$this->sys_ok($result);
|
|
|
|
|
|
} catch(Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
|
|
}
|
|
|
|
} |