本文整理汇总了PHP中TTDate::getMonth方法的典型用法代码示例。如果您正苦于以下问题:PHP TTDate::getMonth方法的具体用法?PHP TTDate::getMonth怎么用?PHP TTDate::getMonth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTDate
的用法示例。
在下文中一共展示了TTDate::getMonth方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: calcAccrualPolicyTime
function calcAccrualPolicyTime($u_obj, $epoch, $offset, $pps_obj, $pay_period_arr, $accrual_balance, $update_records = TRUE)
{
$retval = 0;
Debug::Text('User: ' . $u_obj->getFullName() . ' Status: ' . $u_obj->getStatus() . ' Epoch: ' . TTDate::getDate('DATE+TIME', $epoch), __FILE__, __LINE__, __METHOD__, 10);
//Make sure only active employees accrue time *after* their hire date.
//Will this negative affect Employees who may be on leave?
if ($u_obj->getStatus() == 10 and $epoch >= $u_obj->getHireDate() and ($this->getMinimumEmployedDays() == 0 or TTDate::getDays($epoch - $u_obj->getHireDate()) >= $this->getMinimumEmployedDays())) {
Debug::Text(' User is active and has been employed long enough.', __FILE__, __LINE__, __METHOD__, 10);
$annual_pay_periods = $pps_obj->getAnnualPayPeriods();
$in_apply_frequency_window = FALSE;
$in_apply_rollover_window = FALSE;
$pay_period_start_date = NULL;
$accrual_amount = 0;
if ($this->getType() == 30) {
Debug::Text(' Accrual policy is hour based, real-time window.', __FILE__, __LINE__, __METHOD__, 10);
//Hour based, apply frequency is real-time.
$in_apply_frequency_window = TRUE;
} else {
if ($this->getApplyFrequency() == 10) {
$pay_period_dates = $this->getPayPeriodDatesFromArray($pay_period_arr, $epoch - $offset);
if (is_array($pay_period_dates)) {
Debug::Text(' Pay Period Start Date: ' . TTDate::getDate('DATE+TIME', $pay_period_dates['start_date']) . ' End Date: ' . TTDate::getDate('DATE+TIME', $pay_period_dates['end_date']), __FILE__, __LINE__, __METHOD__, 10);
if ($this->inApplyFrequencyWindow($epoch, $offset, $pay_period_dates['end_date']) == TRUE) {
$in_apply_frequency_window = TRUE;
$pay_period_start_date = $pay_period_dates['start_date'];
//Used for inRolloverFrequencyWindow
} else {
Debug::Text(' User not in Apply Frequency Window: ', __FILE__, __LINE__, __METHOD__, 10);
}
} else {
Debug::Arr($pay_period_dates, ' No Pay Period Dates Found.', __FILE__, __LINE__, __METHOD__, 10);
}
} elseif ($this->inApplyFrequencyWindow($epoch, $offset, NULL, $u_obj->getHireDate()) == TRUE) {
Debug::Text(' User IS in NON-PayPeriod Apply Frequency Window.', __FILE__, __LINE__, __METHOD__, 10);
$in_apply_frequency_window = TRUE;
} else {
Debug::Text(' User is not in Apply Frequency Window.', __FILE__, __LINE__, __METHOD__, 10);
$in_apply_frequency_window = FALSE;
}
}
if ($this->inRolloverFrequencyWindow($epoch, $offset, $u_obj->getHireDate(), $pay_period_start_date)) {
Debug::Text(' In rollover window...', __FILE__, __LINE__, __METHOD__, 10);
$in_apply_rollover_window = TRUE;
}
if ($in_apply_frequency_window == TRUE or $in_apply_rollover_window == TRUE) {
$milestone_obj = $this->getActiveMilestoneObject($u_obj, $epoch);
}
if ($in_apply_rollover_window == TRUE and (isset($milestone_obj) and is_object($milestone_obj))) {
//Have accrual balance passed in for optimization
//$accrual_balance = $this->getCurrentAccrualBalance( $u_obj->getID(), $this->getId() );
//Handle maximum rollover adjustments before continuing.
if ($accrual_balance > $milestone_obj->getRolloverTime()) {
$rollover_accrual_adjustment = bcsub($milestone_obj->getRolloverTime(), $accrual_balance, 0);
Debug::Text(' Adding rollover adjustment of: ' . $rollover_accrual_adjustment, __FILE__, __LINE__, __METHOD__, 10);
//Check to make sure there isn't an identical entry already made.
//Ignore rollover adjustment is another adjustment of any amount has been made on the same day.
$alf = TTnew('AccrualListFactory');
if ($update_records == TRUE) {
$alf->getByCompanyIdAndUserIdAndAccrualPolicyIDAndTypeIDAndTimeStamp($u_obj->getCompany(), $u_obj->getID(), $this->getId(), 60, TTDate::getMiddleDayEpoch($epoch));
}
if ($alf->getRecordCount() == 0) {
//Get effective date, try to use the current milestone rollover date to make things more clear.
$current_milestone_rollover_date = $this->getCurrentMilestoneRolloverDate($epoch, $u_obj->getHireDate());
//If milestone rollover date comes after the current epoch, back date it by one year.
if ($current_milestone_rollover_date > $epoch) {
$current_milestone_rollover_date = mktime(0, 0, 0, TTDate::getMonth($current_milestone_rollover_date), TTDate::getDayOfMonth($current_milestone_rollover_date), TTDate::getYear($epoch) - 1);
}
if ($update_records == TRUE) {
//Don't round to the nearest minute, as that can cause too much error on weekly frequencies.
$af = TTnew('AccrualFactory');
$af->setUser($u_obj->getID());
$af->setType(60);
//Rollover Adjustment
$af->setAccrualPolicyID($this->getId());
$af->setAmount($rollover_accrual_adjustment);
$af->setTimeStamp(TTDate::getMiddleDayEpoch($current_milestone_rollover_date));
$af->setEnableCalcBalance(TRUE);
if ($af->isValid()) {
$af->Save();
}
} else {
Debug::Text(' NOT UPDATING RECORDS...', __FILE__, __LINE__, __METHOD__, 10);
$retval = $rollover_accrual_adjustment;
}
//Make sure we get updated balance after rollover adjustment was made.
$accrual_balance += $rollover_accrual_adjustment;
unset($current_milestone_rollover_date);
} else {
Debug::Text(' Found duplicate rollover accrual entry, skipping...', __FILE__, __LINE__, __METHOD__, 10);
}
} else {
Debug::Text(' Balance hasnt exceeded rollover adjustment...', __FILE__, __LINE__, __METHOD__, 10);
}
unset($rollover_accrual_adjustment, $alf, $af);
}
if ($in_apply_frequency_window === TRUE) {
if (isset($milestone_obj) and is_object($milestone_obj)) {
Debug::Text(' Found Matching Milestone, Accrual Rate: (ID: ' . $milestone_obj->getId() . ') ' . $milestone_obj->getAccrualRate() . '/year', __FILE__, __LINE__, __METHOD__, 10);
//Make sure we get updated balance after rollover adjustment was made.
//Have accrual balance passed in for optimization
//.........这里部分代码省略.........
示例3: _outputPayrollExport
//.........这里部分代码省略.........
if (isset($row[$column_id]) and trim($column_data['hour_code']) != '') {
$data .= str_pad($row['employee_number'], 6, ' ', STR_PAD_LEFT);
$data .= str_pad('', 31, ' ', STR_PAD_LEFT);
//Blank space.
if (isset($setup_data['paychex_preview_advanced_job']['job_columns']) and is_array($setup_data['paychex_preview_advanced_job']['job_columns'])) {
$job_column = array();
foreach ($setup_data['paychex_preview_advanced_job']['job_columns'] as $tmp_job_column) {
$job_column[] = isset($row[$tmp_job_column]) ? $row[$tmp_job_column] : NULL;
}
$data .= str_pad(substr(implode('-', $job_column), 0, 12), 12, ' ', STR_PAD_LEFT);
unset($job_column);
} else {
$data .= str_pad('', 12, ' ', STR_PAD_LEFT);
}
$data .= str_pad('', 1, ' ', STR_PAD_LEFT);
//Shift identifier.
//Allow user to specify three digit hour codes to specify their own E/D codes. If codes are two digit, always use E.
if (strlen(trim($column_data['hour_code'])) < 3) {
$column_data['hour_code'] = 'E' . trim($column_data['hour_code']);
}
//Should start at col51
$data .= str_pad(substr(trim($column_data['hour_code']), 0, 3), 3, ' ', STR_PAD_RIGHT);
if (isset($setup_data['paychex_preview_advanced_job']['include_hourly_rate']) and $setup_data['paychex_preview_advanced_job']['include_hourly_rate'] == TRUE) {
$data .= str_pad(isset($row[$column_id . '_hourly_rate']) ? number_format($row[$column_id . '_hourly_rate'], 4, '.', '') : NULL, 9, 0, STR_PAD_LEFT);
//Override rate
} else {
$data .= str_pad('', 9, 0, STR_PAD_LEFT);
//Override rate
}
$data .= str_pad(TTDate::getTimeUnit($row[$column_id], 20), 8, 0, STR_PAD_LEFT);
//Break out time by day.
$data .= str_pad(TTDate::getYear($row['time_stamp']), 4, 0, STR_PAD_LEFT);
//Year, based on time_stamp epoch column
$data .= str_pad(TTDate::getMonth($row['time_stamp']), 2, 0, STR_PAD_LEFT);
//Month, based on time_stamp epoch column. Can be space padded.
$data .= str_pad(TTDate::getDayOfMonth($row['time_stamp']), 2, 0, STR_PAD_LEFT);
//Day, based on time_stamp epoch column. Can be space padded.
$data .= str_pad('', 4, ' ', STR_PAD_LEFT);
//Filler
$data .= str_pad('', 9, ' ', STR_PAD_LEFT);
//Amount. This can always be calculated from hours and hourly rate above though.
$data .= str_pad('', 13, ' ', STR_PAD_LEFT);
//Blank space
if (isset($setup_data['paychex_preview_advanced_job']['state_columns'])) {
$data .= str_pad(isset($row[$setup_data['paychex_preview_advanced_job']['state_columns']]) ? $row[$setup_data['paychex_preview_advanced_job']['state_columns']] : NULL, 2, ' ', STR_PAD_LEFT);
//State
}
$data .= "\n";
}
}
}
break;
case 'paychex_preview':
//Paychex Preview export format.
//Add an advanced PayChex Preview format that supports rates perhaps?
//http://kb.idb-sys.com/KnowledgebaseArticle10013.aspx
if (!isset($setup_data['paychex_preview']['client_number'])) {
$setup_data['paychex_preview']['client_number'] = '0000';
}
$file_name = $setup_data['paychex_preview']['client_number'] . '_TA.txt';
ksort($setup_data['paychex_preview']['columns']);
$setup_data['paychex_preview']['columns'] = Misc::trimSortPrefix($setup_data['paychex_preview']['columns']);
$data = NULL;
foreach ($rows as $row) {
foreach ($setup_data['paychex_preview']['columns'] as $column_id => $column_data) {
if (isset($row[$column_id]) and trim($column_data['hour_code']) != '') {
示例4: inApplyFrequencyWindow
static function inApplyFrequencyWindow($frequency_id, $start_date, $end_date, $frequency_criteria = array())
{
/*
Frequency IDs:
20 => 'Annually',
25 => 'Quarterly',
30 => 'Monthly',
40 => 'Weekly',
100 => 'Specific Date', //Pay Period Dates, Hire Dates, Termination Dates, etc...
*/
if (!isset($frequency_criteria['month'])) {
$frequency_criteria['month'] = 0;
}
if (!isset($frequency_criteria['day_of_month'])) {
$frequency_criteria['day_of_month'] = 0;
}
if (!isset($frequency_criteria['day_of_week'])) {
$frequency_criteria['day_of_week'] = 0;
}
if (!isset($frequency_criteria['quarter_month'])) {
$frequency_criteria['quarter_month'] = 0;
}
if (!isset($frequency_criteria['date'])) {
$frequency_criteria['date'] = 0;
}
//Debug::Arr($frequency_criteria, 'Freq ID: '. $frequency_id .' Date: Start: '. TTDate::getDate('DATE+TIME', $start_date) .'('.$start_date.') End: '. TTDate::getDate('DATE+TIME', $end_date) .'('.$end_date.')', __FILE__, __LINE__, __METHOD__,10);
$retval = FALSE;
switch ($frequency_id) {
case 20:
//Annually
$year_epoch1 = mktime(TTDate::getHour($start_date), TTDate::getMinute($start_date), TTDate::getSecond($start_date), $frequency_criteria['month'], $frequency_criteria['day_of_month'], TTDate::getYear($start_date));
$year_epoch2 = mktime(TTDate::getHour($end_date), TTDate::getMinute($end_date), TTDate::getSecond($end_date), $frequency_criteria['month'], $frequency_criteria['day_of_month'], TTDate::getYear($end_date));
//Debug::Text('Year1 EPOCH: '. TTDate::getDate('DATE+TIME', $year_epoch1) .'('. $year_epoch1 .')', __FILE__, __LINE__, __METHOD__,10);
//Debug::Text('Year2 EPOCH: '. TTDate::getDate('DATE+TIME', $year_epoch2) .'('. $year_epoch2 .')', __FILE__, __LINE__, __METHOD__,10);
if ($year_epoch1 >= $start_date and $year_epoch1 <= $end_date or $year_epoch2 >= $start_date and $year_epoch2 <= $end_date) {
$retval = TRUE;
}
break;
case 25:
//Quarterly
//Handle quarterly like month, we just need to set the specific month from quarter_month.
if (abs($end_date - $start_date) > 86400 * 93) {
//3 months
$retval = TRUE;
} else {
for ($i = TTDate::getMiddleDayEpoch($start_date); $i <= TTDate::getMiddleDayEpoch($end_date); $i += 86400 * 1) {
if (self::getYearQuarterMonthNumber($i) == $frequency_criteria['quarter_month'] and $frequency_criteria['day_of_month'] == self::getDayOfMonth($i)) {
$retval = TRUE;
break;
}
}
}
break;
case 30:
//Monthly
//Make sure if they specify the day of month to be 31, that is still works for months with 30, or 28-29 days, assuming 31 basically means the last day of the month
if ($frequency_criteria['day_of_month'] > TTDate::getDaysInMonth($start_date) or $frequency_criteria['day_of_month'] > TTDate::getDaysInMonth($end_date)) {
$frequency_criteria['day_of_month'] = TTDate::getDaysInMonth($start_date);
if (TTDate::getDaysInMonth($end_date) < $frequency_criteria['day_of_month']) {
$frequency_criteria['day_of_month'] = TTDate::getDaysInMonth($end_date);
}
//Debug::Text('Apply frequency day of month exceeds days in this month, using last day of the month instead: '. $frequency_criteria['day_of_month'], __FILE__, __LINE__, __METHOD__,10);
}
$month_epoch1 = mktime(TTDate::getHour($start_date), TTDate::getMinute($start_date), TTDate::getSecond($start_date), TTDate::getMonth($start_date), $frequency_criteria['day_of_month'], TTDate::getYear($start_date));
$month_epoch2 = mktime(TTDate::getHour($end_date), TTDate::getMinute($end_date), TTDate::getSecond($end_date), TTDate::getMonth($end_date), $frequency_criteria['day_of_month'], TTDate::getYear($end_date));
//Debug::Text('Day of Month: '. $frequency_criteria['day_of_month'] .' Month EPOCH: '. TTDate::getDate('DATE+TIME', $month_epoch1) .' Current Month: '. TTDate::getMonth( $start_date ), __FILE__, __LINE__, __METHOD__,10);
//Debug::Text('Month1 EPOCH: '. TTDate::getDate('DATE+TIME', $month_epoch1) .'('. $month_epoch1 .') Greater Than: '. TTDate::getDate('DATE+TIME', ($start_date)) .' Less Than: '. TTDate::getDate('DATE+TIME', $end_date) .'('. $end_date .')', __FILE__, __LINE__, __METHOD__,10);
//Debug::Text('Month2 EPOCH: '. TTDate::getDate('DATE+TIME', $month_epoch2) .'('. $month_epoch2 .') Greater Than: '. TTDate::getDate('DATE+TIME', ($start_date)) .' Less Than: '. TTDate::getDate('DATE+TIME', $end_date) .'('. $end_date .')', __FILE__, __LINE__, __METHOD__,10);
if ($month_epoch1 >= $start_date and $month_epoch1 <= $end_date or $month_epoch2 >= $start_date and $month_epoch2 <= $end_date) {
$retval = TRUE;
}
break;
case 40:
//Weekly
$start_dow = self::getDayOfWeek($start_date);
$end_dow = self::getDayOfWeek($end_date);
if ($start_dow == $frequency_criteria['day_of_week'] or $end_dow == $frequency_criteria['day_of_week']) {
$retval = TRUE;
} else {
if ($end_date - $start_date > 86400 * 7) {
$retval = TRUE;
} else {
for ($i = TTDate::getMiddleDayEpoch($start_date); $i <= TTDate::getMiddleDayEpoch($end_date); $i += 86400) {
if (self::getDayOfWeek($i) == $frequency_criteria['day_of_week']) {
$retval = TRUE;
break;
}
}
}
}
break;
case 100:
//Specific date
Debug::Text('Specific Date: ' . TTDate::getDate('DATE+TIME', $frequency_criteria['date']), __FILE__, __LINE__, __METHOD__, 10);
if ($frequency_criteria['date'] >= $start_date and $frequency_criteria['date'] <= $end_date) {
$retval = TRUE;
}
break;
}
Debug::Text('Retval ' . (int) $retval, __FILE__, __LINE__, __METHOD__, 10);
//.........这里部分代码省略.........
示例5: getNextDate
function getNextDate($epoch = FALSE)
{
if ($epoch == '') {
$epoch = TTDate::getTime();
}
if ($this->getSpecialDay() == 1 or $this->getSpecialDay() == 5) {
Debug::text('Easter Sunday Date...', __FILE__, __LINE__, __METHOD__, 10);
//Use easter_days() instead, as easter_date returns incorrect values for some timezones/years (2010 and US/Eastern on Windows)
//$easter_epoch = easter_date(date('Y', $epoch));
$easter_epoch = mktime(12, 0, 0, 3, 21 + easter_days(date('Y', $epoch)), date('Y', $epoch));
//Fix "cross-year" bug.
if ($easter_epoch < $epoch) {
//$easter_epoch = easter_date(date('Y', $epoch)+1);
$easter_epoch = mktime(12, 0, 0, 3, 21 + easter_days(date('Y', $epoch) + 1), date('Y', $epoch) + 1);
}
if ($this->getSpecialDay() == 1) {
Debug::text('Good Friday Date...', __FILE__, __LINE__, __METHOD__, 10);
//$holiday_epoch = mktime(12,0,0,date('n',$easter_epoch),date('j',$easter_epoch) - 2, date('Y', $easter_epoch));
$holiday_epoch = $easter_epoch - 2 * 86400;
} else {
$holiday_epoch = $easter_epoch;
}
} else {
if ($this->getType() == 10) {
//Static
Debug::text('Static Date...', __FILE__, __LINE__, __METHOD__, 10);
//Static date
$holiday_epoch = mktime(12, 0, 0, $this->getMonth(), $this->getDayOfMonth(), date('Y', $epoch));
if ($holiday_epoch < $epoch) {
$holiday_epoch = mktime(12, 0, 0, $this->getMonth(), $this->getDayOfMonth(), date('Y', $epoch) + 1);
}
} elseif ($this->getType() == 20) {
//Dynamic - Week Interval
Debug::text('Dynamic - Week Interval... Current Month: ' . TTDate::getMonth($epoch) . ' Holiday Month: ' . $this->getMonth(), __FILE__, __LINE__, __METHOD__, 10);
//Dynamic
$start_month_epoch = TTDate::getBeginMonthEpoch($epoch);
$end_month_epoch = mktime(12, 0, 0, $this->getMonth() + 1, 1, date('Y', $epoch) + 1);
Debug::text('Start Epoch: ' . TTDate::getDate('DATE+TIME', $start_month_epoch) . ' End Epoch: ' . TTDate::getDate('DATE+TIME', $end_month_epoch), __FILE__, __LINE__, __METHOD__, 10);
//Get all day of weeks in the month. Determine which is less or greater then day.
$day_of_week_dates = array();
$week_interval = 0;
for ($i = $start_month_epoch; $i <= $end_month_epoch; $i += 86400) {
if (TTDate::getMonth($i) == $this->getMonth()) {
$day_of_week = TTDate::getDayOfWeek($i);
//Debug::text('I: '. $i .'('.TTDate::getDate('DATE+TIME', $i).') Current Day Of Week: '. $day_of_week .' Looking for Day Of Week: '. $this->getDayOfWeek(), __FILE__, __LINE__, __METHOD__, 10);
if ($day_of_week == abs($this->getDayOfWeek())) {
$day_of_week_dates[] = date('j', $i);
Debug::text('I: ' . $i . ' Day Of Month: ' . date('j', $i), __FILE__, __LINE__, __METHOD__, 10);
$week_interval++;
}
if ($week_interval >= $this->getWeekInterval()) {
$tmp_holiday_epoch = mktime(12, 0, 0, $this->getMonth(), $day_of_week_dates[$this->getWeekInterval() - 1], date('Y', $i));
//Make sure we keep processing until the holiday comes AFTER todays date.
if ($tmp_holiday_epoch > $epoch) {
break;
}
}
}
}
//Debug::Arr($day_of_week_dates, 'Week Dates Arr: ', __FILE__, __LINE__, __METHOD__, 10);
//$holiday_epoch = mktime(12,0,0, $this->getMonth(), $day_of_week_dates[$this->getWeekInterval()-1], date('Y', $i));
$holiday_epoch = $tmp_holiday_epoch;
} elseif ($this->getType() == 30) {
//Dynamic - Pivot Day
Debug::text('Dynamic - Pivot Date...', __FILE__, __LINE__, __METHOD__, 10);
//Dynamic
if (TTDate::getMonth($epoch) > $this->getMonth()) {
$year_modifier = 1;
} else {
$year_modifier = 0;
}
$start_epoch = mktime(12, 0, 0, $this->getMonth(), $this->getDayOfMonth(), date('Y', $epoch) + $year_modifier);
$holiday_epoch = $start_epoch;
$x = 0;
$x_max = 100;
if ($this->getPivotDayDirection() == 10 or $this->getPivotDayDirection() == 30) {
$direction_multiplier = -1;
} else {
$direction_multiplier = 1;
}
$adjustment = 86400 * $direction_multiplier;
// Adjust by 1 day before or after.
if ($this->getPivotDayDirection() == 10 or $this->getPivotDayDirection() == 20) {
$holiday_epoch += $adjustment;
}
while ($this->getDayOfWeek() != TTDate::getDayOfWeek($holiday_epoch) and $x < $x_max) {
Debug::text('X: ' . $x . ' aTrying...' . TTDate::getDate('DATE+TIME', $holiday_epoch), __FILE__, __LINE__, __METHOD__, 10);
$holiday_epoch += $adjustment;
$x++;
}
}
}
Debug::text('Next Date for: ' . $this->getName() . ' is: ' . TTDate::getDate('DATE+TIME', $holiday_epoch), __FILE__, __LINE__, __METHOD__, 10);
return $holiday_epoch;
}
示例6: inApplyFrequencyWindow
function inApplyFrequencyWindow($current_epoch, $offset, $pay_period_end_date = NULL)
{
$retval = FALSE;
switch ($this->getApplyFrequency()) {
case 10:
//Pay Period
if ($pay_period_end_date == '') {
return FALSE;
}
if ($pay_period_end_date >= $current_epoch - $offset and $pay_period_end_date <= $current_epoch) {
$retval = TRUE;
}
break;
case 20:
//Year
$year_epoch = mktime(0, 0, 0, $this->getApplyFrequencyMonth(), $this->getApplyFrequencyDayOfMonth(), TTDate::getYear($current_epoch));
Debug::Text('Year EPOCH: ' . TTDate::getDate('DATE+TIME', $year_epoch), __FILE__, __LINE__, __METHOD__, 10);
if ($year_epoch >= $current_epoch - $offset and $year_epoch <= $current_epoch) {
$retval = TRUE;
}
break;
case 30:
//Month
$apply_frequency_day_of_month = $this->getApplyFrequencyDayOfMonth();
//Make sure if they specify the day of month to be 31, that is still works for months with 30, or 28-29 days, assuming 31 basically means the last day of the month
if ($apply_frequency_day_of_month > TTDate::getDaysInMonth($current_epoch)) {
$apply_frequency_day_of_month = TTDate::getDaysInMonth($current_epoch);
Debug::Text('Apply frequency day of month exceeds days in this month, using last day of the month instead: ' . $apply_frequency_day_of_month, __FILE__, __LINE__, __METHOD__, 10);
}
$month_epoch = mktime(0, 0, 0, TTDate::getMonth($current_epoch), $apply_frequency_day_of_month, TTDate::getYear($current_epoch));
Debug::Text('Day of Month: ' . $this->getApplyFrequencyDayOfMonth() . ' Month EPOCH: ' . TTDate::getDate('DATE+TIME', $month_epoch) . ' Current Month: ' . TTDate::getMonth($current_epoch), __FILE__, __LINE__, __METHOD__, 10);
Debug::Text('Month EPOCH: ' . TTDate::getDate('DATE+TIME', $month_epoch) . ' Greater Than: ' . TTDate::getDate('DATE+TIME', $current_epoch - $offset) . ' Less Than: ' . TTDate::getDate('DATE+TIME', $current_epoch), __FILE__, __LINE__, __METHOD__, 10);
if ($month_epoch >= $current_epoch - $offset and $month_epoch <= $current_epoch) {
$retval = TRUE;
}
break;
case 40:
//Week
Debug::Text('Current Day Of Week: ' . TTDate::getDayOfWeek($current_epoch - $offset), __FILE__, __LINE__, __METHOD__, 10);
if ($this->getApplyFrequencyDayOfWeek() == TTDate::getDayOfWeek($current_epoch - $offset)) {
$retval = TRUE;
}
break;
}
Debug::Text('RetVal: ' . (int) $retval, __FILE__, __LINE__, __METHOD__, 10);
return $retval;
}
示例7: strtotime
}
default:
$data['product_edition'] = Option::getByKey(getTTProductEdition(), $current_company->getOptions('product_edition'));
//Get Employee counts for this month, and last month
$month_of_year_arr = TTDate::getMonthOfYearArray();
//This month
if (isset($ytd) and $ytd == 1) {
$begin_month_epoch = strtotime('-2 years');
} else {
$begin_month_epoch = TTDate::getBeginMonthEpoch(TTDate::getBeginMonthEpoch(time()) - 86400);
}
$cuclf = new CompanyUserCountListFactory();
$cuclf->getMonthlyMinAvgMaxByCompanyIdAndStartDateAndEndDate($current_company->getId(), $begin_month_epoch, TTDate::getEndMonthEpoch(time()), NULL, NULL, NULL, array('date_stamp' => 'desc'));
if ($cuclf->getRecordCount() > 0) {
foreach ($cuclf as $cuc_obj) {
$data['user_counts'][] = array('label' => $month_of_year_arr[TTDate::getMonth(TTDate::strtotime($cuc_obj->getColumn('date_stamp')))] . ' ' . TTDate::getYear(TTDate::strtotime($cuc_obj->getColumn('date_stamp'))), 'max_active_users' => $cuc_obj->getColumn('max_active_users'), 'max_inactive_users' => $cuc_obj->getColumn('max_inactive_users'), 'max_deleted_users' => $cuc_obj->getColumn('max_deleted_users'));
}
}
$cjlf = new CronJobListFactory();
$cjlf->getMostRecentlyRun();
if ($cjlf->getRecordCount() > 0) {
$cj_obj = $cjlf->getCurrent();
$data['cron'] = array('last_run_date' => $cj_obj->getLastRunDate());
}
if (($current_company->getId() == 1 or isset($config_vars['other']['primary_company_id']) and $current_company->getId() == $config_vars['other']['primary_company_id']) and getTTProductEdition() > 10) {
if (!isset($system_settings['license'])) {
$system_settings['license'] = NULL;
}
//Set this so the license upload area at least shows up regardles of edition.
$data['license_data'] = array();
$license = new TTLicense();
示例8: getAboutData
/**
* Get about data .
*
*/
function getAboutData($ytd = 0, $all_companies = FALSE)
{
global $config_vars;
$clf = new CompanyListFactory();
$sslf = new SystemSettingListFactory();
$system_settings = $sslf->getAllArray();
$clf->getByID(PRIMARY_COMPANY_ID);
if ($clf->getRecordCount() == 1) {
$primary_company = $clf->getCurrent();
}
$current_user = $this->getCurrentUserObject();
if (isset($primary_company) and PRIMARY_COMPANY_ID == $current_user->getCompany()) {
$current_company = $primary_company;
} else {
$current_company = $clf->getByID($current_user->getCompany())->getCurrent();
}
//$current_user_prefs = $current_user->getUserPreferenceObject();
$data = $system_settings;
if (isset($data['new_version']) and $data['new_version'] == TRUE) {
$data['new_version'] = TRUE;
} else {
$data['new_version'] = FALSE;
}
$data['product_edition'] = Option::getByKey(DEPLOYMENT_ON_DEMAND == TRUE ? $current_company->getProductEdition() : getTTProductEdition(), $current_company->getOptions('product_edition'));
$data['application_name'] = APPLICATION_NAME;
$data['organization_url'] = ORGANIZATION_URL;
//Get Employee counts for this month, and last month
$month_of_year_arr = TTDate::getMonthOfYearArray();
//This month
if (isset($ytd) and $ytd == 1) {
$begin_month_epoch = strtotime('-2 years');
} else {
$begin_month_epoch = TTDate::getBeginMonthEpoch(TTDate::getBeginMonthEpoch(time()) - 86400);
}
$cuclf = TTnew('CompanyUserCountListFactory');
if (isset($config_vars['other']['primary_company_id']) and $current_company->getId() == $config_vars['other']['primary_company_id'] and $all_companies == TRUE) {
$cuclf->getTotalMonthlyMinAvgMaxByCompanyStatusAndStartDateAndEndDate(10, $begin_month_epoch, TTDate::getEndMonthEpoch(time()), NULL, NULL, NULL, array('date_stamp' => 'desc'));
} else {
$cuclf->getMonthlyMinAvgMaxByCompanyIdAndStartDateAndEndDate($current_company->getId(), $begin_month_epoch, TTDate::getEndMonthEpoch(time()), NULL, NULL, NULL, array('date_stamp' => 'desc'));
}
Debug::Text('Company User Count Rows: ' . $cuclf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
if ($cuclf->getRecordCount() > 0) {
foreach ($cuclf as $cuc_obj) {
$data['user_counts'][] = array('label' => $month_of_year_arr[TTDate::getMonth(TTDate::strtotime($cuc_obj->getColumn('date_stamp')))] . ' ' . TTDate::getYear(TTDate::strtotime($cuc_obj->getColumn('date_stamp'))), 'max_active_users' => $cuc_obj->getColumn('max_active_users'), 'max_inactive_users' => $cuc_obj->getColumn('max_inactive_users'), 'max_deleted_users' => $cuc_obj->getColumn('max_deleted_users'));
}
}
if (isset($data['user_counts']) == FALSE) {
$data['user_counts'] = array();
}
$cjlf = TTnew('CronJobListFactory');
$cjlf->getMostRecentlyRun();
if ($cjlf->getRecordCount() > 0) {
$cj_obj = $cjlf->getCurrent();
$data['cron'] = array('last_run_date' => $cj_obj->getLastRunDate() == FALSE ? TTi18n::getText('Never') : TTDate::getDate('DATE+TIME', $cj_obj->getLastRunDate()));
}
$data['show_license_data'] = FALSE;
if ((DEPLOYMENT_ON_DEMAND == FALSE and $current_company->getId() == 1 or isset($config_vars['other']['primary_company_id']) and $current_company->getId() == $config_vars['other']['primary_company_id']) and getTTProductEdition() > 10) {
if (!isset($system_settings['license'])) {
$system_settings['license'] = NULL;
}
$data['show_license_data'] = TRUE;
//Set this so the license upload area at least shows up regardles of edition.
$data['license_data'] = array();
$license = new TTLicense();
$retval = $license->validateLicense($system_settings['license']);
if ($retval == TRUE) {
$data['license_data'] = array('organization_name' => $license->getOrganizationName(), 'major_version' => $license->getMajorVersion(), 'minor_version' => $license->getMinorVersion(), 'product_name' => $license->getProductName(), 'active_employee_licenses' => $license->getActiveEmployeeLicenses(), 'issue_date' => TTDate::getDate('DATE', $license->getIssueDate()), 'expire_date' => $license->getExpireDate(), 'expire_date_display' => TTDate::getDate('DATE', $license->getExpireDate()), 'registration_key' => $license->getRegistrationKey(), 'message' => $license->getFullErrorMessage($retval), 'retval' => $retval);
}
}
//Debug::Arr($data, 'Data: ', __FILE__, __LINE__, __METHOD__,10);
return $this->returnHandler($data);
}