diff --git a/application/controllers/map/ServiceCoaMapping.php b/application/controllers/map/ServiceCoaMapping.php new file mode 100644 index 0000000..f02c303 --- /dev/null +++ b/application/controllers/map/ServiceCoaMapping.php @@ -0,0 +1,78 @@ +sys_input) { + throw new Exception("Invalid token"); + } + + $para = $this->sys_input; + $keyword = "%" . $para["keyword"] . "%"; + + $sql = "SELECT + FROM coa + WHERE coaIsInput = 'Y' + AND ( + coaDescription LIKE ? + OR coaAccountNo LIKE ? + ) + AND coaIsActive = 'Y' + LIMIT 15"; + $que = $this->db->query($sql, [$keyword, $keyword]); + if (!$que) { + throw new Exception("failed to query data coa", 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); + } + } + } + + public function getListServiceMapping() + { + try { + if (!$this->isLogin) { + throw new Exception('invalid token'); + + $sql = ""; + $que = $this->db->query($sql); + if (!$que) { + throw new Exception('failed to query service coa mapping', 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); + } + } + } +}