Example #1
0
function selectMiscDoc()
{
    $where = " PersonID = :PID ";
    $whereParam = array();
    $whereParam[":PID"] = $_GET["Q0"];
    $field = isset($_GET["fields"]) ? $_GET["fields"] : "";
    if (isset($_GET["query"]) && $_GET["query"] != "") {
        switch ($field) {
            case "title":
                $where .= " AND title LIKE :qry ";
                $whereParam[":qry"] = "%" . $_GET["query"] . "%";
                break;
            case "doc_no":
                $where .= " AND doc_no=:qry ";
                $whereParam[":qry"] = $_GET["query"];
                break;
            case "row_no":
                $where .= " AND row_no=:qry ";
                $whereParam[":qry"] = $_GET["query"];
                break;
        }
    }
    $no = manage_person_misc_doc::CountMiscDoc($where, $whereParam);
    $where .= dataReader::makeOrder();
    $where .= isset($_GET["start"]) ? " limit " . $_GET["start"] . "," . $_GET["limit"] : "";
    $temp = manage_person_misc_doc::GetAllMiscDoc($where, $whereParam);
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    die;
}
Example #2
0
function SearchJob()
{
    $where = " (1=1) AND PersonType <> 3 ";
    $whereParam = array();
    $field = isset($_GET["fields"]) ? $_GET["fields"] : "";
    if (isset($_GET["query"]) && $_GET["query"] != "" && $_REQUEST['JobH'] != 1) {
        switch ($field) {
            case "title":
                $where .= " AND title LIKE :qry ";
                $whereParam[":qry"] = "%" . $_GET["query"] . "%";
                break;
            case "job_id":
                $where .= " AND job_id = :qry ";
                $whereParam[":qry"] = $_GET["query"];
                break;
        }
    }
    if (isset($_REQUEST["query"]) && $_REQUEST["query"] != "" && $_REQUEST['JobH'] == 1) {
        $where .= " AND title LIKE :qry ";
        $whereParam = array(":qry" => "%" . $_REQUEST["query"] . "%");
    }
    $where .= dataReader::makeOrder();
    $temp = manage_Job::GetAll($where, $whereParam);
    $no = count($temp);
    $temp = array_slice($temp, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    die;
}
Example #3
0
function selectPersons()
{
    $where = "p.IsActive in ('YES','PENDING')";
    $param = array();
    if (!empty($_REQUEST["UserType"])) {
        switch ($_REQUEST["UserType"]) {
            case "IsAgent":
                $where .= " AND IsAgent='YES'";
                break;
            case "IsCustomer":
                $where .= " AND IsCustomer='YES'";
                break;
            case "IsStaff":
                $where .= " AND IsStaff='YES'";
                break;
            case "IsSupporter":
                $where .= " AND IsSupporter='YES'";
                break;
            case "IsExpert":
                $where .= " AND IsExpert='YES'";
                break;
        }
    }
    if (!empty($_REQUEST["UserTypes"])) {
        $arr = preg_split("/,/", $_REQUEST["UserTypes"]);
        $where .= " AND ( 1=0 ";
        foreach ($arr as $r) {
            $where .= " OR {$r}='YES'";
        }
        $where .= ")";
    }
    if (isset($_REQUEST['fields']) && isset($_REQUEST['query'])) {
        $field = $_REQUEST['fields'];
        $field = $_REQUEST['fields'] == "fullname" ? "concat_ws(' ',fname,lname,CompanyName)" : $field;
        $where .= ' and ' . $field . ' like :fld';
        $_REQUEST['query'] = $_REQUEST['query'] == "*" ? "YES" : $_REQUEST['query'];
        $param[':fld'] = '%' . $_REQUEST['query'] . '%';
    }
    if (!empty($_REQUEST["PersonID"])) {
        $where .= " AND PersonID=:p";
        $param[":p"] = $_REQUEST["PersonID"];
    }
    if (!empty($_REQUEST["query"]) && !isset($_REQUEST['fields'])) {
        $where .= " AND ( concat(fname,' ',lname) like :p or CompanyName like :p)";
        $param[":p"] = "%" . $_REQUEST["query"] . "%";
    }
    if (!empty($_REQUEST["IsConfirm"])) {
        $where .= " AND IsConfirm = :e ";
        $param[":e"] = $_REQUEST["IsConfirm"];
    }
    if (!empty($_REQUEST["full"])) {
        $temp = BSC_persons::SelectAll($where . dataReader::makeOrder(), $param);
    } else {
        $temp = BSC_persons::MinSelect($where . dataReader::makeOrder(), $param);
    }
    $no = $temp->rowCount();
    $temp = PdoDataAccess::fetchAll($temp, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    die;
}
Example #4
0
function SelectAllWarrentyRequests()
{
    $param = array();
    $where = "1=1 ";
    if (!empty($_REQUEST["RequestID"])) {
        $where .= " AND RequestID=:r";
        $param[":r"] = $_REQUEST["RequestID"];
    }
    $param = array();
    if (isset($_REQUEST['fields']) && isset($_REQUEST['query'])) {
        $field = $_REQUEST['fields'];
        $field = $field == "fullname" ? "concat_ws(' ',fname,lname,CompanyName)" : $field;
        $where .= ' and ' . $field . ' like :fld';
        $param[':fld'] = '%' . $_REQUEST['query'] . '%';
    }
    if (!empty($_REQUEST["IsEnded"])) {
        $where .= " AND StatusID = :e ";
        $param[":e"] = WAR_STEPID_END;
    }
    $dt = WAR_requests::SelectAll($where, $param, dataReader::makeOrder());
    //print_r(ExceptionHandler::PopAllExceptions());
    //echo PdoDataAccess::GetLatestQueryString();
    $count = $dt->rowCount();
    $dt = PdoDataAccess::fetchAll($dt, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($dt, $count, $_GET["callback"]);
    die;
}
Example #5
0
function selectUsers()
{
    $query = "\r\n        select distinct s.UserID,p.pfname,plname\r\n        from UsersSystems as s\r\n            join AccountSpecs a on(s.UserID=a.WebUserID)\r\n            join persons p on(p.PersonID=a.PersonID)\r\n        where SysCode in (" . PersonalSystemCode . "," . SalarySystemCode . ") AND UserSystemStatus <> 'DELETE' ";
    $whereParam = array();
    if (!empty($_GET["fields"]) && !empty($_GET["query"])) {
        switch ($_GET["fields"]) {
            case "UserID":
                $query .= " AND s.UserID like :userid";
                $whereParam[":userid"] = "%" . $_GET["query"] . "%";
                break;
            case "pfname":
                $query .= " AND p.pfname like :pfname";
                $whereParam[":pfname"] = "%" . $_GET["query"] . "%";
                break;
            case "plname":
                $query .= " AND p.plname like :plname";
                $whereParam[":plname"] = "%" . $_GET["query"] . "%";
                break;
        }
    }
    $dt = PdoDataAccess::runquery($query . dataReader::makeOrder(), $whereParam);
    $no = count($dt);
    $dt = array_slice($dt, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($dt, $no, $_GET["callback"]);
    die;
}
Example #6
0
function selectAll()
{
    $temp = manage_salary_params::GetAll($_GET["person_type"], $_GET["param_type"], dataReader::makeOrder());
    $no = count($temp);
    $temp = array_slice($temp, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    die;
}
Example #7
0
function Searchbank()
{
    $where = dataReader::makeOrder();
    $temp = manage_bank::GetAll($where);
    $no = count($temp);
    $temp = array_slice($temp, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    die;
}
function searchcostCenterItm()
{
    $where = dataReader::makeOrder();
    $temp = manage_cost_center_exception::GetAll($where);
    $no = count($temp);
    $temp = array_slice($temp, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    die;
}
function searchSITR()
{
    $where = dataReader::makeOrder();
    $temp = manage_salary_item_report::GetAll($where);
    $no = count($temp);
    $temp = array_slice($temp, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    die;
}
function selectAll()
{
    $where = 'where ( 1=1 )';
    $where .= dataReader::makeOrder();
    $temp = manage_tax_table_types::GetAll($where);
    $no = count($temp);
    $temp = array_slice($temp, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    die;
}
Example #11
0
function selectAll()
{
    $where = " pe.staff_id = :staff_id ";
    $whereParam = array();
    $whereParam[":staff_id"] = $_POST["staff_id"];
    $where .= dataReader::makeOrder();
    $temp = manage_professor_exe_posts::GetAll($where, $whereParam);
    echo dataReader::getJsonData($temp, count($temp), $_GET["callback"]);
    die;
}
Example #12
0
function selectbanchs()
{
    $where = " sfid =" . $_GET['sfid'];
    $where .= dataReader::makeOrder();
    $temp = manage_study_branch::GetAll($where);
    $no = count($temp);
    $temp = array_slice($temp, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    die;
}
Example #13
0
function SelectAllLetter()
{
    $where = "1=1";
    $param = array();
    foreach ($_POST as $field => $value) {
        if ($field == "excel" || empty($value) || strpos($field, "inputEl") !== false) {
            continue;
        }
        $prefix = "";
        switch ($field) {
            case "PersonID":
                $prefix = "l.";
                break;
            case "Customer":
                $prefix = "lc.";
                break;
            case "LetterID":
            case "LetterTitle":
                $prefix = "l.";
                break;
            case "FromSendDate":
            case "FromLetterDate":
            case "ToSendDate":
            case "ToLetterDate":
                $value = DateModules::shamsi_to_miladi($value, "-");
                break;
        }
        if ($field == "FromPersonID" || $field == "ToPersonID") {
            $where .= " AND s." . $field . " = :{$field}";
            $param[":{$field}"] = $value;
        } else {
            if (strpos($field, "From") === 0) {
                $where .= " AND " . $prefix . substr($field, 4) . " >= :{$field}";
                $param[":{$field}"] = $value;
            } else {
                if (strpos($field, "To") === 0) {
                    $where .= " AND " . $prefix . substr($field, 2) . " <= :{$field}";
                    $param[":{$field}"] = $value;
                } else {
                    $where .= " AND " . $prefix . $field . " like :{$field}";
                    $param[":{$field}"] = "%" . $value . "%";
                }
            }
        }
    }
    //echo $where;
    //print_r($param);
    $list = OFC_letters::FullSelect($where, $param, dataReader::makeOrder());
    print_r(ExceptionHandler::PopAllExceptions());
    //echo PdoDataAccess::GetLatestQueryString();
    $no = $list->rowCount();
    $list = PdoDataAccess::fetchAll($list, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($list, $no, $_GET['callback']);
    die;
}
Example #14
0
function SearchHistoryJob()
{
    $where = " PersonID = :PID ";
    $whereParam = array();
    $whereParam[":PID"] = $_GET["Q0"];
    $no = manage_person_job::CountPersonJob($where, $whereParam);
    $where .= dataReader::makeOrder();
    $where .= isset($_GET["start"]) ? " limit " . $_GET["start"] . "," . $_GET["limit"] : "";
    $temp = manage_person_job::GetAllPersonJob($where, $whereParam);
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    die;
}
Example #15
0
function selectDev()
{
    $where = " d.PersonID = :PID ";
    $whereParam = array();
    $whereParam[":PID"] = $_GET["Q0"];
    /*
    	$field = isset ( $_GET ["fields"] ) ? $_GET ["fields"] : "";
    	
    	if (isset ( $_GET ["query"] ) && $_GET ["query"] != "") {
    	switch ( $field) {
    		case "Title" :
    			$where .= " AND Title LIKE :qry " ;
    			$whereParam[":qry"] = "%" . $_GET["query"] . "%";
    	        
    		break;
    		case "enlisted" :	
    			$where .= " AND enlisted = :qry1 " ;
    			$whereParam[":qry1"] = "%" . $_GET["query"] . "%";
    	
    		break;
    		case "from_date" :
    			$where .= " AND from_date = :qry1 " ;
    			$whereParam[":qry1"] = $_GET["query"];
    			
    		break;
    		case "to_date" :
    			$where .= " AND to_date = :qry1 " ;
    			$whereParam[":qry1"] = $_GET["query"];
    			
    		break;
    		case "amount" :
    			$where .= " AND amount = :qry1 " ;
    			$whereParam[":qry1"] = $_GET["query"];
    		
    		break;
    		case "war_place" :
    			$where .= " AND war_place LIKE :qry ";
    			$whereParam[":qry"] = "%" . $_GET["query"] . "%";
    			
    		break;
    		
    		
    			}
    }
    */
    $no = manage_person_devotion::CountDevotion($where, $whereParam);
    $where .= dataReader::makeOrder();
    $where .= isset($_GET["start"]) ? " limit " . $_GET["start"] . "," . $_GET["limit"] : "";
    $temp = manage_person_devotion::GetAllDevotions($where, $whereParam);
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    die;
}
Example #16
0
function selectAll()
{
    $where = " where (1=1)";
    if ($_GET["tax_table_type_id"] != "") {
        $where .= " AND tax_table_type_id=:ttid ";
        $whereParam[":ttid"] = $_GET["tax_table_type_id"];
    }
    $where .= dataReader::makeOrder();
    $temp = manage_Tax_Table::GetAll($_GET["tax_table_type_id"], $where, $whereParam);
    $no = count($temp);
    $temp = array_slice($temp, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    die;
}
Example #17
0
function selectEduc()
{
    $where = " pe.PersonID = :PID ";
    $whereParam = array();
    $whereParam[":PID"] = $_GET["Q0"];
    $field = isset($_GET["fields"]) ? $_GET["fields"] : "";
    if (isset($_GET["query"]) && $_GET["query"] != "") {
        switch ($field) {
            case "fname":
                $where .= " AND fname LIKE :qry ";
                $whereParam[":qry"] = "%" . $_GET["query"] . "%";
                break;
            case "lname":
                $where .= " AND lname LIKE :qry ";
                $whereParam[":qry"] = "%" . $_GET["query"] . "%";
                break;
            case "birth_date":
                $where .= " AND birth_date = :qry1 ";
                $whereParam[":qry1"] = $_GET["query"];
                break;
            case "idcard_no":
                $where .= " AND idcard_no = :qry1 ";
                $whereParam[":qry1"] = $_GET["query"];
                break;
            case "father_name":
                $where .= " AND Fname LIKE :qry ";
                $whereParam[":qry"] = "%" . $_GET["query"] . "%";
                break;
            case "Title":
                $where .= " AND Title LIKE :qry ";
                $whereParam[":qry"] = "%" . $_GET["query"] . "%";
                break;
            case "insure_type":
                // شماره بیمه
                $where .= " AND insure_type LIKE :qry ";
                $whereParam[":qry"] = "%" . $_GET["query"] . "%";
                break;
        }
    }
    $no = manage_person_education::CountEducation($where, $whereParam);
    $where .= dataReader::makeOrder();
    $where .= isset($_GET["start"]) ? " limit " . $_GET["start"] . "," . $_GET["limit"] : "";
    $temp = manage_person_education::GetAllEducations($where, $whereParam);
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    die;
}
Example #18
0
function selectEmp()
{
    $where = " eh.PersonID = :PID ";
    $whereParam = array();
    $whereParam[":PID"] = $_GET["Q0"];
    $field = isset($_GET["fields"]) ? $_GET["fields"] : "";
    if (isset($_GET["query"]) && $_GET["query"] != "") {
        switch ($field) {
            case "organization":
                $where .= " AND organization LIKE :qry ";
                $whereParam[":qry"] = "%" . $_GET["query"] . "%";
                break;
            case "unit":
                $where .= " AND unit LIKE :qry ";
                $whereParam[":qry"] = "%" . $_GET["query"] . "%";
                break;
            case "from_date":
                $where .= " AND from_date = :qry1 ";
                $whereParam[":qry1"] = $_GET["query"];
                break;
            case "to_date":
                $where .= " AND to_date = :qry1 ";
                $whereParam[":qry1"] = $_GET["query"];
                break;
            case "org_title":
                $where .= " AND org_title = :qry1 ";
                $whereParam[":qry1"] = $_GET["query"];
                break;
            case "unempTitle":
                $where .= " AND unempTitle = :qry1 ";
                $whereParam[":qry1"] = $_GET["query"];
                break;
            case "title":
                $where .= " AND title LIKE :qry ";
                $whereParam[":qry"] = "%" . $_GET["query"] . "%";
                break;
        }
    }
    $no = manage_person_employment::CountEmp($where, $whereParam);
    $where .= dataReader::makeOrder();
    $where .= isset($_GET["start"]) ? " limit " . $_GET["start"] . "," . $_GET["limit"] : "";
    $temp = manage_person_employment::GetAllEmp($where, $whereParam);
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    die;
}
Example #19
0
function GetAllRequests()
{
    $where = "";
    $param = array();
    if (!empty($_REQUEST["fields"]) && !empty($_GET["query"])) {
        $field = $_REQUEST["fields"] == "fullname" ? "concat(p1.fname,' ',p1.lname)" : $_REQUEST["fields"];
        $where .= " AND\t" . $field . " like :q";
        $param[":q"] = "%" . $_GET["query"] . "%";
    }
    if (isset($_REQUEST["AllReqs"]) && $_REQUEST["AllReqs"] == "false") {
        $where .= " AND IsArchive='NO'";
    }
    $dt = ATN_requests::Get($where . dataReader::makeOrder(), $param);
    //print_r(ExceptionHandler::PopAllExceptions());
    $result = PdoDataAccess::fetchAll($dt, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($result, $dt->rowCount(), $_GET["callback"]);
    die;
}
Example #20
0
function SelectContracts()
{
    $where = "";
    $params = array();
    if (!empty($_REQUEST["ContractID"])) {
        $where .= " AND ContractID=:c";
        $params[":c"] = $_REQUEST["ContractID"];
    }
    $temp = CNT_contracts::Get(isset($_REQUEST["content"]), $where, $params, dataReader::makeOrder());
    $res = PdoDataAccess::fetchAll($temp, $_GET['start'], $_GET['limit']);
    for ($i = 0; $i < count($res); $i++) {
        $arr = WFM_FlowRows::GetFlowInfo(2, $res[$i]["ContractID"]);
        $res[$i]["IsStarted"] = $arr["IsStarted"] ? "YES" : "NO";
        $res[$i]["IsEnded"] = $arr["IsEnded"] ? "YES" : "NO";
        $res[$i]["StepDesc"] = $arr["StepDesc"];
    }
    echo dataReader::getJsonData($res, $temp->rowCount(), $_GET["callback"]);
    die;
}
Example #21
0
function selectBases()
{
    $where = " (1=1) ";
    $whereParam = array();
    $field = isset($_GET["fields"]) ? $_GET["fields"] : "";
    if (isset($_GET["query"]) && $_GET["query"] != "") {
        switch ($field) {
            case "title":
                $where .= " AND title LIKE :qry ";
                $whereParam[":qry"] = "%" . $_GET["query"] . "%";
                break;
            case "BaseValue":
                $where .= " AND BaseValue = :qry ";
                $whereParam[":qry"] = $_GET["query"];
                break;
            case "typeName":
                $where .= " AND i.Title like :qry ";
                $whereParam[":qry"] = "%" . $_GET["query"] . "%";
                break;
            case "fullName":
                $where .= " AND concat(pfname,' ',plname) like :qry ";
                $whereParam[":qry"] = "%" . $_GET["query"] . "%";
                break;
            case "ExecuteDate":
                $where .= " AND ExecuteDate = :qry ";
                $whereParam[":qry"] = DateModules::shamsi_to_miladi($_GET["query"]);
                break;
        }
    }
    $where .= dataReader::makeOrder();
    $temp = manage_bases::GetAll($where, $whereParam);
    $no = count($temp);
    $temp = array_slice($temp, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    die;
}
Example #22
0
function SelectMyPlans()
{
    $param = array($_SESSION["USER"]["PersonID"]);
    $where = "p.PersonID=?";
    $dt = PLN_plans::SelectAll($where, $param, dataReader::makeOrder());
    print_r(ExceptionHandler::PopAllExceptions());
    //echo PdoDataAccess::GetLatestQueryString();
    $count = $dt->rowCount();
    $dt = PdoDataAccess::fetchAll($dt, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($dt, $count, $_GET["callback"]);
    die;
}
Example #23
0
 static function SelectSendedLetters($where = "", $param = array())
 {
     $query = "select s.*,l.*, \n\t\t\t\tconcat_ws(' ',fname, lname,CompanyName) ToPersonName,\n\t\t\t\tif(count(DocumentID) > 0,'YES','NO') hasAttach,\n\t\t\t\tsubstr(s.SendDate,1,10) _SendDate\n\t\t\tfrom OFC_send s\n\t\t\t\tjoin OFC_letters l using(LetterID)\n\t\t\t\tjoin BSC_persons p on(s.ToPersonID=p.PersonID)\n\t\t\t\tleft join DMS_documents on(ObjectType='letterAttach' AND ObjectID=s.LetterID)\n\t\t\twhere FromPersonID=:fpid " . $where . "\n\t\t\tgroup by SendID\n\t\t";
     $param[":fpid"] = $_SESSION["USER"]["PersonID"];
     $query .= dataReader::makeOrder();
     return PdoDataAccess::runquery_fetchMode($query, $param);
 }
Example #24
0
function GetAllHolidays()
{
    $where = "";
    $whereParam = array();
    if (!empty($_REQUEST["Year"])) {
        $year = $_REQUEST["Year"];
        $StartDate = DateModules::shamsi_to_miladi($year . "-01-01", "-");
        $EndDate = DateModules::shamsi_to_miladi($year . "-12-" . DateModules::DaysOfMonth($year, 12), "-");
        $where .= " AND TheDate between ? AND ?";
        $whereParam[] = $StartDate;
        $whereParam[] = $EndDate;
    }
    $temp = ATN_holidays::Get($where . dataReader::makeOrder(), $whereParam);
    echo dataReader::getJsonData($temp->fetchAll(), $temp->rowCount(), $_GET["callback"]);
    die;
}
Example #25
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;
}
Example #26
0
function SelectAllForms()
{
    $where = "1=1";
    $param = array();
    $ObjectDesc = "case f.FlowID \r\n\t\t\twhen 1 then concat_ws(' ','وام شماره',lp.RequestID,'به مبلغ',\r\n\t\t\t\tPartAmount,'مربوط به',if(pp.IsReal='YES',concat(pp.fname, ' ', pp.lname),pp.CompanyName))\r\n\t\t\t\t\r\n\t\t\twhen 4 then concat_ws(' ','ضمانت نامه', wp.CompanyName,wp.fname,wp.lname, 'به مبلغ ',wr.amount)\r\n\t\t\t\r\n\t\tend";
    if (!empty($_GET["fields"]) && !empty($_GET["query"])) {
        $field = $_GET["fields"] == "ObjectDesc" ? $ObjectDesc : $_GET["fields"];
        $field = $_GET["fields"] == "StepDesc" ? "ifnull(fs.StepDesc,'شروع گردش')" : $field;
        $where .= " AND {$field} like :fld";
        $param[":fld"] = "%" . $_GET["query"] . "%";
    }
    //----------------- received forms ----------------------
    if (!empty($_GET["MyForms"]) && $_GET["MyForms"] == "true") {
        $dt = PdoDataAccess::runquery("select FlowID,StepID \r\n\t\t\tfrom WFM_FlowSteps s \r\n\t\t\tleft join BSC_persons p using(PostID)\r\n\t\t\twhere s.IsActive='YES' AND if(s.PersonID>0,s.PersonID=:pid,p.PersonID=:pid)", array(":pid" => $_SESSION["USER"]["PersonID"]));
        if (count($dt) == 0) {
            echo dataReader::getJsonData(array(), 0, $_GET["callback"]);
            die;
        }
        $where .= " AND fr.IsEnded='NO' AND (";
        foreach ($dt as $row) {
            $preStep = $row["StepID"] * 1 - 1;
            $nextStep = $row["StepID"] * 1 + 1;
            $where .= "(fr.FlowID=" . $row["FlowID"] . " AND fs.StepID" . ($preStep == 0 ? " is null" : "=" . $preStep) . " AND ActionType='CONFIRM') OR (fr.FlowID=" . $row["FlowID"] . " AND fs.StepID=" . $nextStep . " AND ActionType='REJECT') OR";
        }
        $where = substr($where, 0, strlen($where) - 2) . ")";
    }
    //--------------------------------------------------------
    $query = "select fr.*,f.FlowDesc, \r\n\t\t\t\t\tb.InfoDesc ObjectTypeDesc,\r\n\t\t\t\t\tifnull(fr.StepDesc,'شروع گردش') StepDesc,\r\n\t\t\t\t\tif(p.IsReal='YES',concat(p.fname, ' ',p.lname),p.CompanyName) fullname,\r\n\t\t\t\t\t{$ObjectDesc} ObjectDesc,\r\n\t\t\t\t\tb.param1 url,\r\n\t\t\t\t\tb.param2 parameter\r\n\t\t\t\tfrom WFM_FlowRows fr\r\n\t\t\t\tjoin ( select max(RowID) RowID,FlowID,ObjectID from WFM_FlowRows group by FlowID,ObjectID )t\r\n\t\t\t\t\tusing(RowID,FlowID,ObjectID)\r\n\t\t\t\tjoin WFM_flows f using(FlowID)\r\n\t\t\t\tjoin BaseInfo b on(b.TypeID=11 AND b.InfoID=f.ObjectType)\r\n\t\t\t\tleft join WFM_FlowSteps fs on(fr.StepRowID=fs.StepRowID)\r\n\t\t\t\tjoin BSC_persons p on(fr.PersonID=p.PersonID)\r\n\t\t\t\t\r\n\t\t\t\tleft join LON_ReqParts lp on(fr.FlowID=1 AND fr.ObjectID=PartID)\r\n\t\t\t\tleft join LON_requests lr on(lp.RequestID=lr.RequestID)\r\n\t\t\t\tleft join BSC_persons pp on(lr.LoanPersonID=pp.PersonID)\r\n\t\r\n\t\t\t\tleft join WAR_requests wr on(fr.FlowID=4 AND wr.RequestID=fr.ObjectID)\r\n\t\t\t\tleft join BaseInfo bf on(bf.TypeID=74 AND bf.InfoID=wr.TypeID)\r\n\t\t\t\tleft join BSC_persons wp on(wp.PersonID=wr.PersonID)\r\n\r\n\t\t\t\twhere " . $where . dataReader::makeOrder();
    $temp = PdoDataAccess::runquery_fetchMode($query, $param);
    //echo PdoDataAccess::GetLatestQueryString();
    $no = $temp->rowCount();
    $temp = PdoDataAccess::fetchAll($temp, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    die;
}
Example #27
0
 static function SelectReceivedForms($where = "", $params = array())
 {
     $dt = PdoDataAccess::runquery("select FlowID,StepID \n\t\t\tfrom WFM_FlowSteps s \n\t\t\tleft join BSC_persons p using(PostID)\n\t\t\twhere s.IsActive='YES' AND if(s.PersonID>0,s.PersonID=:pid,p.PersonID=:pid)", array(":pid" => $_SESSION["USER"]["PersonID"]));
     if (count($dt) == 0) {
         return array();
     }
     $where .= " AND fr.IsEnded='NO' AND (";
     foreach ($dt as $row) {
         $preStep = $row["StepID"] * 1 - 1;
         $nextStep = $row["StepID"] * 1 + 1;
         $where .= "(fr.FlowID=" . $row["FlowID"] . " AND fs.StepID" . ($preStep == 0 ? " is null" : "=" . $preStep) . " AND ActionType='CONFIRM') OR (fr.FlowID=" . $row["FlowID"] . " AND fs.StepID=" . $nextStep . " AND ActionType='REJECT') OR";
     }
     $where = substr($where, 0, strlen($where) - 2) . ")";
     //--------------------------------------------------------
     $query = "select fr.*,f.FlowDesc, \n\t\t\t\t\t\tb.InfoDesc ObjectTypeDesc,\n\t\t\t\t\t\tifnull(fr.StepDesc,'شروع گردش') StepDesc,\n\t\t\t\t\t\tif(p.IsReal='YES',concat(p.fname, ' ',p.lname),p.CompanyName) fullname,\n\t\t\t\t\t\tb.param1 url,\n\t\t\t\t\t\tb.param2 parameter\n\t\t\t\t\tfrom WFM_FlowRows fr\n\t\t\t\t\tjoin ( select max(RowID) RowID,FlowID,ObjectID from WFM_FlowRows group by FlowID,ObjectID )t\n\t\t\t\t\t\tusing(RowID,FlowID,ObjectID)\n\t\t\t\t\tjoin WFM_flows f using(FlowID)\n\t\t\t\t\tjoin BaseInfo b on(b.TypeID=11 AND b.InfoID=f.ObjectType)\n\t\t\t\t\tleft join WFM_FlowSteps fs on(fr.StepRowID=fs.StepRowID)\n\t\t\t\t\tjoin BSC_persons p on(fr.PersonID=p.PersonID)\n\n\t\t\t\t\tleft join LON_ReqParts lp on(fr.ObjectID=PartID)\n\t\t\t\t\tleft join LON_requests lr on(lp.RequestID=lr.RequestID)\n\t\t\t\t\tleft join BSC_persons pp on(lr.LoanPersonID=pp.PersonID)\n\n\t\t\t\t\twhere 1=1 " . $where . dataReader::makeOrder();
     return PdoDataAccess::runquery_fetchMode($query, $params);
 }
Example #28
0
function GetAccountFlow()
{
    $CostID = $_REQUEST["BaseCostID"];
    $TafsiliID = $_REQUEST["TafsiliID"];
    $query = "select d.*,di.*\n\t\tfrom ACC_DocItems di\n\t\t\tjoin ACC_docs d using(DocID)\n\t\twhere d.CycleID=:c AND d.BranchID=:b AND \n\t\t\tdi.CostID=:cost AND di.TafsiliType = :t AND di.TafsiliID=:tid " . dataReader::makeOrder();
    $param = array(":c" => $_SESSION["accounting"]["CycleID"], ":b" => $_SESSION["accounting"]["BranchID"], ":cost" => $CostID, ":t" => TAFTYPE_PERSONS, ":tid" => $TafsiliID);
    $temp = PdoDataAccess::runquery_fetchMode($query, $param);
    $no = $temp->rowCount();
    //------------------------------------------------
    $BlockedAmount = ACC_CostBlocks::GetBlockAmount($CostID, TAFTYPE_PERSONS, $TafsiliID);
    //------------------------------------------------
    echo dataReader::getJsonData($temp->fetchAll(), $no, $_GET["callback"], $BlockedAmount);
    die;
}
Example #29
0
function selectCourse()
{
    $where = " pc.PersonID = :PID ";
    $whereParam = array();
    $whereParam[":PID"] = $_GET["Q0"];
    $field = isset($_GET["fields"]) ? $_GET["fields"] : "";
    if (isset($_GET["query"]) && $_GET["query"] != "") {
        switch ($field) {
            case "title":
                $where .= " AND pc.title LIKE :qry ";
                $whereParam[":qry"] = "%" . $_GET["query"] . "%";
                break;
            case "from_date":
                $where .= " AND from_date = :qry1 ";
                $whereParam[":qry1"] = "%" . $_GET["query"] . "%";
                break;
            case "to_date":
                $where .= " AND to_date = :qry1 ";
                $whereParam[":qry1"] = "%" . $_GET["query"] . "%";
                break;
            case "related_Title":
                $where .= " AND related_Title = :qry1 ";
                $whereParam[":qry1"] = "%" . $_GET["query"] . "%";
                break;
            case "internal_Title":
                $where .= " AND internal_Title = :qry1 ";
                $whereParam[":qry1"] = "%" . $_GET["query"] . "%";
                break;
            case "total_hours":
                $where .= " AND total_hours = :qry1 ";
                $whereParam[":qry1"] = "%" . $_GET["query"] . "%";
                break;
        }
    }
    $query = " SELECT count(*) \n\t\t       FROM  person_courses  pc\n\t\t\t   where 1=1";
    $query .= $where != "" ? " AND " . $where : "";
    $temp = PdoDataAccess::runquery($query, $whereParam);
    $no = $temp[0][0];
    $where .= dataReader::makeOrder();
    $where .= isset($_GET["start"]) ? " limit " . $_GET["start"] . "," . $_GET["limit"] : "";
    $query = " SELECT pc.PersonID,\n                      pc.group_id , \n                      pc.p_id , \n                      pc.title title,\n                      pc.course_id,\n                      pc.from_date,\n                      pc.to_date,\n\t\t\t\t\t  pc.register_no , \n\t\t\t\t\t  pc.score , \n\t\t\t\t\t  pc.certficate_date ,\n                      if(pc.total_hours is null , 0 ,pc.total_hours ) total_hours ,\n                      bi1.Title related_Title,\n                      bi2.Title internal_Title  \n                       \n\t\t       FROM  person_courses  pc\n\t\t\t\t\tleft join Basic_Info bi1 on pc.related =bi1.InfoID and bi1.TypeID=5\n\t\t\t\t\tleft join Basic_Info bi2 on pc.internal =bi2.InfoID and bi2.TypeID=5\n\t\t\t\t\t\n\t\t\t   where 1=1";
    $query .= $where != "" ? " AND " . $where : "";
    $temp = PdoDataAccess::runquery($query, $whereParam);
    $dt = PdoDataAccess::runquery("\n\t\t\t\t\t\t\t\t\tselect sum(total_hours) totalHrs\n\t\t\t\t\t\t\t\t\tfrom person_courses\n\t\t\t\t\t\t\t\t\twhere PersonID=? \n\t\t\t\t\t\t\t\t\t", array($_GET["Q0"]));
    $thSum = count($dt) != 0 ? $dt[0]["totalHrs"] : 0;
    echo dataReader::getJsonData($temp, $no, $_GET["callback"], $thSum);
    die;
}
Example #30
0
function selectDataAudits()
{
    $query = "select \r\n\t\t\tSysName,\r\n\t\t\tconcat_ws(' ',fname,lname,CompanyName) fullname , \r\n\t\t\tMainObjectID , \r\n\t\t\tSubObjectID, \r\n\t\t\tActionType , \r\n\t\t\tActionTime, \r\n\t\t\ttable_comment\r\n\t\t\t\r\n\t\tfrom DataAudit d\r\n\t\tjoin FRW_systems using(SystemID)\r\n\t\tjoin BSC_persons using(PersonID)\r\n\t\tjoin information_schema.TABLES on(Table_schema = 'krrtfir_rtfund' AND Table_name=d.TableName)\r\n\t\t\r\n\t\twhere 1=1";
    $param = array();
    //------------------------------------------------------
    if (!empty($_POST["PersonID"])) {
        $query .= " AND d.PersonID=:p";
        $param[":p"] = $_POST["PersonID"];
    }
    if (!empty($_POST["SystemID"])) {
        $query .= " AND d.SystemID=:s";
        $param[":s"] = $_POST["SystemID"];
    }
    if (!empty($_POST["StartDate"])) {
        $query .= " AND d.ActionTime>:sd";
        $param[":sd"] = DateModules::shamsi_to_miladi($_POST["StartDate"], "-") . " 00:00:00";
    }
    if (!empty($_POST["EndDate"])) {
        $query .= " AND d.ActionTime<:ed";
        $param[":ed"] = DateModules::shamsi_to_miladi($_POST["EndDate"], "-") . " 23:59:59";
    }
    //------------------------------------------------------
    $temp = PdoDataAccess::runquery_fetchMode($query . dataReader::makeOrder(), $param);
    //print_r(ExceptionHandler::PopAllExceptions());
    //echo PdoDataAccess::GetLatestQueryString();
    $cnt = $temp->rowCount();
    $temp = PdoDataAccess::fetchAll($temp, $_REQUEST["start"], $_REQUEST["limit"]);
    echo dataReader::getJsonData($temp, $cnt, $_GET["callback"]);
    die;
}