当前位置: 首页>>代码示例>>PHP>>正文


PHP DateModules::getDateDiff方法代码示例

本文整理汇总了PHP中DateModules::getDateDiff方法的典型用法代码示例。如果您正苦于以下问题:PHP DateModules::getDateDiff方法的具体用法?PHP DateModules::getDateDiff怎么用?PHP DateModules::getDateDiff使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DateModules的用法示例。


在下文中一共展示了DateModules::getDateDiff方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: OnBeforeInsert

 function OnBeforeInsert()
 {
     if ($this->duration_year == 0 && $this->duration_month == 0 && $this->duration_day == 0) {
         $duration = DateModules::getDateDiff($this->to_date, $this->from_date);
         $this->group_duration_year = $this->retired_duration_year = $this->duration_year = floor($duration / 360);
         $this->group_duration_month = $this->retired_duration_month = $this->duration_month = floor(($duration - $this->duration_year * 360) / 30);
         $this->group_duration_day = $this->retired_duration_day = $this->duration_day = $duration - $this->duration_year * 360 - $this->duration_month * 30;
     }
     if ($this->emp_state == EMP_STATE_NONE_GOVERNMENT) {
         $this->retired_duration_year = 0;
         $this->retired_duration_month = 0;
         $this->retired_duration_day = 0;
     }
     return true;
 }
开发者ID:jafarkhani,项目名称:rtfund,代码行数:15,代码来源:employment.class.php

示例2: compute_salary_item2_02


//.........这里部分代码省略.........
				for ($i = 0; $i < count($temp); $i++) {
					switch ($temp[$i]['devotion_type']) {
						case DEVOTION_TYPE_FIGHTER://رزمندگي
							//جبهه : ماهي 5/0% سالي 6% (سوابق تا قبل از 29/5/69
							$this->param2 += ($temp[$i]['amount'] / 30) * 0.005;
							break;
						case DEVOTION_TYPE_PRISONER://آزادگي
							//- آزادگي : ماهي 0.5% سالي 6%
							$this->param2 += ($temp[$i]['amount'] / 30) * 0.005;
							break;
						case DEVOTION_TYPE_WOUNDED://جانبازي
							//- جانبازي : هر 1% جانبازي 6/0%
							$this->param2 += $temp[$i]['amount'] * 0.006;
							break;
					}
				}
			}
			//____________________________________________
			// حقوق مبنا
			$base_salary = manage_writ::get_base_salary($writ_rec["writ_id"], $writ_rec["writ_ver"], $writ_rec["staff_id"], $writ_rec["person_type"]);

			if (in_array($writ_rec['person_type'], array(1, 2, 3))) {
				// حقوق مبنا بدون گروه تشویقی
				$nh_base_salary = manage_writ::get_base_salary($writ_rec["writ_id"], $writ_rec["writ_ver"], $writ_rec["staff_id"], $writ_rec["person_type"], false);
			}
			$value = $base_salary * $this->param2;
			if (in_array($writ_rec['person_type'], array(1, 2, 3))) {
				$this->param4 = $nh_base_salary * $this->param2;
			}

			return $value;
		}
		//احكام طول دوره خدمت
		else {
			//افزايش سنواتي سال قبل
			$obj = new manage_writ_item($prior_writ->writ_id, $prior_writ->writ_ver, $prior_writ->staff_id,
							($prior_writ->person_type == 5 ) ? SIT5_STAFF_ANNUAL_INC : SIT_STAFF_ANNUAL_INC);
			$this->param1 = $obj->value;
			$this->param2 = $obj->param2;
			$this->param3 = $obj->param3;
			$this->param4 = $obj->param4;
			$this->param5 = $obj->param5;
			$this->param6 = $obj->param6;
			$this->param7 = $obj->param7;

			if ($writ_rec['emp_mode'] != EMP_MODE_ENGAGEMENT && in_array($writ_rec['person_type'], array(1, 2, 3))) {
				//ضريب افزايش سنواتي سال قبل
				$this->param2 = manage_writ_item::get_annual_coef($prior_writ_year, $writ_rec['staff_id']);
			} else {
				$this->param2 = 0.05;
			}

			if ($writ_rec['execute_date'] < DateModules::Shamsi_to_Miladi('1384/11/12')) {
				//درصد بسيج سال قبل
				$this->param3 = manage_writ_item::get_mobilization_coef($prior_writ_year, $writ_rec['staff_id']);
			} else if (manage_writ_item::get_writSalaryItem_value($writ_rec["writ_id"], $writ_rec["writ_ver"], $writ_rec["staff_id"], 287) > 0)
				$this->param3 = 0;
			else
				$this->param3 = manage_writ_item::get_mobilization_coef($prior_writ_year, $writ_rec['staff_id']);

			$base_salary = manage_writ::get_base_salary($prior_writ->writ_id, $prior_writ->writ_ver, $prior_writ->staff_id, $prior_writ->person_type);

			if (in_array($writ_rec['person_type'], array(1, 2, 3))) {
				$nh_base_salary = manage_writ::get_base_salary($writ_rec["writ_id"], $writ_rec["writ_ver"], $writ_rec["staff_id"], $writ_rec["person_type"], false);
			}

			if (!($base_salary > 0))
				return false;


			$duplicate_duration = 0;
			if (!empty($writ_rec['last_retired_pay'])) {
				if ($writ_rec['last_retired_pay'] >= $Gone_year_ago_first_day &&
						$writ_rec['last_retired_pay'] < $Gone_year_ago_last_day) {
					$jlast_retired_pay = DateModules::Miladi_to_Shamsi($writ_rec['last_retired_pay']);
					$duplicate_duration = ceil(DateModules::getDateDiff($one_year_ago_last_day, $jlast_retired_pay));
				} else if ($writ_rec['last_retired_pay'] <= $Gone_year_ago_first_day) {
					$duplicate_duration = 360;
				}
			}

			$year_work_days = manage_staff::compute_year_work_days($writ_rec['staff_id'], $Gone_year_ago_first_day, $Gone_year_ago_last_day);
			if ($year_work_days > 360) {
				$year_work_days = 360;
			}
			//نسبت کارکرد در سال قبل.
			$annual_inc_duration = ($year_work_days + $duplicate_duration) / 360;

			//فرمول محاسبه براي سال دوم به بعد.
			$value = (($base_salary + $this->param1) * $this->param2 * $annual_inc_duration) +
					($this->param3 * $base_salary ) + $this->param1;

			if (in_array($writ_rec['person_type'], array(1, 2, 3))) {
				$this->param4 = (($nh_base_salary + $this->param1) * $this->param2 * $annual_inc_duration) +
						$this->param1;
			}
		}

		return $value;
	}
开发者ID:jafarkhani,项目名称:rtfund,代码行数:101,代码来源:writ_item.class.php

示例3: elseif

                    $prof2 = '<tr><td style="background-color:#F0F3FF">سمت اجرايي :</td><td style="font-weight:bold"></td>
							  <td style="background-color:#F0F3FF">تاريخ سمت اجرايي :</td><td style="font-weight:bold"></td></tr>';
                }
            }
            $ptitle = "";
            if ($valid_writs[$k - 1][person_type] == HR_WORKER) {
                $ptitle = 'عنوان شغل';
            } elseif ($valid_writs[$k - 1][person_type] == HR_PROFESSOR) {
                $ptitle = 'عنوان پست';
            } elseif ($valid_writs[$k - 1][person_type] == HR_EMPLOYEE) {
                $ptitle = 'عنوان حکم';
            }
            $tags = array('<!--post_title-->' => $ptitle, '<!--fname-->' => $valid_writs[$k - 1][pfname], '<!--lname-->' => $valid_writs[$k - 1][plname], '<!--father_name-->' => $valid_writs[$k - 1][father_name], '<!--staff_id-->' => $valid_writs[$k - 1][staff_id], '<!--birth_date-->' => DateModules::miladi_to_shamsi($valid_writs[$k - 1][birth_date]), '<!--birth_place-->' => $valid_writs[$k - 1][birth_place], '<!--idcard_no-->' => $valid_writs[$k - 1][idcard_no], '<!--national_code-->' => $valid_writs[$k - 1][national_code], '<!--prof1-->' => $prof1, '<!--worktime_type-->' => $valid_writs[$k - 1][worktime_type_title], '<!--military_type-->' => $valid_writs[$k - 1][military_type_title], '<!--education_level-->' => $valid_writs[$k - 1][education_level_title], '<!--field_title-->' => $valid_writs[$k - 1][sf_sb_title], '<!--doc_date-->' => DateModules::miladi_to_shamsi($valid_writs[$k - 1][doc_date]), '<!--studyPlace-->' => $valid_writs[$k - 1][study_palce], '<!--razm-->' => $valid_writs[$k - 1][razmAmount], '<!--janbaz-->' => $valid_writs[$k - 1][janbazAmount], '<!--unit-->' => $valid_writs[$k - 1][unitName], '<!--emp_state-->' => $valid_writs[$k - 1][emp_state_title], '<!--post_no-->' => $valid_writs[$k - 1][post_no], '<!--last_post_title-->' => $valid_writs[$k - 1][post_title], '<!--prof2-->' => $prof2, '<!--unit_Title-->' => $valid_writs[$k - 1][Unit_Title], '<!--caption-->' => $valid_writs[$k - 1][person_type] == HR_EMPLOYEE ? "عنوان حکم :" : "عنوان پست :", '<!--now-->' => DateModules::shNow());
            if (isset($_REQUEST['Param1']) && $_REQUEST['Param1'] == 2) {
                $TodayDate = DateModules::Now();
                $totalDay = DateModules::getDateDiff($TodayDate, $valid_writs[$k - 1][birth_date]);
                $yAge = (int) ($totalDay / 365.25);
                $mAge = (int) (($totalDay - $yAge * 365.25) / 30.4375);
                $dAge = round($totalDay - $yAge * 365.25 - $mAge * 30.4375);
                $report .= "<tr>\n\t\t\t\t\t\t\t<td>" . $valid_writs[$k - 1][staff_id] . "</td>\n\t\t\t\t\t\t\t<td>" . $valid_writs[$k - 1][pfname] . "</td>\n\t\t\t\t\t\t\t<td>" . $valid_writs[$k - 1][plname] . "</td>\n\t\t\t\t\t\t\t<td>" . DateModules::miladi_to_shamsi($valid_writs[$k - 1][birth_date]) . "</td>\n\t\t\t\t\t\t\t<td>" . $valid_writs[$k - 1][Unit_Title] . "</td> \n\t\t\t\t\t\t\t<td>" . $valid_writs[$k - 1][science_level_title] . "</td> \n\t\t\t\t\t\t\t<td>" . $valid_writs[$k - 1][national_code] . "</td>\n\t\t\t\t\t\t\t<td>" . $yAge . " سال و " . $mAge . " ماه و " . $dAge . " روز" . "</td>\n\t\t\t\t\t\t";
            }
            // مشخص کردن فایل template  مربوط به خلاصه پرونده
            if (isset($_REQUEST['Param1']) && $_REQUEST['Param1'] == 2) {
                $content = file_get_contents("../../reports/employment_history.htm");
            } else {
                $content = file_get_contents("../../reports/summary_doc.htm");
            }
            $content = str_replace(array_keys($tags), array_values($tags), $content);
            //......................................
            $keys = array_keys($history_row);
            sort($keys);
开发者ID:jafarkhani,项目名称:rtfund,代码行数:31,代码来源:summary_doc.php

示例4: compute_year_work_days

 public static function compute_year_work_days($start_date, $end_date, $staff_id)
 {
     //احکام موجود در اين بازه تاريخي را استخراج مي کند.
     $query = " select wst.annual_effect,w.execute_date\n                   from  writs  w\n\t\t\t\t\t\tINNER JOIN writ_subtypes  wst\n                                      ON (w.writ_type_id = wst.writ_type_id AND\n                                          w.writ_subtype_id = wst.writ_subtype_id AND\n                                          w.person_type = wst.person_type)\n                   where  execute_date >= '{$start_date}' AND\n                          execute_date <= '{$end_date}'    AND\n                    \n                         (history_only !=" . HISTORY_ONLY . " OR history_only is null ) AND\n                          staff_id = {$staff_id}\n                   order by  execute_date  ";
     $writ_recSet = PdoDataAccess::runquery($query);
     $writ_duration = 0;
     $duration = 0;
     $prev_end_date = null;
     for ($i = 0; $i < count($writ_recSet); $i++) {
         if ($i + 1 < count($writ_recSet)) {
             $writ_duration = DateModules::getDateDiff(DateModules::miladi_to_shamsi($writ_recSet[$i + 1]['execute_date']), DateModules::miladi_to_shamsi($writ_recSet[$i]['execute_date']));
             if ($prev_end_date == $writ_recSet[$i]['execute_date']) {
                 $writ_duration--;
             }
             $prev_end_date = $writ_recSet[$i + 1]['execute_date'];
         } else {
             $writ_duration = DateModules::getDateDiff(DateModules::miladi_to_shamsi($end_date), DateModules::miladi_to_shamsi($writ_recSet[$i]['execute_date']));
             if ($prev_end_date == $writ_recSet[$i]['execute_date']) {
                 $writ_duration--;
             }
         }
         switch ($writ_recSet[$i]['annual_effect']) {
             case HALF_COMPUTED:
                 $writ_duration *= 0.5;
                 break;
             case DOUBLE_COMPUTED:
                 $writ_duration *= 2;
                 break;
             case NOT_COMPUTED:
                 $writ_duration = 0;
                 break;
         }
         $duration += $writ_duration;
     }
     $duration++;
     return $duration;
 }
开发者ID:jafarkhani,项目名称:rtfund,代码行数:37,代码来源:writ.class.php

示例5: round

        $d = round(($total - $y * 365 - $m * 30));


        $temp[$i]["s1"] = str_pad($y, 2, "0", STR_PAD_LEFT) . "" . str_pad($m, 2, "0", STR_PAD_LEFT) . "" . str_pad($d, 2, "0", STR_PAD_LEFT);
 
        $total_not_rasmi = ($total_not_rasmi_year) * 365 + ($total_not_rasmi_month) * 30 + ($total_not_rasmi_day);
        
               
        //........................................چنانچه سابقه خدمت کمتر از سی باشد بایستی در سنوات غیر رسمی دیده شود..............................
         if( $temp[$i]['last_retired_pay']!="" && $temp[$i]['last_retired_pay']!='0000-00-00') {
             $temp[$i]['last_retired_pay'] = DateModules::miladi_to_shamsi($temp[$i]['last_retired_pay']); 
       
        $sumDays1 = round($total + $total_not_rasmi) ;  
        if( ( 30 * 365 ) > $sumDays1 )  {

            $Diff_To_Now = DateModules::getDateDiff($CurrentDate, $temp[$i]['last_retired_pay']) + 1 ;
            $diffSubDays = ( 30 * 365 ) + 2 - $sumDays1 ; 
            $total_not_rasmi += ( $diffSubDays + $Diff_To_Now ) ; 

        }
            
        }

        if( $temp[$i]['last_retired_pay']=='0000-00-00' || DateModules::shamsi_to_miladi($temp[$i]['last_retired_pay']) >= $CurrentDate  )
            $temp[$i]['last_retired_pay'] = "" ; 
        //......................................................................
            
        $ny = (int) ($total_not_rasmi / 365);
        $nm = (int) (($total_not_rasmi - $ny * 365) / 30);
        $nd = round(($total_not_rasmi - $ny * 365 - $nm * 30));
 
开发者ID:jafarkhani,项目名称:rtfund,代码行数:30,代码来源:retired_info_report.php

示例6: compute_year_work_days

 static function compute_year_work_days($staff_id, $start_date, $end_date)
 {
     //ط§ط­ع©ط§ظ… ظ…ظˆط¬ظˆط¯ ط¯ط± ط§ظٹظ† ط¨ط§ط²ظ‡ طھط§ط±ظٹط®ظٹ ط±ط§ ط§ط³طھط®ط±ط§ط¬ ظ…ظٹ ع©ظ†ط¯.
     $query = "select wst.annual_effect,w.execute_date\n\t    \t\t\tfrom writs w\n\t    \t\t\t\tINNER JOIN writ_subtypes  wst\n\t\t\t\t\t\t\t\t\t  ON (w.writ_type_id = wst.writ_type_id AND \n\t\t\t\t\t\t\t\t\t  \t  w.writ_subtype_id = wst.writ_subtype_id)\n\t\t\t\t\t\twhere execute_date >= '{$start_date}' AND execute_date <= '{$end_date}' AND\n\t                            \n\t                             (history_only !=" . HISTORY_ONLY . " OR history_only is null) AND\n\t                             staff_id = {$staff_id}\n\t\t\t\t\t\torder by execute_date";
     $writDT = PdoDataAccess::runquery($query);
     $writ_duration = 0;
     $duration = 0;
     $prev_end_date = null;
     for ($i = 0; $i < count($writDT); $i++) {
         if ($i + 1 < count($writDT)) {
             $writ_duration = DateModules::getDateDiff(DateModules::Miladi_to_Shamsi($writDT[$i + 1]["execute_date"]), DateModules::Miladi_to_Shamsi($writDT[$i]["execute_date"]));
             if ($prev_end_date == $writDT[$i]['execute_date']) {
                 $writ_duration--;
             }
             $prev_end_date = $writDT[$i + 1]['execute_date'];
         } else {
             $writ_duration = DateModules::getDateDiff(DateModules::Miladi_to_Shamsi($end_date), DateModules::Miladi_to_Shamsi($writDT[$i]["execute_date"]));
             if ($prev_end_date == $writDT[$i]['execute_date']) {
                 $writ_duration--;
             }
             //$prev_end_date = $writ_recSet[$key+1]['execute_date'];
         }
         switch ($writDT[$i]['annual_effect']) {
             case HALF_COMPUTED:
                 $writ_duration *= 0.5;
                 break;
             case DOUBLE_COMPUTED:
                 $writ_duration *= 2;
                 break;
             case NOT_COMPUTED:
                 $writ_duration = 0;
                 break;
         }
         $duration += $writ_duration;
     }
     $duration++;
     return $duration;
 }
开发者ID:jafarkhani,项目名称:rtfund,代码行数:38,代码来源:staff.class.php

示例7: OnBeforeInsert

 function OnBeforeInsert()
 {
     if (($this->devotion_type == FIGHTING_DEVOTION || $this->devotion_type == FREEDOM_DEVOTION || $this->devotion_type == WAR_REGION_WORK_DEVOTION || $this->devotion_type == WAR_REGION_TEACHING_DEVOTION) && (empty($this->from_date) || $this->from_date == '0000-00-00' || empty($this->to_date) || $this->to_date == '0000-00-00')) {
         parent::PushException(START_AND_END_DATE_MUST_NOT_BE_NULL);
         return false;
     }
     if ($this->devotion_type == FIGHTING_DEVOTION || $this->devotion_type == FREEDOM_DEVOTION || $this->devotion_type == WAR_REGION_WORK_DEVOTION || $this->devotion_type == WAR_REGION_TEACHING_DEVOTION) {
         $this->amount = DateModules::getDateDiff($this->to_date, $this->from_date);
     }
     if ($this->devotion_type == DEVOTION_TYPE_WOUNDED && (empty($this->from_date) || $this->from_date == '0000-00-00')) {
         parent::PushException(START_DATE_MUST_NOT_BE_NULL);
         return false;
     }
     //در صورتی که فرد رزمنده و جانباز با همدیگر باشد امکان ثبت فیلد
     // "مدت قابل قبول بازنشستگی که کسور آن  پرداخت شده "باید وجود داشته باشد.
     //در صورتی که فرد رزمنده و جانباز با همدیگر باشد امکان ثبت فیلد
     // "مدت قابل قبول بازنشستگی که کسور آن  پرداخت شده "باید وجود داشته باشد.
     if ($this->devotion_type == FIGHTING_DEVOTION) {
         $query = "\tselect *\n\t\t\t\t\t\t\t\t\tfrom person_devotions pd\n\t\t\t\t\t\t\t\t\t\t\twhere pd.devotion_type = " . SACRIFICE_DEVOTION . " and  pd.PersonID = " . $this->PersonID;
         $temp = parent::runquery($query);
         if (count($temp) == 0 && $this->duration_include_paied_retired_fraction > 0) {
             parent::PushException(ER_WITHOUT_SACRIFIC_DEVOTION_HISTORY);
             return false;
         }
         // از زمان رزمندگی فرد نباید بیشتر باشد
         if ($this->amount < $this->duration_include_paied_retired_fraction) {
             parent::PushException(ER_PAIED_DURATION_OVER_DEVOTION_DURATION);
             return false;
         }
         //با خدمت در دستگاه نباید همپوشانی زمانی داشته باشد.
         $query = "select * from writs w\n\t\t\t\t\t\t\t\t\t\tINNER JOIN staff s\n\t\t\t\t\t\t\t\t\t\t\t  ON (w.staff_id = s.staff_id)\n\t\t\t\t\t\t where w.execute_date >='" . $this->from_date . "' and w.execute_date <='" . $this->to_date . "' and s.PersonID = " . $this->PersonID;
         $tmp = parent::runquery($query);
         if (count($tmp) > 0) {
             parent::PushException(ER_PERSON_DEVOTIONS_AND_WRITS_COINCIDENT);
             return false;
         }
         // با سربازی نباید تداخل داشته باشد.
         //---------- این شرط بنابه درخواست آقای دلکلاله در تاریخ 28 خرداد 91 حذف گردید---------------------------
         /*	if($this->enlisted != 0 ) {
                                            
                                            $query =" select *
                                                                                    from persons p
                                                                                                    where ( p.military_from_date >='".$this->from_date."' and p.military_to_date <='".$this->to_date."' ) and
                                                                                                                    p.PersonID =".$this->PersonID ;
            /*
            *  or
                                                                                                                    p.military_from_date <= '".$this->from_date."' and  p.military_to_date >= '".$this->to_date."' or
                                                                                                                    p.military_from_date >='".$this->from_date."' and p.military_to_date >= '".$this->to_date."' or
                                                                                                                    p.military_from_date <= '".$this->from_date."' and p.military_to_date >= '".$this->to_date."' 
            *
            */
         /*                              $res = parent::runquery($query);
         
                                             if(count($res) >  0)
                                             {
                                                     parent::PushException(ER_PERSON_DEVOTIONS_AND_MILITARY_SERVICE_COINCIDENT);
                                                     return false;
                                             }
                                         }*/
     }
     return true;
 }
开发者ID:jafarkhani,项目名称:rtfund,代码行数:62,代码来源:devotion.class.php


注:本文中的DateModules::getDateDiff方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。