本文整理汇总了PHP中TTDate::getEndYearEpoch方法的典型用法代码示例。如果您正苦于以下问题:PHP TTDate::getEndYearEpoch方法的具体用法?PHP TTDate::getEndYearEpoch怎么用?PHP TTDate::getEndYearEpoch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTDate
的用法示例。
在下文中一共展示了TTDate::getEndYearEpoch方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mktime
if (isset($filter_data['user_ids']) and isset($filter_data['year'])) {
if (isset($filter_data['year'])) {
$year_epoch = mktime(0, 0, 0, 1, 1, $filter_data['year']);
Debug::Text(' Year: ' . TTDate::getDate('DATE+TIME', $year_epoch), __FILE__, __LINE__, __METHOD__, 10);
}
$pseallf = TTnew('PayStubEntryAccountLinkListFactory');
$pseallf->getByCompanyId($current_company->getId());
if ($pseallf->getRecordCount() > 0) {
$pseal_obj = $pseallf->getCurrent();
}
//
//Get all data for the form.
//
//Get Pay Periods in date range.
$pplf = TTnew('PayPeriodListFactory');
$pplf->getByCompanyIdAndTransactionStartDateAndTransactionEndDate($current_company->getId(), TTDate::getBeginYearEpoch($year_epoch), TTDate::getEndYearEpoch($year_epoch));
if ($pplf->getRecordCount() > 0) {
foreach ($pplf as $pp_obj) {
$pay_period_ids[] = $pp_obj->getID();
}
}
$report_columns = $static_columns;
$pself = TTnew('PayStubEntryListFactory');
$pself->getReportByCompanyIdAndUserIdAndPayPeriodId($current_company->getId(), $filter_data['user_ids'], $pay_period_ids);
foreach ($pself as $pse_obj) {
$user_id = $pse_obj->getColumn('user_id');
$pay_stub_entry_name_id = $pse_obj->getColumn('pay_stub_entry_name_id');
$raw_rows[$user_id][$pay_stub_entry_name_id] = $pse_obj->getColumn('amount');
}
//var_dump($raw_rows);
//
示例2: TTnew
break;
case 'recalculate_paystub_ytd':
//Debug::setVerbosity(11);
Debug::Text('Recalculating Pay Stub YTDs!', __FILE__, __LINE__, __METHOD__, 10);
Debug::Text('Pay Stub ID: ' . $pay_stub_ids, __FILE__, __LINE__, __METHOD__, 10);
$init_progress_bar = TRUE;
//Just need the pay_stub_id of the modified pay stub.
$pslf = TTnew('PayStubListFactory');
$pslf->StartTransaction();
if (is_array($pay_stub_ids)) {
foreach ($pay_stub_ids as $pay_stub_id) {
$pslf->getByIdAndCompanyIdAndIgnoreDeleted($pay_stub_id, $current_company->getId());
if ($pslf->getRecordCount() > 0) {
$main_ps_obj = $pslf->getCurrent();
//Get all pay stubs NEWER then this one.
$pslf->getByUserIdAndStartDateAndEndDate($main_ps_obj->getUser(), $main_ps_obj->getTransactionDate(), TTDate::getEndYearEpoch($main_ps_obj->getTransactionDate()));
$total_pay_stubs = $pslf->getRecordCount();
if ($total_pay_stubs > 0) {
if ($init_progress_bar == TRUE) {
InitProgressBar();
$init_progress_bar = FALSE;
}
$progress_bar->setValue(0);
$progress_bar->display();
$x = 1;
foreach ($pslf as $ps_obj) {
Debug::Text('ReCalculating Pay Stub ID: ' . $ps_obj->getId(), __FILE__, __LINE__, __METHOD__, 10);
$ps_obj->reCalculatePayStubYTD($ps_obj->getId());
$progress_bar->setValue(Misc::calculatePercent($x, $total_pay_stubs));
$progress_bar->display();
$x++;
示例3: getCurrentPayPeriodNumber
function getCurrentPayPeriodNumber($epoch = NULL, $end_date_epoch = NULL)
{
//EPOCH MUST BE TRANSACTION DATE!!!
//End Date Epoch must be END DATE of pay period
//Don't return pay period number if its a manual schedule.
if ($this->getType() == 5) {
return FALSE;
}
//FIXME: Turn this query in to a straight count(*) query for even more speed.
if ($epoch == NULL or $epoch == '') {
$epoch = TTDate::getTime();
}
//Debug::text('Epoch: '. TTDate::getDate('DATE+TIME',$epoch) .' - End Date Epoch: '. TTDate::getDate('DATE+TIME',$end_date_epoch) , __FILE__, __LINE__, __METHOD__, 10);
/*
//FIXME: If a company starts with TimeTrex half way through the year, this will be incorrect.
//Because it only counts pay periods that exist, not pay periods that WOULD have existed.
$pplf = new PayPeriodListFactory();
$pplf->getByPayPeriodScheduleIdAndStartTransactionDateAndEndTransactionDate( $this->getId(), TTDate::getBeginYearEpoch( $epoch ), $epoch );
$retval = $pplf->getRecordCount();
Debug::text('Current Pay Period: '. $retval , __FILE__, __LINE__, __METHOD__, 10);
*/
//Half Fixed method here. We cache the results so to speed it up, but there still might be a faster way to do this.
//FIXME: Perhaps some type of hybrid system like the above unless they have less then a years worth of
//pay periods, then use this method below?
$id = $this->getId() . $epoch . $end_date_epoch;
$retval = $this->getCache($id);
if ($retval === FALSE) {
//FIXME: I'm sure there is a quicker way to do this.
$next_transaction_date = 0;
$next_end_date = $end_date_epoch;
$end_year_epoch = TTDate::getEndYearEpoch($epoch);
$i = 0;
while ($next_transaction_date <= $end_year_epoch and $i < 100) {
//Debug::text('I: '. $i .' Looping: Transaction Date: '. TTDate::getDate('DATE+TIME',$next_transaction_date) .' - End Year Epoch: '. TTDate::getDate('DATE+TIME',$end_year_epoch) , __FILE__, __LINE__, __METHOD__, 10);
$this->getNextPayPeriod($next_end_date);
$next_transaction_date = $this->getNextTransactionDate();
$next_end_date = $this->getNextEndDate();
if ($next_transaction_date <= $end_year_epoch) {
$i++;
}
}
Debug::text('i: ' . $i, __FILE__, __LINE__, __METHOD__, 10);
$retval = $this->getAnnualPayPeriods() - $i;
Debug::text('Current Pay Period: ' . $retval, __FILE__, __LINE__, __METHOD__, 10);
//Cache results
$this->saveCache($retval, $id);
}
return $retval;
}
示例4: UserListFactory
$ugdf->Save();
}
$ulf = new UserListFactory();
$ulf->getSearchByCompanyIdAndArrayCriteria($current_company->getId(), $filter_data);
if ($ulf->getRecordCount() > 0) {
foreach ($ulf as $u_obj) {
$filter_data['user_ids'][] = $u_obj->getId();
}
if (isset($filter_data['year']) and isset($filter_data['user_ids'])) {
//Get all pay period IDs in year.
if (isset($filter_data['year'])) {
$year_epoch = mktime(0, 0, 0, 1, 1, $filter_data['year']);
Debug::Text(' Year: ' . TTDate::getDate('DATE+TIME', $year_epoch), __FILE__, __LINE__, __METHOD__, 10);
}
$pself = new PayStubEntryListFactory();
$pself->getReportByCompanyIdAndUserIdAndTransactionStartDateAndTransactionEndDate($current_company->getId(), $filter_data['user_ids'], TTDate::getBeginYearEpoch($year_epoch), TTDate::getEndYearEpoch($year_epoch));
$report_columns = $static_columns;
foreach ($pself as $pse_obj) {
$user_id = $pse_obj->getColumn('user_id');
$pay_stub_entry_name_id = $pse_obj->getColumn('pay_stub_entry_name_id');
$raw_rows[$user_id][$pay_stub_entry_name_id] = $pse_obj->getColumn('amount');
}
//var_dump($raw_rows);
if (isset($raw_rows)) {
$ulf = new UserListFactory();
$utlf = new UserTitleListFactory();
$title_options = $utlf->getByCompanyIdArray($current_company->getId());
$uglf = new UserGroupListFactory();
$group_options = $uglf->getArrayByNodes(FastTree::FormatArray($uglf->getByCompanyIdArray($current_company->getId()), 'no_tree_text', TRUE));
$blf = new BranchListFactory();
$branch_options = $blf->getByCompanyIdArray($current_company->getId());
示例5: testCalendarAccrualD
function testCalendarAccrualD()
{
global $dd;
$hire_date = $this->getUserObject($this->user_id)->getHireDate();
$current_epoch = TTDate::getBeginYearEpoch($hire_date + 86400 * 365 * 2);
$accrual_policy_id = $this->createAccrualPolicy($this->company_id, 50);
$dd->createPolicyGroup($this->company_id, NULL, NULL, NULL, NULL, NULL, NULL, array($this->user_id), NULL, array($accrual_policy_id));
$this->calcAccrualTime($this->company_id, $accrual_policy_id, TTDate::getBeginYearEpoch($current_epoch), TTDate::getEndYearEpoch($current_epoch));
$accrual_balance = $this->getCurrentAccrualBalance($this->user_id, $accrual_policy_id);
$this->assertEquals($accrual_balance, 80 * 3600);
}
示例6: reCalculateYTD
function reCalculateYTD()
{
//Get all pay stubs NEWER then this one.
$pslf = new PayStubListFactory();
$pslf->getByUserIdAndStartDateAndEndDate($this->getUser(), $this->getTransactionDate(), TTDate::getEndYearEpoch($this->getTransactionDate()));
$total_pay_stubs = $pslf->getRecordCount();
if ($total_pay_stubs > 0) {
$pslf->StartTransaction();
foreach ($pslf as $ps_obj) {
$this->reCalculatePayStubYTD($ps_obj->getId());
}
$pslf->CommitTransaction();
} else {
Debug::Text('No Newer Pay Stubs found!', __FILE__, __LINE__, __METHOD__, 10);
}
return TRUE;
}
示例7: isUniqueName
function isUniqueName($name)
{
//BindDate() causes a deprecated error if date_stamp is not set, so just return TRUE so we can throw a invalid date error elsewhere instead.
//This also causes it so we can never have a invalid date and invalid name validation errors at the same time.
if ($this->getDateStamp() == '') {
return TRUE;
}
//When a holiday gets moved back/forward due to falling on weekend, it can throw off the check to see if the holiday
//appears in the same year. For example new years 01-Jan-2011 gets moved to 31-Dec-2010, its in the same year
//as the previous New Years day or 01-Jan-2010, so this check fails.
//
//I think this can only happen with New Years, or other holidays that fall within two days of the new year.
//So exclude the first three days of the year to allow for weekend adjustments.
$ph = array('policy_id' => $this->getHolidayPolicyID(), 'name' => $name, 'start_date1' => $this->db->BindDate(TTDate::getBeginYearEpoch($this->getDateStamp()) + 86400 * 3), 'end_date1' => $this->db->BindDate(TTDate::getEndYearEpoch($this->getDateStamp())), 'start_date2' => $this->db->BindDate($this->getDateStamp() - 86400 * 15), 'end_date2' => $this->db->BindDate($this->getDateStamp() + 86400 * 15));
$query = 'select id from ' . $this->getTable() . '
where holiday_policy_id = ?
AND name = ?
AND
(
(
date_stamp >= ?
AND date_stamp <= ?
)
OR
(
date_stamp >= ?
AND date_stamp <= ?
)
)
AND deleted=0';
$name_id = $this->db->GetOne($query, $ph);
Debug::Arr($name_id, 'Unique Name: ' . $name, __FILE__, __LINE__, __METHOD__, 10);
if ($name_id === FALSE) {
return TRUE;
} else {
if ($name_id == $this->getId()) {
return TRUE;
}
}
return FALSE;
}
示例8: createPayStubAmendments
//.........这里部分代码省略.........
$psaf->setRecurringPayStubAmendmentId($this->getId());
$psaf->setPayStubEntryNameId($this->getPayStubEntryNameId());
if ($this->getType() == 10) {
$psaf->setRate($this->getRate());
$psaf->setUnits($this->getUnits());
$psaf->setAmount($this->getAmount());
} else {
$psaf->setPercentAmount($this->getPercentAmount());
$psaf->setPercentAmountEntryNameID($this->getPercentAmountEntryNameId());
}
$psaf->setDescription($this->getPayStubAmendmentDescription());
$psaf->setEffectiveDate(TTDate::getBeginDayEpoch($pay_period_obj->getEndDate()));
if ($psaf->isValid()) {
$psaf->Save();
}
} else {
//Amendment already inserted!
Debug::text('Recurring PS Amendment already inserted for User: ' . $user_id, __FILE__, __LINE__, __METHOD__, 10);
}
} else {
Debug::text('Skipping User because they are INACTIVE or are not on the Recurring PS Amendment User List - ID: ' . $user_id, __FILE__, __LINE__, __METHOD__, 10);
//continue;
}
}
} else {
Debug::text('Not in TimeFrame, not inserting amendments: Epoch: ' . $epoch . ' Pay Period End Date: ' . $pay_period_obj->getEndDate(), __FILE__, __LINE__, __METHOD__, 10);
}
}
break;
case 30:
//Weekly
//Weekly
case 40:
//Monthly
//Monthly
case 70:
//Annually
switch ($this->getFrequency()) {
case 30:
$trigger_date = TTDate::getDateOfNextDayOfWeek(TTDate::getBeginWeekEpoch($epoch), $this->getStartDate());
$start_date = TTDate::getBeginWeekEpoch($epoch);
$end_date = TTDate::getEndWeekEpoch($epoch);
break;
case 40:
$trigger_date = TTDate::getDateOfNextDayOfMonth(TTDate::getBeginMonthEpoch($epoch), $this->getStartDate());
//$monthly_date = TTDate::getDateOfNextDayOfMonth( TTDate::getBeginMonthEpoch($epoch), $this->getStartDate() );
$start_date = TTDate::getBeginMonthEpoch($epoch);
$end_date = TTDate::getEndMonthEpoch($epoch);
break;
case 70:
$trigger_date = TTDate::getDateOfNextYear($this->getStartDate());
$start_date = TTDate::getBeginYearEpoch($epoch);
$end_date = TTDate::getEndYearEpoch($epoch);
break;
}
Debug::text('Trigger Date: ' . TTDate::getDate('DATE', $trigger_date), __FILE__, __LINE__, __METHOD__, 10);
if ($epoch >= $trigger_date and $this->checkTimeFrame($epoch)) {
Debug::text('After end of pay period.', __FILE__, __LINE__, __METHOD__, 10);
foreach ($user_ids as $user_id) {
//Make sure schedule user is in the PS amendment user list and user is active.
if ($ulf->getById($user_id)->getCurrent()->getStatus() != 10 and !in_array($user_id, $user_ids)) {
Debug::text('Skipping User because they are INACTIVE or are not on the Recurring PS Amendment User List - ID: ' . $user_id, __FILE__, __LINE__, __METHOD__, 10);
continue;
}
$psalf = new PayStubAmendmentListFactory();
if ($psalf->getByUserIdAndRecurringPayStubAmendmentIdAndStartDateAndEndDate($user_id, $this->getId(), $start_date, $end_date)->getRecordCount() == 0) {
//No amendment, good to insert one
Debug::text('Inserting Recurring PS Amendment for User: ' . $user_id, __FILE__, __LINE__, __METHOD__, 10);
$psaf = new PayStubAmendmentFactory();
$psaf->setUser($user_id);
$psaf->setStatus(50);
$psaf->setType($this->getType());
$psaf->setRecurringPayStubAmendmentId($this->getId());
$psaf->setPayStubEntryNameId($this->getPayStubEntryNameId());
if ($this->getType() == 10) {
$psaf->setRate($this->getRate());
$psaf->setUnits($this->getUnits());
$psaf->setAmount($this->getAmount());
} else {
$psaf->setPercentAmount($this->getPercentAmount());
$psaf->setPercentAmountEntryNameID($this->getPercentAmountEntryNameId());
}
$psaf->setDescription($this->getDescription());
$psaf->setEffectiveDate(TTDate::getBeginDayEpoch($trigger_date));
if ($psaf->isValid()) {
$psaf->Save();
}
} else {
//Amendment already inserted!
Debug::text('Recurring PS Amendment already inserted for User: ' . $user_id, __FILE__, __LINE__, __METHOD__, 10);
}
}
}
break;
}
}
//$this->FailTransaction();
$this->CommitTransaction();
return TRUE;
}
示例9: getTimePeriodDates
//.........这里部分代码省略.........
break;
case 'last_year_4th_quarter':
$quarter = 4;
$quarter_dates = TTDate::getYearQuarters(TTDate::getBeginYearEpoch($epoch) - 86400, $quarter);
$start_date = $quarter_dates['start'];
$end_date = $quarter_dates['end'];
break;
case 'last_3_months':
$end_date = TTDate::getEndDayEpoch(TTDate::getMiddleDayEpoch($epoch) - 86400);
$start_date = mktime(0, 0, 0, TTDate::getMonth($end_date) - 3, TTDate::getDayOfMonth($end_date), TTDate::getYear($end_date));
break;
case 'last_6_months':
$end_date = TTDate::getEndDayEpoch(TTDate::getMiddleDayEpoch($epoch) - 86400);
$start_date = mktime(0, 0, 0, TTDate::getMonth($end_date) - 6, TTDate::getDayOfMonth($end_date), TTDate::getYear($end_date));
break;
case 'last_9_months':
$end_date = TTDate::getEndDayEpoch(TTDate::getMiddleDayEpoch($epoch) - 86400);
$start_date = mktime(0, 0, 0, TTDate::getMonth($end_date) - 9, TTDate::getDayOfMonth($end_date), TTDate::getYear($end_date));
break;
case 'last_12_months':
$end_date = TTDate::getEndDayEpoch(TTDate::getMiddleDayEpoch($epoch) - 86400);
$start_date = mktime(0, 0, 0, TTDate::getMonth($end_date), TTDate::getDayOfMonth($end_date), TTDate::getYear($end_date) - 1);
break;
case 'last_18_months':
$end_date = TTDate::getEndDayEpoch(TTDate::getMiddleDayEpoch($epoch) - 86400);
$start_date = mktime(0, 0, 0, TTDate::getMonth($end_date) - 18, TTDate::getDayOfMonth($end_date), TTDate::getYear($end_date));
break;
case 'last_24_months':
$end_date = TTDate::getEndDayEpoch(TTDate::getMiddleDayEpoch($epoch) - 86400);
$start_date = mktime(0, 0, 0, TTDate::getMonth($end_date) - 24, TTDate::getDayOfMonth($end_date), TTDate::getYear($end_date));
break;
case 'this_year':
$start_date = TTDate::getBeginYearEpoch($epoch);
$end_date = TTDate::getEndYearEpoch($epoch);
break;
case 'last_year':
$start_date = TTDate::getBeginYearEpoch(TTDate::getBeginYearEpoch($epoch) - 86400);
$end_date = TTDate::getEndYearEpoch(TTDate::getBeginYearEpoch($epoch) - 86400);
break;
case 'last_2_years':
$end_date = TTDate::getEndYearEpoch(TTDate::getBeginYearEpoch($epoch) - 86400);
$start_date = mktime(0, 0, 0, TTDate::getMonth($end_date), TTDate::getDayOfMonth($end_date), TTDate::getYear($end_date) - 2);
break;
case 'last_3_years':
$end_date = TTDate::getEndYearEpoch(TTDate::getBeginYearEpoch($epoch) - 86400);
$start_date = mktime(0, 0, 0, TTDate::getMonth($end_date), TTDate::getDayOfMonth($end_date), TTDate::getYear($end_date) - 3);
break;
case 'last_5_years':
$end_date = TTDate::getEndYearEpoch(TTDate::getBeginYearEpoch($epoch) - 86400);
$start_date = mktime(0, 0, 0, TTDate::getMonth($end_date), TTDate::getDayOfMonth($end_date), TTDate::getYear($end_date) - 5);
break;
case 'to_yesterday':
//"Up To" means we need to use the end time of the day we go up to.
$start_date = TTDate::getBeginYearEpoch(TTDate::getBeginYearEpoch(31564800) - 86400);
$end_date = TTDate::getBeginDayEpoch(TTDate::getMiddleDayEpoch($epoch) - 86400) - 1;
break;
case 'to_today':
$start_date = TTDate::getBeginYearEpoch(TTDate::getBeginYearEpoch(31564800) - 86400);
$end_date = TTDate::getBeginDayEpoch(TTDate::getMiddleDayEpoch($epoch)) - 1;
break;
case 'to_this_week':
$start_date = TTDate::getBeginYearEpoch(TTDate::getBeginYearEpoch(31564800) - 86400);
$end_date = TTDate::getBeginWeekEpoch($epoch, $start_week_day) - 1;
break;
case 'to_last_week':
$start_date = TTDate::getBeginYearEpoch(TTDate::getBeginYearEpoch(31564800) - 86400);
示例10: isUniqueName
function isUniqueName($name)
{
$ph = array('policy_id' => $this->getHolidayPolicyID(), 'name' => $name, 'start_date1' => $this->db->BindDate(TTDate::getBeginYearEpoch($this->getDateStamp())), 'end_date1' => $this->db->BindDate(TTDate::getEndYearEpoch($this->getDateStamp())), 'start_date2' => $this->db->BindDate($this->getDateStamp() - 86400 * 15), 'end_date2' => $this->db->BindDate($this->getDateStamp() + 86400 * 15));
$query = 'select id from ' . $this->getTable() . '
where holiday_policy_id = ?
AND name = ?
AND
(
(
date_stamp >= ?
AND date_stamp <= ?
)
OR
(
date_stamp >= ?
AND date_stamp <= ?
)
)
AND deleted=0';
$name_id = $this->db->GetOne($query, $ph);
Debug::Arr($name_id, 'Unique Name: ' . $name, __FILE__, __LINE__, __METHOD__, 10);
if ($name_id === FALSE) {
return TRUE;
} else {
if ($name_id == $this->getId()) {
return TRUE;
}
}
return FALSE;
}
示例11: array
$ugdlf->getByUserIdAndScriptAndDefault($current_user->getId(), $_SERVER['SCRIPT_NAME']);
if ($ugdlf->getRecordCount() > 0) {
Debug::Text('Found Default Report!', __FILE__, __LINE__, __METHOD__, 10);
$ugd_obj = $ugdlf->getCurrent();
$filter_data = $ugd_obj->getData();
$generic_data['id'] = $ugd_obj->getId();
} else {
Debug::Text('Default Settings!', __FILE__, __LINE__, __METHOD__, 10);
//Default selections
$filter_data['user_status_ids'] = array(-1);
$filter_data['branch_ids'] = array(-1);
$filter_data['department_ids'] = array(-1);
$filter_data['user_title_ids'] = array(-1);
$filter_data['group_ids'] = array(-1);
$filter_data['transaction_start_date'] = TTDate::getBeginYearEpoch();
$filter_data['transaction_end_date'] = TTDate::getEndYearEpoch();
}
}
$ulf = new UserListFactory();
$all_array_option = array('-1' => TTi18n::gettext('-- All --'));
//Get include employee list.
$ulf->getByCompanyId($current_company->getId());
$user_options = $ulf->getArrayByListFactory($ulf, FALSE, TRUE);
$filter_data['src_include_user_options'] = Misc::arrayDiffByKey((array) $filter_data['include_user_ids'], $user_options);
$filter_data['selected_include_user_options'] = Misc::arrayIntersectByKey((array) $filter_data['include_user_ids'], $user_options);
//Get exclude employee list
$exclude_user_options = Misc::prependArray($all_array_option, $ulf->getArrayByListFactory($ulf, FALSE, TRUE));
$filter_data['src_exclude_user_options'] = Misc::arrayDiffByKey((array) $filter_data['exclude_user_ids'], $user_options);
$filter_data['selected_exclude_user_options'] = Misc::arrayIntersectByKey((array) $filter_data['exclude_user_ids'], $user_options);
//Get employee status list.
$user_status_options = Misc::prependArray($all_array_option, $ulf->getOptions('status'));