private function OnBeforeInsert() { $query = "select w.writ_id, w.writ_ver, w.execute_date, w.staff_id, s.personID, w.person_type, w.cur_group, w.education_level, w.onduty_year, w.onduty_month, w.onduty_day, w.family_responsible, w.included_children_count, w.post_id, j.job_group, w.emp_mode, w.emp_state, w.job_id, w.marital_status, p.PersonID, p.military_duration, p.military_duration_day, p.birth_city_id, p.locality_type, p.sex, s.last_retired_pay , sit.salary_item_type_id, sit.salary_compute_type, sit.multiplicand, sit.function_name, sit.user_data_entry, sit.editable_value, s.work_start_date , bf.param1 master_education_level, sit.person_type as sp_person_type from HRM_writs w inner join HRM_staff s on s.staff_id = w.staff_id inner join HRM_persons p on p.personid = s.personid and p.person_type = s.person_type join BaseInfo bf on(bf.TypeID=56 AND bf.InfoID=w.education_level) left join HRM_jobs j on(j.job_id=w.job_id),HRM_salary_item_types sit where w.writ_id = " . $this->writ_id . " and w.writ_ver = " . $this->writ_ver . " and w.staff_id =" . $this->staff_id . " and sit.salary_item_type_id = " . $this->salary_item_type_id; $baseInfo = parent::runquery($query); if (count($baseInfo) == 0) return true; // ----- در صورتی که حکم خودکار است روال مربوط به محاسبه قلم فراخوانی می شود ------------------ if (manage_writ::is_auto_writ($baseInfo[0]['execute_date'], $baseInfo[0]['person_type']) !== false) { $value = $this->calculate_writ_item_value($baseInfo[0]); if ($value === false) { return false; } if (($baseInfo[0]['user_data_entry'] == USER_DATA_ENTRY || $baseInfo[0]['editable_value'] ) && isset($_POST['isset_by_user']) && $this->value > 0) { $this->base_value = $value; } else { $this->base_value = $value; $this->value = $value; } } return true; }
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; } $time_limited = $FullWrt[0]['time_limited']; //$drp_MaritalStatus = manage_domains::DRP_MaritalStatus("marital_status",$objWrt->marital_status); //$drp_educ = manage_domains::DRP_EducLevel("education_level",$objWrt->education_level,"with:50%"); //$studyFielsArr = manage_domains::DRP_StudyField_StudyBranch("form_WritForm","sfid", "sbid",$objWrt->sfid, $objWrt->sbid); //$writTypeArr = manage_domains::DRP_writType_writSubType("form_WritForm", "writ_type_id", "writ_subtype_id",$objWrt->writ_type_id ,$objWrt->writ_subtype_id);