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


PHP TTDate::inApplyFrequencyWindow方法代码示例

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


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

示例1: inApplyFrequencyWindow

 function inApplyFrequencyWindow($pay_period_start_date, $pay_period_end_date, $hire_date = NULL, $termination_date = NULL, $birth_date = NULL)
 {
     if ($this->getApplyFrequency() == FALSE or $this->getApplyFrequency() == 10) {
         //Each pay period
         return TRUE;
     }
     $frequency_criteria = array('month' => $this->getApplyFrequencyMonth(), 'day_of_month' => $this->getApplyFrequencyDayOfMonth(), 'quarter_month' => $this->getApplyFrequencyQuarterMonth());
     $specific_date = FALSE;
     $frequency_id = $this->getApplyFrequency();
     switch ($this->getApplyFrequency()) {
         case 100:
             //Hire Date
             $frequency_criteria['date'] = $hire_date;
             $frequency_id = 100;
             //Specific date
             break;
         case 110:
             //Hire Date anniversary.
             $frequency_criteria['month'] = TTDate::getMonth($hire_date);
             $frequency_criteria['day_of_month'] = TTDate::getDayOfMonth($hire_date);
             $frequency_id = 20;
             //Annually
             break;
         case 120:
             $frequency_criteria['date'] = $termination_date;
             $frequency_id = 100;
             //Specific date
             break;
         case 130:
             //Birth Date anniversary.
             $frequency_criteria['month'] = TTDate::getMonth($birth_date);
             $frequency_criteria['day_of_month'] = TTDate::getDayOfMonth($birth_date);
             $frequency_id = 20;
             //Annually
             break;
     }
     $retval = TTDate::inApplyFrequencyWindow($frequency_id, $pay_period_start_date, $pay_period_end_date, $frequency_criteria);
     Debug::Arr($frequency_criteria, 'Frequency: ' . $this->getApplyFrequency() . ' Retval: ' . (int) $retval, __FILE__, __LINE__, __METHOD__, 10);
     return $retval;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:40,代码来源:CompanyDeductionFactory.class.php

示例2: test_inApplyFrequencyWindow

 function test_inApplyFrequencyWindow()
 {
     //Annually
     $frequency_criteria = array('month' => 1, 'day_of_month' => 2, 'day_of_week' => 0, 'quarter_month' => 0, 'date' => 0);
     //No range
     $this->assertEquals(TTDate::inApplyFrequencyWindow(20, strtotime('01-Jan-2010'), strtotime('01-Jan-2010'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(20, strtotime('02-Jan-2010'), strtotime('02-Jan-2010'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(20, strtotime('03-Jan-2010'), strtotime('03-Jan-2010'), $frequency_criteria), FALSE);
     //Range
     $this->assertEquals(TTDate::inApplyFrequencyWindow(20, strtotime('01-Jan-2010'), strtotime('03-Jan-2010'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(20, strtotime('02-Jan-2010 12:00PM'), strtotime('02-Jan-2010 12:00PM'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(20, strtotime('02-Jan-2010 12:00AM'), strtotime('02-Jan-2010 11:59PM'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(20, strtotime('01-Jan-2010') - 86400 * 7, strtotime('01-Jan-2010'), $frequency_criteria), FALSE);
     //Range
     $this->assertEquals(TTDate::inApplyFrequencyWindow(20, strtotime('02-Jan-2010') - 86400 * 7, strtotime('02-Jan-2010'), $frequency_criteria), TRUE);
     //Range
     $this->assertEquals(TTDate::inApplyFrequencyWindow(20, strtotime('03-Jan-2010') - 86400 * 7, strtotime('03-Jan-2010'), $frequency_criteria), TRUE);
     //Range
     $this->assertEquals(TTDate::inApplyFrequencyWindow(20, strtotime('04-Jan-2010') - 86400 * 7, strtotime('04-Jan-2010'), $frequency_criteria), TRUE);
     //Range
     $this->assertEquals(TTDate::inApplyFrequencyWindow(20, strtotime('05-Jan-2010') - 86400 * 7, strtotime('05-Jan-2010'), $frequency_criteria), TRUE);
     //Range
     $this->assertEquals(TTDate::inApplyFrequencyWindow(20, strtotime('06-Jan-2010') - 86400 * 7, strtotime('06-Jan-2010'), $frequency_criteria), TRUE);
     //Range
     $this->assertEquals(TTDate::inApplyFrequencyWindow(20, strtotime('07-Jan-2010') - 86400 * 7, strtotime('07-Jan-2010'), $frequency_criteria), TRUE);
     //Range
     $this->assertEquals(TTDate::inApplyFrequencyWindow(20, strtotime('08-Jan-2010') - 86400 * 7, strtotime('08-Jan-2010'), $frequency_criteria), TRUE);
     //Range
     $this->assertEquals(TTDate::inApplyFrequencyWindow(20, strtotime('09-Jan-2010') - 86400 * 7, strtotime('09-Jan-2010'), $frequency_criteria), TRUE);
     //Range
     $this->assertEquals(TTDate::inApplyFrequencyWindow(20, strtotime('10-Jan-2010') - 86400 * 7, strtotime('10-Jan-2010'), $frequency_criteria), FALSE);
     //Range
     //Quarterly
     $frequency_criteria = array('month' => 0, 'day_of_month' => 15, 'day_of_week' => 0, 'quarter_month' => 2, 'date' => 0);
     //No range
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('14-Feb-2010'), strtotime('14-Feb-2010'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('15-Feb-2010'), strtotime('15-Feb-2010'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('16-Feb-2010'), strtotime('16-Feb-2010'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('14-May-2010'), strtotime('14-May-2010'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('15-May-2010'), strtotime('15-May-2010'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('16-May-2010'), strtotime('16-May-2010'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('14-Aug-2010'), strtotime('14-Aug-2010'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('15-Aug-2010'), strtotime('15-Aug-2010'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('16-Aug-2010'), strtotime('16-Aug-2010'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('14-Nov-2010'), strtotime('14-Nov-2010'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('15-Nov-2010'), strtotime('15-Nov-2010'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('16-Nov-2010'), strtotime('16-Nov-2010'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('14-Jan-2010'), strtotime('14-Jan-2010'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('14-Mar-2010'), strtotime('14-Mar-2010'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('14-Apr-2010'), strtotime('14-Apr-2010'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('14-Jun-2010'), strtotime('14-Jun-2010'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('14-Jul-2010'), strtotime('14-Jul-2010'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('14-Sep-2010'), strtotime('14-Sep-2010'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('14-Oct-2010'), strtotime('14-Oct-2010'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('14-Dec-2010'), strtotime('14-Dec-2010'), $frequency_criteria), FALSE);
     //Range
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('01-Aug-2010'), strtotime('15-Aug-2010'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('15-Aug-2010'), strtotime('20-Aug-2010'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('16-Aug-2010'), strtotime('20-Aug-2010'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('01-Jul-2010'), strtotime('15-Aug-2010'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('01-Jun-2010'), strtotime('15-Aug-2010'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('01-May-2010'), strtotime('15-Aug-2010'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('01-Apr-2010'), strtotime('15-Aug-2010'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('01-Apr-2009'), strtotime('15-Aug-2010'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('16-Aug-2009'), strtotime('14-Dec-2010'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('19-Aug-2009'), strtotime('14-Nov-2009'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('19-Aug-2009'), strtotime('15-Nov-2009'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(25, strtotime('19-Aug-2009'), strtotime('15-Nov-2010'), $frequency_criteria), TRUE);
     //Monthly
     $frequency_criteria = array('month' => 2, 'day_of_month' => 31, 'day_of_week' => 0, 'quarter_month' => 0, 'date' => 0);
     //No range
     $this->assertEquals(TTDate::inApplyFrequencyWindow(30, strtotime('27-Feb-2010'), strtotime('27-Feb-2010'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(30, strtotime('28-Feb-2010'), strtotime('28-Feb-2010'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(30, strtotime('01-Mar-2010'), strtotime('01-Mar-2010'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(30, strtotime('27-Feb-2011'), strtotime('27-Feb-2011'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(30, strtotime('28-Feb-2011'), strtotime('28-Feb-2011'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(30, strtotime('01-Mar-2011'), strtotime('01-Mar-2011'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(30, strtotime('28-Feb-2012'), strtotime('28-Feb-2012'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(30, strtotime('29-Feb-2012'), strtotime('29-Feb-2012'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(30, strtotime('01-Mar-2012'), strtotime('01-Mar-2012'), $frequency_criteria), FALSE);
     //Range
     $this->assertEquals(TTDate::inApplyFrequencyWindow(30, strtotime('28-Feb-2010'), strtotime('05-Mar-2010'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(30, strtotime('22-Feb-2010'), strtotime('28-Feb-2010'), $frequency_criteria), TRUE);
     //Weekly
     $frequency_criteria = array('month' => 0, 'day_of_month' => 0, 'day_of_week' => 2, 'quarter_month' => 0, 'date' => 0);
     //No range
     $this->assertEquals(TTDate::inApplyFrequencyWindow(40, strtotime('12-Apr-2010'), strtotime('12-Apr-2010'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(40, strtotime('13-Apr-2010'), strtotime('13-Apr-2010'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(40, strtotime('14-Apr-2010'), strtotime('14-Apr-2010'), $frequency_criteria), FALSE);
     //Range
     $this->assertEquals(TTDate::inApplyFrequencyWindow(40, strtotime('07-Apr-2010'), strtotime('12-Apr-2010'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(40, strtotime('14-Apr-2010'), strtotime('19-Apr-2010'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(40, strtotime('11-Apr-2010'), strtotime('17-Apr-2010'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(40, strtotime('12-Apr-2010'), strtotime('18-Apr-2010'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(40, strtotime('13-Apr-2010'), strtotime('19-Apr-2010'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(40, strtotime('14-Apr-2010'), strtotime('20-Apr-2010'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(40, strtotime('12-Apr-2010'), strtotime('17-Apr-2010'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(40, strtotime('13-Apr-2010'), strtotime('17-Apr-2010'), $frequency_criteria), TRUE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(40, strtotime('14-Apr-2010'), strtotime('17-Apr-2010'), $frequency_criteria), FALSE);
     $this->assertEquals(TTDate::inApplyFrequencyWindow(40, strtotime('11-Apr-2010'), strtotime('18-Apr-2010'), $frequency_criteria), TRUE);
//.........这里部分代码省略.........
开发者ID:alachaum,项目名称:timetrex,代码行数:101,代码来源:DateTimeTest.php


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