예제 #1
0
function GetAllLoans()
{
    $where = "1=1";
    $whereParam = array();
    if (isset($_GET["IsCustomer"])) {
        $where .= " AND IsCustomer=true";
    }
    if (isset($_GET["IsPlan"])) {
        $where .= " AND IsPlan='YES'";
    }
    if (!empty($_GET["GroupID"])) {
        $where .= " AND GroupID=:g";
        $whereParam[":g"] = $_GET["GroupID"];
    }
    if (!empty($_REQUEST["LoanID"])) {
        $where .= " AND LoanID=:l";
        $whereParam[":l"] = $_REQUEST["LoanID"];
    }
    $field = isset($_GET["fields"]) ? $_GET["fields"] : "";
    if (isset($_GET["query"]) && $_GET["query"] != "") {
        $where .= " AND " . $field . " LIKE :qry ";
        $whereParam[":qry"] = "%" . $_GET["query"] . "%";
    }
    $temp = LON_loans::SelectAll($where, $whereParam);
    $no = $temp->rowCount();
    $temp = PdoDataAccess::fetchAll($temp, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    die;
}
예제 #2
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;
}
예제 #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;
}
예제 #4
0
function selectEqualizations()
{
    $dt = PdoDataAccess::runquery_fetchMode("select EqualizationID,RegDate,BankID,BankDesc \r\n\t\tfrom ACC_equalizations left join ACC_banks using(BankID)");
    $temp = PdoDataAccess::fetchAll($dt, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($temp, $dt->rowCount(), $_GET["callback"]);
    die;
}
예제 #5
0
function SelectAllForms()
{
    $dt = VOT_forms::Get();
    $no = $dt->rowCount();
    $dt = PdoDataAccess::fetchAll($dt, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($dt, $no, $_GET["callback"]);
    die;
}
예제 #6
0
function selectDeposites()
{
    $temp = PdoDataAccess::runquery_fetchMode("\r\n\t\tselect TafsiliID,CostID,concat_ws('-',b1.BlockDesc,b2.BlockDesc) CostDesc,\r\n\t\t\tsum(CreditorAmount-DebtorAmount) amount,TafsiliDesc\r\n\t\tfrom ACC_DocItems \r\n\t\t\tjoin ACC_docs using(DocID)\r\n\t\t\tjoin ACC_CostCodes cc using(CostID)\r\n\t\t\tleft join ACC_blocks b1 on(b1.BlockID=cc.level1)\r\n\t\t\tleft join ACC_blocks b2 on(b2.BlockID=cc.level2)\r\n\t\t\tjoin ACC_tafsilis using(TafsiliID)\r\n\t\t\r\n\t\twhere /*DocStatus != 'RAW'*/ 1=1\r\n\t\t\tAND CostID in(" . COSTID_ShortDeposite . "," . COSTID_LongDeposite . ")\r\n\t\t\tAND CycleID=" . $_SESSION["accounting"]["CycleID"] . "\r\n\t\t\tAND BranchID=" . $_SESSION["accounting"]["BranchID"] . "\r\n\t\tgroup by TafsiliID,CostID");
    $dt = PdoDataAccess::fetchAll($temp, $_GET["start"], $_GET["limit"]);
    //echo PdoDataAccess::GetLatestQueryString();
    echo dataReader::getJsonData($dt, $temp->rowCount(), $_GET["callback"]);
    die;
}
예제 #7
0
function formsSelect()
{
    $where = "1=1" . dataReader::makeOrder();
    $dt = FGR_forms::select($where);
    $no = $dt->rowCount();
    $temp = PdoDataAccess::fetchAll($dt, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    die;
}
예제 #8
0
function GetSavingFlow()
{
    $query = "select d.*,di.*\n\t\tfrom ACC_DocItems di\n\t\t\tjoin ACC_docs d using(DocID)\n\t\t\tjoin ACC_tafsilis t on(di.TafsiliID=t.TafsiliID)\n\t\t\tjoin BSC_persons p on(t.ObjectID=p.PersonID)\n\t\twhere d.CycleID=:c AND d.BranchID=:b AND \n\t\t\tdi.CostID=:cost AND di.TafsiliType = :t AND p.PersonID=:p";
    $param = array(":c" => $_SESSION["accounting"]["CycleID"], ":b" => $_SESSION["accounting"]["BranchID"], ":cost" => COSTID_saving, ":t" => TAFTYPE_PERSONS, ":p" => $_REQUEST["PersonID"]);
    $temp = PdoDataAccess::runquery_fetchMode($query, $param);
    $no = $temp->rowCount();
    $temp = PdoDataAccess::fetchAll($temp, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    die;
}
예제 #9
0
function AccDocFlow()
{
    $CostID = $_REQUEST["CostID"];
    $CurYear = substr(DateModules::shNow(), 0, 4);
    $temp = PdoDataAccess::runquery_fetchMode("\r\n\t\tselect d.DocDate,\r\n\t\t\td.description,\r\n\t\t\tdi.DebtorAmount,\r\n\t\t\tdi.CreditorAmount,\r\n\t\t\tdi.details\r\n\t\tfrom ACC_DocItems di join ACC_docs d using(DocID)\r\n\t\tleft join ACC_tafsilis t1 on(t1.TafsiliType=1 AND di.TafsiliID=t1.TafsiliID)\r\n\t\tleft join ACC_tafsilis t2 on(t2.TafsiliType=1 AND di.TafsiliID2=t2.TafsiliID)\r\n\t\twhere CycleID=:year AND CostID=:cid AND (t1.ObjectID=:pid or t2.ObjectID=:pid)\r\n\t\t\tAND DocStatus in('CONFIRM','ARCHIVE')\r\n\t\torder by DocDate\r\n\t", array(":year" => $CurYear, ":pid" => $_SESSION["USER"]["PersonID"], ":cid" => $CostID));
    //print_r(ExceptionHandler::PopAllExceptions());
    $count = $temp->rowCount();
    $temp = PdoDataAccess::fetchAll($temp, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($temp, $count, $_GET["callback"]);
    die;
}
예제 #10
0
function SelectAll()
{
    $where = "1=1";
    if (!empty($_REQUEST["TaskStatus"])) {
        $where .= " AND TaskStatus in(" . ($_REQUEST["TaskStatus"] == "RAW" ? "'RAW'" : "'DONE','RESPONSE'") . ")";
    }
    $res = PdoDataAccess::runquery_fetchMode("\r\n\t\tselect\tt.* , \r\n\t\t\t\tSysName,\r\n\t\t\t\tconcat_ws(' ',fname,lname,CompanyName) RegPersonName\r\n\t\t\t\t\r\n\t\tfrom FRW_tasks t\r\n\t\tjoin BSC_persons on(RegPersonID = PersonID)\r\n\t\tjoin FRW_systems using(SystemID)\r\n\t\t\r\n\t\twhere {$where} order by FIELD(TaskStatus,'RAW') desc,ifnull(DoneDate,CreateDate) desc");
    $cnt = $res->rowCount();
    $res = PdoDataAccess::fetchAll($res, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($res, $cnt, $_GET["callback"]);
    die;
}
예제 #11
0
function selectIncomeCheques()
{
    $where = "1=1";
    $param = array();
    MakeWhere($where, $param);
    $query = "\r\n\t\tselect i.*,\r\n\t\t\tcase when i.CostID is null then group_concat(t2.TafsiliDesc SEPARATOR '<br>')\r\n\t\t\t\telse t1.TafsiliDesc end fullname,\r\n\t\t\tcase when i.CostID is null then group_concat(concat_ws('-', bb1.blockDesc, bb2.blockDesc) SEPARATOR '<br>') \r\n\t\t\t\telse concat_ws('-', b1.blockDesc, b2.blockDesc, b3.blockDesc) end CostDesc,\r\n\t\t\tb.BankDesc, \r\n\t\t\tt3.TafsiliDesc ChequeStatusDesc,\r\n\t\t\tt.docs\r\n\t\t\t\r\n\t\tfrom ACC_IncomeCheques i\r\n\t\t\tleft join ACC_tafsilis t1 using(TafsiliID)\r\n\t\t\tleft join ACC_CostCodes cc using(CostID)\r\n\t\t\tleft join ACC_blocks b1 on(cc.level1=b1.BlockID)\r\n\t\t\tleft join ACC_blocks b2 on(cc.level2=b2.BlockID)\r\n\t\t\tleft join ACC_blocks b3 on(cc.level3=b3.BlockID)\r\n\t\t\t\r\n\t\t\tleft join LON_BackPays bp using(IncomeChequeID)\r\n\t\t\tleft join LON_requests using(RequestID)\r\n\t\t\tleft join LON_loans l using(LoanID)\r\n\t\t\tleft join ACC_CostCodes cc2 on(cc2.level1=" . BLOCKID_LOAN . " AND cc2.level2=l.blockID)\r\n\t\t\tleft join ACC_blocks bb1 on(cc2.level1=bb1.BlockID)\r\n\t\t\tleft join ACC_blocks bb2 on(cc2.level2=bb2.BlockID)\r\n\t\t\tleft join ACC_tafsilis t2 on(t2.TafsiliType=" . TAFTYPE_PERSONS . " AND t2.ObjectID=LoanPersonID)\r\n\t\t\r\n\t\tleft join ACC_banks b on(ChequeBank=BankID)\r\n\t\tleft join ACC_tafsilis t3 on(t3.TafsiliType=" . TAFTYPE_ChequeStatus . " AND t3.TafsiliID=ChequeStatus)\r\n\t\tleft join (\r\n\t\t\tselect SourceID, group_concat(distinct LocalNo) docs\r\n\t\t\tfrom ACC_DocItems join ACC_docs using(DocID)\r\n\t\t\twhere SourceType='" . DOCTYPE_INCOMERCHEQUE . "' \r\n\t\t\tgroup by SourceID\r\n\t\t)t on(i.IncomeChequeID=t.SourceID)\r\n\t\t\r\n\t\twhere " . $where . " \r\n\t\tgroup by i.IncomeChequeID";
    //.........................................................
    $query .= dataReader::makeOrder();
    $temp = PdoDataAccess::runquery_fetchMode($query, $param);
    print_r(ExceptionHandler::PopAllExceptions());
    //echo PdoDataAccess::GetLatestQueryString();
    $no = $temp->rowCount();
    $temp = PdoDataAccess::fetchAll($temp, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    die;
}
예제 #12
0
function GetAllPersonShifts()
{
    $where = "";
    $param = array();
    $field = isset($_GET["fields"]) ? $_GET["fields"] : "";
    $field = $field == "PersonID" ? "concat_ws(' ',fname,lname,CompanyName)" : $field;
    $field = $field == "ShiftID" ? "s.ShiftTitle" : $field;
    if (isset($_GET["query"]) && $_GET["query"] != "") {
        $where .= " AND " . $field . " LIKE :qry ";
        $param[":qry"] = "%" . $_GET["query"] . "%";
    }
    $temp = ATN_PersonShifts::Get($where, $param, dataReader::makeOrder() . ",FromDate asc");
    $no = $temp->rowCount();
    $temp = PdoDataAccess::fetchAll($temp, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    die;
}
예제 #13
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;
}
예제 #14
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;
}
예제 #15
0
function selectTemplateItems()
{
    $where = "";
    $params = array();
    if (!empty($_REQUEST["TemplateID"])) {
        $where .= " AND TemplateID in(0,:t)";
        $params[":t"] = $_REQUEST["TemplateID"];
    }
    if (!empty($_GET["query"])) {
        $field = empty($_GET["field"]) ? "" : $_GET["field"];
    }
    if (!empty($_REQUEST["NotGlobal"])) {
        $where .= " AND TemplateID >0";
    }
    $temp = CNT_TemplateItems::Get($where . " order by TemplateItemID", $params);
    if (!empty($_REQUEST["limit"])) {
        $res = PdoDataAccess::fetchAll($temp, $_GET["start"], $_GET["limit"]);
    } else {
        $res = $temp->fetchAll();
    }
    echo dataReader::getJsonData($res, $temp->rowCount(), $_GET["callback"]);
    die;
}
예제 #16
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;
}
예제 #17
0
function SelectOperations()
{
    $param = array();
    $where = "";
    if (isset($_REQUEST['fields']) && isset($_REQUEST['query'])) {
        $field = $_REQUEST['fields'];
        $where .= ' and ' . $field . ' like :fld';
        $param[':fld'] = '%' . $_REQUEST['query'] . '%';
    }
    $dt = NTC_operations::Get($where . dataReader::makeOrder(), $param);
    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;
}
예제 #18
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;
}
예제 #19
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;
}
예제 #20
0
function SelectAllMessages($returnCount = false)
{
    $where = "";
    $param = array();
    if (!empty($_REQUEST["RequestID"])) {
        $where .= " AND RequestID=?";
        $param[] = $_REQUEST["RequestID"];
    }
    if (!empty($_REQUEST["MsgStatus"])) {
        $where .= " AND MsgStatus=?";
        $param[] = $_REQUEST["MsgStatus"];
    }
    $res = LON_messages::Get($where, $param, dataReader::makeOrder());
    if ($returnCount) {
        return $res->rowCount();
    }
    print_r(ExceptionHandler::PopAllExceptions());
    $cnt = $res->rowCount();
    $res = PdoDataAccess::fetchAll($res, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($res, $cnt, $_GET["callback"]);
    die;
}
예제 #21
0
function GetAllCostBlocks()
{
    $temp = ACC_CostBlocks::Get();
    $dt = PdoDataAccess::fetchAll($temp, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($dt, $temp->rowCount(), $_GET["callback"]);
    die;
}
예제 #22
0
function SelectPersonExpertDomains()
{
    $query = "select RowID,PersonID,d.DomainID,\r\n\t\tconcat_ws(' ',fname,lname,CompanyName) fullname,DomainDesc\r\n\t\t\r\n\t\tfrom BSC_PersonExpertDomain d\r\n\t\tjoin BSC_ExpertDomain using(DomainID)\r\n\t\tjoin BSC_persons using(PersonID)\r\n\t\t\r\n\t\twhere 1=1";
    $param = array();
    if (!empty($_REQUEST["fields"]) && !empty($_REQUEST["query"])) {
        if ($_REQUEST["fields"] == "PersonID") {
            $query .= " AND concat_ws(' ',fname,lname,CompanyName) like :fl";
            $param[":fl"] = "%" . $_REQUEST["query"] . "%";
        } else {
            $query .= " AND DomainDesc like :d";
            $param[":d"] = "%" . $_REQUEST["query"] . "%";
        }
    }
    $temp = PdoDataAccess::runquery_fetchMode($query, $param);
    $result = PdoDataAccess::fetchAll($temp, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($result, $temp->rowCount(), $_GET["callback"]);
    die;
}
예제 #23
0
function SelectMyMessages()
{
    if ($_REQUEST["mode"] == "receive") {
        $query = "select m.*,r.* ,concat(fname,' ',lname) FromPersonName, substr(MsgDate,1,10) _MsgDate\n\t\t\tfrom OFC_messages m join OFC_MessageReceivers r using(MessageID)\n\t\t\t\tjoin BSC_persons p on(m.PersonID=p.PersonID)\n\t\t\twhere r.PersonID=:p";
        $query .= isset($_REQUEST["deleted"]) && $_REQUEST["deleted"] == "true" ? " AND r.IsDeleted='YES'" : " AND r.IsDeleted='NO'";
    } else {
        $query = "select m.*,r.* ,concat(fname,' ',lname) ToPersonName, substr(MsgDate,1,10) _MsgDate\n\t\t\tfrom OFC_messages m join OFC_MessageReceivers r using(MessageID)\n\t\t\tjoin BSC_persons p on(r.PersonID=p.PersonID)\n\t\t\twhere m.PersonID=:p";
        $query .= isset($_REQUEST["deleted"]) && $_REQUEST["deleted"] == "true" ? " AND m.IsDeleted='YES'" : " AND m.IsDeleted='NO'";
    }
    $param = array(":p" => $_SESSION["USER"]["PersonID"]);
    $dt = PdoDataAccess::runquery_fetchMode($query, $param);
    print_r(ExceptionHandler::PopAllExceptions());
    $cnt = $dt->rowCount();
    $dt = PdoDataAccess::fetchAll($dt, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($dt, $cnt, $_GET["callback"]);
    die;
}
예제 #24
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;
}
예제 #25
0
function selectStudents()
{
    $query = "\n\t\tSELECT StNo,concat(PFName,' ',PLName) fullname FROM students\n\t\twhere stNO like :s OR concat(PFName,' ',PLName) like :s";
    $st = PdoDataAccess::runquery_fetchMode($query, array(":s" => '%' . $_GET["query"] . '%'));
    $no = $st->rowCount();
    $temp = PdoDataAccess::fetchAll($st, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    die;
}
예제 #26
0
function selectPackages()
{
    $where = " AND BranchID=?";
    $param = array($_REQUEST["BranchID"]);
    if (!empty($_GET["fields"])) {
        $field = $_GET["fields"];
        $field = $field == "PersonID" ? "concat_ws(' ',fname,lname,CompanyName)" : $field;
        $where .= " AND " . $field . " like ?";
        $param[] = "%" . $_GET["query"] . "%";
    }
    $dt = DMS_packages::Get($where . dataReader::makeOrder(), $param);
    $list = PdoDataAccess::fetchAll($dt, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($list, $dt->rowCount(), $_GET["callback"]);
    die;
}
예제 #27
0
function GetAllTafsilis()
{
    $where = " t.IsActive='YES' AND t.TafsiliType=:g";
    $whereParam = array();
    $whereParam[":g"] = $_GET["TafsiliType"];
    $field = isset($_GET["fields"]) ? $_GET["fields"] : "concat(TafsiliID, TafsiliDesc)";
    if (isset($_GET["query"]) && $_GET["query"] != "") {
        $where .= " AND " . $field . " LIKE :qry ";
        $whereParam[":qry"] = "%" . $_GET["query"] . "%";
    }
    if (!empty($_REQUEST["Shareholder"])) {
        $where .= " AND p.IsShareholder='YES' ";
    }
    $temp = ACC_tafsilis::SelectAll($where . dataReader::makeOrder(), $whereParam);
    $no = $temp->rowCount();
    $temp = PdoDataAccess::fetchAll($temp, $_GET["start"], $_GET["limit"]);
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    die;
}