Example #1
0
function selectWrtData()
{
    $where = "";
    $whereParam = array();
    MakeAdvanceSearchWhere($where, $whereParam);
    $field = isset($_GET["fields"]) ? $_GET["fields"] : "";
    if (isset($_GET["query"]) && $_GET["query"] != "") {
        switch ($field) {
            case "PersonID":
                $where .= " AND p.PersonID = :qry1 ";
                $whereParam[":qry1"] = "%" . $_GET["query"] . "%";
                break;
            case "writ_id":
                $where .= " AND w.writ_id = :qry1 ";
                $whereParam[":qry1"] = $_GET["query"];
                break;
            case "writ_ver":
                $where .= " AND w.writ_ver = :qry1 ";
                $whereParam[":qry1"] = $_GET["query"];
                break;
            case "fullname":
                $where .= " AND fullname LIKE :qry ";
                $whereParam[":qry"] = "%" . $_GET["query"] . "%";
                break;
            case "staff_id":
                $where .= " AND w.staff_id = :qry1 ";
                $whereParam[":qry1"] = $_GET["query"];
                break;
            case "org_title":
                $where .= " AND org_title = :qry1 ";
                $whereParam[":qry1"] = $_GET["query"];
                break;
            case "wt_title":
                $where .= " AND wt_title LIKE :qry ";
                $whereParam[":qry"] = $_GET["query"];
                break;
            case "emp_state_title":
                $where .= " AND emp_state_title LIKE :qry ";
                $whereParam[":qry"] = "%" . $_GET["query"] . "%";
                break;
            case "execute_date":
                $where .= " AND w.execute_date = :qry1 ";
                $whereParam[":qry1"] = $_GET["query"];
                break;
            case "history_only_title":
                $where .= " AND history_only_title = :qry1 ";
                $whereParam[":qry1"] = $_GET["query"];
                break;
            case "corrective_title":
                $where .= " AND corrective_title = :qry1 ";
                $whereParam[":qry1"] = $_GET["query"];
                break;
            case "corrective_writ_id":
                $where .= " AND corrective_writ_id = :qry1 ";
                $whereParam[":qry1"] = $_GET["query"];
                break;
            case "mablagh":
                $where .= " AND mablagh = :qry1 ";
                $whereParam[":qry1"] = $_GET["query"];
                break;
        }
    }
    $temp = manage_writ::GetAllWrits($where . dataReader::makeOrder(), $whereParam);
    $no = $temp->rowCount();
    $temp = PdoDataAccess::fetchAll($temp, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    //  echo PdoDataAccess::GetLatestQueryString();
    die;
}