Files
BE_IBL/application/controllers/nasacom/Downloadlist.php
2026-04-15 15:23:57 +07:00

975 lines
30 KiB
PHP

<?php
class Downloadlist extends MY_Controller
{
var $db_regional;
public function index()
{
echo "SPECIALIST API";
}
public function __construct()
{
parent::__construct();
$this->db_regional = $this->load->database("nasional", true);
}
function lookupdoctorbyname(){
try {
//# cek token valid
if (! $this->isLogin) {
$this->sys_error("Invalid Token");
exit;
}
$prm = $this->sys_input;
$specialist = $prm['specialist'];
$doctor = $prm['doctor'];;
$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_doctor
JOIN m_specialist ON M_DoctorM_SpecialID = M_SpecialistID AND M_SpecialistIsActive = 'Y'
WHERE
M_SpecialistName LIKE CONCAT('%','{$specialist}','%') AND
M_DoctorIsActive = 'Y' GROUP BY M_DoctorID) a";
// $total = $this->db_regional->query($sql,$sql_param)->row()->total;
$query = $this->db_regional->query($sql);
//echo $this->db_regional->last_query();
$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_doctor count", $this->db_regional);
exit;
}
$sql = "select M_DoctorID as id,
M_DoctorName as name,
M_SpecialistID,
M_SpecialistName,
m_doctor.*
from m_doctor
JOIN m_specialist ON M_DoctorM_SpecialID = M_SpecialistID AND M_SpecialistIsActive = 'Y'
WHERE
M_SpecialistName LIKE CONCAT('%','{$specialist}','%') AND
M_DoctorName LIKE CONCAT('%','{$doctor}','%') AND
M_DoctorIsActive = 'Y'
GROUP BY M_DoctorID
ORDER BY M_SpecialistName ASC, M_DoctorName ASC
limit $number_limit offset $number_offset";
$sql_param = array($search);
$query = $this->db_regional->query($sql);
//echo $this->db_regional->last_query();
if ($query) {
$rows = $query->result_array();
} else {
$this->sys_error_db("m_doctor 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 listingdownload()
{
try {
//# cek token valid
if (! $this->isLogin) {
$this->sys_error("Invalid Token");
exit;
}
$prm = $this->sys_input;
$search = $prm['search'];
$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 DownloadAgreementID
FROM download_agreement
JOIN m_mou ON DownloadAgreementM_MouID = M_MouID
WHERE
M_MouName LIKE CONCAT('%','{$search}','%') AND
DownloadAgreementIsActive = 'Y'
GROUP BY DownloadAgreementID
) a";
$sql_param = array($search);
// $total = $this->db_regional->query($sql,$sql_param)->row()->total;
$query = $this->db_regional->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("download_agreement count", $this->db_regional);
exit;
}
$sql = "SELECT DownloadAgreementID,
DownloadAgreementDate,
DownloadAgreementM_MouID,
DownloadAgreementStatus as status,
M_MouName,
M_MouNumber,
'' as details
FROM download_agreement
JOIN m_mou ON DownloadAgreementM_MouID = M_MouID
WHERE
M_MouName LIKE CONCAT('%','{$search}','%') AND
DownloadAgreementIsActive = 'Y'
GROUP BY DownloadAgreementID
ORDER BY DownloadAgreementDate ASC
limit $number_limit offset $number_offset";
$query = $this->db_regional->query($sql);
//echo $this->db_regional->last_query();
if ($query) {
$rows = $query->result_array();
foreach ($rows as $key => $value) {
$sql = "SELECT DownloadAgreementDetailsID,
DownloadAgreementDetailsNat_RegionalID,
DownloadAgreementDetailsStatus as status,
Nat_RegionalName
FROM download_agreement_details
JOIN nat_regional ON DownloadAgreementDetailsNat_RegionalID = Nat_RegionalID
WHERE
DownloadAgreementDetailsIsActive = 'Y'";
$details = $this->db_regional->query($sql)->result_array();
$rows[$key]['details'] = $details;
}
} else {
$this->sys_error_db("download_agreement 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 addnewspecialist()
{
try {
//# cek token valid
if (! $this->isLogin) {
$this->sys_error("Invalid Token");
exit;
}
//# ambil parameter input
$prm = $this->sys_input;
$name = $prm['name'];
$sql = "insert into m_specialist(
M_SpecialistName,
M_SpecialistCreated,
M_SpecialistLastUpdated
)
values( ?, now(), now())";
$query = $this->db_regional->query($sql,
array(
$name
)
);
//echo $query;
if (!$query) {
$this->sys_error_db("m_specialist insert");
exit;
}
$last_id = $this->db_regional->insert_id();
$result = array ("total" => 1, "records" => array("xid" => 0));
$this->sys_ok($result);
$last_id = $this->db_regional->insert_id();
} catch(Exception $exc) {
$message = $exc->getMessage();
$this->sys_error($message);
}
}
public function editspecialist()
{
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'];
$userid = $this->sys_user["M_UserID"];
$sqlcompany = "update m_specialist SET
M_SpecialistName = ?,
M_SpecialistLastUpdated = now()
where
M_SpecialistID = ?
";
$querycompany = $this->db_regional->query($sqlcompany,
array(
$name,
$id
)
);
// echo $query;
if (!$querycompany) {
$this->sys_error_db("m_specialist update");
exit;
}
$result = array ("total" => 1, "records" => array("xid" => $id));
$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;
$specialistid = $prm['specialistid'];
$M_DoctorName = $prm['M_DoctorName'];
$M_DoctorMinValueR = $prm['M_DoctorMinValueR'];
$M_DoctorMaxValueR = $prm['M_DoctorMaxValueR'];
$M_DoctorMinInclusiveR = $prm['M_DoctorMinInclusiveR'];
$M_DoctorMaxInclusiveR = $prm['M_DoctorMaxInclusiveR'];
$M_DoctorNoteR = $prm['M_DoctorNoteR'];
$M_DoctorMinValueS = $prm['M_DoctorMinValueS'];
$M_DoctorMaxValueS = $prm['M_DoctorMaxValueS'];
$M_DoctorMinInclusiveS = $prm['M_DoctorMinInclusiveS'];
$M_DoctorMaxInclusiveS = $prm['M_DoctorMaxInclusiveS'];
$M_DoctorNoteS = $prm['M_DoctorNoteS'];
$M_DoctorMinValueI = $prm['M_DoctorMinValueI'];
$M_DoctorMaxValueI = $prm['M_DoctorMaxValueI'];
$M_DoctorMinInclusiveI = $prm['M_DoctorMinInclusiveI'];
$M_DoctorMaxInclusiveI = $prm['M_DoctorMaxInclusiveI'];
$M_DoctorNoteI = $prm['M_DoctorNoteI'];
$userid = $this->sys_user["M_UserID"];
if($specialistid == 0){
$errors = array();
if($specialistid == 0){
array_push($errors,array('field'=>'specialist','msg'=>'Bakteri dipilih dulu dong'));
}
$result = array ("total" => -1,"errors" => $errors, "records" => 0);
$this->sys_ok($result);
}else{
if($prm['xid'] == 0){
$sql = "insert into m_doctor(
M_DoctorName,
M_DoctorM_SpecialID,
M_DoctorMinValueR,
M_DoctorMaxValueR,
M_DoctorMinInclusiveR,
M_DoctorMaxInclusiveR,
M_DoctorNoteR,
M_DoctorMinValueS,
M_DoctorMaxValueS,
M_DoctorMinInclusiveS,
M_DoctorMaxInclusiveS,
M_DoctorNoteS,
M_DoctorMinValueI,
M_DoctorMaxValueI,
M_DoctorMinInclusiveI,
M_DoctorMaxInclusiveI,
M_DoctorNoteI,
M_DoctorUserID,
M_DoctorCreated,
M_DoctorLastUpdated)
values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,now(),now())";
$query = $this->db_regional->query($sql,
array(
$M_DoctorName,
$specialistid,
$M_DoctorMinValueR,
$M_DoctorMaxValueR,
$M_DoctorMinInclusiveR,
$M_DoctorMaxInclusiveR,
$M_DoctorNoteR,
$M_DoctorMinValueS,
$M_DoctorMaxValueS,
$M_DoctorMinInclusiveS,
$M_DoctorMaxInclusiveS,
$M_DoctorNoteS,
$M_DoctorMinValueI,
$M_DoctorMaxValueI,
$M_DoctorMinInclusiveI,
$M_DoctorMaxInclusiveI,
$M_DoctorNoteI,
$userid
)
);
if (!$query) {
$this->sys_error_db("m_doctor insert",$this->db_regional);
exit;
}
$last_id = $this->db_regional->insert_id();
$result = array ("total" => 1, "records" => array("xid" => 0));
$this->sys_ok($result);
}else{
$sql = "UPDATE m_doctor SET M_DoctorM_SpecialID = '{$specialistid}',
M_DoctorName = '{$M_DoctorName}',
M_DoctorMinValueR = '{$M_DoctorMinValueR}',
M_DoctorMaxValueR = '{$M_DoctorMaxValueR}',
M_DoctorMinInclusiveR = '{$M_DoctorMinInclusiveR}',
M_DoctorMaxInclusiveR = '{$M_DoctorMaxInclusiveR}',
M_DoctorNoteR = '{$M_DoctorNoteR}',
M_DoctorMinValueS = '{$M_DoctorMinValueS}',
M_DoctorMaxValueS = '{$M_DoctorMaxValueS}',
M_DoctorMinInclusiveS = '{$M_DoctorMinInclusiveS}',
M_DoctorMaxInclusiveS = '{$M_DoctorMaxInclusiveS}',
M_DoctorNoteS = '{$M_DoctorNoteS}',
M_DoctorMinValueI = '{$M_DoctorMinValueI}',
M_DoctorMaxValueI = '{$M_DoctorMaxValueI}',
M_DoctorMinInclusiveI = '{$M_DoctorMinInclusiveI}',
M_DoctorMaxInclusiveI = '{$M_DoctorMaxInclusiveI}',
M_DoctorNoteI = '{$M_DoctorNoteI}',
M_DoctorUserID = '{$userid}',
M_DoctorLastUpdated = now()
WHERE M_DoctorID = '{$prm['xid']}'";
//echo $sql;
$query = $this->db_regional->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 deletespecialist()
{
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_specialist SET
M_SpecialistIsActive = 'N',
M_SpecialistLastUpdated = now()
WHERE
M_SpecialistID = ?
";
$query = $this->db_regional->query($sql,
array(
$prm['id']
)
);
// echo $query;
if (!$query) {
$this->sys_error_db("m_specialist delete");
exit;
}
$sql = "update m_doctor SET
M_DoctorIsActive = 'N',
M_DoctorLastUpdated = now()
WHERE
M_DoctorM_SpecialID = ?
";
$query = $this->db_regional->query($sql,
array(
$prm['id']
)
);
// echo $query;
if (!$query) {
$this->sys_error_db("m_doctor 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;
$userid = $this->sys_user["M_UserID"];
$sql = "update m_doctor SET
M_DoctorIsActive = 'N',
M_DoctorLastUpdated = now()
WHERE
M_DoctorID = ?
";
$query = $this->db_regional->query($sql,
array(
$prm['id']
)
);
// echo $query;
if (!$query) {
$this->sys_error_db("m_doctor 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 searchspecialist(){
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_specialist
WHERE
M_SpecialistName like ?
AND M_SpecialistIsActive = 'Y'";
$query = $this->db_regional->query($sql,$q['search']);
//echo $query;
if ($query) {
$tot_count = $query->result_array()[0]["total"];
}
else {
$this->sys_error_db("m_specialist count",$this->db_regional);
exit;
}
$sql = "
SELECT M_SpecialistID, M_SpecialistName
FROM m_specialist
WHERE
M_SpecialistName like ?
AND M_SpecialistIsActive = 'Y'
ORDER BY M_SpecialistName ASC
";
$query = $this->db_regional->query($sql, array($q['search']));
if ($query) {
$rows = $query->result_array();
//echo $this->db_regional->last_query();
$result = array("total" => $tot_count, "records" => $rows, "total_display" => sizeof($rows));
$this->sys_ok($result);
}
else {
$this->sys_error_db("m_specialist rows",$this->db_regional);
exit;
}
}
function searchspecialistbyname(){
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_specialist
WHERE
M_SpecialistName like ?
AND M_SpecialistIsActive = 'Y'";
$query = $this->db_regional->query($sql,$q['search']);
//echo $query;
if ($query) {
$tot_count = $query->result_array()[0]["total"];
}
else {
$this->sys_error_db("m_specialist count",$this->db_regional);
exit;
}
$sql = "
SELECT M_SpecialistID, M_SpecialistName
FROM m_specialist
WHERE
M_SpecialistName like ?
AND M_SpecialistIsActive = 'Y'
ORDER BY M_SpecialistName ASC
";
$query = $this->db_regional->query($sql, array($q['search']));
if ($query) {
$rows = $query->result_array();
//echo $this->db_regional->last_query();
$result = array("total" => $tot_count, "records" => $rows, "total_display" => sizeof($rows));
$this->sys_ok($result);
}
else {
$this->sys_error_db("m_specialist rows",$this->db_regional);
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_regional->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_regional);
exit;
}
$sql = "
SELECT *
FROM m_city
WHERE
M_CityName like ?
AND M_CityIsActive = 'Y'
ORDER BY M_CityName ASC
";
$query = $this->db_regional->query($sql, array($q['search']));
if ($query) {
$rows = $query->result_array();
//echo $this->db_regional->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_regional);
exit;
}
}
function searchdistrict(){
if (! $this->isLogin) {
$this->sys_error("Invalid Token");
exit;
}
$prm = $this->sys_input;
$id = $prm['id'];
$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_DistrictM_CityID = '{$id}'
AND M_DistrictIsActive = 'Y'";
$query = $this->db_regional->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_regional);
exit;
}
$sql = "
SELECT *
FROM m_district
WHERE
M_DistrictName like ?
AND M_DistrictM_CityID = '{$id}'
AND M_DistrictIsActive = 'Y'
ORDER BY M_DistrictName ASC
";
$query = $this->db_regional->query($sql, array($q['search']));
if ($query) {
$rows = $query->result_array();
//echo $this->db_regional->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_regional);
exit;
}
}
function searchkelurahan(){
if (! $this->isLogin) {
$this->sys_error("Invalid Token");
exit;
}
$prm = $this->sys_input;
$id = $prm['id'];
$max_rst = 12;
$tot_count =0;
$q = [
'search' => '%'
];
if ($prm['search'] != '')
{
$q['search'] = "%{$prm['search']}%";
}
// QUERY TOTAL
$sql = "SELECT count(*) as total
FROM m_kelurahan
WHERE
M_KelurahanName like ?
AND M_KelurahanM_DistrictID = '{$id}'
AND M_KelurahanIsActive = 'Y'";
$query = $this->db_regional->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_regional);
exit;
}
$sql = "
SELECT *
FROM m_kelurahan
WHERE
M_KelurahanName like ?
AND M_KelurahanM_DistrictID = '{$id}'
AND M_KelurahanIsActive = 'Y'
ORDER BY M_KelurahanName ASC
";
$query = $this->db_regional->query($sql, array($q['search']));
if ($query) {
$rows = $query->result_array();
//echo $this->db_regional->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_regional);
exit;
}
}
function searchcompany(){
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_company
WHERE
M_CompanyName like ?
AND M_CompanyIsActive = 'Y'";
$query = $this->db_regional->query($sql,$q['search']);
//echo $query;
if ($query) {
$tot_count = $query->result_array()[0]["total"];
}
else {
$this->sys_error_db("m_company count",$this->db_regional);
exit;
}
$sql = "
SELECT *
FROM m_company
WHERE
M_CompanyName like ?
AND M_CompanyIsActive = 'Y'
ORDER BY M_CompanyName ASC
";
$query = $this->db_regional->query($sql, array($q['search']));
if ($query) {
$rows = $query->result_array();
//echo $this->db_regional->last_query();
$result = array("total" => $tot_count, "records" => $rows, "total_display" => sizeof($rows));
$this->sys_ok($result);
}
else {
$this->sys_error_db("m_company rows",$this->db_regional);
exit;
}
}
function searchmou(){
if (! $this->isLogin) {
$this->sys_error("Invalid Token");
exit;
}
$prm = $this->sys_input;
$id = $prm['id'];
$max_rst = 12;
$tot_count =0;
$q = [
'search' => '%'
];
if ($prm['search'] != '')
{
$q['search'] = "%{$prm['search']}%";
}
// QUERY TOTAL
$sql = "SELECT count(*) as total
FROM m_mou
WHERE
M_MouName like ?
AND M_MouM_CompanyID = '{$id}'
AND M_MouIsActive = 'Y'";
$query = $this->db_regional->query($sql,$q['search']);
//echo $query;
if ($query) {
$tot_count = $query->result_array()[0]["total"];
}
else {
$this->sys_error_db("m_mou count",$this->db_regional);
exit;
}
$sql = "SELECT *
FROM m_mou
WHERE
M_MouName like ?
AND M_MouM_CompanyID = '{$id}'
AND M_MouIsActive = 'Y'
ORDER BY M_MouName ASC
";
$query = $this->db_regional->query($sql, array($q['search']));
if ($query) {
$rows = $query->result_array();
// echo $this->db_regional->last_query();
$result = array("total" => $tot_count, "records" => $rows, "total_display" => sizeof($rows));
$this->sys_ok($result);
}
else {
$this->sys_error_db("m_mou rows",$this->db_regional);
exit;
}
}
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(SELECT M_DoctorID, CONCAT(M_DoctorPrefix, ' ',M_DoctorName) as M_DoctorName
FROM m_doctor
WHERE M_DoctorIsActive = 'Y') a
WHERE
M_DoctorName like ?";
$query = $this->db_regional->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_regional);
exit;
}
$sql = "SELECT * FROM(SELECT M_DoctorID, CONCAT(M_DoctorPrefix, ' ',M_DoctorName) as M_DoctorName
FROM m_doctor
WHERE M_DoctorIsActive = 'Y') a
WHERE
M_DoctorName like ?
ORDER BY M_DoctorName ASC
";
$query = $this->db_regional->query($sql, array($q['search']));
if ($query) {
$rows = $query->result_array();
//echo $this->db_regional->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_regional);
exit;
}
}
function selectaddressdoctor(){
try {
//# cek token valid
if (! $this->isLogin) {
$this->sys_error("Invalid Token");
exit;
}
$prm = $this->sys_input;
$rows = [];
$query ="SELECT M_DoctorAddressID,
CONCAT(M_DoctorAddressNote, ': ',M_DoctorAddressDescription) as M_DoctorAddressNote
FROM
m_doctoraddress
WHERE M_DoctorAddressIsActive = 'Y' AND M_DoctorAddressM_DoctorID = '{$id}'";
//echo $query;
$rows['addressdoctors'] = $this->db_regional->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);
}
}
}