Esempio n. 1
0
 function Remove()
 {
     if ($this->list_type == 9) {
         $tblName = "mission_list_items";
     } else {
         $tblName = "pay_get_list_items";
     }
     $query = " select * from " . $tblName . " where list_id = " . $this->list_id;
     $tmp = parent::runquery($query);
     $query = " select * from pay_get_lists where list_id = " . $this->list_id . " and doc_state = 3 ";
     $tmp2 = parent::runquery($query);
     if (count($tmp) > 0) {
         parent::PushException("این لیست شامل مجموعه ای از افراد می باشد .");
         return false;
     } else {
         if (count($tmp2) > 0) {
             parent::PushException("این لیست تایید واحد مرکزی می باشد .");
             return false;
         } else {
             $result = parent::delete("pay_get_lists", "list_id=?", array($this->list_id));
         }
     }
     if (!$result) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->MainObjectID = $this->list_id;
     $daObj->TableName = "pay_get_lists";
     $daObj->execute();
     return true;
 }
Esempio n. 2
0
 static function DeleteWST($id)
 {
     $arr = explode('-', $id);
     PdoDataAccess::runquery("delete from writ_subtypes where person_type=" . $arr[3] . " and writ_type_id=" . $arr[4] . " and writ_subtype_id=" . $arr[5]);
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->MainObjectID = $_POST["id"];
     $daObj->TableName = "writ_subtypes";
     $daObj->execute();
 }
Esempio n. 3
0
function WritTypeDelete()
{
    $arr = explode('-', $_POST["id"]);
    PdoDataAccess::runquery("delete from writ_types where person_type=" . $arr[3] . " and writ_type_id=" . $arr[4]);
    $daObj = new DataAudit();
    $daObj->ActionType = DataAudit::Action_delete;
    $daObj->MainObjectID = $_POST["id"];
    $daObj->TableName = "writ_types";
    $daObj->execute();
    echo "true";
    die;
}
Esempio n. 4
0
 static function DeleteLoan($LoanID)
 {
     if (parent::delete("LON_loans", " LoanID=?", array($LoanID)) === false) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->MainObjectID = $LoanID;
     $daObj->TableName = "LON_loans";
     $daObj->execute();
     return true;
 }
Esempio n. 5
0
 static function Remove($sid)
 {
     $result = parent::delete("SalaryItemReport", "SalaryItemReportID=:SID ", array(":SID" => $sid));
     if (!$result) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->MainObjectID = $sid;
     $daObj->TableName = "SalaryItemReport";
     $daObj->execute();
     return true;
 }
 static function Remove($sid, $pt, $cid)
 {
     $result = parent::delete("CostCenterException", "SalaryItemTypeID=:SID and  PersonType = :PT and CostCenterID = :CC ", array(":SID" => $sid, ":PT" => $pt, ":CC" => $cid));
     if (!$result) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->MainObjectID = $sid;
     $daObj->SubObjectID = $cid;
     $daObj->TableName = "CostCenterException";
     $daObj->execute();
     return true;
 }
 function RemoveTaxItem($tax_table_id, $row_no)
 {
     $result = parent::delete("tax_table_items", "tax_table_id=:tid and row_no=:rid", array(":tid" => $this->tax_table_id, ":rid" => $this->row_no));
     if ($result === false) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_add;
     $daObj->MainObjectID = $this->tax_table_id;
     $daObj->SubObjectID = $this->row_no;
     $daObj->TableName = "tax_table_items";
     $daObj->execute();
     return true;
 }
Esempio n. 8
0
 static function Remove($sid, $pt)
 {
     $result = parent::delete("SubtractItemInfo", "SalaryItemTypeID=:SID and  PersonType = :PT ", array(":SID" => $sid, ":PT" => $pt));
     if (!$result) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->MainObjectID = $sid;
     $daObj->SubObjectID = $pt;
     $daObj->TableName = "SubtractItemInfo";
     $daObj->execute();
     return true;
 }
 function AddSub($DB = "")
 {
     $result = parent::insert($DB . "person_subtracts", $this);
     if ($result === false) {
         return false;
     }
     $this->subtract_id = parent::InsertID();
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_add;
     $daObj->MainObjectID = $this->subtract_id;
     $daObj->TableName = "person_subtracts";
     $daObj->execute();
     return true;
 }
Esempio n. 10
0
 public static function remove($report_id)
 {
     if (parent::delete("rp_report_columns", "report_id=?", array($report_id)) === false) {
         return false;
     }
     if (parent::delete("rp_reports", "report_id=?", array($report_id)) === false) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->MainObjectID = $report_id;
     $daObj->TableName = "rp_reports,rp_report_columns";
     $daObj->execute();
     return true;
 }
 function Remove($All = "")
 {
     $query = " select * from evaluation_lists where list_id = " . $this->list_id . " and doc_state = 3 ";
     $tmp2 = parent::runquery($query);
     if (count($tmp2) > 0) {
         parent::PushException("این لیست تایید واحد مرکزی می باشد .");
         return false;
     } else {
         if ($All == "true") {
             $result = parent::delete("evaluation_list_items", "list_id=?", array($this->list_id));
         } else {
             $result = parent::delete("evaluation_list_items", "list_id =? and ListItemID=? ", array($this->list_id, $this->ListItemID));
         }
     }
     if (!$result) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->MainObjectID = $this->list_id;
     $daObj->SubObjectID = $this->ListItemID;
     $daObj->TableName = "evaluation_list_items";
     $daObj->execute();
     return true;
 }
Esempio n. 12
0
 static function RemoveJobHistory($PersonID, $row_no)
 {
     $whereParams = array();
     $whereParams[":pid"] = $PersonID;
     $whereParams[":rowid"] = $row_no;
     if (PdoDataAccess::delete("PersonJobs", " PersonID=:pid and RowNO=:rowid", $whereParams) === false) {
         parent::PushException(ER_PERSON_DEP_DEL);
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->RelatedPersonID = $PersonID;
     $daObj->MainObjectID = $row_no;
     $daObj->TableName = "PersonJobs";
     $daObj->execute();
     return true;
 }
Esempio n. 13
0
 function RemoveTax($tax_table_type_id, $person_type)
 {
     if (!$this->onBeforeDelete()) {
         return false;
     }
     $result = parent::delete("tax_table_types", "tax_table_type_id=:tid and person_type = :pt ", array(":tid" => $this->tax_table_type_id, ":pt" => $this->person_type));
     if ($result === false) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->RelatedPersonType = DataAudit::PersonType_staff;
     $daObj->MainObjectID = $this->tax_table_type_id;
     $daObj->TableName = "tax_table_types";
     $daObj->execute();
     return true;
 }
Esempio n. 14
0
 function Add($pdo = null)
 {
     if (!$pdo) {
         $pdo = PdoDataAccess::getPdoObject();
     }
     $stmt = $pdo->prepare("insert into ACC_equalizations(RegDate,BankID,ImportFile) \r\n\t\t\tvalues(" . PDONOW . ",:b,:data)");
     $stmt->bindParam(":b", $this->BankID);
     $stmt->bindParam(":data", $this->ImportFile, PDO::PARAM_LOB);
     $stmt->execute();
     $this->EqualizationID = $pdo->lastInsertId();
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_add;
     $daObj->MainObjectID = $this->EqualizationID;
     $daObj->TableName = "ACC_equalizations";
     $daObj->execute();
     return true;
 }
Esempio n. 15
0
 static function Remove($bid)
 {
     $res = parent::runquery(" select count(*) cn from staff where bank_id = " . $bid);
     if ($res[0]['cn'] > 0) {
         parent::PushException("حذف این رکورد امکان پذیر نمی باشد.");
         return false;
     }
     $result = parent::delete("banks", "bank_id=:BID ", array(":BID" => $bid));
     if (!$result) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->MainObjectID = $bid;
     $daObj->TableName = "banks";
     $daObj->execute();
     return true;
 }
Esempio n. 16
0
 function Edit($pdo = "", $DB = "")
 {
     /*$qry = "select person_type from staff where staff_id =".$this->staff_id ; 
     		$res = parent::runquery($qry) ; 
     		if($res[0]['person_type'] == 1 || $res[0]['person_type'] == 2 || $res[0]['person_type'] == 3 )
     			$DB = "hrms." ; 
     		else $DB = "hrms_sherkati."; */
     $result = parent::update($DB . "payment_items", $this, " pay_year=" . $this->pay_year . " and pay_month=" . $this->pay_month . " and \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   staff_id=" . $this->staff_id . " and payment_type =" . $this->payment_type, array(), $pdo);
     if ($result === false) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_update;
     $daObj->MainObjectID = $this->staff_id;
     $daObj->TableName = "payment_items";
     $daObj->execute($pdo);
     return true;
 }
Esempio n. 17
0
 static function Remove($pid)
 {
     $res = parent::runquery(" select count(*) cn from SubtractItemInfo where arrangement = " . $pid);
     if ($res[0]['cn'] > 0) {
         parent::PushException("حذف این رکورد امکان پذیر نمی باشد.");
         return false;
     }
     $result = parent::delete("priority", "PriorityID=:PID ", array(":PID" => $pid));
     if (!$result) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->MainObjectID = $pid;
     $daObj->TableName = "priority";
     $daObj->execute();
     return true;
 }
Esempio n. 18
0
 static function Remove($uid, $cid)
 {
     $res = parent::runquery(" select count(*) cn from person_educations where university_id = " . $uid . " and country_id =" . $cid);
     if ($res[0]['cn'] > 0) {
         parent::PushException("حذف این رکورد به علت استفاده در اطلاعات پرسنل امکان پذیر نمی باشد.");
         return false;
     }
     $result = parent::delete("universities", "university_id=:UID and  country_id = :CID ", array(":UID" => $uid, ":CID" => $cid));
     if (!$result) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->MainObjectID = $uid;
     $daObj->SubObjectID = $cid;
     $daObj->TableName = "universities";
     $daObj->execute();
     return true;
 }
Esempio n. 19
0
 static function Remove($CostID)
 {
     $query = " select count(*) cn \r\n\t\t\t\tfrom writs \r\n\t\t\t\t    where  cost_center_id = " . $CostID;
     $res = parent::runquery($query);
     if ($res[0]['cn'] > 0) {
         parent::PushException("این مرکز هزینه در احکام ثبت گردیده است لذا حذف امکان پذیر نمی باشد.");
         return false;
     }
     $result = parent::delete("cost_centers", "cost_center_id=:CID ", array(":CID" => $CostID));
     if ($result === false) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->MainObjectID = $CostID;
     $daObj->TableName = "cost_centers";
     $daObj->execute();
     return true;
 }
Esempio n. 20
0
 static function Remove($sfid, $sbid)
 {
     $res = parent::runquery(" select count(*) cn from person_educations where sfid = " . $sfid . " and sbid = " . $sbid);
     if ($res[0]['cn'] > 0) {
         parent::PushException("این رشته در اطلاعات پایه افراد ثبت شده است به همین دلیل حذف امکان پذیر نمی باشد .");
         return false;
     }
     $result = parent::delete("study_branchs", "sfid=:sfid and sbid=:sbid", array(":sfid" => $sfid, ":sbid" => $sbid));
     if ($result === false) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->MainObjectID = $sfid;
     $daObj->SubObjectID = $sbid;
     $daObj->TableName = "study_branchs";
     $daObj->execute();
     return true;
 }
 function Remove()
 {
     $result = parent::delete("HRM_person_dependent_supports", "PersonID=:pid and master_row_no=:mrno and row_no=:rno", array(":pid" => $this->PersonID, ":mrno" => $this->master_row_no, ":rno" => $this->row_no));
     if ($result === false) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->RelatedPersonID = $this->PersonID;
     $daObj->RelatedPersonType = 3;
     $daObj->MainObjectID = $this->row_no;
     $daObj->TableName = "person_dependent_supports";
     $daObj->execute();
     return true;
 }
Esempio n. 22
0
 static function remove($staff_id, $PersonID = "")
 {
     if ($staff_id != "") {
         $whereParam = array(":staff_id" => $staff_id);
         $return = PdoDataAccess::delete("staff_details", "staff_id=:staff_id", $whereParam);
         if ($return == "0") {
             return false;
         }
         $daObj = new DataAudit();
         $daObj->ActionType = DataAudit::Action_delete;
         $daObj->MainObjectID = $staff_id;
         $daObj->TableName = "staff_details";
         $daObj->execute();
         return true;
     }
     if ($PersonID != "") {
         $query = "delete sd\n\t\t\t\t\t\tfrom staff_details sd join staff s using(staff_id) where s.PersonID=?";
         PdoDataAccess::runquery($query, array($PersonID));
         if (ExceptionHandler::GetExceptionCount() != 0) {
             return false;
         }
         return true;
     }
 }
Esempio n. 23
0
 function RemoveTax()
 {
     if (!$this->onBeforeDelete()) {
         return false;
     }
     $result = parent::delete("tax_tables", "tax_table_id=:tid ", array(":tid" => $this->tax_table_id));
     if ($result === false) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_add;
     $daObj->MainObjectID = $this->tax_table_id;
     $daObj->TableName = "tax_tables";
     $daObj->execute();
     return true;
 }
 function RemoveParam($param_type, $person_type)
 {
     $obj = new manage_salary_param_types($param_type, $person_type);
     if (!$obj->onBeforeDelete()) {
         return false;
     }
     $result = parent::delete("salary_param_types", "param_type=:pid and person_type = :pt ", array(":pid" => $this->param_type, ":pt" => $this->person_type));
     if ($result === false) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->RelatedPersonType = DataAudit::PersonType_staff;
     $daObj->MainObjectID = $this->param_type;
     $daObj->TableName = "salary_param_types";
     $daObj->execute();
     return true;
 }
Esempio n. 25
0
 static function RemoveEducation($personID, $row_no)
 {
     $whereParams = array();
     $whereParams[":pid"] = $personID;
     $whereParams[":rowid"] = $row_no;
     if (parent::delete("HRM_person_educations", " PersonID=:pid and row_no=:rowid", $whereParams) === false) {
         parent::PushException(ER_PERSON_DEP_DEL);
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->RelatedPersonType = 3;
     $daObj->RelatedPersonID = $personID;
     $daObj->MainObjectID = $row_no;
     $daObj->TableName = "person_educations";
     $daObj->execute();
     return true;
 }
 function change_state()
 {
     $whereParams = array();
     $whereParams[":py"] = $this->PayYear;
     $whereParams[":pm"] = $this->PayMonth;
     if ($this->PersonType == 102) {
         $pt = " in ( 1,2,3) ";
     } else {
         if ($this->PersonType == 100) {
             $pt = " in ( 1,2,3,5,100 ) ";
         } else {
             $pt = $this->PersonType;
         }
     }
     $query = " update SalaryItemReport\r\n                                  set state = " . $this->state . "\r\n                                                 where PayYear = :py and PayMonth = :pm and PersonType {$pt}  ";
     $result = parent::runquery($query, $whereParams);
     if ($result === false) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_update;
     $daObj->MainObjectID = $this->PayMonth;
     $daObj->SubObjectID = $this->state;
     $daObj->TableName = "SalaryItemReport";
     $daObj->execute();
     return true;
 }
Esempio n. 27
0
 static function RemoveUnit($ouid)
 {
     $whereParams = array();
     $whereParams[":ouid"] = $ouid;
     $db = PdoDataAccess::getPdoObject();
     /*@var $db PDO*/
     $db->beginTransaction();
     parent::runquery("insert into org_units_history select *,'DELETE',now() from org_new_units where ouid=:ouid", $whereParams);
     $return = PdoDataAccess::delete("org_new_units", " ouid=:ouid", $whereParams);
     if ($return === false) {
         $db->rollBack();
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->MainObjectID = $ouid;
     $daObj->TableName = "org_new_units";
     $daObj->execute();
     $db->commit();
     return true;
 }
Esempio n. 28
0
 static function DeleteFolder($FolderID)
 {
     PdoDataAccess::runquery("delete from OFC_ArchiveItems where FolderID=?", array($FolderID));
     if (parent::delete("OFC_archive", "FolderID=?", array($FolderID)) === false) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->MainObjectID = $FolderID;
     $daObj->TableName = "OFC_archive";
     $daObj->execute();
     return true;
 }
Esempio n. 29
0
 function AddMilitaryBase($PID)
 {
     $qry = " select * \r\n\t\t\t    from bases \r\n\t\t\t\twhere baseType = 1 and baseValue = 1 and   personid =" . $PID;
     $resRec = parent::runquery($qry);
     $query = "\tselect  personid ,\r\n\t\t\t\tif ((military_duration > (DATEDIFF( military_to_date ,military_from_date))/30.4375 ) ,military_duration , (DATEDIFF( military_to_date ,military_from_date))/30.4375 ) duration\r\n\r\n\t\t\t    from persons\r\n\t\t\t\twhere sex = 1 and person_type in (2,3,5) and personid = " . $PID;
     $res = parent::runquery($query);
     if ($res[0]['duration'] / 12 > 1 && count($resRec) == 0) {
         $this->PersonID = $PID;
         $this->BaseType = 1;
         $this->BaseValue = 1;
         $this->RegDate = DateModules::Now();
         $this->ExecuteDate = DateModules::Now();
         $this->BaseMode = 'SYSTEM';
         $this->ExtraInfo = $res[0]['duration'];
         $this->BaseStatus = 'NORMAL';
         $result = parent::insert($query, $this);
         if ($result === false) {
             return false;
         }
         $daObj = new DataAudit();
         $daObj->ActionType = DataAudit::Action_add;
         $daObj->MainObjectID = $this->PersonID;
         $daObj->SubObjectID = $this->BaseType;
         $daObj->TableName = "bases";
         $daObj->execute();
         return true;
     } else {
         if ($res[0]['duration'] / 12 < 1 && count($resRec) == 1) {
             $this->BaseStatus = 'DELETED';
             $result = parent::update("bases", $this, "BaseType = 1 and  BaseValue =1 and personid =" . $PID);
             if ($result === false) {
                 return false;
             }
             $daObj = new DataAudit();
             $daObj->ActionType = DataAudit::Action_update;
             $daObj->MainObjectID = $this->PersonID;
             $daObj->SubObjectID = $this->BaseStatus;
             $daObj->TableName = "bases";
             $daObj->execute();
             return true;
         } else {
             if ($res[0]['duration'] / 12 > 1 && count($resRec) == 1) {
                 if ($resRec[0]['BaseStatus'] == 'DELETED') {
                     $this->BaseStatus = 'NORMAL';
                     $result = parent::update("bases", $this, "BaseType = 1 and  BaseValue =1 and personid =" . $PID);
                     if ($result === false) {
                         return false;
                     }
                     $daObj = new DataAudit();
                     $daObj->ActionType = DataAudit::Action_update;
                     $daObj->MainObjectID = $this->PersonID;
                     $daObj->SubObjectID = $this->BaseStatus;
                     $daObj->TableName = "bases";
                     $daObj->execute();
                     return true;
                 } else {
                     return true;
                 }
             }
         }
     }
 }
Esempio n. 30
0
 static function RemovePost($post_id)
 {
     if (!self::OnBeforeDelete($post_id)) {
         return false;
     }
     $whereParams = array();
     $whereParams[":post_id"] = $post_id;
     $db = parent::getPdoObject();
     /*@var $db PDO*/
     $db->beginTransaction();
     parent::runquery("insert into position_history select *,'DELETE',now() from position where post_id=:post_id", $whereParams);
     $return = parent::delete("position", " post_id=:post_id", $whereParams);
     if ($return == "0") {
         $db->rollBack();
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->MainObjectID = $post_id;
     $daObj->TableName = "position";
     $daObj->execute();
     $db->commit();
     self::OnAfterDelete();
     return true;
 }