Initial import
This commit is contained in:
68
application/controllers/tools/Booking_comp.php
Normal file
68
application/controllers/tools/Booking_comp.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
class Booking_comp extends MY_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
function get($code)
|
||||
{
|
||||
$sql = "select m_branch.*,M_CityName
|
||||
from m_branch
|
||||
join m_city on M_BranchM_CityID = M_CityID
|
||||
where M_BranchIsActive = 'Y' and M_BranchIsDefault='Y'";
|
||||
$qry = $this->db->query($sql);
|
||||
if (!$qry) {
|
||||
echo json_encode(["status" => "ERR", "message" => "Err " .
|
||||
$this->db->error()["message"]]);
|
||||
exit;
|
||||
}
|
||||
$rows = $qry->result_array();
|
||||
if (count($rows) == 0) {
|
||||
echo json_encode(["status" => "ERR",
|
||||
"message" => "No Default Branch" ]);
|
||||
exit;
|
||||
}
|
||||
$branchName = $rows[0]["M_BranchName"];
|
||||
$branchAddress = $rows[0]["M_BranchAddress"];
|
||||
$branchCity = $rows[0]["M_CityName"];
|
||||
$sql = "select
|
||||
FutureOrderNumber,
|
||||
M_TitleName, M_PatientPrefix,
|
||||
M_PatientName, M_PatientSuffix
|
||||
from future_order
|
||||
join m_patient on
|
||||
FutureOrderNumber=?
|
||||
and FutureOrderM_PatientID = M_PatientID
|
||||
join m_title on M_PatientM_TitleID = M_TitleID";
|
||||
$qry = $this->db->query($sql,[$code]);
|
||||
if (!$qry) {
|
||||
echo json_encode(["status" => "ERR", "message" => "Err " .
|
||||
$this->db->error()["message"]]);
|
||||
exit;
|
||||
}
|
||||
$rows = $qry->result_array();
|
||||
if (count($rows)==0){
|
||||
echo json_encode(["status" => "ERR",
|
||||
"message" => "Kode Booking $code not found." ]);
|
||||
exit;
|
||||
}
|
||||
$r = $rows[0];
|
||||
$patient = $r["M_TitleName"];
|
||||
if ($r["M_PatientPrefix"] != "") {
|
||||
if ($patient!= "") $patient .= " " .$r["M_PatientPrefix"];
|
||||
}
|
||||
if ($r["M_PatientName"] != "") {
|
||||
if ($patient!= "") $patient .= " " .$r["M_PatientName"];
|
||||
}
|
||||
if ($r["M_PatientSuffix"] != "") {
|
||||
if ($patient!= "") $patient .= " " .$r["M_PatientSuffix"];
|
||||
}
|
||||
echo json_encode([
|
||||
"branchName"=> $branchName,
|
||||
"branchCity"=> $branchCity,
|
||||
"branchAddress"=> $branchAddress,
|
||||
"patient"=> $patient
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user