90 lines
2.7 KiB
PHP
90 lines
2.7 KiB
PHP
<?php
|
|
|
|
class Bank extends MY_Controller
|
|
{
|
|
var $db_smartone;
|
|
public function index()
|
|
{
|
|
echo "Bank API";
|
|
}
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->db_smartone = $this->load->database("onedev", true);
|
|
}
|
|
|
|
|
|
public function search()
|
|
{
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$prm = $this->sys_input;
|
|
|
|
if (isset($prm['card']))
|
|
{
|
|
$sql = "SELECT Nat_BankID, Nat_BankName
|
|
FROM nat_bank WHERE Nat_BankIsCard = 'Y' AND Nat_BankIsActive = 'Y' ORDER BY Nat_BankName ASC";
|
|
$query = $this->db_smartone->query($sql);
|
|
}
|
|
else if (isset($prm['edc']))
|
|
{
|
|
$sql = "SELECT Nat_BankID, Nat_BankName
|
|
FROM nat_bank WHERE Nat_BankIsEDC = 'Y' AND Nat_BankIsActive = 'Y' ORDER BY Nat_BankName ASC";
|
|
$query = $this->db_smartone->query($sql);
|
|
}
|
|
else
|
|
{
|
|
$sql = "SELECT Nat_BankID, Nat_BankName
|
|
FROM nat_bank WHERE Nat_BankIsActive = 'Y' ORDER BY Nat_BankName ASC";
|
|
$query = $this->db_smartone->query($sql);
|
|
}
|
|
|
|
// $sql = "select Nat_BankID, Nat_BankName
|
|
// from nat_bank
|
|
// where Nat_BankIsActive = 'Y'
|
|
// ORDER BY Nat_BankName";
|
|
$query = $this->db_smartone->query($sql);
|
|
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
|
|
$result = array("total" => 0, "records" => $rows, "total_display" => sizeof($rows));
|
|
$this->sys_ok($result);
|
|
}
|
|
else {
|
|
$this->sys_error_db("BANK rows",$this->db_smartone);
|
|
exit;
|
|
}
|
|
}
|
|
|
|
public function search_account()
|
|
{
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$prm = $this->sys_input;
|
|
|
|
$sql = "select M_BankAccountID, CONCAT(Nat_BankCode, ' no ', M_BankAccountNo) M_BankAccountNo
|
|
from nat_bank
|
|
JOIN m_bank_account ON M_BankAccountNat_BankID = Nat_BankID AND M_BankAccountIsActive = 'Y'
|
|
where Nat_BankIsActive = 'Y'
|
|
ORDER BY Nat_BankName";
|
|
$query = $this->db_smartone->query($sql);
|
|
|
|
if ($query) {
|
|
$rows = $query->result_array();
|
|
|
|
$result = array("total" => 0, "records" => $rows, "total_display" => sizeof($rows));
|
|
$this->sys_ok($result);
|
|
}
|
|
else {
|
|
$this->sys_error_db("BANK rows",$this->db_smartone);
|
|
exit;
|
|
}
|
|
}
|
|
}
|