function DatesAreValid() { $dt = PdoDataAccess::runquery("select * from ATN_PersonShifts\r\n\t\t\twhere PersonID=:p \r\n\t\t\tAND ( :f between FromDate AND ToDate OR :t between FromDate AND ToDate ) AND RowID <> :r", array(":p" => $this->PersonID, ":r" => $this->RowID, ":f" => DateModules::shamsi_to_miladi($this->FromDate, "-"), ":t" => DateModules::shamsi_to_miladi($this->ToDate, "-"))); if (count($dt) > 0) { ExceptionHandler::PushException("شیفت انتخاب شده دارای تداخل زمانی میباشد"); return false; } /*$ShiftObj = new ATN_shifts($this->ShiftID); $dt = PdoDataAccess::runquery("select * from ATN_PersonShifts join ATN_shifts using(ShiftID) where PersonID=:p AND ( (:s between FromTime AND ToTime) OR (:e between FromTime AND ToTime) ) AND RowID <> :r AND ( (:f between FromDate AND if(ToDate='0000-00-00','4000-00-00',ToDate) ) OR (:t between FromDate AND if(ToDate='0000-00-00','4000-00-00',ToDate) ) )", array(":p" => $this->PersonID, ":s" => $ShiftObj->FromTime, ":e" => $ShiftObj->ToTime, ":r" => $this->RowID, ":f" => DateModules::shamsi_to_miladi($this->FromDate), ":t" => DateModules::shamsi_to_miladi($this->ToDate))); if(count($dt) > 0) { ExceptionHandler::PushException("شیفت های این فرد با یکدیگر دارای تداخل ساعتی می باشند");; return false; } */ return true; }
function release_post() { $temp = parent::runquery("SELECT s.staff_id, s.post_id\r\n \t\tFROM position p INNER JOIN staff s ON(s.staff_id = p.staff_id)\r\n \t\tWHERE p.post_id = ? AND s.staff_id=?", array($this->post_id, $this->staff_id)); if (count($temp) == 0) { return true; } if ($temp[0]["post_id"] == $this->post_id) { ExceptionHandler::PushException(CANNT_RELEASE_WRIT_POST); return false; } parent::runquery("update position set staff_id=null where post_id=" . $this->post_id); $daObj = new DataAudit(); $daObj->ActionType = DataAudit::Action_update; $daObj->RelatedPersonType = DataAudit::PersonType_staff; $daObj->RelatedPersonID = $this->staff_id; $daObj->MainObjectID = $this->post_id; $daObj->TableName = "position"; $daObj->description = "آزاد کردن پست اجرایی هیئت علمی"; $daObj->execute(); //------------------ baseinfo update --------------------------- $staffObj = new manage_staff("", "", $this->staff_id); require_once inc_manage_post; manage_posts::baseinfoRelease($staffObj->PersonID, $this->post_id, "آزاد کردن پست اجرایی هیئت علمی"); //-------------------------------------------------------------- return true; }
public function Remove() { if (!DMS_documents::DeleteAllDocument($this->ContractID, "contract")) { ExceptionHandler::PushException("خطا در حذف مدارک"); return false; } return parent::Remove(); }
function Add($pdo = null) { $dt = self::Get(" AND ChequeNo=? AND ChequeDate=?", array($this->ChequeNo, DateModules::shamsi_to_miladi($this->ChequeDate))); if ($dt->rowCount() > 0) { ExceptionHandler::PushException("چک دیگری با این شماره و تاریخ قبلا ثبت شده است"); return false; } return parent::Add($pdo); }
public function Remove($pdo = null) { $dt = parent::runquery("select * from BSC_persons where PostID=?", array($this->PostID), $pdo); if (count($dt) > 0) { ExceptionHandler::PushException("این پست به فردی نسبت داده شده است و قابل حذف نمی باشد"); return false; } $this->IsActive = "NO"; return $this->Edit($pdo); }
static function DeleteDocument($DocumentID) { if (!DMS_DocFiles::DeletePage("", $DocumentID)) { ExceptionHandler::PushException("خطا در حذف صفحات پیوست"); return false; } if (!PdoDataAccess::delete("DMS_DocParamValues", "DocumentID=?", array($DocumentID))) { ExceptionHandler::PushException("خطا در حذف پارامترهای پیوست"); return false; } if (parent::delete("DMS_documents", " DocumentID=?", array($DocumentID)) === false) { return false; } $daObj = new DataAudit(); $daObj->ActionType = DataAudit::Action_delete; $daObj->MainObjectID = $DocumentID; $daObj->TableName = "DMS_documents"; $daObj->execute(); return true; }
static function DeletePlan($PlanID) { $obj = new PLN_plans($PlanID); if ($obj->StepID != STEPID_RAW) { return false; } if (!DMS_documents::DeleteAllDocument($obj->PlanID, "plan")) { ExceptionHandler::PushException("خطا در حذف مدارک"); return false; } if (parent::delete("PLN_PlanItems", " PlanID=?", array($PlanID)) === false) { return false; } if (parent::delete("PLN_plans", " PlanID=?", array($PlanID)) === false) { return false; } $daObj = new DataAudit(); $daObj->ActionType = DataAudit::Action_delete; $daObj->MainObjectID = $PlanID; $daObj->TableName = "PLN_plans"; $daObj->execute(); return true; }
static function RemoveFlowStep($StepRowID) { $info = PdoDataAccess::runquery("select * from WFM_FlowSteps where StepRowID=?", array($StepRowID)); $dt = parent::runquery("select * from WFM_FlowRows\n\t\t\tjoin ( select max(RowID) RowID,FlowID,ObjectID \n\t\t\t\t\tfrom WFM_FlowRows group by FlowID,ObjectID )t\n\t\t\tusing(RowID,FlowID,ObjectID)\n\t\t\twhere FlowID=? AND StepRowID=?", array($info[0]["FlowID"], $StepRowID)); if (count($dt) > 0) { ExceptionHandler::PushException("FlowRowExists"); return false; } parent::runquery("update WFM_FlowSteps set IsActive='NO', StepID=-1 where StepRowID=?", array($StepRowID)); PdoDataAccess::runquery("update WFM_FlowSteps set StepID=StepID-1 \n\t\t\twhere IsOuter='NO' AND StepID>? AND FlowID=?", array($info[0]["StepID"], $info[0]["FlowID"])); $daObj = new DataAudit(); $daObj->ActionType = DataAudit::Action_delete; $daObj->MainObjectID = $StepRowID; $daObj->SubObjectID = $info[0]["StepID"]; $daObj->TableName = "WFM_FlowSteps"; $daObj->execute(); return true; }
public function AccountNoValidity() { $dt = parent::runquery("select * from ACC_accounts where AccountNo=? AND AccountID<>?", array($this->AccountNo, $this->AccountID)); if (count($dt) > 0) { ExceptionHandler::PushException("کد حساب تکراری است"); return false; } return true; }
function EditPerson() { if ($this->UserName != "") { $dt = PdoDataAccess::runquery("select * \r\n\t\t\t\tfrom BSC_persons where PersonID<>? AND UserName=?", array($this->PersonID, $this->UserName)); if (count($dt) > 0) { ExceptionHandler::PushException("شناسه وارد شده تکراری است"); return false; } } if (parent::update("BSC_persons", $this, " PersonID=:l", array(":l" => $this->PersonID)) === false) { return false; } $daObj = new DataAudit(); $daObj->ActionType = DataAudit::Action_update; $daObj->MainObjectID = $this->PersonID; $daObj->TableName = "BSC_persons"; $daObj->execute(); $dt = PdoDataAccess::runquery("select * from ACC_tafsilis where ObjectID=? AND TafsiliType=1", array($this->PersonID)); require_once getenv("DOCUMENT_ROOT") . '/accounting/baseinfo/baseinfo.class.php'; if (count($dt) == 0) { $obj = new ACC_tafsilis(); $obj->ObjectID = $this->PersonID; $obj->TafsiliCode = $this->PersonID; $obj->TafsiliDesc = $this->IsReal == "YES" ? $this->fname . " " . $this->lname : $this->CompanyName; $obj->TafsiliType = "1"; $obj->AddTafsili(); } else { $obj = new ACC_tafsilis($dt[0]["TafsiliID"]); $obj->TafsiliCode = $this->PersonID; $obj->TafsiliDesc = $this->IsReal == "YES" ? $this->fname . " " . $this->lname : $this->CompanyName; $obj->EditTafsili(); } return true; }
$readOnly = false; $state = manage_writ::get_writ_state($_REQUEST["WID"], $writver, $_REQUEST["STID"]); $pay_calc = manage_writ::check_for_use_in_pay_calc($_REQUEST["WID"], $writver, $_REQUEST["STID"]); if ($pay_calc == null) { if ($state == WRIT_PERSONAL && ($objWrt->check_corrective_state() == 'NOT_CORRECTING' || $objWrt->writ_has_new_version())) { ExceptionHandler::PushException('اين حکم در صدور حکم اصلاحي استفاده شده است و امکان تغيير آن وجود ندارد', ExceptionHandler::ExceptionType_warning); $readOnly = true; } else { if ($state != WRIT_PERSONAL) { ExceptionHandler::PushException("این حکم منتقل شده است و امکان ویرایش آن وجود ندارد", ExceptionHandler::ExceptionType_warning); $readOnly = true; } } } else { if ($pay_calc != null && $state != WRIT_PERSONAL) { ExceptionHandler::PushException(" این حکم در محاسبه حقوق" . " " . $pay_calc . " " . "استفاده شده است و امکان ویرایش آن وجود ندارد.", ExceptionHandler::ExceptionType_warning); $readOnly = true; } } //................................... $is_auto_writ = manage_writ::is_auto_writ($exedate, $objWrt->person_type, $writ_id, $writver, $staff_id); if (manage_writ::is_first_writ($writ_id, $writver, $staff_id)) { $is_new_writ = false; $header_is_open = false; $is_auto_writ = true; } $is_new_writ = manage_writ::is_new_writ($exedate, $objPerson->person_type, $writ_id, $writver, $staff_id); $header_is_open = $is_new_writ ? "false" : "true"; if (manage_writ::check_for_use_in_pay_calc($writ_id, $writver, $staff_id) == null) { $salary_fields_is_open = true; }
function Add($pdo = null) { if (!self::BlockTrigger($pdo)) { return false; } if ($this->CostID == COSTID_share) { $amount = $this->CreditorAmount > 0 ? $this->CreditorAmount : $this->DebtorAmount; if ($amount * 1 % ShareBaseAmount != 0) { ExceptionHandler::PushException("مبلغ سرفصل حساب سهام باید مضربی از " . ShareBaseAmount . " باشد"); return false; } } if (!parent::insert("ACC_DocItems", $this, $pdo)) { return false; } $this->ItemID = parent::InsertID($pdo); $daObj = new DataAudit(); $daObj->ActionType = DataAudit::Action_add; $daObj->MainObjectID = $this->ItemID; $daObj->TableName = "ACC_DocItems"; $daObj->execute($pdo); return true; }
public function Remove($pdo = null) { if (!parent::delete(static::TableName, static::TableKey . "=:id", array(":id" => $this->{static::TableKey}), $pdo)) { ExceptionHandler::PushException(self::ERR_Remove); return false; } $daObj = new DataAudit(); $daObj->ActionType = DataAudit::Action_delete; $daObj->MainObjectID = $this->{static::TableKey}; $daObj->TableName = static::TableName; $daObj->execute(); return true; }
function EndWarrantyDoc($ReqObj, $pdo) { /*@var $ReqObj WAR_requests */ //------------- get CostCodes -------------------- $CostCode_warrenty = FindCostID("300"); $CostCode_warrenty_commitment = FindCostID("700"); $CostCode_wage = FindCostID("750-07"); $CostCode_FutureWage = FindCostID("760-07"); $CostCode_fund = FindCostID("100"); $CostCode_seporde = FindCostID("690"); $CostCode_pasandaz = FindCostID("209-10"); $CostCode_guaranteeAmount_zemanati = FindCostID("904-02"); $CostCode_guaranteeAmount_daryafti = FindCostID("904-04"); $CostCode_guaranteeAmount2_zemanati = FindCostID("905-02"); $CostCode_guaranteeAmount2_daryafti = FindCostID("905-04"); //------------------------------------------------ $CycleID = substr(DateModules::miladi_to_shamsi($ReqObj->StartDate), 0, 4); //------------------ find tafsilis --------------- $PersonTafsili = FindTafsiliID($ReqObj->PersonID, TAFTYPE_PERSONS); if (!$PersonTafsili) { ExceptionHandler::PushException("تفصیلی مربوطه یافت نشد.[" . $ReqObj->PersonID . "]"); return false; } //---------------- add doc header -------------------- $DocObj = new ACC_docs(); $DocObj->RegDate = PDONOW; $DocObj->regPersonID = $_SESSION['USER']["PersonID"]; $DocObj->DocDate = PDONOW; $DocObj->CycleID = $CycleID; $DocObj->BranchID = $ReqObj->BranchID; $DocObj->DocType = DOCTYPE_WARRENTY_END; $DocObj->description = "خاتمه ضمانت نامه " . $ReqObj->_TypeDesc . " به شماره " . $ReqObj->RequestID . " به نام " . $ReqObj->_fullname; if (!$DocObj->Add($pdo)) { ExceptionHandler::PushException("خطا در ایجاد سند"); return false; } //----------------- add Doc items ------------------------ $itemObj = new ACC_DocItems(); $itemObj->DocID = $DocObj->DocID; $itemObj->TafsiliType = TAFTYPE_PERSONS; $itemObj->TafsiliID = $PersonTafsili; $itemObj->SourceType = DOCTYPE_WARRENTY_END; $itemObj->SourceID = $ReqObj->RequestID; $itemObj->SourceID2 = $ReqObj->ReqVersion; $itemObj->locked = "YES"; $itemObj->CostID = $CostCode_warrenty; $itemObj->CreditorAmount = $ReqObj->amount; $itemObj->DebtorAmount = 0; if (!$itemObj->Add($pdo)) { ExceptionHandler::PushException("خطا در ثبت ردیف ضمانت نامه"); return false; } unset($itemObj->ItemID); $itemObj->CostID = $CostCode_warrenty_commitment; $itemObj->CreditorAmount = 0; $itemObj->DebtorAmount = $ReqObj->amount; if (!$itemObj->Add($pdo)) { ExceptionHandler::PushException("خطا در ثبت ردیف تعهد ضمانت نامه"); return false; } //---------------------------- block Cost ---------------------------- if ($ReqObj->IsBlock == "YES") { $dt = PdoDataAccess::runquery("select * from ACC_blocks where SourceType=? AND SourceID=?", array(DOCTYPE_WARRENTY, $ReqObj->RequestID)); if (count($dt) > 0) { $blockObj = new ACC_CostBlocks($dt[0]["BlockID"]); $blockObj->IsActive = "NO"; $blockObj->Edit($pdo); } } //---------- ردیف های تضمین ---------- $SumAmount = 0; $countAmount = 0; $dt = PdoDataAccess::runquery("\r\n\t\tSELECT DocumentID, ParamValue, InfoDesc as DocTypeDesc\r\n\t\t\tFROM DMS_DocParamValues\r\n\t\t\tjoin DMS_DocParams using(ParamID)\r\n\t\t\tjoin DMS_documents d using(DocumentID)\r\n\t\t\tjoin BaseInfo b on(InfoID=d.DocType AND TypeID=8)\r\n\t\t\tleft join ACC_DocItems on(SourceType=" . DOCTYPE_DOCUMENT . " AND SourceID=DocumentID)\r\n\t\twhere ItemID is null AND b.param1=1 AND \r\n\t\t\tparamType='currencyfield' AND ObjectType='warrenty' AND ObjectID=?", array($ReqObj->RequestID), $pdo); foreach ($dt as $row) { unset($itemObj->ItemID); $itemObj->CostID = $CostCode_guaranteeAmount_zemanati; $itemObj->DebtorAmount = 0; $itemObj->CreditorAmount = $row["ParamValue"]; $itemObj->TafsiliType = TAFTYPE_PERSONS; $itemObj->TafsiliID = $PersonTafsili; $itemObj->SourceType = DOCTYPE_DOCUMENT; $itemObj->SourceID = $row["DocumentID"]; $itemObj->details = $row["DocTypeDesc"]; $itemObj->Add($pdo); $SumAmount += $row["ParamValue"] * 1; $countAmount++; } if ($SumAmount > 0) { unset($itemObj->ItemID); unset($itemObj->TafsiliType); unset($itemObj->TafsiliID); unset($itemObj->details); $itemObj->CostID = $CostCode_guaranteeAmount2_zemanati; $itemObj->DebtorAmount = $SumAmount; $itemObj->CreditorAmount = 0; $itemObj->Add($pdo); } if (ExceptionHandler::GetExceptionCount() > 0) { return false; } return $DocObj->DocID; }
function SaveOperation() { $obj = new NTC_operations(); PdoDataAccess::FillObjectByArray($obj, $_POST); $obj->GroupLetter = isset($_POST["GroupLetter"]) ? "YES" : "NO"; $pdo = PdoDataAccess::getPdoObject(); $pdo->beginTransaction(); if (empty($obj->OperationID)) { $obj->OperationDate = PDONOW; $result = $obj->Add($pdo); } else { $result = $obj->Edit($pdo); } require_once "phpExcelReader.php"; $data = new Spreadsheet_Excel_Reader(); $data->setOutputEncoding('utf-8'); $data->setRowColOffset(0); $data->read($_FILES["PersonFile"]["tmp_name"]); for ($i = 0; $i < $data->sheets[0]['numRows']; $i++) { if (!empty($data->sheets[0]['cells'][$i][0])) { $PersonID = $data->sheets[0]['cells'][$i][0]; $dt = PdoDataAccess::runquery("select PersonID from BSC_persons where PersonID=?", array($PersonID)); if (count($dt) > 0) { $PersonObj = new NTC_persons(); $PersonObj->OperationID = $obj->OperationID; $PersonObj->PersonID = $PersonID; for ($j = 1; $j < count($data->sheets[0]['cells'][$i]); $j++) { eval("\$PersonObj->col{$j} = '" . $data->sheets[0]['cells'][$i][$j] . "';"); } $PersonObj->Add($pdo); } } } $dt = NTC_persons::Get(" AND OperationID=?", array($obj->OperationID), $pdo); if ($dt->rowCount() == 0) { $pdo->rollBack(); echo Response::createObjectiveResponse(false, "در فایل ارسالی هیچ فرد معتبری یافت نشد"); die; } $dt = $dt->fetchAll(); //----------- create letter ------------- if ($obj->SendType == "LETTER" && $obj->GroupLetter == "YES") { $LetterObj = new OFC_letters(); $LetterObj->LetterType = "INNER"; $LetterObj->LetterTitle = $obj->title; $LetterObj->LetterDate = PDONOW; $LetterObj->RegDate = PDONOW; $LetterObj->PersonID = $_SESSION["USER"]["PersonID"]; $LetterObj->context = $obj->context; if (!$LetterObj->AddLetter($pdo)) { ExceptionHandler::PushException("خطا در ثبت نامه"); } } //--------------------------------------- foreach ($dt as $row) { $context = $obj->context; for ($i = 1; $i < 10; $i++) { $context = preg_replace("/\\[col" . $i . "\\]/", $row["col" . $i], $context); } switch ($obj->SendType) { case "SMS": break; //------------------------------------------------------------------ //------------------------------------------------------------------ case "EMAIL": $email = $row["email"]; if ($email == "") { ExceptionHandler::PushException("فاقد ایمیل"); continue; } $result = SendEmail($email, $obj->title, $context); if (!$result) { ExceptionHandler::PushException("خطا در ارسال ایمیل"); } break; //------------------------------------------------------------------ //------------------------------------------------------------------ case "LETTER": if ($obj->GroupLetter == "NO") { $LetterObj = new OFC_letters(); $LetterObj->LetterType = "INNER"; $LetterObj->LetterTitle = $obj->title; $LetterObj->LetterDate = PDONOW; $LetterObj->RegDate = PDONOW; $LetterObj->PersonID = $_SESSION["USER"]["PersonID"]; $LetterObj->context = $context; $LetterObj->AddLetter($pdo); $SendObj = new OFC_send(); $SendObj->LetterID = $LetterObj->LetterID; $SendObj->FromPersonID = $LetterObj->PersonID; $SendObj->ToPersonID = $row["PersonID"]; $SendObj->SendDate = PDONOW; $SendObj->SendType = 1; if (!$SendObj->AddSend($pdo)) { ExceptionHandler::PushException("خطا در ثبت نامه"); } } else { $Cobj = new OFC_LetterCustomers(); $Cobj->LetterID = $LetterObj->LetterID; $Cobj->PersonID = $row["PersonID"]; $Cobj->IsHide = "NO"; $Cobj->LetterTitle = $obj->title; if (!$Cobj->Add($pdo)) { ExceptionHandler::PushException("خطا در ثبت ذینفع نامه"); } } break; //------------------------------------------------------------------ } if (ExceptionHandler::GetExceptionCount() == 0) { $PObj = new NTC_persons(); $PObj->RowID = $row["RowID"]; $PObj->IsSuccess = "YES"; if ($obj->SendType == "LETTER") { $PObj->LetterID = $LetterObj->LetterID; } $PObj->Edit($pdo); } } $pdo->commit(); //print_r(ExceptionHandler::PopAllExceptions()); echo Response::createObjectiveResponse($result, ExceptionHandler::GetExceptionsToString()); die; }
function Equalization_UpdateChecks() { $BankID = $_POST["BankID"]; $result = ""; require_once "phpExcelReader.php"; $data = new Spreadsheet_Excel_Reader(); $data->setOutputEncoding('utf-8'); $data->setRowColOffset(0); $data->read($_FILES["attach"]["tmp_name"]); $pdo = PdoDataAccess::getPdoObject(); $pdo->beginTransaction(); //--------------- add to equalizations ------------- $EqualObj = new ACC_equalizations(); $EqualObj->RegDate = PDONOW; $EqualObj->BankID = $BankID; $EqualObj->ImportFile = fread(fopen($_FILES["attach"]["tmp_name"], 'r'), $_FILES["attach"]["size"]); $EqualObj->Add($pdo); //----------- insert DocHeader -------------------- $obj = new ACC_docs(); $obj->RegDate = PDONOW; $obj->regPersonID = $_SESSION['USER']["PersonID"]; $obj->DocDate = PDONOW; $obj->CycleID = $_SESSION["accounting"]["CycleID"]; $obj->BranchID = $_SESSION["accounting"]["BranchID"]; $obj->DocType = DOCTYPE_EQUALCHECKS; $obj->description = "مغایرت گیری بانکی / به روز رسانی چک ها "; if (!$obj->Add($pdo)) { ExceptionHandler::PushException("خطا در ایجاد سند"); return false; } $successCount = 0; for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++) { $checkNo = ""; switch ($BankID) { case "4": // اقتصاد نوین $TafsiliID = ""; $TafsiliID2 = ""; if (empty($data->sheets[0]['cells'][$i][1])) { continue; } $cellData = $data->sheets[0]['cells'][$i][1]; if (isset($cellData) && strpos(trim($cellData), "چک عادي ش.") !== false) { $arr = preg_split("/\\//", $cellData); $checkNo = $arr[2]; $checkNo = substr($checkNo, 0, strpos($checkNo, "صندوق پژوهش")); } break; } if ($checkNo == "") { continue; } //---------------- add doc items -------------------- $dt = PdoDataAccess::runquery("\r\n\t\t\tSELECT * FROM ACC_IncomeCheques \r\n\t\t\t\twhere ChequeNo=? AND ChequeStatus<>" . INCOMECHEQUE_VOSUL, array($checkNo), $pdo); if (count($dt) > 0) { $inChequeObj = new ACC_IncomeCheques($dt[0]["IncomeChequeID"]); $inChequeObj->EqualizationID = $EqualObj->EqualizationID; $inChequeObj->ChequeStatus = INCOMECHEQUE_VOSUL; $inChequeObj->Edit($pdo); $temp = $inChequeObj->GetBackPays($pdo); foreach ($temp as $row) { $BackPayObj = new LON_BackPays($row["BackPayID"]); $BackPayObj->EqualizationID = $EqualObj->EqualizationID; $BackPayObj->Edit($pdo); } ACC_IncomeCheques::AddToHistory($inChequeObj->IncomeChequeID, $inChequeObj->ChequeStatus, $pdo); RegisterOuterCheque($obj->DocID, $inChequeObj, $pdo, COSTID_Bank, $TafsiliID, $TafsiliID2); $successCount++; $result .= "شماره چک : " . $checkNo . " به روز رسانی شد <br>"; } else { $result .= "<font color=red> شماره چک : " . $checkNo . " یافت نشد </font><br>"; } } if ($successCount == 0) { $pdo->rollBack(); } else { $pdo->commit(); } echo Response::createObjectiveResponse(true, $successCount == 0 ? "هیچ چکی به روز نگردید" : $result); die; }
function GroupCancelWrit() { ini_set('max_execution_time', 1000); //300 seconds = 5 minutes ini_set("memory_limit", '500M'); $where = "s.person_type=" . $_POST["person_type"]; $whereParams = array(); //------------------------ Make Where Clause ---------------------- if (!empty($_REQUEST["ouid"])) { $where .= " AND ( o.ouid = :ouid OR o.parent_path LIKE '%,:ouid,%' OR o.parent_path LIKE '%:ouid,%' OR o.parent_path LIKE '%,:ouid%' ) "; $whereParams[":ouid"] = $_REQUEST["ouid"]; } if (!empty($_POST["from_PersonID"])) { $where .= " AND p.PersonID >= :f_personid"; $whereParams[":f_personid"] = $_POST["from_PersonID"]; } if (!empty($_POST["to_PersonID"])) { $where .= " AND p.PersonID <= :t_personid"; $whereParams[":t_personid"] = $_POST["to_PersonID"]; } if (!empty($_POST["from_issue_date"])) { $where .= " AND issue_date <= :f_issue_date"; $whereParams[":f_issue_date"] = $_POST["from_issue_date"]; } if (!empty($_POST["to_issue_date"])) { $where .= " AND issue_date >= :t_issue_date"; $whereParams[":t_issue_date"] = $_POST["to_issue_date"]; } if (!empty($_POST["execute_date"])) { $execute_date = DateModules::Shamsi_to_Miladi($_POST["execute_date"]); $where .= " AND execute_date = :exe_date"; $whereParams[":exe_date"] = $execute_date; } if (!empty($_POST["writ_type_id"])) { $where .= " AND w.writ_type_id = :writ_type_id"; $whereParams[":writ_type_id"] = $_POST["writ_type_id"]; } if (!empty($_POST["writ_subtype_id"])) { $where .= " AND w.writ_subtype_id = :writ_subtype_id"; $whereParams[":writ_subtype_id"] = $_POST["writ_subtype_id"]; } //----------------------------------------------------------------- /*$where .= " AND bf.MasterID in (1,2) AND if( tbl1.personid is not null , bf.MasterID in (1) , ( bf.MasterID in (1,2) and tbl1.personid is null ) )" ; */ $query = "SELECT s.staff_id,\n\t\t \t w.writ_id,\n\t\t w.writ_ver,\n\t\t w.writ_type_id,\n\t\t w.writ_subtype_id,\n\t\t w.issue_date,\n\t\t w.execute_date,\n\t\t p.pfname,\n\t\t\t p.plname\n\t\t\t \n\t\n\t\t FROM writs w\n\t\t \tJOIN org_new_units o ON(w.ouid=o.ouid)\n\t\t\t\tJOIN staff s ON (s.staff_id=w.staff_id)\n\t\t\t\t\n JOIN persons p ON(s.PersonID = p.PersonID and s.person_type=p.person_type)\t\t\t\t\n \n\t\t WHERE " . $where; /*inner join Basic_Info bf on(bf.TypeID=6 AND bf.InfoID=w.education_level) left join (select personid from bases where BaseType in(4) AND BaseStatus = 'NORMAL') tbl1 on tbl1.personid = s.personid*/ $staff_dt = PdoDataAccess::runquery($query, $whereParams); //echo PdoDataAccess::GetLatestQueryString() ; die() ; if (count($staff_dt) == 0) { echo "موارد انتخابی شما هیچ حکمی را برای ابطال شامل نمی شود."; die; } $log_obj = new manage_writ_group_cancel_log(); $success_count = 0; $unsuccess_count = 0; for ($index = 0; $index < count($staff_dt); $index++) { /*if(manage_writ::IsUsed($staff_dt[$index]["writ_id"], $staff_dt[$index]["writ_ver"], $staff_dt[$index]["staff_id"])) { ExceptionHandler::PushException("از حکم در جای دیگری استفاده شده است."); $log_obj->make_unsuccess_rows($staff_dt[$index], ExceptionHandler::GetExceptionsToString("<br>")); $unsuccess_count++; }*/ if (manage_writ::get_writ_state($staff_dt[$index]["writ_id"], $staff_dt[$index]["writ_ver"], $staff_dt[$index]["staff_id"]) != WRIT_PERSONAL) { ExceptionHandler::PushException("این حکم منتقل شده است."); $log_obj->make_unsuccess_rows($staff_dt[$index]); $unsuccess_count++; } else { if (!manage_writ::RemoveWrit($staff_dt[$index]["writ_id"], $staff_dt[$index]["writ_ver"], $staff_dt[$index]["staff_id"])) { $log_obj->make_unsuccess_rows($staff_dt[$index]); $unsuccess_count++; } else { $log_obj->make_success_row($staff_dt[$index]); $success_count++; } } /*if($index == 0) { $log_obj->finalize(); echo $log_obj->make_result(); die(); }*/ } $log_obj->finalize(); echo $log_obj->make_result(); die; }
function CheckPartAmount() { $dt = parent::runquery("select ifnull(sum(PayAmount),0) from LON_payments \r\n\t\t\twhere RequestID=? AND PayID<>?", array($this->RequestID, $this->PayID)); $PartObj = LON_ReqParts::GetValidPartObj($this->RequestID); if ($dt[0][0] * 1 + $this->PayAmount * 1 > $PartObj->PartAmount * 1) { ExceptionHandler::PushException("مبالغ وارد شده از سقف مبلغ وام تجاوز می کند"); return false; } return true; }