Ejemplo n.º 1
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;
}
Ejemplo n.º 2
0
 function BlockTrigger($pdo = null)
 {
     if (!isset($this->TafsiliType) || !isset($this->TafsiliID)) {
         return true;
     }
     $BlockedAmount = ACC_CostBlocks::GetBlockAmount($this->CostID, $this->TafsiliType, $this->TafsiliID, $pdo);
     if ($BlockedAmount > 0) {
         $temp = PdoDataAccess::runquery("select ifnull(sum(CreditorAmount-DebtorAmount),0) remain\n\t\t\t\tfrom ACC_DocItems join ACC_docs using(DocID)\n\t\t\t\twhere CycleID=? AND CostID=? AND TafsiliType=? AND TafsiliID=? AND ItemID<>?", array($_SESSION["accounting"]["CycleID"], $this->CostID, $this->TafsiliType, $this->TafsiliID, $this->ItemID), $pdo);
         if ($temp[0][0] * 1 - $BlockedAmount < $this->DebtorAmount * 1) {
             ExceptionHandler::PushException("مبلغ وارد شده بیشتر از مبلغ قابل برداشت می باشد " . "<br>مبلغ قابل برداشت : " . ($temp[0][0] * 1 - $BlockedAmount));
             return false;
         }
     }
     return true;
 }