예제 #1
0
function WritTypeSave()
{
    if (empty($_POST["wstid"])) {
        $wtid = PdoDataAccess::GetLastID("HRM_writ_subtypes", "writ_subtype_id", " person_type=:PT", array(":PT" => $_POST['pt']));
        $wtid++;
        $query = "insert into HRM_writ_subtypes(person_type,writ_type_id,writ_subtype_id,title,print_title,description,\r\n\t\t\temp_state , emp_mode , worktime_type)\r\n                                values('" . $_POST["pt"] . "',1," . $wtid . ",'" . $_POST["title"] . "','" . $_POST["print_title"] . "','',0,0,0)";
        PdoDataAccess::runquery($query);
        $daObj = new DataAudit();
        $daObj->ActionType = DataAudit::Action_add;
        $daObj->MainObjectID = $_POST['pt'] . "-" . $wtid;
        $daObj->TableName = "HRM_writ_types";
        $daObj->execute();
        echo Response::createObjectiveResponse("true", $_POST['pt'] . "-" . $wtid);
    } else {
        $query = "update writ_types set title = '" . $_POST["title"] . "'\r\n                            where person_type=" . $_POST['pt'] . " and writ_type_id=" . $_POST['id'];
        PdoDataAccess::runquery($query);
        $daObj = new DataAudit();
        $daObj->ActionType = DataAudit::Action_update;
        $daObj->MainObjectID = $_POST['pt'] . "-" . $_POST['id'];
        $daObj->TableName = "job_category";
        $daObj->execute();
        echo Response::createObjectiveResponse("true", $_POST['pt'] . "-" . $_POST['id']);
    }
    die;
}
 function Add()
 {
     $masterID = parent::GetLastID("mission_list_items", "list_row_no", "list_id=" . $this->list_id);
     $this->list_row_no = $masterID + 1;
     $query = " select person_type from staff \r\n\t                     where staff_id = " . $this->staff_id;
     $res = parent::runquery($query);
     if ($res[0]['person_type'] == HR_PROFESSOR) {
         $this->salary_item_type_id = 42;
     } else {
         if ($res[0]['person_type'] == HR_EMPLOYEE) {
             $this->salary_item_type_id = 43;
         } else {
             if ($res[0]['person_type'] == HR_CONTRACT) {
                 $this->salary_item_type_id = 643;
             }
         }
     }
     $result = parent::insert("mission_list_items", $this);
     if ($result === false) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_add;
     $daObj->MainObjectID = $this->list_id;
     $daObj->SubObjectID = $this->list_row_no;
     $daObj->TableName = "mission_list_items";
     $daObj->execute();
     return true;
 }
예제 #3
0
function AddGroup()
{
    $InfoID = PdoDataAccess::GetLastID("BaseInfo", "InfoID", "TypeID=1");
    PdoDataAccess::runquery("insert into BaseInfo(TypeID,InfoID, InfoDesc) \r\n\t\tvalues(1,?,?)", array($InfoID + 1, $_POST["GroupDesc"]));
    echo Response::createObjectiveResponse(true, "");
    die;
}
예제 #4
0
 function AddTaxItem()
 {
     $this->row_no = parent::GetLastID("HRM_tax_table_items", "row_no", " tax_table_id =" . $this->tax_table_id) + 1;
     $result = parent::insert("HRM_tax_table_items", $this);
     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 = "HRM_tax_table_items";
     $daObj->execute();
     return true;
 }
예제 #5
0
 function AddList()
 {
     $lastid = parent::GetLastID("evaluation_lists", "list_id");
     $this->list_id = $lastid + 1;
     $return = parent::insert("evaluation_lists", $this);
     if ($return === false) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_add;
     $daObj->MainObjectID = $this->list_id;
     $daObj->TableName = "evaluation_lists";
     $daObj->execute();
     return true;
 }
예제 #6
0
 function AddWST()
 {
     $wsid = PdoDataAccess::GetLastID("writ_subtypes", "writ_subtype_id", "person_type = :PT and writ_type_id = :WTI ", array(":PT" => $this->person_type, ":WTI" => $this->writ_type_id));
     $wsid++;
     $this->writ_subtype_id = $wsid;
     $return = parent::insert("writ_subtypes", $this);
     if ($return === false) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_add;
     $daObj->MainObjectID = $this->person_type . "-" . $this->writ_type_id . "-" . $this->writ_subtype_id;
     $daObj->TableName = "writ_subtypes";
     $daObj->execute();
     return true;
 }
예제 #7
0
 function AddTax()
 {
     $tax_table_type_id = parent::GetLastID("HRM_tax_table_types", "tax_table_type_id");
     $tax_table_type_id++;
     $this->tax_table_type_id = $tax_table_type_id;
     $result = parent::insert("HRM_tax_table_types", $this);
     if ($result === false) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_add;
     $daObj->MainObjectID = $this->tax_table_type_id;
     $daObj->TableName = "HRM_tax_table_types";
     $daObj->execute();
     return true;
 }
 function Add()
 {
     $masterID = parent::GetLastID("pay_get_list_items", "list_row_no", "list_id=" . $this->list_id);
     $this->list_row_no = $masterID + 1;
     $result = parent::insert("pay_get_list_items", $this);
     if ($result === false) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_add;
     $daObj->MainObjectID = $this->list_id;
     $daObj->SubObjectID = $this->list_row_no;
     $daObj->TableName = "pay_get_list_items";
     $daObj->execute();
     return true;
 }
예제 #9
0
 function Add()
 {
     $this->bank_id = parent::GetLastID("banks", "bank_id") + 1;
     if ($this->branch_code == 0 || $this->branch_code == null) {
         $this->branch_code = PDONULL;
     }
     $return = parent::insert("banks", $this);
     if ($return === false) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_add;
     $daObj->MainObjectID = $this->bank_id;
     $daObj->TableName = "banks";
     $daObj->execute();
     return true;
 }
예제 #10
0
 function Add()
 {
     $pdo = parent::getPdoObject();
     /*@var $pdo PDO*/
     $pdo->beginTransaction();
     $this->row_no = parent::GetLastID("HRM_person_dependent_supports", "row_no", "PersonID=:pid and master_row_no=:mrno", array(":pid" => $this->PersonID, ":mrno" => $this->master_row_no)) + 1;
     $result = parent::insert("HRM_person_dependent_supports", $this);
     if ($result === false) {
         $pdo->rollBack();
         return false;
     }
     $this->row_no = parent::InsertID();
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_add;
     $daObj->RelatedPersonID = $this->PersonID;
     $daObj->RelatedPersonType = 3;
     $daObj->MainObjectID = $this->row_no;
     $daObj->TableName = "HRM_person_dependent_supports";
     $daObj->execute();
     $pdo->commit();
     return true;
 }
예제 #11
0
 public static function LastID($pdo = null)
 {
     return PdoDataAccess::GetLastID(static::TableName, static::TableKey, "", array(), $pdo) + 1;
 }
예제 #12
0
function SaveLetter($dieing = true)
{
    $Letter = new OFC_letters();
    pdoDataAccess::FillObjectByArray($Letter, $_POST);
    if ($Letter->RefLetterID != "") {
        $obj = new OFC_letters($Letter->RefLetterID);
        if (empty($obj->LetterID)) {
            Response::createObjectiveResponse(false, "شماره نامه عطف قابل بازیابی نمی باشد");
            die;
        }
    }
    if ($Letter->LetterID == '') {
        $Letter->PersonID = $_SESSION["USER"]["PersonID"];
        $Letter->LetterDate = PDONOW;
        $Letter->RegDate = PDONOW;
        $res = $Letter->AddLetter();
    } else {
        $res = $Letter->EditLetter();
    }
    if (!empty($_FILES["PageFile"]["tmp_name"])) {
        $st = preg_split("/\\./", $_FILES['PageFile']['name']);
        $extension = strtolower($st[count($st) - 1]);
        if (in_array($extension, array("jpg", "jpeg", "gif", "png", "pdf")) === false) {
            Response::createObjectiveResponse(false, "فرمت فایل ارسالی نامعتبر است");
            die;
        }
        $dt = DMS_documents::SelectAll("ObjectType='letter' AND ObjectID=?", array($Letter->LetterID));
        if (count($dt) == 0) {
            $obj = new DMS_documents();
            $obj->DocType = 0;
            $obj->ObjectType = "letter";
            $obj->ObjectID = $Letter->LetterID;
            $obj->AddDocument();
            $DocumentID = $obj->DocumentID;
        } else {
            $DocumentID = $dt[0]["DocumentID"];
        }
        //..............................................
        $obj2 = new DMS_DocFiles();
        $obj2->DocumentID = $DocumentID;
        $obj2->PageNo = PdoDataAccess::GetLastID("DMS_DocFiles", "PageNo", "DocumentID=?", array($DocumentID)) + 1;
        $obj2->FileType = $extension;
        $obj2->FileContent = substr(fread(fopen($_FILES['PageFile']['tmp_name'], 'r'), $_FILES['PageFile']['size']), 0, 200);
        $obj2->AddPage();
        $fp = fopen(getenv("DOCUMENT_ROOT") . "/storage/documents/" . $obj2->RowID . "." . $extension, "w");
        fwrite($fp, substr(fread(fopen($_FILES['PageFile']['tmp_name'], 'r'), $_FILES['PageFile']['size']), 200));
        fclose($fp);
    }
    if ($dieing) {
        Response::createObjectiveResponse($res, $Letter->GetExceptionCount() != 0 ? $Letter->popExceptionDescription() : $Letter->LetterID);
        die;
    }
    return true;
}
예제 #13
0
function importStudent()
{
    $dt = PdoDataAccess::runquery("select * from StudentPersonMap where StNo=?", array($_POST["StNo"]));
    if (count($dt) > 0) {
        echo Response::createObjectiveResponse(false, "Duplicate");
        die;
    }
    $pdo = PdoDataAccess::getPdoObject();
    $pdo->beginTransaction();
    $query = "insert into \n\t\tpersons(person_type,pfname,plname,efname,elname,father_name,idcard_no,birth_date,national_code,\n\t\t\t\tsex,address1,home_phone1,mobile_phone,email,comment)\n\t\tselect " . $_POST["person_type"] . ",PFName,PLName,EFName,ELName,DadName,BCN,BirthDate,NID,\n\t\t\t\tsex,address1,PhoneNo,mobile,EMail,concat('انتقال اطلاعات دانشجو با شماره دانشجویی', StNo)\n\t\tfrom students where StNo=?";
    PdoDataAccess::runquery($query, array($_POST["StNo"]), $pdo);
    if (ExceptionHandler::GetExceptionCount() > 0) {
        $pdo->rollBack();
        echo Response::createObjectiveResponse(false, "1");
        //print_r(ExceptionHandler::PopAllExceptions());
        die;
    }
    //--------------------------------------------------------------------------
    $personID = PdoDataAccess::InsertID();
    $staff_id = PdoDataAccess::GetLastID("staff", "staff_id", "", array(), $pdo) + 1;
    PdoDataAccess::runquery("insert into staff(staff_id,PersonID,person_type) \n\t\t\tvalues({$staff_id}, {$personID}, " . $_POST["person_type"] . ")", array(), $pdo);
    if (ExceptionHandler::GetExceptionCount() > 0) {
        $pdo->rollBack();
        echo Response::createObjectiveResponse(false, "2");
        //print_r(ExceptionHandler::PopAllExceptions());
        die;
    }
    //--------------------------------------------------------------------------
    $query = "insert into StudentPersonMap\tvalues({$personID}," . $_POST["StNo"] . ")";
    PdoDataAccess::runquery($query, array(), $pdo);
    if (ExceptionHandler::GetExceptionCount() > 0) {
        $pdo->rollBack();
        //print_r(ExceptionHandler::PopAllExceptions());
        echo Response::createObjectiveResponse(false, "5");
        die;
    }
    //--------------------------------------------------------------------------
    $query = "select RFID from educ.StudentSpecs where StNo=?";
    $dt = PdoDataAccess::runquery($query, array($_POST["StNo"]), $pdo);
    if (ExceptionHandler::GetExceptionCount() > 0) {
        $pdo->rollBack();
        echo Response::createObjectiveResponse(false, "3");
        //print_r(ExceptionHandler::PopAllExceptions());
        die;
    }
    if (count($dt) > 0 && $dt[0][0] != "") {
        $id = PdoDataAccess::GetLastID("pas.PersonSettings", "PersonSettingsID");
        $query = "insert into pas.PersonSettings(PersonSettingsID,PersonID,CardStatus,CardNumber,WorkGroupID,CalendarID)\n\t\t\tvalues(" . ($id + 1) . ",{$personID},'ENABLE',NULL,0,0)";
        PdoDataAccess::runquery($query, array(), $pdo);
        if (ExceptionHandler::GetExceptionCount() > 0) {
            $pdo->rollBack();
            print_r(ExceptionHandler::PopAllExceptions());
            echo Response::createObjectiveResponse(false, "4");
            die;
        }
    }
    //--------------------------------------------------------------------------
    $pdo->commit();
    $result = ExceptionHandler::GetExceptionCount() == 0 ? "true" : "false";
    echo Response::createObjectiveResponse($result, "");
    die;
}
예제 #14
0
 static function LastID($pdo = "")
 {
     return PdoDataAccess::GetLastID("HRM_writs", "writ_id", "", array(), $pdo);
 }
예제 #15
0
 public static function LastID()
 {
     return PdoDataAccess::GetLastID("wfm_forms", "LetterID");
 }
예제 #16
0
 function LastID()
 {
     return PdoDataAccess::GetLastID("HRM_salary_item_types", "salary_item_type_id");
 }
예제 #17
0
 public static function LastID($pdo = "")
 {
     return PdoDataAccess::GetLastID("persons", "PersonID", "", array(), $pdo);
 }
예제 #18
0
 private static function LastID($PersonID)
 {
     $whereParam = array();
     $whereParam[":PD"] = $PersonID;
     return parent::GetLastID("PersonJobs", "RowNO", "PersonID=:PD", $whereParam);
 }
예제 #19
0
 private static function LastID()
 {
     return PdoDataAccess::GetLastID("salary_params", "param_id");
 }
예제 #20
0
 private static function LastID($PersonID)
 {
     $whereParam = array();
     $whereParam[":PD"] = $PersonID;
     return parent::GetLastID("HRM_person_educations", "row_no", "PersonID=:PD", $whereParam);
 }
예제 #21
0
function SaveDocType()
{
    $st = stripslashes(stripslashes($_POST["record"]));
    $data = json_decode($st);
    if ($data->InfoID * 1 == 0) {
        $pdo = PdoDataAccess::getPdoObject();
        $pdo->beginTransaction();
        $data->InfoID = PdoDataAccess::GetLastID("BaseInfo", "InfoID", "TypeID=?", array($data->TypeID), $pdo);
        $data->InfoID = $data->InfoID * 1 + 1;
        PdoDataAccess::runquery("insert into BaseInfo(TypeID,InfoID,InfoDesc,param1) values(?,?,?,?)", array($data->TypeID, $data->InfoID, $data->InfoDesc, $data->param1), $pdo);
        $pdo->commit();
    } else {
        PdoDataAccess::runquery("update BaseInfo set InfoDesc=? where TypeID=? AND InfoID=?", array($data->InfoDesc, $data->TypeID, $data->InfoID));
    }
    echo Response::createObjectiveResponse(ExceptionHandler::GetExceptionCount() == 0, "");
    die;
}
예제 #22
0
 public static function LastID()
 {
     return parent::GetLastID("rp_reports", "report_id");
 }
예제 #23
0
 static function GetLastLocalNo()
 {
     $no = parent::GetLastID("ACC_docs", "LocalNo", "CycleID=? AND BranchID=?", array($_SESSION["accounting"]["CycleID"], $_SESSION["accounting"]["BranchID"]));
     return $no + 1;
 }
예제 #24
0
 private static function LastID($PersonID)
 {
     $whereParam = array();
     $whereParam[":PD"] = $PersonID;
     return parent::GetLastID("person_devotions", "devotion_row", "PersonID=:PD", $whereParam);
 }
예제 #25
0
 private static function LastID($PersonID)
 {
     $whereParam = array();
     $whereParam[":PD"] = $PersonID;
     return PdoDataAccess::GetLastID("person_employments", "row_no", "PersonID=:PD", $whereParam);
 }
예제 #26
0
 static function Create_New_Staff($personid, $persontype)
 {
     $obj = new manage_staff($personid, $persontype);
     if ($persontype == 3 || $persontype == 5) {
         $obj->person_type = 2;
     } else {
         if ($persontype == 2) {
             $obj->person_type = 1;
         }
     }
     $old_staff_id = $obj->staff_id;
     $ret = $obj->AddStaff();
     if ($ret == true) {
         //--------------------------------------------------
         $qry = " select * from staff_tax_history where staff_id=" . $old_staff_id . " AND payed_tax_value IS NOT NULL ";
         $tmp = PdoDataAccess::runquery($qry);
         if (count($tmp) > 0) {
             $Newobj = new manage_staff_tax($old_staff_id);
             parent::FillObjectByArray($Newobj, $tmp[0]);
             $Newobj->staff_id = $obj->staff_id;
             $Newobj->tax_history_id = parent::GetLastID('staff_tax_history', 'tax_history_id') + 1;
             if (PdoDataAccess::insert("staff_tax_history", $Newobj) === false) {
                 return false;
             }
         }
         //................. آزاد کردن پست سازمانی شماره شناسایی قبلی ...................
         $qry = " update position set staff_id= null where staff_id = " . $old_staff_id;
         PdoDataAccess::runquery($qry);
         //..................................................
         $query = " update persons set person_type = " . $obj->person_type . " where  personid =" . $obj->PersonID;
         PdoDataAccess::runquery($query);
         if (ExceptionHandler::GetExceptionCount() == 0) {
             return $obj->staff_id;
         }
     }
     return false;
 }
예제 #27
0
 private static function LastID($staff_id)
 {
     $whereParam = array();
     $whereParam[":staff_id"] = $staff_id;
     return parent::GetLastID("professor_exe_posts", "row_no", "staff_id=:staff_id", $whereParam);
 }
예제 #28
0
 function AddPost()
 {
     $db = PdoDataAccess::getPdoObject();
     /*@var $db PDO*/
     $db->beginTransaction();
     $this->post_id = parent::GetLastID("`position`", "post_id") + 1;
     $this->RegDate = PDONOW;
     $return = parent::insert("`position`", $this);
     if ($return === false) {
         $db->rollBack();
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_add;
     $daObj->MainObjectID = $this->post_id;
     $daObj->TableName = "position";
     $daObj->execute();
     $db->commit();
     $this->OnAfterInsert();
     return true;
 }
예제 #29
0
 private static function LastID($pdo = "")
 {
     return PdoDataAccess::GetLastID("staff", "staff_id", "", array());
 }