Пример #1
0
function selectCheques()
{
    $where = "1=1";
    $whereParam = array();
    if (isset($_REQUEST["DocID"])) {
        $where .= " AND DocID=:d";
        $whereParam[":d"] = $_REQUEST["DocID"];
    }
    if (isset($_GET["fields"]) && !empty($_GET["query"])) {
        switch ($_GET["fields"]) {
            case "CheckNo":
                $where .= " AND CheckNo = :q";
                $whereParam[":q"] = $_GET["query"];
                break;
            case "reciever":
                $where .= " AND reciever like :q";
                $whereParam[":q"] = '%' . $_GET["query"] . '%';
                break;
            case "DocID":
                $where .= " AND DocID = :q";
                $whereParam[":q"] = $_GET["query"];
                break;
            case "accountTitle":
                $where .= " AND accountTitle like :q";
                $whereParam[":q"] = '%' . $_GET["query"] . '%';
                break;
            case "amount":
                $where .= " AND amount = :q";
                $whereParam[":q"] = $_GET["query"];
                break;
            case "CheckStatus":
                $where .= " AND b.title like :q";
                $whereParam[":q"] = '%' . $_GET["query"] . '%';
                break;
        }
    }
    if (!empty($_GET["date"])) {
        $where .= " AND CheckDate = :q";
        $whereParam[":q"] = DateModules::shamsi_to_miladi($_GET["date"]);
    }
    $where .= dataReader::makeOrder();
    $temp = ACC_DocCheques::GetAll($where, $whereParam);
    $no = count($temp);
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    die;
}