/** مزد سنوات */ private function compute_salary_item5_39($writ_rec) { // should be deleted at the first of 91 ------------------------------------------ $MONTH_DAY_COUNT = ($writ_rec["person_type"] == HR_WORKER) ? 31 : MONTH_DAY_COUNT; if ($writ_rec['execute_date'] >= '2012-03-20') { $MONTH_DAY_COUNT = 30; } //param1 : افزايش سنواتي سال قبل //param2 : نرخ سنوات امسال //param3 : تعداد روزهاي ماه $this_writ_year = substr(DateModules::miladi_to_shamsi($writ_rec['execute_date']), 0, 4); $one_year_ago = $this_writ_year - 1; $one_year_ago_first_day = $one_year_ago . "-01-01"; $one_year_ago_last_day_writ = $one_year_ago . "-12-29"; $Gone_year_ago_first_day = DateModules::shamsi_to_miladi($one_year_ago_first_day); $Gone_year_ago_last_day = DateModules::shamsi_to_miladi($one_year_ago_last_day_writ); if ($this_writ_year >= '1389') { //آخرين حکم قبل از سال شخص را استخراج مي کند. $prior_writ_rec = manage_writ::get_last_writ_by_date($writ_rec['staff_id'],$Gone_year_ago_last_day); //'2013-02-18' //در بدو استخدام سنوات به شخص تعلق نمي گيرد. if ($prior_writ_rec->writ_id == "") return 0; //end } $annual_rate = manage_salary_params::get_salaryParam_value("", $writ_rec['person_type'].",101", SPT_GROUP1_ANNUAL_RATE, $writ_rec['execute_date'], $writ_rec['job_group']); if (!(0 < $annual_rate)) { parent::PushException(UNKNOWN_GROUP1_ANNUAL_RATE); return false; } if ($this_writ_year >= '1389') { if ($prior_writ_rec->writ_id != "") $prior_annual_inc = manage_writ_item::get_writSalaryItem_value($prior_writ_rec->writ_id, $prior_writ_rec->writ_ver, $prior_writ_rec->staff_id, SIT_STAFF_DEFINED_ANNUAL_INC); else $prior_annual_inc = 0; } else { $prior_annual_inc = 0; } $work_start_date = $writ_rec["work_start_date"]; if ($this_writ_year >= '1389') $year_work_days = manage_writ::compute_year_work_days($Gone_year_ago_first_day, $Gone_year_ago_last_day, $writ_rec['staff_id']); else $year_work_days = manage_writ::compute_year_work_days($work_start_date, $Gone_year_ago_last_day, $writ_rec['staff_id']); if ($year_work_days > 365 && $writ_rec['person_type'] == HR_CONTRACT) { $year_work_days = 360; } $Day_Year = ( $writ_rec['person_type'] == HR_CONTRACT ) ? 360 : 365; if ($writ_rec['person_type'] == HR_CONTRACT) $month_duration = 30; else if ($writ_rec['person_type'] == HR_WORKER) $month_duration = $MONTH_DAY_COUNT; if ($writ_rec['execute_date'] >= '2012-03-20') { $month_duration = 30; } $value = $prior_annual_inc + (($annual_rate * $month_duration) * $year_work_days / $Day_Year ); return $value; }