FHM09062601IBL - registrasi klinik: tambah endpoint searchcompany dan getmoubycompany
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1293,6 +1293,70 @@ class Registrationv3 extends MY_Controller
|
||||
exit;
|
||||
}
|
||||
|
||||
function searchcompany()
|
||||
{
|
||||
if (!$this->isLogin) {
|
||||
$this->sys_error("Invalid Token");
|
||||
exit;
|
||||
}
|
||||
$prm = $this->sys_input;
|
||||
$search = $this->db_onedev->escape_like_str($prm['search'] ?? '');
|
||||
|
||||
$sql = "SELECT
|
||||
M_CompanyID AS id,
|
||||
M_CompanyName AS name,
|
||||
M_CompanyNumber AS number
|
||||
FROM m_company
|
||||
WHERE M_CompanyIsActive = 'Y'
|
||||
AND M_CompanyName LIKE '%{$search}%'
|
||||
ORDER BY M_CompanyName ASC
|
||||
LIMIT 20";
|
||||
|
||||
$query = $this->db_onedev->query($sql);
|
||||
if (!$query) {
|
||||
$this->sys_error_db("searchcompany error", $this->db_onedev);
|
||||
exit;
|
||||
}
|
||||
$this->sys_ok(array("records" => $query->result_array()));
|
||||
exit;
|
||||
}
|
||||
|
||||
function getmoubycompany()
|
||||
{
|
||||
if (!$this->isLogin) {
|
||||
$this->sys_error("Invalid Token");
|
||||
exit;
|
||||
}
|
||||
$prm = $this->sys_input;
|
||||
$company_id = intval($prm['company_id'] ?? 0);
|
||||
if (!$company_id) {
|
||||
$this->sys_error("company_id required");
|
||||
exit;
|
||||
}
|
||||
|
||||
$sql = "SELECT
|
||||
M_MouID AS id,
|
||||
M_MouName AS name,
|
||||
M_MouNumber AS number,
|
||||
M_MouRefNumber AS ref_number,
|
||||
M_MouStartDate AS start_date,
|
||||
M_MouEndDate AS end_date
|
||||
FROM m_mou
|
||||
WHERE M_MouM_CompanyID = ?
|
||||
AND M_MouIsActive = 'Y'
|
||||
AND M_MouIsReleased = 'Y'
|
||||
AND CURDATE() BETWEEN M_MouStartDate AND M_MouEndDate
|
||||
ORDER BY M_MouName ASC";
|
||||
|
||||
$query = $this->db_onedev->query($sql, [$company_id]);
|
||||
if (!$query) {
|
||||
$this->sys_error_db("getmoubycompany error", $this->db_onedev);
|
||||
exit;
|
||||
}
|
||||
$this->sys_ok(array("records" => $query->result_array()));
|
||||
exit;
|
||||
}
|
||||
|
||||
function getpoli()
|
||||
{
|
||||
if (!$this->isLogin) {
|
||||
|
||||
Reference in New Issue
Block a user