Пример #1
0
function deleteParam()
{
    $obj = new manage_salary_params();
    $obj->param_id = $_POST["param_id"];
    echo $obj->RemoveParam($obj->param_id) ? "true" : ExceptionHandler::GetExceptionsToString("\n");
    die;
}
Пример #2
0
 public static function simulate_bime($pay_year, $pay_month, $payment_type = NULL)
 {
     $e_date = "31-" . $pay_month . "-" . $pay_year;
     $end_month_date = DateModules::shamsi_to_miladi($e_date);
     $s_date = "1-" . $pay_month . "-" . $pay_year;
     $start_month_date = DateModules::shamsi_to_miladi($s_date);
     $worker_month_day = 30;
     $actual_month_day = DateModules::get_month_dayno($pay_year, $pay_month);
     //...................................
     PdoDataAccess::runquery("DROP TABLE IF EXISTS temp_insure_include_sum ");
     PdoDataAccess::runquery(" DROP TABLE IF EXISTS temp_limit_staff ");
     PdoDataAccess::runquery(" CREATE TEMPORARY TABLE temp_limit_staff AS\r\n\t\t\t\t\t\t\t\tSELECT DISTINCT s.staff_id , s.person_type\r\n\t\t\t\t\t\t\t\tFROM staff s\r\n\t\t\t\t\t\t\t\t\tINNER JOIN staff_include_history si\r\n\t\t\t\t\t\t\t\t\t\tON (s.staff_id = si.staff_id AND si.start_date <= ('{$end_month_date}') AND (si.end_date IS NULL OR si.end_date >= ('{$end_month_date}'))) \r\n\t\t\t\t\t\t\t\tWHERE si.insure_include = 1 ");
     PdoDataAccess::runquery("ALTER TABLE temp_limit_staff ADD INDEX (staff_id)");
     PdoDataAccess::runquery(" CREATE TEMPORARY table temp_insure_include_sum AS\r\n\t\t\t\t\t\t\t\tSELECT s.staff_id ,\r\n\t\t\t\t\t\t\t\t\t\t0 value,\r\n\t\t\t\t\t\t\t\t\t\tsum(pi.pay_value) + CASE WHEN sum(pi.diff_pay_value * pi.diff_value_coef) < 0 THEN 0 ELSE sum(pi.diff_pay_value * pi.diff_value_coef) END param1 ,\r\n\t\t\t\t\t\t\t\t\t\t0 param2 ,\r\n\t\t\t\t\t\t\t\t\t\t0 param3 , \r\n\t\t\t\t\t\t\t\t\t\tCASE WHEN s.person_type = " . HR_WORKER . " THEN {$worker_month_day} ELSE {$actual_month_day} END month_days\r\n\t\t\t\t\t\t\t\tFROM payment_items pi\r\n\t\t\t\t\t\t\t\tINNER JOIN salary_item_types sit\r\n\t\t\t\t\t\t\t\t\tON (pi.salary_item_type_id = sit.salary_item_type_id AND \r\n\t\t\t\t\t\t\t\t\t\tsit.credit_topic = " . CREDIT_TOPIC_1 . " AND \r\n\t\t\t\t\t\t\t\t\t\tsit.insure_include = 1)\r\n\t\t\t\t\t\t\t\tINNER JOIN temp_limit_staff s\r\n\t\t\t\t\t\t\t\t\tON (s.staff_id = pi.staff_id)\r\n\t\t\t\t\t\t\t\tWHERE pi.pay_year = ({$pay_year}) AND \r\n\t\t\t\t\t\t\t\t\tpi.pay_month = ({$pay_month}) AND \r\n\t\t\t\t\t\t\t\t\tpi.payment_type = 1\r\n\t\t\t\t\t\t\t\t\t{$payment_type_where}\r\n\t\t\t\t\t\t\t\tGROUP BY\r\n\t\t\t\t\t\t\t\tstaff_id; ");
     PdoDataAccess::runquery("ALTER TABLE temp_insure_include_sum ADD INDEX (staff_id)");
     $max_daily_salary_insure_include = manage_salary_params::get_salaryParam_value("", 100, SPT_MAX_DAILY_SALARY_INSURE_INCLUDE, $start_month_date);
     PdoDataAccess::runquery(" UPDATE temp_insure_include_sum\r\n\t\t\t\t\t\t\t  SET param1 = {$max_daily_salary_insure_include} * {$worker_month_day} \r\n\t\t\t\t\t\t\t  WHERE param1 > {$max_daily_salary_insure_include} * {$worker_month_day} ");
     //استخراج درصد بیمه بیکاری سهم کارفرما
     $res = PdoDataAccess::runquery("SELECT value\r\n\t\t\t\t\t\t\t\t\tFROM salary_params\r\n\t\t\t\t\t\t\t\t\t\tWHERE from_date <= '" . $start_month_date . "' AND\r\n\t\t\t\t\t\t\t\t\t\t\tto_date >= '" . $end_month_date . "' AND person_type =100 AND \r\n\t\t\t\t\t\t\t\t\t\t\tparam_type = " . SPT_UNEMPLOYMENT_INSURANCE_VALUE);
     $unemployment_insurance_value = $res[0]['value'];
     //استخراج درصد بیمه سهم شخص
     $res = PdoDataAccess::runquery("SELECT value\r\n\t\t\t\t\t\t\t\t\tFROM salary_params\r\n\t\t\t\t\t\t\t\t\tWHERE from_date <= '" . $start_month_date . "' AND\r\n\t\t\t\t\t\t\t\t\t\t\tto_date >= '" . $end_month_date . "' AND person_type =100 AND \r\n\t\t\t\t\t\t\t\t\t\t\tparam_type = " . SPT_SOCIAL_SUPPLY_INSURE_PERSON_VALUE);
     $person_value = $res[0]['value'];
     //استخراج درصد بیمه سهم کارفرما
     $res = PdoDataAccess::runquery("SELECT value\r\n\t\t\t\t\t\t\t\t\tFROM salary_params\r\n\t\t\t\t\t\t\t\t\tWHERE from_date <= '" . $start_month_date . "' AND\r\n\t\t\t\t\t\t\t\t\t\t\tto_date >= '" . $end_month_date . "' AND person_type =100 AND \r\n\t\t\t\t\t\t\t\t\t\t\tparam_type = " . SPT_SOCIAL_SUPPLY_INSURE_EMPLOYER_VALUE);
     $employmer_value = $res[0]['value'];
     PdoDataAccess::runquery(" UPDATE temp_insure_include_sum\r\n\t\t\t\t\t\t\t\tSET value =  param1 * {$person_value} ,\r\n\t\t\t\t\t\t\t\t\tparam2 = param1 * {$employmer_value} ,\r\n\t\t\t\t\t\t\t\t\tparam3 = param1 * {$unemployment_insurance_value} \r\n\t\t\t\t\t\t\t\tWHERE (1=1)");
 }
Пример #3
0
    
    if ($res1[0]['MasterID'] != $res2[0]['MasterID']) {

        $qry = " SELECT doc_date , grade , university_id
				 FROM person_educations  p
									inner join staff s on p.personID = s.PersonID

				 WHERE s.staff_id = " . $_POST['staff_id'] . " and p.education_level =" . $res1[0]['education_level'];

        $res3 = PdoDataAccess::runquery($qry);
        $DayRes = DateModules::GDateMinusGDate($EndDate, $res3[0]['doc_date']);

        DateModules::day_to_ymd($DayRes, $Ryear, $Rmonth, $Rday);

        // مدت سنوات تجربی
        $ValDuty = manage_salary_params::get_salaryParam_value("", 101, 65, $EndDate, ($res1[0]['grade'] + 1), $res1[0]['MasterID']); //manage_salary_params::get_salaryParam_value("", 101, 65, DateModules::Now(), ($res1[0]['grade'] + 1), $res1[0]['MasterID']);



        if ($Ryear >= $ValDuty) {
            $Condition1 = 1; //  احراز شرط اول 
            $Madrak = $res1[0]['MasterID'];
            $totalYear = $Ryear;
        }
    }


if($Condition1 == 0 ) {
     $ConTitle = "  عدم " ; 
     $Madrak = $res2[0]['MasterID'];
     }
Пример #4
0
 function SearchSalaryParam($where = "", $whereParam = array())
 {
     return manage_salary_params::select($where, $whereParam);
 }
Пример #5
0
	private function compute_salary_other_premium5($writ_rec) {

		//$param1 سایر مزایا1
		//$param2 سایر مزایا2
		//$param3
		//$param4
		//$param5


		$edu_main_level = manage_person_education::GetEducationalGroupLevel($writ_rec['education_level'], 'MasterID');


		$Minsalary = manage_salary_params::get_salaryParam_value("", $writ_rec['person_type'].",101", SPT_SAYER_MAZAYA1, $writ_rec['execute_date'], $edu_main_level);

		$Maskan = self::compute_salary_item5_37($writ_rec);
		$Mozdgroup = self::compute_salary_item5_34($writ_rec);

		$this->param1 = $Minsalary - ($Maskan + $Mozdgroup );

		if ($this->param1 < 0)
			$this->param1 = 0;

		$this->param2 = manage_salary_params::get_salaryParam_value("", $writ_rec['person_type'].",101", SPT_SAYER_MAZAYA2, $writ_rec['execute_date'], $edu_main_level);


		$value = $this->param1 + $this->param2;

		if (!($value > 0))
			return 0;
		return $value;
	}
 static function calculate_mission($staff_id, $pay_year, $pay_month, $dayNo, $coef, $IncludeSalary)
 {
     $qry = " select person_type from staff where staff_id = " . $staff_id;
     $res = PdoDataAccess::runquery($qry);
     if ($res[0]['person_type'] == 1) {
         $qry = " select salary_item_type_id , (pay_value ) val \n\t\t\t\t\t\tfrom hrms.payment_items\n\t\t\t\t\t\t\twhere staff_id = {$staff_id} and pay_year = {$pay_year} and pay_month = {$pay_month} and salary_item_type_id in (1,6,22) \n\t\t\t\t\t group by salary_item_type_id ";
         $resItm = PdoDataAccess::runquery($qry);
         if ($pay_year == 1392 && $pay_month < 7) {
             for ($j = 0; $j < count($resItm); $j++) {
                 if ($resItm[$j]['salary_item_type_id'] == 1) {
                     $baseSalary = $resItm[$j]['val'];
                 } else {
                     if ($resItm[$j]['salary_item_type_id'] == 6) {
                         $makhsos = $resItm[$j]['val'];
                     }
                 }
             }
             $IncludeSalary = $baseSalary + $makhsos;
             $value = ($baseSalary + $makhsos) * $dayNo / 20;
         } else {
             if ($pay_year >= 1392 && $pay_month > 7 || $pay_year > 1392) {
                 $baseValue = 3939372;
             } else {
                 return 0;
             }
             $baseSalary = $makhsos = $jazb = 0;
             for ($j = 0; $j < count($resItm); $j++) {
                 if ($resItm[$j]['salary_item_type_id'] == 1) {
                     $baseSalary = $resItm[$j]['val'];
                 } else {
                     if ($resItm[$j]['salary_item_type_id'] == 6) {
                         $makhsos = $resItm[$j]['val'];
                     } else {
                         if ($resItm[$j]['salary_item_type_id'] == 22) {
                             $jazb = $resItm[$j]['val'];
                         }
                     }
                 }
             }
             $IncludeSalary = $baseSalary + $makhsos + $jazb;
             $sumItm = ($baseSalary + $makhsos + $jazb) / 20;
             if ($sumItm > 3939372 * 20 / 100) {
                 $sumItm = 3939372 * 20 / 100;
             }
             $value = $sumItm * $dayNo;
         }
     } else {
         //	echo "-------------------------------<br>" ;
         $minSalary = manage_salary_params::get_salaryParam_value("", 2, SPT_MIN_SALARY, DateModules::shamsi_to_miladi($pay_year . "/" . $pay_month . "/01"));
         if ($pay_month < 7) {
             $day = 31;
         } else {
             if ($pay_month > 6 && $pay_month < 12) {
                 $day = 30;
             } else {
                 if ($pay_month == 12) {
                     $day = 29;
                 }
             }
         }
         $param1 = $minSalary / 20;
         // 4900000
         $qry = " SELECT  insure_include , service_include\n\t\t\t\t\t\tFROM staff_include_history\n\t\t\t\t\t\t\tWHERE  staff_id = {$staff_id} and start_date <='" . DateModules::shamsi_to_miladi($pay_year . "/" . $pay_month . "/01") . "' and\n\t\t\t\t\t\t\t\t(  end_date is null or end_date = '0000-00-00' or end_date >= '" . DateModules::shamsi_to_miladi($pay_year . "/" . $pay_month . "/{$day}") . "' )";
         $res2 = PdoDataAccess::runquery($qry);
         if ($res2[0]['service_include'] == 1) {
             $param2 = manage_payment_calculation::sum_salary_items($pay_year, $pay_month, $staff_id, $res[0]['person_type'], 1);
         }
         if ($res2[0]['insure_include'] == 1) {
             $param2 = manage_payment_calculation::sum_salary_items($pay_year, $pay_month, $staff_id, $res[0]['person_type'], 2);
         }
         $param3 = ($param2 - $minSalary) / 50;
         $IncludeSalary = $param2;
         $param4 = $param1 + $param3;
         $value = ($param4 * $coef + $param4) * intval($dayNo) + $param4 * ($dayNo - intval($dayNo));
         // ضریب منطقه همیشه مقدار دارد ؟؟؟؟؟
         //..................
         $qry = " select  sum(pay_value ) pval \n\t\t\t\t\t\tfrom hrmstotal.payment_items\n\t\t\t\t\t\t\twhere staff_id = {$staff_id} and pay_year = {$pay_year} and pay_month = {$pay_month} and salary_item_type_id in (10364 , 10366 , 10367) \n\t\t\t\t\t  ";
         $result = PdoDataAccess::runquery($qry);
         $MissionVal = $result[0]['pval'] / 20;
         $value = $MissionVal > 724200 ? 724200 : $MissionVal;
     }
     return $value;
 }
Пример #7
0
function compute_salary_item1_01($writ_rec)
{
    //param1 : پايه
    //param2 : عدد مبنا
    //param3 : ضريب حقوق
    if (($writ_rec['emp_state'] == EMP_STATE_SOLDIER_CONTRACTUAL || $writ_rec['emp_state'] == EMP_STATE_ONUS_SOLDIER_CONTRACTUAL || $writ_rec['emp_state'] == EMP_STATE_CONTRACTUAL) && $writ_rec['execute_date'] < str_replace("/", "-", DateModules::shamsi_to_miladi('1389-07-01'))) {
        $base = 1;
    } else {
        $base = $writ_rec['base'];
    }
    $professor_base_number = Get_professor_base_number($writ_rec['science_level']);
    $salary_coef = manage_salary_params::get_salaryParam_value("", HR_PROFESSOR, SPT_SALARY_COEF, $writ_rec['execute_date']);
    if (!$salary_coef) {
        PdoDataAccess::PushException(SALARY_COEF_NOT_FOUND);
        return false;
    }
    //$this->param1 = $base;
    //$this->param2 = $professor_base_number;
    //$this->param3 = $salary_coef;
    $value = $salary_coef * ($professor_base_number + 5 * $base);
    //echo  $value ." value ----<br> ";
    if (!($value > 0)) {
        parent::PushException(BASE_SALARY_CALC_ERR);
        return false;
    }
    if (($writ_rec['emp_state'] == EMP_STATE_SOLDIER_CONTRACTUAL || $writ_rec['emp_state'] == EMP_STATE_ONUS_SOLDIER_CONTRACTUAL || $writ_rec['emp_state'] == EMP_STATE_CONTRACTUAL) && $writ_rec['execute_date'] < '2009-09-23') {
        $value *= 0.95;
    }
    //echo  $value ." value ----<br> "; die();
    return $value;
}