本文整理汇总了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;
}
示例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);
//.........这里部分代码省略.........