function saveEducData() { //........ Fill object .............. $obj = new manage_person_education(); PdoDataAccess::FillObjectByArray($obj, $_POST); $obj->PersonID = $_POST['PersonID']; $obj->doc_date = DateModules::Shamsi_to_Miladi($obj->doc_date); $obj->certificated = empty($obj->certificated) ? "0" : $obj->certificated; //.................................... if ($_POST['sfid'] == "-1") { $obj->sfid = PDONULL; } if (!isset($_POST['sbid'])) { $obj->sbid = PDONULL; } if ($_POST['university_id'] == "-1") { $obj->university_id = PDONULL; } if ($_POST['country_id'] == "-1") { $obj->country_id = PDONULL; } if (empty($_POST["row_no"])) { $return = $obj->AddEducation(); } else { $return = $obj->EditEducation(); } echo $return ? Response::createObjectiveResponse(true, $obj->row_no) : Response::createObjectiveResponse(false, ExceptionHandler::GetExceptionsToString("\n")); die; }
function save() { $obj = new manage_professor_exe_posts(); PdoDataAccess::FillObjectByArray($obj, $_POST); $postObj = new manage_posts($obj->post_id); if ($postObj->post_id == "") { echo Response::createObjectiveResponse(false, "کد پست وارد شده معتبر نمی باشد."); die; } if ($postObj->validity_start != "" && $postObj->validity_start != '0000-00-00' && DateModules::CompareDate($postObj->validity_start, str_replace("/", "-", DateModules::shamsi_to_miladi($obj->from_date))) > 0 || $postObj->validity_end != "" && $postObj->validity_end != '0000-00-00' && ($obj->to_date != "" && $obj->to_date != "0000-00-00") && DateModules::CompareDate($postObj->validity_end, str_replace("/", "-", DateModules::shamsi_to_miladi($obj->to_date))) < 0) { echo Response::createObjectiveResponse(false, "پست انتخابی از نظر تاریخ اعتبار و تاریخ های شروع و پایان وارد شده معتبر نمی باشد."); die; } if (empty($obj->row_no)) { $return = $obj->ADD(); } else { $return = $obj->Edit(); } if (!$return) { echo Response::createObjectiveResponse($return, ExceptionHandler::GetExceptionsToString()); die; } if (isset($_POST["assign_post"])) { $return = $obj->assign_post(); } else { $return = $obj->release_post(); } echo Response::createObjectiveResponse($return, ExceptionHandler::GetExceptionsToString()); die; }
function saveStaffData() { $obj = new manage_staff(); PdoDataAccess::FillObjectByArray($obj, $_POST); if (isset($_POST["work_start_date"])) { $obj->work_start_date = DateModules::Shamsi_to_Miladi($_POST["work_start_date"]); } if (isset($_POST["ProfWorkStart"])) { $obj->ProfWorkStart = DateModules::Shamsi_to_Miladi($_POST["ProfWorkStart"]); } if (isset($_POST["retired_date"])) { $obj->retired_date = DateModules::Shamsi_to_Miladi($_POST["retired_date"]); } if (isset($_POST["last_retired_pay"])) { $obj->last_retired_pay = DateModules::Shamsi_to_Miladi($_POST["last_retired_pay"]); } if (!isset($_POST['Over25'])) { $obj->Over25 = 0; } $obj->sum_paied_pension = $obj->sum_paied_pension > 0 ? $obj->sum_paied_pension : "0"; $return = $obj->EditStaff(); $key = $obj->staff_id . "," . $obj->PersonID . "," . $obj->person_type; echo $return ? Response::createObjectiveResponse("true", $key) : Response::createObjectiveResponse(false, ExceptionHandler::GetExceptionsToString("\n")); die; }
function SaveRequest() { $obj = new ATN_requests(); PdoDataAccess::FillObjectByArray($obj, $_POST); if ($obj->ReqType != "CORRECT") { if (!empty($obj->ToDate)) { $dt = PdoDataAccess::runquery("\r\n\t\t\t\tselect * from ATN_requests \r\n\t\t\t\twhere PersonID=:p AND RequestID<>:r \r\n\t\t\t\tAND ( (FromDate<=:f AND ToDate>=:f) OR (FromDate<=:t AND ToDate>=:t) )\r\n\t\t\t", array(":p" => $_SESSION["USER"]["PersonID"], ":r" => $obj->RequestID, ":f" => DateModules::shamsi_to_miladi($obj->FromDate, "-"), ":t" => DateModules::shamsi_to_miladi($obj->ToDate, "-"))); if (count($dt) > 0) { echo Response::createObjectiveResponse(false, "در بازه زمانی وارد شده قبلا درخواستی ثبت شده است"); die; } } else { $dt = PdoDataAccess::runquery("\r\n\t\t\t\tselect * from ATN_requests \r\n\t\t\t\twhere PersonID=:p AND RequestID<>:r \r\n\t\t\t\tAND (\r\n\t\t\t\t\t\t(FromDate<=:f AND ToDate>=:f) OR \r\n\t\t\t\t\t\t( if(ToDate is null,FromDate=:f,FromDate<=:f AND ToDate>=:f) AND \r\n\t\t\t\t\t\t\tStartTime<=:st AND EndTime>=:st) OR \r\n\t\t\t\t\t\t( if(ToDate is null,FromDate=:f,FromDate<=:f AND ToDate>=:f) AND \r\n\t\t\t\t\t\t\tStartTime<=:et AND EndTime>= :et) )\r\n\t\t\t", array(":p" => $_SESSION["USER"]["PersonID"], ":r" => $obj->RequestID, ":f" => DateModules::shamsi_to_miladi($obj->FromDate, "-"), ":st" => $obj->StartTime, ":et" => $obj->EndTime)); //echo PdoDataAccess::GetLatestQueryString();die(); if (count($dt) > 0) { echo Response::createObjectiveResponse(false, "در بازه زمانی وارد شده قبلا درخواستی ثبت شده است"); die; } } } if (empty($obj->RequestID)) { $obj->PersonID = $_SESSION["USER"]["PersonID"]; $obj->ReqDate = PDONOW; $result = $obj->Add(); } else { $result = $obj->Edit(); } //print_r(ExceptionHandler::PopAllExceptions()); echo Response::createObjectiveResponse($result, ""); die; }
function SavePersonalInfo() { $obj = new BSC_persons(); $obj->PersonID = $_SESSION["USER"]["PersonID"]; PdoDataAccess::FillObjectByArray($obj, $_POST); $result = $obj->EditPerson(); echo Response::createObjectiveResponse($result, ""); die; }
function SaveContract() { $pdo = PdoDataAccess::getPdoObject(); $pdo->beginTransaction(); $CntObj = new CNT_contracts(); PdoDataAccess::FillObjectByArray($CntObj, $_POST); if ($_POST["ContractID"] == "") { $CntObj->RegPersonID = $_SESSION['USER']["PersonID"]; $CntObj->RegDate = PDONOW; $result = $CntObj->Add($pdo); } else { $result = $CntObj->Edit($pdo); /* removing values of contract items */ CNT_ContractItems::RemoveAll($CntObj->ContractID, $pdo); } if (!$result) { $pdo->rollBack(); print_r(ExceptionHandler::PopAllExceptions()); //echo PdoDataAccess::GetLatestQueryString(); echo Response::createObjectiveResponse(false, ExceptionHandler::GetExceptionsToString()); die; } /* Adding the values of Contract items */ foreach ($_POST as $PostData => $val) { if (empty($val)) { continue; } if (!(substr($PostData, 0, 8) == "TplItem_")) { continue; } $items = explode('_', $PostData); $TemplateItemID = $items[1]; $CntItemsObj = new CNT_ContractItems(); $CntItemsObj->ContractID = $CntObj->ContractID; $CntItemsObj->TemplateItemID = $TemplateItemID; $TplItemObj = new CNT_TemplateItems($CntItemsObj->TemplateItemID); switch ($TplItemObj->ItemType) { case 'shdatefield': $CntItemsObj->ItemValue = DateModules::shamsi_to_miladi($val); break; default: $CntItemsObj->ItemValue = $val; } $result = $CntItemsObj->Add($pdo); } if (!$result) { $pdo->rollBack(); print_r(ExceptionHandler::PopAllExceptions()); //echo PdoDataAccess::GetLatestQueryString(); echo Response::createObjectiveResponse(false, ExceptionHandler::GetExceptionsToString()); die; } $pdo->commit(); echo Response::createObjectiveResponse(true, $CntObj->ContractID); die; }
function saveTaxHis() { $obj = new manage_staff_tax(); PdoDataAccess::FillObjectByArray($obj, $_POST); $obj->start_date = DateModules::Shamsi_to_Miladi($_POST['start_date']); $obj->end_date = DateModules::Shamsi_to_Miladi($_POST['end_date']); if (!empty($_POST['tax_history_id'])) { $return = $obj->EditStaffTaxHistory($_POST['PersonID']); } else { $return = $obj->SaveStaffTaxHistory($_POST['PersonID']); } echo $return ? Response::createObjectiveResponse(true, $_POST['PersonID']) : Response::createObjectiveResponse(false, ExceptionHandler::GetExceptionsToString("\n")); die; }
function SaveUnit() { $obj = new manage_units(); PdoDataAccess::FillObjectByArray($obj, $_POST); if (empty($_POST["ouid"])) { $obj->RegDate = date('Y-m-d'); $obj->parent_path = $_POST["parent_path"] == "" ? $obj->parent_path : $_POST["parent_path"] . "," . $obj->parent_ouid; $obj->AddUnit(); } else { $obj->ouid = $_POST["ouid"]; $obj->EditUnit(); } echo Response::createObjectiveResponse("true", $obj->ouid); die; }
function SaveLoan() { $obj = new LON_loans(); PdoDataAccess::FillObjectByArray($obj, $_POST); $obj->IsCustomer = isset($_POST["IsCustomer"]) ? "YES" : "NO"; $obj->IsPlan = isset($_POST["IsPlan"]) ? "YES" : "NO"; if (empty($_POST["LoanID"])) { $result = $obj->AddLoan(); } else { $result = $obj->EditLoan(); } //print_r(ExceptionHandler::PopAllExceptions()); echo Response::createObjectiveResponse($result, ""); die; }
function saveTask() { $obj = new FRW_tasks(); PdoDataAccess::FillObjectByArray($obj, $_POST); if (isset($_POST["DoneDesc"])) { $obj->DoneDate = PDONOW; } if ($obj->TaskID != "") { $result = $obj->EditTask(); } else { $obj->RegPersonID = $_SESSION["USER"]["PersonID"]; $obj->CreateDate = PDONOW; $result = $obj->AddTask(); } Response::createObjectiveResponse($result, ""); die; }
function SaveItem() { $obj = new manage_writ_item(); PdoDataAccess::FillObjectByArray($obj, $_POST); $obj->remembered = isset($_POST['remembered']) ? $_POST['remembered'] : 0; $obj->must_pay = isset($_POST['must_pay']) ? $_POST['must_pay'] : 0; if (isset($_REQUEST["mode"])) { if ($_REQUEST["mode"] == "new") { $return = $obj->AddWritItem(); } else { $return = $obj->EditWritItem(); } } else { $return = $obj->EditWritItem(); } echo Response::createObjectiveResponse($return, $return ? $obj->writ_id : ExceptionHandler::popExceptionDescription()); die; }
function SaveCostCenter() { $obj = new manage_cost_centers(); PdoDataAccess::FillObjectByArray($obj, $_POST); if (!empty($obj->cost_center_id)) { if (!$obj->Edit()) { echo "UpdateError"; die; } } else { if (!$obj->Add()) { echo "InsertError"; die; } } echo Response::createObjectiveResponse("true", $obj->cost_center_id); die; }
function SaveWarrentyRequest() { $obj = new WAR_requests(); PdoDataAccess::FillObjectByArray($obj, $_POST); $obj->StatusID = WAR_STEPID_RAW; if (empty($obj->RequestID)) { $obj->ReqDate = PDONOW; $obj->RequestID = WAR_requests::LastID(); $result = $obj->Add(); if ($result) { WAR_requests::ChangeStatus($obj->RequestID, $obj->StatusID, "", true); } } else { $result = $obj->Edit(); } //print_r(ExceptionHandler::PopAllExceptions()); echo Response::createObjectiveResponse($result, $obj->RequestID); die; }
function saveDevData() { $obj = new manage_person_devotion(); PdoDataAccess::FillObjectByArray($obj, $_POST); $obj->PersonID = $_POST['PersonID']; $obj->from_date = DateModules::Shamsi_to_Miladi($_POST["from_date"]); $obj->to_date = DateModules::Shamsi_to_Miladi($_POST["to_date"]); $obj->letter_date = DateModules::Shamsi_to_Miladi($_POST["letter_date"]); $obj->amount = empty($obj->amount) ? "0" : $obj->amount; $obj->continous = !empty($obj->continous) ? $obj->continous : 0; $obj->enlisted = !empty($obj->enlisted) ? $obj->enlisted : 0; if (empty($_POST["devotion_row"])) { $return = $obj->AddDevotion(); } else { $return = $obj->EditDevotion(); } echo $return ? Response::createObjectiveResponse(true, $obj->devotion_row) : Response::createObjectiveResponse(false, ExceptionHandler::GetExceptionsToString("\n")); die; }
function SaveElement() { $obj = new PLN_Elements(); PdoDataAccess::FillObjectByArray($obj, $_POST); if (empty($obj->properties)) { $obj->properties = " "; } if (empty($obj->EditorProperties)) { $obj->EditorProperties = " "; } if ($obj->ElementID * 1 > 0) { $result = $obj->Edit(); } else { $result = $obj->Add(); } //print_r(ExceptionHandler::PopAllExceptions()); echo Response::createObjectiveResponse($result, ""); die; }
function WritSubTypeSave() { $obj = new manage_writ_subType($_POST['person_type'], $_POST['writ_type_id']); PdoDataAccess::FillObjectByArray($obj, $_POST); $obj->time_limited = isset($_POST['time_limited']) ? $_POST['time_limited'] : 0; $obj->req_staff_signature = isset($_POST['req_staff_signature']) ? $_POST['req_staff_signature'] : 0; $obj->automatic = isset($_POST['automatic']) ? $_POST['automatic'] : 0; $obj->edit_fields = isset($_POST['edit_fields']) ? $_POST['edit_fields'] : 0; $obj->force_writ_issue = isset($_POST['force_writ_issue']) ? $_POST['force_writ_issue'] : 0; $obj->show_in_summary_doc = isset($_POST['show_in_summary_doc']) ? $_POST['show_in_summary_doc'] : 0; if (empty($_POST["writ_subtype_id"])) { $result = $obj->AddWST(); } else { $obj->writ_subtype_id = $_POST["writ_subtype_id"]; $result = $obj->EditWST(); } echo Response::createObjectiveResponse($result == true ? "true" : "false", $obj->person_type . "-" . $obj->writ_type_id . "-" . $obj->writ_subtype_id); die; }
function SaveMenu() { if (isset($_POST["record"])) { $obj = new FRW_Menus(); PdoDataAccess::FillObjectByJsonData($obj, $_POST["record"]); $st = stripslashes(stripslashes($_POST["record"])); $data = json_decode($st); $obj->ParentID = $data->GroupID; $res = $obj->EditMenu(); } else { $obj = new FRW_Menus(); PdoDataAccess::FillObjectByArray($obj, $_POST); if (isset($_POST["MenuID"]) && $_POST["MenuID"] > 0) { $res = $obj->EditMenu(); } else { $res = $obj->AddMenu(); } } //print_r(ExceptionHandler::PopAllExceptions()); echo Response::createObjectiveResponse($res, ""); die; }
function Next_Corrective_Writ() { $obj = new manage_writ($_POST['writ_id'], $_POST['writ_ver'], $_POST['staff_id']); PdoDataAccess::FillObjectByArray($obj, $_POST); $ret = $obj->Next_Corrective_Writ(); if (!empty($ret->writ_id)) { echo Response::createObjectiveResponse(true, "{WID: " . $ret->writ_id . " , WVER: " . $ret->writ_ver . " , STF:" . $ret->staff_id . " }"); } else { echo Response::createResponse(false, "Stop"); } }
function SaveMessage() { $obj = new OFC_messages(); PdoDataAccess::FillObjectByArray($obj, $_POST); $obj->PersonID = $_SESSION["USER"]["PersonID"]; $obj->MsgDate = PDONOW; $pdo = PdoDataAccess::getPdoObject(); $pdo->beginTransaction(); if (!$obj->Add($pdo)) { $pdo->rollBack(); echo Response::createObjectiveResponse(false, "خطا در ایجاد پیام"); die; } $receivers = json_decode($_POST["receivers"]); foreach ($receivers as $PersonID) { $obj2 = new OFC_MessageReceivers(); $obj2->MessageID = $obj->MessageID; $obj2->PersonID = $PersonID; $obj2->Add($pdo); } if (ExceptionHandler::GetExceptionCount() != 0) { $pdo->rollBack(); echo Response::createObjectiveResponse(false, "خطا در ارسال پیام"); die; } $pdo->commit(); echo Response::createObjectiveResponse(true, ""); die; }
function CreateLoan() { $pdo = PdoDataAccess::getPdoObject(); $pdo->beginTransaction(); $obj = new LON_requests(); PdoDataAccess::FillObjectByArray($obj, $_POST); $obj->LoanID = 1; $obj->BranchID = $_SESSION["accounting"]["BranchID"]; $obj->ReqDate = PDONOW; $result = $obj->AddRequest($pdo); if (!$result) { $pdo->rollBack(); echo Response::createObjectiveResponse(false, "خطا در ایجاد وام"); die; } $pobj = new LON_ReqParts(); $pobj->RequestID = $obj->RequestID; PdoDataAccess::FillObjectByArray($pobj, $_POST); $pobj->PartDate = PDONOW; $pobj->PartDesc = "شرایط اولیه"; $pobj->PayInterval = 1; $pobj->FundWage = $pobj->CustomerWage; $result = $pobj->AddPart(); if (!$result) { $pdo->rollBack(); echo Response::createObjectiveResponse(false, "خطا در ایجاد شرایط وام"); die; } $pdo->commit(); echo Response::createObjectiveResponse(true, ""); die; }
function saveData() { $obj = new manage_person(); PdoDataAccess::FillObjectByArray($obj, $_POST); $obj->birth_date = DateModules::Shamsi_to_Miladi($_POST["birth_date"]); $obj->issue_date = DateModules::Shamsi_to_Miladi($_POST["issue_date"]); $obj->military_from_date = DateModules::Shamsi_to_Miladi($_POST["military_from_date"]); $obj->military_to_date = DateModules::Shamsi_to_Miladi($_POST["military_to_date"]); $obj->person_type = 3; /*$obj = new manage_person($_POST["PersonID"]); $obj->insure_no = $_POST["insure_no"]; $obj->PersonID = $_POST["PersonID"];*/ //---------- control duplicate national_code ---------------------- if ($obj->national_code != "" && $obj->PersonID == "") { $temp = PdoDataAccess::runquery("select * from HRM_persons \n where national_code= ? ", array($obj->national_code)); if (count($temp) != 0) { Response::createObjectiveResponse(false, " این فرد قبلا در سیستم ثبت شده است. "); die; } } //.......................................................................... if (trim($_FILES['ProfPhoto']['name']) == '') { //$message=' نام فایل خالی است '; $PhotoSwitch = FALSE; } elseif ($_FILES['ProfPhoto']['error'] != 0) { $message = ' خطا در ارسال فایل' . $_FILES['ProfPhoto']['error']; } elseif ($_FILES['ProfPhoto']['size'] > $_POST['MAX_FILE_SIZE']) { $message = ' طول فایل بیش از 50 کیلو بایت است '; } elseif (in_array(strtolower(end(explode(".", $_FILES['ProfPhoto']['name']))), array("jpg", "jpeg")) != 1) { $message = "فرمت عکس قابل قبول نمی باشد."; } else { $_size = $_FILES['ProfPhoto']['size']; $_name = $_FILES['ProfPhoto']['tmp_name']; $data = addslashes(fread(fopen($_name, 'r'), $_size)); $PhotoQuery = ""; /* //اگر استاد قبلا عکس داشته است $Photosql = pdodb::getInstance("","","","photo",""); if (count($img_res) > 0){ $PhotoQuery = "UPDATE photo.StaffPhotos SET picture='$data' WHERE PersonID=".$img_res[0]['PersonID']; $auditmessage = 'بروز رسانی عکس'; } else{ $PhotoQuery = "INSERT INTO photo.StaffPhotos (PersonID, picture) VALUES ($HrmsPersonID, '$data')"; $auditmessage = 'اضافه کردن عکس'; } $Photo_res = $Photosql->ExecuteBinary($PhotoQuery); $Photosql->audit($auditmessage); //Added by Bagheri (2013-Oct-23) -- pass is here temporary. $oaPhotoQuery = "UPDATE officeas.uni_pic SET picture='$data' WHERE uid='".$UserID."'"; $oamysql = pdodb::getInstance("172.20.20.36", "picuser", "sp#U12_oA", "officeas"); $oamysql->ExecuteBinary($oaPhotoQuery); $auditmessage = 'ﺏﺭﻭﺯ ﺮﺳﺎﻧی ﻉکﺱ اتوماسیون'; $Photosql->audit($auditmessage); //End of Bagheri. $PhotoSwitch =true; */ } //.......................................................................... if (empty($_POST["PersonID"])) { $staffObject = new manage_staff(); PdoDataAccess::FillObjectByArray($staffObject, $_POST); $obj->PersonID = null; if ($obj->national_code == "") { $obj->national_code = 0; } $return = $obj->AddPerson($staffObject); if ($return === TRUE && $PhotoSwitch !== FALSE) { $qry = " update HRM_persons set picture = '{$data}' where PersonID = " . $obj->PersonID; if (PdoDataAccess::runquery($qry) === false) { $return = false; } } } else { $qry = " select s.* \n\t\t\t from HRM_persons p inner join HRM_staff s \n\t\t\t\t\t\t\t\t\t\t\t\ton p.personid = s.personid and p.person_type = s.person_type\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t where p.personid = " . $obj->PersonID; $ptres = PdoDataAccess::runquery($qry); $return = $obj->EditPerson(); $staffObject = new manage_staff($obj->PersonID, $obj->person_type); PdoDataAccess::FillObjectByArray($staffObject, $_POST); $return = $staffObject->EditStaff(); if ($return === TRUE) { $qry = " update HRM_persons set picture = '{$data}' where PersonID = " . $obj->PersonID; if (PdoDataAccess::runquery($qry) === false) { $return = false; } } } echo $return ? Response::createObjectiveResponse(true, "{PID:" . $obj->PersonID . ",SID:" . $staffObject->staff_id . "}") : Response::createObjectiveResponse(false, ExceptionHandler::GetExceptionsToString("\n")); die; }
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; }
function SavePost() { $obj = new manage_posts(); PdoDataAccess::FillObjectByArray($obj, $_POST); if (isset($_POST['included'])) { $obj->included = 1; } else { $obj->included = 0; } if (isset($_POST['ManagementCoef'])) { $obj->ManagementCoef = 1; } else { $obj->ManagementCoef = 0; } if ($obj->jfid == "-1") { $obj->jfid = PDONULL; } if (empty($_POST["post_id"])) { $obj->parent_path = $_POST["parent_path"] == "" ? $obj->parent_path : $_POST["parent_path"] . "," . $obj->parent_path; $obj->RegDate = date('Y-m-d'); $obj->AddPost(); } else { $obj->post_id = $_POST["post_id"]; $obj->EditPost(); } echo Response::createObjectiveResponse("true", $obj->post_id); die; }
function SaveRole() { $obj = new ACC_roles(); PdoDataAccess::FillObjectByArray($obj, $_POST); $obj->Add(); echo Response::createObjectiveResponse(true, ""); die; }
function saveDocItem() { $obj = new ACC_DocItems(); PdoDataAccess::FillObjectByArray($obj, $_POST); if ($obj->TafsiliType == "") { $obj->TafsiliType = PDONULL; } if ($obj->TafsiliID == "") { $obj->TafsiliID = PDONULL; } if ($obj->TafsiliType2 == "") { $obj->TafsiliType2 = PDONULL; } if ($obj->TafsiliID2 == "") { $obj->TafsiliID2 = PDONULL; } if ($obj->ItemID == "") { $return = $obj->Add(); } else { $return = $obj->Edit(); } if (!$return) { echo Response::createObjectiveResponse(false, ExceptionHandler::GetExceptionsToString()); die; } echo Response::createObjectiveResponse(true, ""); die; }
function SavePerson() { $obj = new BSC_persons(); PdoDataAccess::FillObjectByArray($obj, $_POST); if (isset($_SESSION["USER"]["portal"])) { $obj->PersonID = $_SESSION["USER"]["PersonID"]; } if (empty($obj->PersonID)) { $hash_cost_log2 = 8; $hasher = new PasswordHash($hash_cost_log2, true); $obj->UserPass = $hasher->HashPassword(md5("123456")); } if (isset($_SESSION["USER"]["framework"])) { $obj->IsAgent = !isset($_POST["IsAgent"]) ? "NO" : "YES"; $obj->IsCustomer = !isset($_POST["IsCustomer"]) ? "NO" : "YES"; $obj->IsStaff = !isset($_POST["IsStaff"]) ? "NO" : "YES"; $obj->IsShareholder = !isset($_POST["IsShareholder"]) ? "NO" : "YES"; $obj->IsSupporter = !isset($_POST["IsSupporter"]) ? "NO" : "YES"; $obj->IsExpert = !isset($_POST["IsExpert"]) ? "NO" : "YES"; } if ($obj->PersonID > 0) { $result = $obj->EditPerson(); } else { $result = $obj->AddPerson(); } echo Response::createObjectiveResponse($result, !$result ? ExceptionHandler::GetExceptionsToString() : ""); die; }
/** حق شغل */ private function compute_salary_item2_34($writ_rec) { //param1 : امتیاز //param2 : //param3 : //param4 : //param5 : //param6 : //param7 : if($writ_rec['execute_date'] >='2013-02-19' && $writ_rec['execute_date'] < '2013-03-20' ) { return ; } $job_level = ""; // در وضعیت ثبت حکم پارامتر 4 را از حکم قبلي می خواند //در صورتي که کاربر آن را به روز رساني کند مقدار ثبت شده توسط کاربر مد نظر قرار می گيرد if ($this->param4 === null) { $obj = new manage_writ(); parent::FillObjectByArray($obj, $writ_rec); $prior_writ = $obj->get_prior_writ("","",$writ_rec['execute_date']); if (!empty($prior_writ->writ_id)) { $item34 = new manage_writ_item($prior_writ->writ_id, $prior_writ->writ_ver, $prior_writ->staff_id, 34); if ($item34 && $item34->param4) $this->param4 = $item34->param4; } } $jdate = '1387/12/30'; $date = DateModules::Shamsi_to_Miladi($jdate); $last_writ = manage_writ::get_last_writ_by_date($writ_rec['staff_id'], $date); $max_education_level = $writ_rec['education_level']; $Jexecute_date = DateModules::Miladi_to_Shamsi($writ_rec["execute_date"]); if ($Jexecute_date >= '1388/01/01') $new_emmployee = true; else $new_emmployee = false; $salary_item_type_166 = null; $salary_item_type_12 = null; if (!empty($last_writ->writ_id)) { $salary_item_type_166 = new manage_writ_item($last_writ->writ_id, $last_writ->writ_ver, $last_writ->staff_id, 166); if (empty($salary_item_type_166->salary_item_type_id)) { $salary_item_type_12 = new manage_writ_item($last_writ->writ_id, $last_writ->writ_ver, $last_writ->staff_id, 12); } } // level , job_level $scores = array( 1 => array(1 => 2400, 2 => 2650, 3 => 2650, 4 => 2650, 5 => 2650), 2 => array(1 => 2600, 2 => 2850, 3 => 2850, 4 => 2850, 4 => 2850), 3 => array(1 => 2800, 2 => 3050, 3 => 3050, 4 => 3050, 5 => 3050), 4 => array(1 => 3000, 2 => 3250, 3 => 3600, 4 => 4050, 5 => 4600), 5 => array(1 => 3200, 2 => 3450, 3 => 3800, 4 => 4250, 5 => 4800), 6 => array(1 => 3400, 2 => 3650, 3 => 4000, 4 => 4450, 5 => 5000), 7 => array(1 => 3600, 2 => 3850, 3 => 4200, 4 => 4650, 5 => 5200), 8 => array(1 => 3800, 2 => 4050, 3 => 4400, 4 => 4850, 5 => 5400), 9 => array(1 => 4000, 2 => 4250, 3 => 4600, 4 => 5050, 5 => 5600), 10 => array(1 => 4200, 2 => 4450, 3 => 4800, 4 => 5250, 5 => 5800), 11 => array(1 => 4400, 2 => 4650, 3 => 5000, 4 => 5450, 5 => 6000), 12 => array(1 => 4600, 2 => 4850, 3 => 5200, 4 => 5650, 5 => 6200), 13 => array(1 => 4800, 2 => 5050, 3 => 5400, 4 => 5850, 5 => 6400), 14 => array(1 => 5000, 2 => 5250, 3 => 5600, 4 => 6050, 5 => 6600), 15 => array(1 => 5200, 2 => 5450, 3 => 5800, 4 => 6250, 5 => 6800), 16 => array(1 => 5400, 2 => 5650, 3 => 6000, 4 => 6450, 5 => 7000) ); if (!empty($last_writ->writ_id)) { if ($writ_rec['cur_group'] < 6) $level = 1; else $level = $writ_rec['cur_group'] - 4; } else { if ($writ_rec['cur_group'] < 6) $level = 1; else $level = $writ_rec['cur_group'] - 4; } //در صورتی که به فرد نه ویژه و نه هعمترازی تعلق نگرفته باشد در سطح یک قرار می گیرد. if (!$salary_item_type_12 && !$salary_item_type_166) { $job_level = 1; } //به فرد در آخرین حکم سال 87 ویژه تعلق می گرفته است. $vije_include = false; if ($salary_item_type_166) { if ($salary_item_type_166->param1 >= 600 && $salary_item_type_166->param1 < 1100) { $job_level = 3; $vije_include = true; } else if ($salary_item_type_166->param1 >= 1100 && $salary_item_type_166->param1 < 1600) { $job_level = 4; $vije_include = true; } else if ($salary_item_type_166->param1 >= 1600) { $job_level = 5; $vije_include = true; } } //به فرد در آخرین حکم سال 87 تفاوت همترازی تعلق گرفته است. if ($salary_item_type_12 && !empty($salary_item_type_12->writ_id)) { $person_devotions = manage_person_devotion::get_person_devotions($writ_rec["PersonID"], "(" . SACRIFICE_DEVOTION . ")"); $person_family_shohada = manage_person_devotion::get_person_devotions($writ_rec['PersonID'], '(' . BEHOLDER_FAMILY_DEVOTION . ')', BOY . ',' . DAUGHTER); if (($max_education_level == 500 || $max_education_level == 501)) { $coef = 3; $vije_include = true; } else if ($max_education_level > 501) { $coef = 4; $vije_include = true; } if (count($person_devotions) != 0 || count($person_family_shohada) != 0) { $coef++; } if ($coef) { $job_level = $coef; } } if ($writ_rec['person_type'] != 1 && $job_level > 4) { $job_level = 4; } if ($writ_rec['onduty_year'] >= 30) { $writ_rec['onduty_year'] = 30; $writ_rec['onduty_month'] = 0; $writ_rec['onduty_day'] = 0; } if (!$vije_include) { $related_onduty_year = ($writ_rec['related_onduty_year'] + ($writ_rec['related_onduty_month'] / 12) + ($writ_rec['related_onduty_day'] / 365.25)) / 6; if ($new_emmployee) $coef = 1 / 12; else $coef = 0.1; $onduty_year = (($writ_rec['onduty_year'] - $writ_rec['related_onduty_year']) + (($writ_rec['onduty_month'] - $writ_rec['related_onduty_month']) / 12) + (($writ_rec['onduty_day'] - $writ_rec['related_onduty_month']) / 365.25)) * $coef; // احتساب مضاعف سنوات آزادگان $dev_add_coef = 0; $person_devotions = manage_person_devotion::get_person_devotions($writ_rec["PersonID"], "(" . FREEDOM_DEVOTION . ")"); $person_family_shohada = manage_person_devotion::get_person_devotions($writ_rec['PersonID'], '(' . BEHOLDER_FAMILY_DEVOTION . ')', BOY . ',' . DAUGHTER); if ( ( count($person_devotions) > 0 && $person_devotions[0]['amount'] > 0 ) || count($person_family_shohada) > 0 ) $dev_add_coef = 1; $job_level += floor(($related_onduty_year + $onduty_year) * (1 + $dev_add_coef)); if ($writ_rec['person_type'] != 1 && $job_level > 4) { $job_level = 4; } $result = manage_posts::get_job_fields($writ_rec['post_id']); if ($result) $jl = $result["job_level"]; else $jl = JOB_LEVEL_COMMON; if ($max_education_level < 400 && $jl < JOB_LEVEL_BS) $job_level = min(array($job_level, 2)); else $job_level = min(array($job_level, 3)); } if (!empty($this->param4)) { $job_level = $this->param4; } else { //...... چنانچه دستی وارد نشده باشد از اولین حکم در سال 88 رتبه مربوطه برداشته می شود ........ $MyQry = "select wsi.param3 from writs w inner join writ_salary_items wsi on w.writ_id = wsi.writ_id and w.writ_ver = wsi.writ_ver where w.staff_id = " . $writ_rec['staff_id'] . " and w.execute_date >= '2009-03-21' and ( w.history_only <> 1 or w.history_only is null ) and wsi.salary_item_type_id = 34 order by w.execute_date ASC limit 1 "; $MyRes = parent::runquery($MyQry); if ($MyRes[0]['param3'] > 0) $job_level = round($MyRes[0]['param3']); } //.......................................... $score = !empty($job_level) ? $scores[$level][$job_level] : 0; $rial_coef = manage_salary_params::get_salaryParam_value("", $writ_rec["person_type"].",101", SPT_RIAL_COEF, $writ_rec["execute_date"]); // echo $rial_coef ."idkjf"; die(); $value = $score * $rial_coef; if (!($value > 0)) { return false; } $this->param1 = $score; $this->param2 = $level; $this->param3 = $job_level; return $value; }
static function register($user, $pass) { $temp = PdoDataAccess::runquery("select * from BSC_persons where UserName=?", array($user)); if (count($temp) > 0) { return "DuplicateUserName"; } else { $hash_cost_log2 = 8; $hasher = new PasswordHash($hash_cost_log2, true); $obj = new BSC_persons(); PdoDataAccess::FillObjectByArray($obj, $_POST); $obj->UserPass = $hasher->HashPassword($pass); $obj->IsCustomer = "YES"; $obj->AddPerson(); $temp = PdoDataAccess::runquery("select * from BSC_persons where UserName=?", array($user)); $_SESSION['USER'] = $temp[0]; $_SESSION['USER']["framework"] = true; $_SESSION['USER']["portal"] = true; //.......................................................... if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { if (strlen($_SERVER['HTTP_X_FORWARDED_FOR']) > 15) { $_SESSION['LIPAddress'] = substr($_SERVER['HTTP_X_FORWARDED_FOR'], 0, strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')); } else { $_SESSION['LIPAddress'] = $_SERVER['HTTP_X_FORWARDED_FOR']; } } else { $_SESSION['LIPAddress'] = $_SERVER['REMOTE_ADDR']; } //.......................................................... return true; } }
function SavePlanExpert() { $obj = new PLN_experts(); PdoDataAccess::FillObjectByArray($obj, $_POST); if (empty($obj->RowID)) { $obj->RegDate = PDONOW; $result = $obj->Add(); } else { $result = $obj->Edit(); } echo Response::createObjectiveResponse($result, ExceptionHandler::GetExceptionsToString()); die; }
/** * اين تابع بررسي مي کند که در زمان شروع اصلاح حکمي و جود دارد يا خير ؟ * * @param $staff_id * @param $corrective_date * @return اگر حکمی وجود داشته باشد رکورد آن را برمی گرداند در غیر اینصورت null برمی گرداند */ public static function Is_Writ_For_Correct($staff_id, $corrective_date) { $corrective_date = DateModules::Shamsi_to_Miladi($corrective_date); $query = " SELECT *\n\t\t \t\t FROM writs\n\t\t \t WHERE staff_id = " . $staff_id . " AND\n\t\t \t \t\t execute_date = '" . $corrective_date . "' AND\n\t\t \t \t\t history_only <> 1\n\t\t \t ORDER BY writ_id , writ_ver DESC "; $temp = parent::runquery($query); if (count($temp) != 0) { $ObjWrt = new manage_writ(); parent::FillObjectByArray($ObjWrt, $temp[0]); return $ObjWrt; } else { return NULL; } }