<?php
session_start();
require_once '../utils/errorhandler.php';
require_once '../utils/response.php';
require_once '../model/dbclass.php';
require_once '../model/model.php';
require_once '../model/glaccount.php';

$glaccount = new GLAccount();
//$atsrecord = explode("/",$_POST["atsrecordname"]);
$accounttype = (isset($_POST["accounttype"]) && $_POST["accounttype"] !== "") ? ($_POST["accounttype"] . "%") : "%";
$status = (isset($_POST["status"]) && $_POST["status"] !== "") ? $_POST["status"] : "OPEN";
//$pageno = $_POST["pageno"] > 0 ? $_POST["pageno"] : 1;
//$limit = 5000;

$query = "SELECT * FROM glaccount WHERE accounttype LIKE '" . $accounttype . "' AND status LIKE '$status' ORDER BY description ASC";
$result = $glaccount->executeByQuerySelector($query);

if($result){
	echo success($result,200, "Successful" ,"Successful");
}else{
	echo badRequest(204, "Not successful");
}
?>