本文整理汇总了PHP中TTDate::getBeginYearEpoch方法的典型用法代码示例。如果您正苦于以下问题:PHP TTDate::getBeginYearEpoch方法的具体用法?PHP TTDate::getBeginYearEpoch怎么用?PHP TTDate::getBeginYearEpoch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTDate
的用法示例。
在下文中一共展示了TTDate::getBeginYearEpoch方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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());
示例2: 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);
//
示例3: getOtherEntryNamesByUserIdAndPayStubIdAndYear
function getOtherEntryNamesByUserIdAndPayStubIdAndYear($user_id, $pay_stub_id, $year = NULL, $where = NULL, $order = NULL)
{
if ($user_id == '') {
return FALSE;
}
if ($pay_stub_id == '') {
return FALSE;
}
if ($year == '') {
$year = TTDate::getTime();
}
$begin_year_epoch = TTDate::getBeginYearEpoch($year);
$pplf = new PayPeriodListFactory();
$pslf = new PayStubListFactory();
//$psenlf = new PayStubEntryNameListFactory();
$psealf = new PayStubEntryAccountListFactory();
$ph = array('transaction_date' => $this->db->BindTimeStamp($begin_year_epoch), 'user_id' => $user_id, 'pay_stub_id' => $pay_stub_id);
//Make sure we don't include entries that have a sum of 0.
//This is YTD for the EMPLOYEES... So it should always be when they are paid.
$query = '
select distinct(pay_stub_entry_name_id)
from ' . $this->getTable() . ' as a,
' . $pslf->getTable() . ' as b,
' . $psealf->getTable() . ' as c
where a.pay_stub_id = b.id
AND a.pay_stub_entry_name_id = c.id
AND b.pay_period_id in (select id from ' . $pplf->getTable() . ' as y
where y.pay_period_schedule_id = ( select pay_period_schedule_id from ' . $pplf->getTable() . ' as z where z.id = b.pay_period_id ) AND y.transaction_date >= ? AND y.deleted=0)
AND b.user_id = ?
AND c.type_id in (10,20,30)
AND a.pay_stub_entry_name_id NOT IN ( select distinct(pay_stub_entry_name_id) from ' . $this->getTable() . ' as x WHERE x.pay_stub_id = ?)
AND a.deleted = 0
AND b.deleted = 0
GROUP BY pay_stub_entry_name_id
HAVING sum(amount) > 0';
$query .= $this->getWhereSQL($where);
$query .= $this->getSortSQL($order);
$result = $this->rs = $this->db->GetCol($query, $ph);
return $result;
}
示例4: createPayPeriods
function createPayPeriods()
{
$max_pay_periods = 29;
$ppslf = new PayPeriodScheduleListFactory();
$ppslf->getById($this->pay_period_schedule_id);
if ($ppslf->getRecordCount() > 0) {
$pps_obj = $ppslf->getCurrent();
for ($i = 0; $i < $max_pay_periods; $i++) {
if ($i == 0) {
//$end_date = TTDate::getBeginYearEpoch( strtotime('01-Jan-07') );
$end_date = TTDate::getBeginYearEpoch(time());
} else {
$end_date = $end_date + 86400 * 14;
}
Debug::Text('I: ' . $i . ' End Date: ' . TTDate::getDate('DATE+TIME', $end_date), __FILE__, __LINE__, __METHOD__, 10);
$pps_obj->createNextPayPeriod($end_date, 86400 * 3600);
}
}
return TRUE;
}
示例5: 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;
}
示例6: 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);
}
示例7: 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;
}
示例8: getTimePeriodDates
//.........这里部分代码省略.........
$end_date = TTDate::getEndMonthEpoch($epoch);
break;
case 'last_month':
$start_date = TTDate::getBeginMonthEpoch(TTDate::getBeginMonthEpoch($epoch) - 86400);
$end_date = TTDate::getEndMonthEpoch(TTDate::getBeginMonthEpoch($epoch) - 86400);
break;
case 'last_2_months':
$start_date = TTDate::getBeginMonthEpoch(TTDate::getBeginMonthEpoch($epoch) - 86400 * 32);
$end_date = TTDate::getEndMonthEpoch(TTDate::getBeginMonthEpoch($epoch) - 86400);
break;
case 'last_30_days':
$start_date = TTDate::getBeginDayEpoch(TTDate::getMiddleDayEpoch($epoch) - 86400 * 30);
$end_date = TTDate::getEndDayEpoch(TTDate::getMiddleDayEpoch($epoch) - 86400);
break;
case 'last_45_days':
$start_date = TTDate::getBeginDayEpoch(TTDate::getMiddleDayEpoch($epoch) - 86400 * 45);
$end_date = TTDate::getEndDayEpoch(TTDate::getMiddleDayEpoch($epoch) - 86400);
break;
case 'last_60_days':
$start_date = TTDate::getBeginDayEpoch(TTDate::getMiddleDayEpoch($epoch) - 86400 * 60);
$end_date = TTDate::getEndDayEpoch(TTDate::getMiddleDayEpoch($epoch) - 86400);
break;
case 'this_quarter':
$quarter = TTDate::getYearQuarter($epoch);
$quarter_dates = TTDate::getYearQuarters($epoch, $quarter);
//Debug::Arr($quarter_dates, 'Quarter Dates: Quarter: '. $quarter, __FILE__, __LINE__, __METHOD__,10);
$start_date = $quarter_dates['start'];
$end_date = $quarter_dates['end'];
break;
case 'last_quarter':
$quarter = TTDate::getYearQuarter($epoch) - 1;
if ($quarter == 0) {
$quarter = 4;
$epoch = TTDate::getBeginYearEpoch() - 86400;
//Need to jump back into the previous year.
}
$quarter_dates = TTDate::getYearQuarters($epoch, $quarter);
$start_date = $quarter_dates['start'];
$end_date = $quarter_dates['end'];
break;
case 'last_90_days':
$start_date = TTDate::getBeginDayEpoch(TTDate::getMiddleDayEpoch($epoch) - 86400 * 90);
$end_date = TTDate::getEndDayEpoch(TTDate::getMiddleDayEpoch($epoch) - 86400);
break;
case 'this_year_1st_quarter':
$quarter = 1;
$quarter_dates = TTDate::getYearQuarters($epoch, $quarter);
$start_date = $quarter_dates['start'];
$end_date = $quarter_dates['end'];
break;
case 'this_year_2nd_quarter':
$quarter = 2;
$quarter_dates = TTDate::getYearQuarters($epoch, $quarter);
$start_date = $quarter_dates['start'];
$end_date = $quarter_dates['end'];
break;
case 'this_year_3rd_quarter':
$quarter = 3;
$quarter_dates = TTDate::getYearQuarters($epoch, $quarter);
$start_date = $quarter_dates['start'];
$end_date = $quarter_dates['end'];
break;
case 'this_year_4th_quarter':
$quarter = 4;
$quarter_dates = TTDate::getYearQuarters($epoch, $quarter);
$start_date = $quarter_dates['start'];
示例9: 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;
}
示例10: _getData
function _getData($format = NULL)
{
$this->tmp_data = array('pay_stub_entry' => array());
$columns = $this->getColumnDataConfig();
$filter_data = $this->getFilterConfig();
$form_data = $this->formatFormConfig();
require_once Environment::getBasePath() . '/classes/payroll_deduction/PayrollDeduction.class.php';
$pd_obj = new PayrollDeduction('US', 'WA');
//State doesn't matter.
$pd_obj->setDate($filter_data['end_date']);
$social_security_wage_limit = $pd_obj->getSocialSecurityMaximumEarnings();
$medicare_additional_threshold_limit = $pd_obj->getMedicareAdditionalEmployerThreshold();
Debug::Text('Social Security Wage Limit: ' . $social_security_wage_limit . ' Medicare Threshold: ' . $medicare_additional_threshold_limit . ' Date: ' . TTDate::getDate('DATE', $filter_data['end_date']), __FILE__, __LINE__, __METHOD__, 10);
//Need to get totals up to the beginning of this quarter so we can determine if any employees have exceeded the social security limit.
$pself = TTnew('PayStubEntryListFactory');
$ytd_filter_data = $filter_data;
$ytd_filter_data['end_date'] = $ytd_filter_data['start_date'] - 1;
$ytd_filter_data['start_date'] = TTDate::getBeginYearEpoch($ytd_filter_data['start_date']);
$pself->getAPIReportByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $ytd_filter_data);
//Debug::Arr($ytd_filter_data, 'YTD Filter Data: Row Count: '. $pself->getRecordCount(), __FILE__, __LINE__, __METHOD__,10);
if ($pself->getRecordCount() > 0) {
foreach ($pself as $pse_obj) {
$user_id = $pse_obj->getColumn('user_id');
//Make sure we don't add this to the unique user_id list.
//Always use middle day epoch, otherwise multiple entries could exist for the same day.
$date_stamp = TTDate::getMiddleDayEpoch(TTDate::strtotime($pse_obj->getColumn('pay_stub_transaction_date')));
$branch = $pse_obj->getColumn('default_branch');
$department = $pse_obj->getColumn('default_department');
$pay_stub_entry_name_id = $pse_obj->getPayStubEntryNameId();
if (!isset($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp])) {
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp] = array('pay_period_start_date' => strtotime($pse_obj->getColumn('pay_stub_start_date')), 'pay_period_end_date' => strtotime($pse_obj->getColumn('pay_stub_end_date')), 'pay_period_transaction_date' => strtotime($pse_obj->getColumn('pay_stub_transaction_date')), 'pay_period' => strtotime($pse_obj->getColumn('pay_stub_transaction_date')));
}
if (isset($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id])) {
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id] = bcadd($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id], $pse_obj->getColumn('amount'));
} else {
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id] = $pse_obj->getColumn('amount');
}
}
if (isset($this->tmp_data['pay_stub_entry']) and is_array($this->tmp_data['pay_stub_entry'])) {
foreach ($this->tmp_data['pay_stub_entry'] as $user_id => $data_a) {
foreach ($data_a as $date_stamp => $data_b) {
if (!isset($this->tmp_data['ytd_pay_stub_entry'][$user_id]['social_security_wages'])) {
$this->tmp_data['ytd_pay_stub_entry'][$user_id]['social_security_wages'] = 0;
}
$this->tmp_data['ytd_pay_stub_entry'][$user_id]['social_security_wages'] += Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['social_security_wages']['include_pay_stub_entry_account'], $form_data['social_security_wages']['exclude_pay_stub_entry_account']);
//Include tips in this amount as well.
$this->tmp_data['ytd_pay_stub_entry'][$user_id]['social_security_wages'] += Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['social_security_tips']['include_pay_stub_entry_account'], $form_data['social_security_tips']['exclude_pay_stub_entry_account']);
//Handle additional medicare wages in excess of 200,000
if (!isset($this->tmp_data['ytd_pay_stub_entry'][$user_id]['medicare_wages'])) {
$this->tmp_data['ytd_pay_stub_entry'][$user_id]['medicare_wages'] = 0;
}
$this->tmp_data['ytd_pay_stub_entry'][$user_id]['medicare_wages'] += Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['medicare_wages']['include_pay_stub_entry_account'], $form_data['medicare_wages']['exclude_pay_stub_entry_account']);
}
}
}
//Debug::Arr($this->tmp_data['ytd_pay_stub_entry'], 'YTD Tmp Raw Data: ', __FILE__, __LINE__, __METHOD__,10);
}
unset($pse_obj, $user_id, $date_stamp, $branch, $department, $pay_stub_entry_name_id, $this->tmp_data['pay_stub_entry']);
//Get just the data for the quarter now.
$pself->getAPIReportByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $filter_data);
if ($pself->getRecordCount() > 0) {
foreach ($pself as $pse_obj) {
$user_id = $this->user_ids[] = $pse_obj->getColumn('user_id');
//Always use middle day epoch, otherwise multiple entries could exist for the same day.
$date_stamp = TTDate::getMiddleDayEpoch(TTDate::strtotime($pse_obj->getColumn('pay_stub_transaction_date')));
$branch = $pse_obj->getColumn('default_branch');
$department = $pse_obj->getColumn('default_department');
$pay_stub_entry_name_id = $pse_obj->getPayStubEntryNameId();
if (!isset($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp])) {
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp] = array('pay_period_start_date' => strtotime($pse_obj->getColumn('pay_stub_start_date')), 'pay_period_end_date' => strtotime($pse_obj->getColumn('pay_stub_end_date')), 'pay_period_transaction_date' => strtotime($pse_obj->getColumn('pay_stub_transaction_date')), 'pay_period' => strtotime($pse_obj->getColumn('pay_stub_transaction_date')));
}
if (isset($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id])) {
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id] = bcadd($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id], $pse_obj->getColumn('amount'));
} else {
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id] = $pse_obj->getColumn('amount');
}
}
if (isset($this->tmp_data['pay_stub_entry']) and is_array($this->tmp_data['pay_stub_entry'])) {
foreach ($this->tmp_data['pay_stub_entry'] as $user_id => $data_a) {
foreach ($data_a as $date_stamp => $data_b) {
$quarter_month = TTDate::getYearQuarterMonthNumber($date_stamp);
//Debug::Text('Quarter Month: '. $quarter_month .' Epoch: '. TTDate::getDate('DATE', $date_stamp), __FILE__, __LINE__, __METHOD__,10);
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['wages'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['wages']['include_pay_stub_entry_account'], $form_data['wages']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['income_tax'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['income_tax']['include_pay_stub_entry_account'], $form_data['income_tax']['exclude_pay_stub_entry_account']);
//FIXME: If employees are excluded from Social Security, it will still include total wages
//resulting in the 941 form being incorrect in its calculation.
//Add Form Setup tab field to select the Social Security tax/deductions?
//However there can often be two of them, is just the employee one enough? We could use the employees and include/exclude accounts from that at least then.
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['social_security_wages'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['social_security_wages']['include_pay_stub_entry_account'], $form_data['social_security_wages']['exclude_pay_stub_entry_account']);
//Handle social security wage limit.
if (!isset($this->tmp_data['ytd_pay_stub_entry'][$user_id]['social_security_wages'])) {
$this->tmp_data['ytd_pay_stub_entry'][$user_id]['social_security_wages'] = 0;
}
if ($this->tmp_data['ytd_pay_stub_entry'][$user_id]['social_security_wages'] < $social_security_wage_limit) {
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['social_security_wages'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['social_security_wages']['include_pay_stub_entry_account'], $form_data['social_security_wages']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['social_security_tips'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['social_security_tips']['include_pay_stub_entry_account'], $form_data['social_security_tips']['exclude_pay_stub_entry_account']);
if ($this->tmp_data['ytd_pay_stub_entry'][$user_id]['social_security_wages'] + $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['social_security_wages'] + $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['social_security_tips'] > $social_security_wage_limit) {
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['social_security_wages'] = $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['social_security_wages'] - ($this->tmp_data['ytd_pay_stub_entry'][$user_id]['social_security_wages'] + $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['social_security_wages'] + $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['social_security_tips'] - $social_security_wage_limit);
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['social_security_tips'] = 0;
$this->tmp_data['ytd_pay_stub_entry'][$user_id]['social_security_wages'] = $social_security_wage_limit;
//.........这里部分代码省略.........
示例11: array
//Check for default saved report first.
$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.