Initial import
This commit is contained in:
754
one-api/application/controllers/mockup/masterdata/Doctorso.php
Normal file
754
one-api/application/controllers/mockup/masterdata/Doctorso.php
Normal file
@@ -0,0 +1,754 @@
|
||||
<?php
|
||||
|
||||
class Doctorso extends MY_Controller
|
||||
{
|
||||
var $db_onedev;
|
||||
public function index()
|
||||
{
|
||||
echo "DOCTORSO API";
|
||||
}
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->db_onedev = $this->load->database("onedev", true);
|
||||
}
|
||||
|
||||
|
||||
function lookupdoctorso(){
|
||||
try {
|
||||
//# cek token valid
|
||||
if (! $this->isLogin) {
|
||||
$this->sys_error("Invalid Token");
|
||||
exit;
|
||||
}
|
||||
$prm = $this->sys_input;
|
||||
$id = $prm['id'];
|
||||
$sql = "select M_DoctorSOID as id,
|
||||
M_DoctorSOM_DoctorID as doctorid,
|
||||
M_DoctorSONat_SubGroupID as subgroupid,
|
||||
M_DoctorID,
|
||||
CONCAT(Nat_SubGroupName,' ' ,'[ ',Nat_SubGroupCode,' ]') as description,
|
||||
CONCAT(Nat_SubGroupName,' ' ,'[ ',Nat_SubGroupCode,' ]') as Nat_SubGroupNames,
|
||||
Nat_SubGroupID,
|
||||
'xxx' as action
|
||||
from m_doctorso
|
||||
JOIN m_doctor ON M_DoctorSOM_DoctorID = M_DoctorID
|
||||
JOIN nat_subgroup ON M_DoctorSONat_SubGroupID = Nat_SubGroupID
|
||||
where
|
||||
M_DoctorSOM_DoctorID = {$id} AND M_DoctorSOIsActive = 'Y'";
|
||||
//echo $sql;
|
||||
$rows = $this->db_onedev->query($sql)->result();
|
||||
|
||||
$result = array ("total" => 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';
|
||||
}
|
||||
$sql = "select COUNT(*) as total
|
||||
from m_doctor
|
||||
where
|
||||
M_DoctorIsActive = 'Y'";
|
||||
$sql_param = array($search);
|
||||
$total = $this->db_onedev->query($sql,$sql_param)->row()->total;
|
||||
|
||||
|
||||
$sql = "SELECT * FROM (select M_DoctorID as id, M_DoctorName as name,
|
||||
CONCAT(M_DoctorPrefix,' ',M_DoctorName,' ',M_DoctorSufix) as description
|
||||
from m_doctor
|
||||
WHERE M_DoctorIsActive = 'Y') a
|
||||
where
|
||||
( description LIKE CONCAT('%','{$search}','%')
|
||||
)
|
||||
ORDER BY id ASC $limit";
|
||||
$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_doctor select");
|
||||
exit;
|
||||
}
|
||||
|
||||
$result = array ("total" => $total, "total_filter"=>count($rows),"records" => $rows);
|
||||
$this->sys_ok($result);
|
||||
|
||||
} catch(Exception $exc) {
|
||||
$message = $exc->getMessage();
|
||||
$this->sys_error($message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function addnewdoctor()
|
||||
{
|
||||
try {
|
||||
//# cek token valid
|
||||
if (! $this->isLogin) {
|
||||
$this->sys_error("Invalid Token");
|
||||
exit;
|
||||
}
|
||||
|
||||
//# ambil parameter input
|
||||
$prm = $this->sys_input;
|
||||
$name_doctor = $prm['name'];
|
||||
$address_doctor = $prm['address'];
|
||||
$phone_doctor = $prm['phone'];
|
||||
$email_doctor = $prm['email'];
|
||||
$pic_doctor = $prm['pic'];
|
||||
$doctortypenew_doctor = $prm['doctortypenew'];
|
||||
$doctortype_doctor = $prm['doctortype'];
|
||||
$islabfrom = $prm['islabfrom'];
|
||||
$islabto = $prm['islabto'];
|
||||
$city = $prm['city'];
|
||||
$district = $prm['district'];
|
||||
$kelurahan = $prm['kelurahan'];
|
||||
$doctormindp = $prm['doctormindp'];
|
||||
$doctor = $prm['doctor'];
|
||||
|
||||
if($doctortypenew_doctor != ''){
|
||||
$sql = "insert into m_doctortype(
|
||||
M_DoctorTypeName,
|
||||
M_DoctorTypeCreated,
|
||||
M_DoctorTypeLastUpdated
|
||||
)
|
||||
values( ?, now(), now())";
|
||||
$query = $this->db_onedev->query($sql,
|
||||
array(
|
||||
$doctortypenew_doctor
|
||||
)
|
||||
);
|
||||
//echo $query;
|
||||
if (!$query) {
|
||||
$this->sys_error_db("m_doctortype insert");
|
||||
exit;
|
||||
}
|
||||
$doctortypenewid = $this->db_onedev->insert_id();
|
||||
$sqldoctor = "insert into m_doctor(
|
||||
M_DoctorName,
|
||||
M_DoctorNat_CityID,
|
||||
M_DoctorNat_DistrictID,
|
||||
M_DoctorNat_KelurahanID,
|
||||
M_DoctorAddress,
|
||||
M_DoctorPhone,
|
||||
M_DoctorEmail,
|
||||
M_DoctorPIC,
|
||||
M_DoctorM_DoctorTypeID,
|
||||
M_DoctorIsLabFrom,
|
||||
M_DoctorIsLabTo,
|
||||
M_DoctorMinDP,
|
||||
M_DoctorNat_DoctorID,
|
||||
M_DoctorCreated,
|
||||
M_DoctorLastUpdated
|
||||
)
|
||||
values( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, now(), now())";
|
||||
$querydoctor = $this->db_onedev->query($sqldoctor,
|
||||
array(
|
||||
$name_doctor,
|
||||
$city,
|
||||
$district,
|
||||
$kelurahan,
|
||||
$address_doctor,
|
||||
$phone_doctor,
|
||||
$email_doctor,
|
||||
$pic_doctor,
|
||||
$doctortypenewid,
|
||||
$islabfrom,
|
||||
$islabto,
|
||||
$doctormindp,
|
||||
$doctor
|
||||
)
|
||||
);
|
||||
//echo $query;
|
||||
if (!$querydoctor) {
|
||||
$this->sys_error_db("m_doctor insert");
|
||||
exit;
|
||||
}
|
||||
|
||||
$result = array ("total" => 1, "records" => array("xid" => 0));
|
||||
$this->sys_ok($result);
|
||||
} else{
|
||||
$sql = "insert into m_doctor(
|
||||
M_DoctorName,
|
||||
M_DoctorNat_CityID,
|
||||
M_DoctorNat_DistrictID,
|
||||
M_DoctorNat_KelurahanID,
|
||||
M_DoctorAddress,
|
||||
M_DoctorPhone,
|
||||
M_DoctorEmail,
|
||||
M_DoctorPIC,
|
||||
M_DoctorM_DoctorTypeID,
|
||||
M_DoctorIsLabFrom,
|
||||
M_DoctorIsLabTo,
|
||||
M_DoctorMinDP,
|
||||
M_DoctorNat_DoctorID,
|
||||
M_DoctorCreated,
|
||||
M_DoctorLastUpdated
|
||||
)
|
||||
values( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, now(), now())";
|
||||
$query = $this->db_onedev->query($sql,
|
||||
array(
|
||||
$name_doctor,
|
||||
$city,
|
||||
$district,
|
||||
$kelurahan,
|
||||
$address_doctor,
|
||||
$phone_doctor,
|
||||
$email_doctor,
|
||||
$pic_doctor,
|
||||
$doctortype_doctor,
|
||||
$islabfrom,
|
||||
$islabto,
|
||||
$doctormindp,
|
||||
$doctor
|
||||
)
|
||||
);
|
||||
//echo $query;
|
||||
if (!$query) {
|
||||
$this->sys_error_db("m_doctor insert");
|
||||
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 editdoctor()
|
||||
{
|
||||
try {
|
||||
//# cek token valid
|
||||
if (! $this->isLogin) {
|
||||
$this->sys_error("Invalid Token");
|
||||
exit;
|
||||
}
|
||||
|
||||
//# ambil parameter input
|
||||
$prm = $this->sys_input;
|
||||
$id_doctor = $prm['id'];
|
||||
$name_doctor = $prm['name'];
|
||||
$address_doctor = $prm['address'];
|
||||
$phone_doctor = $prm['phone'];
|
||||
$email_doctor = $prm['email'];
|
||||
$pic_doctor = $prm['pic'];
|
||||
$doctortypenew_doctor = $prm['doctortypenew'];
|
||||
$doctortype_doctor = $prm['doctortype'];
|
||||
$islabfrom = $prm['islabfrom'];
|
||||
$islabto = $prm['islabto'];
|
||||
$city = $prm['city'];
|
||||
$district = $prm['district'];
|
||||
$kelurahan = $prm['kelurahan'];
|
||||
$doctormindp = $prm['doctormindp'];
|
||||
$doctor = $prm['doctor'];
|
||||
|
||||
if($doctortypenew_doctor != ''){
|
||||
$sql = "insert into m_doctortype(
|
||||
M_DoctorTypeName,
|
||||
M_DoctorTypeCreated,
|
||||
M_DoctorTypeLastUpdated
|
||||
)
|
||||
values( ?, now(), now())";
|
||||
$query = $this->db_onedev->query($sql,
|
||||
array(
|
||||
$doctortypenew_doctor
|
||||
)
|
||||
);
|
||||
//echo $query;
|
||||
if (!$query) {
|
||||
$this->sys_error_db("m_doctortype insert");
|
||||
exit;
|
||||
}
|
||||
$doctortypenewid = $this->db_onedev->insert_id();
|
||||
$sqldoctor = "update m_doctor SET
|
||||
M_DoctorName = ?,
|
||||
M_DoctorNat_CityID = ?,
|
||||
M_DoctorNat_DistrictID = ?,
|
||||
M_DoctorNat_KelurahanID = ?,
|
||||
M_DoctorAddress = ?,
|
||||
M_DoctorPhone = ?,
|
||||
M_DoctorEmail = ?,
|
||||
M_DoctorPIC = ?,
|
||||
M_DoctorM_DoctorTypeID = ?,
|
||||
M_DoctorIsLabFrom = ?,
|
||||
M_DoctorIsLabTo = ?,
|
||||
M_DoctorMinDP = ?,
|
||||
M_DoctorNat_DoctorID = ?,
|
||||
M_DoctorLastUpdated = now()
|
||||
where
|
||||
M_DoctorID = ?
|
||||
";
|
||||
$querydoctor = $this->db_onedev->query($sqldoctor,
|
||||
array(
|
||||
$name_doctor,
|
||||
$city,
|
||||
$district,
|
||||
$kelurahan,
|
||||
$address_doctor,
|
||||
$phone_doctor,
|
||||
$email_doctor,
|
||||
$pic_doctor,
|
||||
$doctortypenewid,
|
||||
$islabfrom,
|
||||
$islabto,
|
||||
$doctormindp,
|
||||
$doctor,
|
||||
$id_doctor
|
||||
)
|
||||
);
|
||||
//echo $query;
|
||||
if (!$querydoctor) {
|
||||
$this->sys_error_db("m_doctor update");
|
||||
exit;
|
||||
}
|
||||
$result = array ("total" => 1, "records" => array("xid" => $id_doctor));
|
||||
$this->sys_ok($result);
|
||||
} else {
|
||||
$sql = "update m_doctor SET
|
||||
M_DoctorName = ?,
|
||||
M_DoctorNat_CityID = ?,
|
||||
M_DoctorNat_DistrictID = ?,
|
||||
M_DoctorNat_KelurahanID = ?,
|
||||
M_DoctorAddress = ?,
|
||||
M_DoctorPhone = ?,
|
||||
M_DoctorEmail = ?,
|
||||
M_DoctorPIC = ?,
|
||||
M_DoctorM_DoctorTypeID = ?,
|
||||
M_DoctorIsLabFrom = ?,
|
||||
M_DoctorIsLabTo = ?,
|
||||
M_DoctorMinDP = ?,
|
||||
M_DoctorNat_DoctorID = ?,
|
||||
M_DoctorLastUpdated = now()
|
||||
where
|
||||
M_DoctorID = ?
|
||||
";
|
||||
$query = $this->db_onedev->query($sql,
|
||||
array(
|
||||
$name_doctor,
|
||||
$city,
|
||||
$district,
|
||||
$kelurahan,
|
||||
$address_doctor,
|
||||
$phone_doctor,
|
||||
$email_doctor,
|
||||
$pic_doctor,
|
||||
$doctortype_doctor,
|
||||
$islabfrom,
|
||||
$islabto,
|
||||
$doctormindp,
|
||||
$doctor,
|
||||
$id_doctor
|
||||
)
|
||||
);
|
||||
//echo $query;
|
||||
if (!$query) {
|
||||
$this->sys_error_db("m_doctor update");
|
||||
exit;
|
||||
}
|
||||
$result = array ("total" => 1, "records" => array("xid" => $id_doctor));
|
||||
$this->sys_ok($result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
} catch(Exception $exc) {
|
||||
$message = $exc->getMessage();
|
||||
$this->sys_error($message);
|
||||
}
|
||||
}
|
||||
|
||||
public function addnewdoctorso()
|
||||
{
|
||||
try {
|
||||
//# cek token valid
|
||||
if (! $this->isLogin) {
|
||||
$this->sys_error("Invalid Token");
|
||||
exit;
|
||||
}
|
||||
|
||||
//# ambil parameter input
|
||||
$prm = $this->sys_input;
|
||||
$doctorid = $prm['doctorid'];
|
||||
$subgroupid = $prm['natsubgroupid'];
|
||||
|
||||
|
||||
if($prm['xid'] == "0" || $prm['xid'] == 0){
|
||||
$sql = "insert into m_doctorso(
|
||||
M_DoctorSOM_DoctorID,
|
||||
M_DoctorSONat_SubGroupID,
|
||||
M_DoctorSOCreated,
|
||||
M_DoctorSOLastUpdated
|
||||
)
|
||||
values( ?,?,now(),now())";
|
||||
$query = $this->db_onedev->query($sql,
|
||||
array(
|
||||
$doctorid,
|
||||
$subgroupid
|
||||
)
|
||||
);
|
||||
//echo $query;
|
||||
if (!$query) {
|
||||
$this->sys_error_db("m_doctorso insert");
|
||||
exit;
|
||||
}
|
||||
$result = array ("total" => 1, "records" => array("xid" => 0));
|
||||
$this->sys_ok($result);
|
||||
|
||||
}else{
|
||||
$subgroupid = $prm['natsubgroupid'];
|
||||
$sql = "UPDATE m_doctorso SET M_DoctorSONat_SubGroupID = '{$doctorid}' WHERE M_DoctorSOID = '{$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 deletedoctorso()
|
||||
{
|
||||
try {
|
||||
//# cek token valid
|
||||
if (! $this->isLogin) {
|
||||
$this->sys_error("Invalid Token");
|
||||
exit;
|
||||
}
|
||||
|
||||
//# ambil parameter input
|
||||
$prm = $this->sys_input;
|
||||
|
||||
$sql = "update m_doctorso SET
|
||||
M_DoctorSOIsActive = 'N',
|
||||
M_DoctorSOLastUpdated = now()
|
||||
WHERE
|
||||
M_DoctorSOID = ?
|
||||
|
||||
";
|
||||
|
||||
$query = $this->db_onedev->query($sql,
|
||||
array(
|
||||
$prm['id']
|
||||
)
|
||||
);
|
||||
// echo $query;
|
||||
if (!$query) {
|
||||
$this->sys_error_db("m_doctorso 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 deletedoctor()
|
||||
{
|
||||
try {
|
||||
//# cek token valid
|
||||
if (! $this->isLogin) {
|
||||
$this->sys_error("Invalid Token");
|
||||
exit;
|
||||
}
|
||||
|
||||
//# ambil parameter input
|
||||
$prm = $this->sys_input;
|
||||
|
||||
$sql = "update m_doctor SET
|
||||
M_DoctorIsActive = 'N',
|
||||
M_DoctorLastUpdated = now()
|
||||
WHERE
|
||||
M_DoctorID = ?
|
||||
|
||||
";
|
||||
|
||||
$query = $this->db_onedev->query($sql,
|
||||
array(
|
||||
$prm['id']
|
||||
)
|
||||
);
|
||||
// echo $query;
|
||||
if (!$query) {
|
||||
$this->sys_error_db("m_doctor delete");
|
||||
exit;
|
||||
}
|
||||
|
||||
$sql = "UPDATE m_doctorso SET
|
||||
M_DoctorSOIsActive = 'N',
|
||||
M_DoctorSOLastUpdated = now()
|
||||
WHERE
|
||||
M_DoctorSOM_DoctorID = ?
|
||||
";
|
||||
|
||||
$query = $this->db_onedev->query($sql,
|
||||
array(
|
||||
$prm['id']
|
||||
)
|
||||
);
|
||||
// echo $query;
|
||||
if (!$query) {
|
||||
$this->sys_error_db("m_doctorso 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 selectdoctortype(){
|
||||
|
||||
try {
|
||||
//# cek token valid
|
||||
if (! $this->isLogin) {
|
||||
$this->sys_error("Invalid Token");
|
||||
exit;
|
||||
}
|
||||
$rows = [];
|
||||
$query =" SELECT *
|
||||
FROM m_doctortype
|
||||
WHERE
|
||||
M_DoctorTypeIsActive = 'Y'
|
||||
";
|
||||
//echo $query;
|
||||
$rows['doctortypes'] = $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 nat_doctor
|
||||
WHERE
|
||||
Nat_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 searchnatsubgroup(){
|
||||
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 nat_subgroup
|
||||
WHERE
|
||||
Nat_SubGroupName like ?
|
||||
AND Nat_SubGroupIsActive = '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("nat_subgroup count",$this->db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$sql = "
|
||||
SELECT * FROM(SELECT *, CONCAT(Nat_SubGroupName,' ' ,'[ ',Nat_SubGroupCode,' ]') as Nat_SubGroupNames
|
||||
FROM nat_subgroup
|
||||
WHERE Nat_SubGroupIsActive = 'Y') a
|
||||
WHERE
|
||||
Nat_SubGroupNames like ?
|
||||
AND Nat_SubGroupIsActive = 'Y'
|
||||
ORDER BY Nat_SubGroupName 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("nat_subgroup rows",$this->db);
|
||||
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 nat_city
|
||||
WHERE
|
||||
Nat_CityName like ?
|
||||
AND Nat_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("nat_city count",$this->db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$sql = "
|
||||
SELECT *
|
||||
FROM nat_city
|
||||
WHERE
|
||||
Nat_CityName like ?
|
||||
AND Nat_CityIsActive = 'Y'
|
||||
ORDER BY Nat_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("nat_city rows",$this->db);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
function getdistrict(){
|
||||
$prm = $this->sys_input;
|
||||
$query =" SELECT *
|
||||
FROM nat_district
|
||||
WHERE
|
||||
Nat_DistrictIsActive = 'Y' AND Nat_DistrictNat_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 nat_kelurahan
|
||||
WHERE
|
||||
Nat_KelurahanIsActive = 'Y' AND Nat_KelurahanNat_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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user