From a00891a7be48f159d7d17be228b2bcbbfe9f12c1 Mon Sep 17 00:00:00 2001 From: sas-adib Date: Sun, 13 Sep 2026 19:40:44 +0700 Subject: [PATCH] add endpoint listing service items --- .../controllers/map/ServiceCoaMapping.php | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/application/controllers/map/ServiceCoaMapping.php b/application/controllers/map/ServiceCoaMapping.php index e291dbb..f122da0 100644 --- a/application/controllers/map/ServiceCoaMapping.php +++ b/application/controllers/map/ServiceCoaMapping.php @@ -13,6 +13,45 @@ class ServiceCoaMapping extends MY_Controller parent::__construct(); } + public function getListItemJasa() + { + try { + if (!$this->sys_input) { + throw new Exception("Invalid token"); + } + $para = $this->sys_input; + $keyword = "%"; + if ($para['keyword'] != '') { + $keyword .= $para['keyword'] . "%"; + } + + $sql = "SELECT + M_ItemID, + M_ItemCode, + M_ItemDesc + FROM m_item + WHERE M_ItemIsActive = 'Y' + AND M_ItemDesc LIKE ? + AND M_ItemItem_CategoryID = '4'"; + $que = $this->db->query($sql, [$keyword]); + if (!$que) { + throw new Exception('failed to get item jasa', 1); + } + $data = $que->result_array(); + + $this->sys_ok($data); + } catch (Exception $e) { + $mssg = "[Error] " . $e->getMessage(); + $code = $e->getCode(); + if ($code == 0) { + $this->sys_error($mssg); + } else { + $this->sys_error_db($mssg); + } + exit(); + } + } + public function getListCoa() { try { @@ -24,6 +63,9 @@ class ServiceCoaMapping extends MY_Controller $keyword = "%" . $para["keyword"] . "%"; $sql = "SELECT + coaID, + coaAccountNo, + coaDescription FROM coa WHERE coaIsInput = 'Y' AND (