private function compute_salary_item2_19($writ_rec) { //param1 : حقوق مبنا + افزايش سنواتي + فوق العاده شغل + حداقل دريافتي + فوق العاده شغل برجسته //param2 : ضريب فوق العاده جذب ويژه //param3 : نمره ارزشيابي //در صورتي که شخص جانباز باشد از ضريب يک مقطع بالاتر استفاده مي کند. // بنا به درخواست آقای دلکلاله برای همه افراد دیده می شود . // if($writ_rec['person_type'] != HR_CONTRACT && $writ_rec['person_type'] != HR_WORKER ) { $qry = " SELECT pd.personid FROM person_devotions pd WHERE (pd.devotion_type IN (" . DEVOTION_TYPE_WOUNDED . "," . DEVOTION_TYPE_PRISONER . ") OR (pd.devotion_type = " . BEHOLDER_FAMILY_DEVOTION . " AND (pd.personel_relation = " . BOY . " OR pd.personel_relation = " . DAUGHTER . "))) AND pd.PersonID = " . $writ_rec['personID']; $resDev = parent::runquery($qry); if (count($resDev) > 0) $personDev = true; else $personDev = false; // } // else // { // $personDev = false ; //} //.......................................................... //چون فرمول براي قبل از سال 85 و بعد از آن متفاوت است کد به صورت زير اصلاح شد. $jexecute_date = DateModules::Miladi_to_Shamsi($writ_rec['execute_date']); list($year, $month, $day) = explode('/', $jexecute_date); $education_level = $writ_rec['education_level']; if ($year <= 1384) { //در صورتي که شخص جانباز باشد از ضريب يک مقطع بالاتر استفاده مي کند. //$person_devotions = manage_person_devotion::get_person_devotions($writ_rec["PersonID"], // '('.DEVOTION_TYPE_WOUNDED.','.DEVOTION_TYPE_PRISONER.')'); //حقوق مبنا + افزايش سنواتي + حداقل دريافتي + فوق العاده شغل + فوق العاده شغل برجسته $this->param1 = manage_writ_item::compute_writ_items_sum($writ_rec["writ_id"], $writ_rec["writ_ver"], $writ_rec["staff_id"], '( ' . SIT_STAFF_BASE_SALARY . ' , ' . SIT_STAFF_ANNUAL_INC . ' , ' . SIT_STAFF_JOB_EXTRA . ' , ' . SIT_STAFF_DOMINANT_JOB_EXTRA . ' , ' . SIT_STAFF_MIN_PAY . ' )'); //در صورتي که مجموع اقلام فوق کمتر از حداقل دريافتي شود //حداقل دريافتي براي محاسبات ملاک خواهد بود. $min_salary = manage_salary_params::get_salaryParam_value("", $writ_rec["person_type"].",101", SPT_MIN_SALARY, $writ_rec['execute_date']); if ($this->param1 < $min_salary) $this->param1 = $min_salary; if (($education_level <= EDUCATION_LEVEL_SEVENTH_GRADE && $education_level != EDUCATION_LEVEL_NEW_END_HIGH_SCHOOL) && $personDev == true) { $this->param2 = 0.40; } else if (($education_level <= EDUCATION_LEVEL_SEVENTH_GRADE && $education_level != EDUCATION_LEVEL_NEW_END_HIGH_SCHOOL)) { $this->param2 = 0.35; } else if (($education_level <= EDUCATION_LEVEL_THIRTH_HONARESTAN && $education_level != EDUCATION_LEVEL_NEW_END_HIGH_SCHOOL) && $personDev == true) { $this->param2 = 0.50; } else if (($education_level <= EDUCATION_LEVEL_THIRTH_HONARESTAN && $education_level != EDUCATION_LEVEL_NEW_END_HIGH_SCHOOL)) { $this->param2 = 0.40; } else if (($education_level <= EDUCATION_LEVEL_ALL_DIPLOMA || $education_level == EDUCATION_LEVEL_NEW_END_HIGH_SCHOOL) && $personDev == true) { $this->param2 = 0.65; } else if ($education_level <= EDUCATION_LEVEL_ALL_DIPLOMA || $education_level == EDUCATION_LEVEL_NEW_END_HIGH_SCHOOL) { $this->param2 = 0.50; } else if (($education_level == EDUCATION_LEVEL_HIGH_DIPLOMA || $education_level == EDUCATION_LEVEL_EQUAL_HIGH_DIPLOMA) && $personDev == true) { $this->param2 = 0.85; } else if ($education_level == EDUCATION_LEVEL_HIGH_DIPLOMA || $education_level == EDUCATION_LEVEL_EQUAL_HIGH_DIPLOMA) { $this->param2 = 0.65; } else if (($education_level == EDUCATION_LEVEL_BS || $education_level == EDUCATION_LEVEL_EQUAL_BS) && $personDev == true) { $this->param2 = 1; } else if ($education_level == EDUCATION_LEVEL_BS || $education_level == EDUCATION_LEVEL_EQUAL_BS) { $this->param2 = 0.85; } else if ($education_level == EDUCATION_LEVEL_MS || $education_level == EDUCATION_LEVEL_EQUAL_MS) { $this->param2 = 1; } $writ_year = substr(DateModules::Miladi_to_Shamsi($writ_rec['execute_date']), 0, 4); $writ_year--; $this->param3 = manage_writ_item::get_evaluation_scores_sum($writ_year, $writ_rec['staff_id']); $multiplicant = $this->param2 * ($this->param3 / 100) + 0.0000001; $multiplicant = round($multiplicant, 2); $value = $this->param1 * $multiplicant; if (!($value > 0)) { parent::PushException(SPECIAL_ABSORB_EXTRA_ITEM_CALC_ERR); return false; } } else if ($year >= 1385 && $year < 1388) { $date = DateModules::Shamsi_to_Miladi('1384/12/29'); $last_writ_obj = manage_writ::get_last_writ_by_date($writ_rec['staff_id'], $date); if (!empty($last_writ_obj->writ_id)) { $value = manage_writ_item::get_writSalaryItem_value($last_writ_obj->writ_id, $last_writ_obj->writ_ver, $last_writ_obj->staff_id, SIT_STAFF_HEIAT_OMANA_SPECIAL_EXTRA); } if (!($value > 0)) { parent::PushException(SPECIAL_ABSORB_EXTRA_ITEM_CALC_ERR); return false; } } else if ($year >= 1390) { if ($education_level < EDUCATION_LEVEL_DIPLOMA && $education_level != EDUCATION_LEVEL_NEW_END_HIGH_SCHOOL && $personDev == true) { $education_level = DIPLOMA_LEVEL; } else if ($education_level < EDUCATION_LEVEL_DIPLOMA && $education_level != EDUCATION_LEVEL_NEW_END_HIGH_SCHOOL) { $education_level = UNDER_DIPLOMA_LEVEL; } else if (($education_level <= EDUCATION_LEVEL_ALL_DIPLOMA || $education_level == EDUCATION_LEVEL_THREE_YEAR_HIGH_SCHOOL || $education_level == EDUCATION_LEVEL_THREE_YEAR_HIGH_SCHOOL_WITHOUT_SCORE || $education_level == EDUCATION_LEVEL_NEW_END_HIGH_SCHOOL) && $personDev == true) { $education_level = HIGH_DIPLOMA_LEVEL; } else if ($education_level <= EDUCATION_LEVEL_ALL_DIPLOMA || $education_level == EDUCATION_LEVEL_THREE_YEAR_HIGH_SCHOOL || $education_level == EDUCATION_LEVEL_THREE_YEAR_HIGH_SCHOOL_WITHOUT_SCORE || $education_level == EDUCATION_LEVEL_NEW_END_HIGH_SCHOOL) { $education_level = DIPLOMA_LEVEL; } else if (($education_level == EDUCATION_LEVEL_HIGH_DIPLOMA || $education_level == EDUCATION_LEVEL_EQUAL_HIGH_DIPLOMA) && $personDev == true) { $education_level = BS_LEVEL; } else if ($education_level == EDUCATION_LEVEL_HIGH_DIPLOMA || $education_level == EDUCATION_LEVEL_EQUAL_HIGH_DIPLOMA) { $education_level = HIGH_DIPLOMA_LEVEL; } else if (($education_level == EDUCATION_LEVEL_BS || $education_level == EDUCATION_LEVEL_EQUAL_BS) && $personDev == true) { $education_level = MS_LEVEL; } else if ($education_level == EDUCATION_LEVEL_BS || $education_level == EDUCATION_LEVEL_EQUAL_BS) { $education_level = BS_LEVEL; } else if (($education_level == EDUCATION_LEVEL_MS || $education_level == EDUCATION_LEVEL_HOZE_LEVEL3_EQUAL_MS || $education_level == EDUCATION_LEVEL_EQUAL_MS) && $personDev == true) { $education_level = PHD_LEVEL; } else if ($education_level == EDUCATION_LEVEL_MS || $education_level == EDUCATION_LEVEL_HOZE_LEVEL3_EQUAL_MS || $education_level == EDUCATION_LEVEL_EQUAL_MS) { $education_level = MS_LEVEL; } else if ($education_level >= EDUCATION_LEVEL_DOCTORATE) { $education_level = PHD_LEVEL; } switch ($education_level) { case PHD_LEVEL : $this->param1 = 'دکتری'; break; case MS_LEVEL : $this->param1 = 'کارشناسی ارشد'; break; case BS_LEVEL : $this->param1 = 'کارشناسی'; break; case HIGH_DIPLOMA_LEVEL : $this->param1 = 'فوق دیپلم'; break; case DIPLOMA_LEVEL : $this->param1 = 'دیپلم'; break; case UNDER_DIPLOMA_LEVEL : $this->param1 = 'زیر دیپلم'; break; } $this->param4 = $writ_rec['onduty_year'] . ' سال و ' . $writ_rec['onduty_month'] . ' ماه و ' . $writ_rec['onduty_day'] . ' روز'; //بررسی سنوات خدمت و اختلاف آن با سنوات خدمت در حکم. unset($duty_duration); $duty_duration_year = 0; $duty_duration_month = 0; $duty_duration_day = 0; $duty_qry = " SELECT s.work_start_date, p.military_duration, p.military_duration_day FROM staff s INNER JOIN persons p ON (s.PersonID = p.PersonID) WHERE s.staff_id = " . $writ_rec['staff_id']; $duty_res = parent::runquery($duty_qry); if ($duty_res[0]['work_start_date']) { $duty_duration = DateModules::GDateMinusGDate($writ_rec['execute_date'], $duty_res[0]['work_start_date']) + (floor($duty_res[0]['military_duration'] * 30.4375 + $duty_res[0]['military_duration_day'])) + 1; $duty_duration_year = floor($duty_duration / 366.25); $duty_duration_month = floor(($duty_duration - ($duty_duration_year * 366.25)) / 30); $duty_duration_day = floor($duty_duration - ($duty_duration_year * 366.25) - floor($duty_duration_month * 30)); } $emp_qry = " SELECT SUM(pe.retired_duration_year) retired_duration_year, SUM(pe.retired_duration_month) retired_duration_month, SUM(pe.retired_duration_day) retired_duration_day FROM person_employments pe WHERE pe.PersonID = " . $writ_rec['PersonID']; $emp_res = parent::runquery($emp_qry); $duty_duration_year += $emp_res[0]['retired_duration_year']; $duty_duration_month += $emp_res[0]['retired_duration_month']; $duty_duration_day += $emp_res[0]['retired_duration_day']; //........................................................................... if ($duty_duration_day >= 30) { $duty_duration_month += floor($duty_duration_day / 30); $duty_duration_day -= floor(floor($duty_duration_day / 30) * 30); } if ($duty_duration_month >= 12) { $duty_duration_year += floor($duty_duration_month / 12); $duty_duration_month -= floor($duty_duration_month / 12) * 12; } $this->param2 = $duty_duration_year . ' سال و ' . $duty_duration_month . ' ماه و ' . $duty_duration_day . ' روز'; $pqry = " SELECT value FROM salary_params sp WHERE sp.param_type = " . SPT_HEIAT_OMANA_ABSORBTION_VALUE . " AND sp.person_type = ".$writ_rec['person_type']." AND sp.from_date <= '" . $writ_rec['execute_date'] . "' AND sp.to_date >= '" . $writ_rec['execute_date'] . "' AND sp.dim1_id = " . $education_level . " AND sp.dim2_id > " . $writ_rec['onduty_year'] . " ORDER BY sp.from_date DESC,sp.to_date DESC, dim2_id LIMIT 1 "; $pres = parent::runquery($pqry); if (count($pres) < 1) { parent::PushException(NOT_DEFINE_HEIAT_OMANA_PARAM); return false; } $value = $pres[0]['value']; $this->param3 = $value; } return $value; }