本文整理汇总了PHP中TTDate::getTime方法的典型用法代码示例。如果您正苦于以下问题:PHP TTDate::getTime方法的具体用法?PHP TTDate::getTime怎么用?PHP TTDate::getTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTDate
的用法示例。
在下文中一共展示了TTDate::getTime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHolidayDefaultData
/**
* Get default holiday data for creating new holidayes.
* @return array
*/
function getHolidayDefaultData()
{
$company_obj = $this->getCurrentCompanyObject();
Debug::Text('Getting holiday default data...', __FILE__, __LINE__, __METHOD__, 10);
$data = array('company_id' => $company_obj->getId(), 'date_stamp' => TTDate::getAPIDate('DATE', TTDate::getTime()));
return $this->returnHandler($data);
}
示例2: getRecurringScheduleControlDefaultData
/**
* Get default recurring_schedule_control data for creating new recurring_schedule_controles.
* @return array
*/
function getRecurringScheduleControlDefaultData()
{
$company_obj = $this->getCurrentCompanyObject();
Debug::Text('Getting recurring_schedule_control default data...', __FILE__, __LINE__, __METHOD__, 10);
$data = array('company_id' => $company_obj->getId(), 'start_week' => 1, 'start_date' => TTDate::getAPIDate('DATE', TTDate::getBeginWeekEpoch(TTDate::getTime())), 'end_date' => NULL);
return $this->returnHandler($data);
}
示例3: getData
function getData()
{
global $cache;
$country = $this->getCountry();
$epoch = $this->getDate();
$federal_status = $this->getFederalFilingStatus();
if ($federal_status == '') {
$federal_status = 10;
}
if ($epoch == NULL or $epoch == '') {
$epoch = TTDate::getTime();
}
$cache_id = $country . $epoch . $federal_status;
if (is_string($cache->get($cache_id, $this->table))) {
$this->income_tax_rates = unserialize($cache->get($cache_id, $this->table));
} else {
$this->income_tax_rates = FALSE;
}
if ($this->income_tax_rates === FALSE) {
$query = 'select country,state,district,status,income,rate,constant,effective_date
from ' . $this->table . '
where
(
effective_date = ( select effective_date
from ' . $this->table . '
where effective_date <= ' . $epoch . '
AND country = ' . $this->db->qstr($country) . '
ORDER BY effective_date DESC
LIMIT 1)
)
AND
( country = ' . $this->db->qstr($country) . ')
ORDER BY effective_date desc, income asc, rate asc
';
//Debug::text('Query: '. $query , __FILE__, __LINE__, __METHOD__, 10);
try {
$rs = $this->db->Execute($query);
} catch (Exception $e) {
throw new DBError($e);
}
$rs = $rs->GetRows();
$prev_income = 0;
$prev_rate = 0;
$prev_constant = 0;
foreach ($rs as $key => $arr) {
$type = 'federal';
$this->income_tax_rates[$type][] = array('prev_income' => trim($prev_income), 'income' => trim($arr['income']), 'prev_rate' => bcdiv(trim($prev_rate), 100), 'rate' => bcdiv(trim($arr['rate']), 100), 'prev_constant' => trim($prev_constant), 'constant' => trim($arr['constant']));
$prev_income = $arr['income'];
$prev_rate = $arr['rate'];
$prev_constant = $arr['constant'];
}
if (isset($arr)) {
Debug::text('bUsing values from: ' . TTDate::getDate('DATE+TIME', $arr['effective_date']), __FILE__, __LINE__, __METHOD__, 10);
}
//var_dump($this->income_tax_rates);
$cache->save(serialize($this->income_tax_rates), $cache_id, $this->table);
}
return $this;
}
示例4: getTimeSheetDates
/**
* Get all necessary dates for building the TimeSheet in a single call, this is mainly as a performance optimization.
* @param array $data filter data
* @return array
*/
function getTimeSheetDates($base_date)
{
$epoch = TTDate::parseDateTime($base_date);
if ($epoch == '') {
$epoch = TTDate::getTime();
}
$start_date = TTDate::getBeginWeekEpoch($epoch, $this->getCurrentUserPreferenceObject()->getStartWeekDay());
$end_date = TTDate::getEndWeekEpoch($epoch, $this->getCurrentUserPreferenceObject()->getStartWeekDay());
$retarr = array('base_date' => $epoch, 'start_date' => $start_date, 'end_date' => $end_date, 'base_display_date' => TTDate::getAPIDate('DATE', $epoch), 'start_display_date' => TTDate::getAPIDate('DATE', $start_date), 'end_display_date' => TTDate::getAPIDate('DATE', $end_date));
return $retarr;
}
示例5: getScheduleDates
/**
* Get all necessary dates for building the schedule in a single call, this is mainly as a performance optimization.
* @param array $data filter data
* @return array
*/
function getScheduleDates($base_date, $type, $strict = TRUE)
{
$epoch = TTDate::parseDateTime($base_date);
if ($epoch == '') {
$epoch = TTDate::getTime();
}
if ($type == '') {
$type = 'week';
}
switch (strtolower($type)) {
case 'day':
if ($strict == TRUE) {
$start_date = TTDate::getBeginDayEpoch($epoch);
$end_date = TTDate::getEndDayEpoch($epoch);
} else {
$start_date = TTDate::getBeginDayEpoch($epoch);
$end_date = TTDate::getBeginDayEpoch(TTDate::getMiddleDayEpoch($epoch) + 86400);
}
break;
case 'week':
if ($strict == TRUE) {
$start_date = TTDate::getBeginWeekEpoch($epoch, $this->getCurrentUserPreferenceObject()->getStartWeekDay());
$end_date = TTDate::getEndWeekEpoch($epoch, $this->getCurrentUserPreferenceObject()->getStartWeekDay());
} else {
$start_date = TTDate::getBeginDayEpoch($epoch);
$end_date = TTDate::getBeginDayEpoch(TTDate::getMiddleDayEpoch($epoch) + 7 * 86400);
}
break;
case 'month':
if ($strict == TRUE) {
$start_date = TTDate::getBeginWeekEpoch(TTDate::getBeginMonthEpoch($epoch), $this->getCurrentUserPreferenceObject()->getStartWeekDay());
$end_date = TTDate::getEndWeekEpoch(TTDate::getEndMonthEpoch($epoch), $this->getCurrentUserPreferenceObject()->getStartWeekDay());
} else {
$start_date = TTDate::getBeginDayEpoch($epoch);
$end_date = TTDate::getBeginDayEpoch(TTDate::getMiddleDayEpoch($epoch) + 30 * 86400);
}
break;
case 'year':
if ($strict == TRUE) {
$start_date = TTDate::getBeginWeekEpoch(TTDate::getBeginMonthEpoch($epoch), $this->getCurrentUserPreferenceObject()->getStartWeekDay());
$end_date = TTDate::getEndWeekEpoch(TTDate::getEndMonthEpoch(TTDate::getEndMonthEpoch($epoch) + 86400 * 2), $this->getCurrentUserPreferenceObject()->getStartWeekDay());
} else {
$start_date = TTDate::getBeginDayEpoch($epoch);
$end_date = TTDate::getBeginDayEpoch(TTDate::getMiddleDayEpoch($epoch) + 62 * 86400);
}
break;
}
$retarr = array('base_date' => $epoch, 'start_date' => $start_date, 'end_date' => $end_date, 'base_display_date' => TTDate::getAPIDate('DATE', $epoch), 'start_display_date' => TTDate::getAPIDate('DATE', $start_date), 'end_display_date' => TTDate::getAPIDate('DATE', $end_date));
Debug::Arr($retarr, 'Schedule Dates: Base Date: ' . $base_date . ' Type: ' . $type . ' Strict: ' . (int) $strict, __FILE__, __LINE__, __METHOD__, 10);
return $retarr;
}
示例6: setCrumb
static function setCrumb($name, $url = NULL)
{
global $db, $current_user;
//
// If bread crumbs "seem" like they are getting overwritten, make sure the
// setCrumb function is being called ONLY in the default section of the switch statement. NOT THE TOP.
//
if ($url == '') {
$url = $_SERVER['REQUEST_URI'];
}
if (!is_object($current_user)) {
return FALSE;
}
Debug::text('Dropping Bread Crumb: ' . $name . ' URL: ' . $url, __FILE__, __LINE__, __METHOD__, 10);
$ph = array('user_id' => $current_user->getId(), 'name' => $name);
//Determine if we should update or insert bread crumb.
$query = 'select name
FROM bread_crumb
WHERE user_id = ?
AND name = ?
LIMIT 1';
try {
$rs = $db->Execute($query, $ph);
} catch (Exception $e) {
throw new DBError($e);
}
if ($rs->RecordCount() == 1) {
$ph = array('url' => $url, 'created_date' => TTDate::getTime(), 'user_id' => $current_user->getId(), 'name' => $name);
$query = 'UPDATE bread_crumb
SET url = ?,
created_date = ?
WHERE user_id = ?
AND name = ?';
} else {
$ph = array('user_id' => $current_user->getId(), 'name' => $name, 'url' => $url, 'created_date' => TTDate::getTime());
$query = 'insert into bread_crumb (user_id,name,url,created_date)
VALUES(
?,
?,
?,
?
)';
}
try {
$db->Execute($query, $ph);
} catch (Exception $e) {
throw new DBError($e);
}
return TRUE;
}
示例7: TTnew
$psaf->FailTransaction();
}
default:
BreadCrumb::setCrumb($title);
if (isset($id)) {
$psalf = TTnew('PayStubAmendmentListFactory');
//$uwlf->GetByUserIdAndCompanyId($current_user->getId(), $current_company->getId() );
$psalf->GetById($id);
foreach ($psalf as $pay_stub_amendment) {
//Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10);
$user_id = $pay_stub_amendment->getUser();
$pay_stub_amendment_data = array('id' => $pay_stub_amendment->getId(), 'filter_user_id' => $pay_stub_amendment->getUser(), 'pay_stub_entry_name_id' => $pay_stub_amendment->getPayStubEntryNameId(), 'status_id' => $pay_stub_amendment->getStatus(), 'effective_date' => $pay_stub_amendment->getEffectiveDate(), 'type_id' => $pay_stub_amendment->getType(), 'rate' => $pay_stub_amendment->getRate(), 'units' => $pay_stub_amendment->getUnits(), 'amount' => $pay_stub_amendment->getAmount(), 'percent_amount' => $pay_stub_amendment->getPercentAmount(), 'percent_amount_entry_name_id' => $pay_stub_amendment->getPercentAmountEntryNameId(), 'description' => $pay_stub_amendment->getDescription(), 'private_description' => $pay_stub_amendment->getPrivateDescription(), 'authorized' => $pay_stub_amendment->getAuthorized(), 'ytd_adjustment' => $pay_stub_amendment->getYTDAdjustment(), 'created_date' => $pay_stub_amendment->getCreatedDate(), 'created_by' => $pay_stub_amendment->getCreatedBy(), 'updated_date' => $pay_stub_amendment->getUpdatedDate(), 'updated_by' => $pay_stub_amendment->getUpdatedBy(), 'deleted_date' => $pay_stub_amendment->getDeletedDate(), 'deleted_by' => $pay_stub_amendment->getDeletedBy());
}
} else {
if ($pay_stub_amendment_data['effective_date'] == '') {
$pay_stub_amendment_data['effective_date'] = TTDate::getTime();
$pay_stub_amendment_data['user_id'] = $user_id;
}
}
//Select box options;
$status_options_filter = array(50);
if (isset($pay_stub_amendment) and $pay_stub_amendment->getStatus() == 55) {
$status_options_filter = array(55);
} elseif (isset($pay_stub_amendment) and $pay_stub_amendment->getStatus() == 52) {
$status_options_filter = array(52);
}
if (!isset($pay_stub_amendment_data['filter_user_id'])) {
$pay_stub_amendment_data['filter_user_id'] = array();
}
$ulf = TTnew('UserListFactory');
$ulf->getSearchByCompanyIdAndArrayCriteria($current_company->getId(), NULL);
示例8: dirname
* $Revision: 8337 $
* $Id: cron.php 8337 2012-11-20 04:40:27Z ipso $
* $Date: 2012-11-19 20:40:27 -0800 (Mon, 19 Nov 2012) $
*/
/*
* Cron replica
* Run this script every minute from the real cron.
*
*/
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'global.inc.php';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'CLI.inc.php';
if (isset($config_vars['other']['installer_enabled']) and $config_vars['other']['installer_enabled'] == TRUE) {
Debug::text('CRON: Installer is enabled, skipping cron jobs for now...', __FILE__, __LINE__, __METHOD__, 0);
} else {
//$current_epoch = strtotime('28-Mar-08 1:30 PM');
$current_epoch = TTDate::getTime();
$executed_jobs = 0;
$cjlf = new CronJobListFactory();
$job_arr = $cjlf->getArrayByListFactory($cjlf->getAll());
$total_jobs = count($job_arr);
foreach ($job_arr as $job_id => $job_name) {
//Get each cronjob row again individually incase the status has changed.
$cjlf = new CronJobListFactory();
$cjlf->getById($job_id);
//Let Execute determine if job is running or not so it can find orphans.
if ($cjlf->getRecordCount() > 0) {
foreach ($cjlf as $cjf_obj) {
//Debug::text('Checking if Job ID: '. $job_id .' is scheduled to run...', __FILE__, __LINE__, __METHOD__, 0);
if ($cjf_obj->isScheduledToRun($current_epoch) == TRUE) {
$executed_jobs++;
$cjf_obj->Execute($config_vars['path']['php_cli'], dirname(__FILE__));
示例9: createPayStubAmendments
function createPayStubAmendments($epoch = NULL)
{
//Get all recurring pay stub amendments and generate single pay stub amendments if appropriate.
if ($epoch == '') {
$epoch = TTDate::getTime();
}
$ulf = TTnew('UserListFactory');
Debug::text('Recurring PS Amendment ID: ' . $this->getId() . ' Frequency: ' . $this->getFrequency(), __FILE__, __LINE__, __METHOD__, 10);
$this->StartTransaction();
$tmp_user_ids = $this->getUser();
if ($tmp_user_ids[0] == -1) {
$ulf->getByCompanyIdAndStatus($this->getCompany(), 10);
foreach ($ulf as $user_obj) {
$user_ids[] = $user_obj->getId();
}
unset($user_obj);
} else {
$user_ids = $this->getUser();
}
unset($tmp_user_ids);
Debug::text('Total User IDs: ' . count($user_ids), __FILE__, __LINE__, __METHOD__, 10);
if (is_array($user_ids) and count($user_ids) > 0) {
//Make the PS amendment duplicate check start/end date separate
//Make the PS amendment effective date separate.
switch ($this->getFrequency()) {
case 10:
//Get all open pay periods
$pplf = TTnew('PayPeriodListFactory');
//FIXME: Get all non-closed pay periods AFTER the start date.
$pplf->getByUserIdListAndNotStatusAndStartDateAndEndDate($user_ids, 20, $this->getStartDate(), $this->getEndDate());
//All non-closed pay periods
Debug::text('Found Open Pay Periods: ' . $pplf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
foreach ($pplf as $pay_period_obj) {
Debug::text('Working on Pay Period: ' . $pay_period_obj->getId(), __FILE__, __LINE__, __METHOD__, 10);
//If near the end of a pay period, or a pay period is already ended, add PS amendment if
//it does not already exist.
if ($epoch >= $pay_period_obj->getEndDate() and $this->checkTimeFrame($epoch)) {
Debug::text('After end of pay period. Start Date: ' . TTDate::getDate('DATE+TIME', $pay_period_obj->getStartDate()) . ' End Date: ' . TTDate::getDate('DATE+TIME', $pay_period_obj->getEndDate()), __FILE__, __LINE__, __METHOD__, 10);
$psalf = TTnew('PayStubAmendmentListFactory');
//Loop through each user of this Pay Period Schedule adding PS amendments if they don't already exist.
$pay_period_schedule_users = $pay_period_obj->getPayPeriodScheduleObject()->getUser();
Debug::text(' Pay Period Schedule Users: ' . count($pay_period_schedule_users), __FILE__, __LINE__, __METHOD__, 10);
foreach ($pay_period_schedule_users as $user_id) {
//Make sure schedule user is in the PS amendment user list and user is active.
Debug::text(' Pay Period Schedule User: ' . $user_id, __FILE__, __LINE__, __METHOD__, 10);
//Debug::Arr($user_ids, ' Recurring PS Amendment Selected Users: ', __FILE__, __LINE__, __METHOD__,10);
if ($ulf->getById($user_id)->getCurrent()->getStatus() == 10 and in_array($user_id, $user_ids)) {
//Check to see if the amendment was added already.
if ($psalf->getByUserIdAndRecurringPayStubAmendmentIdAndStartDateAndEndDate($user_id, $this->getId(), $pay_period_obj->getStartDate(), $pay_period_obj->getEndDate())->getRecordCount() == 0) {
//No amendment, good to insert one
Debug::text('Inserting Recurring PS Amendment for User: ' . $user_id, __FILE__, __LINE__, __METHOD__, 10);
$psaf = TTnew('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->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());
//.........这里部分代码省略.........
示例10: calculateLastDate
function calculateLastDate($user_id)
{
$plf = TTnew('PunchListFactory');
$plf->getLastPunchByUserId($user_id);
if ($plf->getRecordCount() > 0) {
$punch_obj = $plf->getCurrent();
$last_date = $punch_obj->getPunchControlObject()->getUserDateObject()->getDateStamp();
} else {
$last_date = TTDate::getTime();
}
Debug::Text('Last Punch Date: ' . TTDate::getDate('DATE+TIME', $last_date), __FILE__, __LINE__, __METHOD__, 10);
return $last_date;
}
示例11: switch
}
if ($permission->Check('schedule', 'view_own')) {
$permission_children_ids[] = $current_user->getId();
}
$filter_data['permission_children_ids'] = $permission_children_ids;
}
$do = Misc::findSubmitButton('do');
switch ($do) {
case 'view_schedule':
default:
$user_ids = array();
if ($filter_data['start_date'] != '' and $filter_data['show_days'] != '') {
$start_date = $filter_data['start_date'] = TTDate::getBeginDayEpoch(TTDate::parseDateTime($filter_data['start_date']));
$end_date = $filter_data['end_date'] = $start_date + ($filter_data['show_days'] * 86400 - 3601);
} else {
$start_date = $filter_data['start_date'] = TTDate::getBeginWeekEpoch(TTDate::getTime(), $current_user_prefs->getStartWeekDay());
$end_date = $filter_data['end_date'] = $start_date + $filter_data['show_days'] * (86400 - 3601);
}
Debug::text(' Start Date: ' . TTDate::getDate('DATE+TIME', $start_date) . ' End Date: ' . TTDate::getDate('DATE+TIME', $end_date), __FILE__, __LINE__, __METHOD__, 10);
$sf = TTnew('ScheduleFactory');
$raw_schedule_shifts = $sf->getScheduleArray($filter_data);
if (is_array($raw_schedule_shifts)) {
foreach ($raw_schedule_shifts as $day_epoch => $day_schedule_shifts) {
foreach ($day_schedule_shifts as $day_schedule_shift) {
$user_ids[] = $day_schedule_shift['user_id'];
$day_schedule_shift['is_owner'] = $permission->isOwner($day_schedule_shift['user_created_by'], $day_schedule_shift['user_id']);
$day_schedule_shift['is_child'] = $permission->isChild($day_schedule_shift['user_id'], $permission_children_ids);
$tmp_schedule_shifts[$day_epoch][$day_schedule_shift['branch']][$day_schedule_shift['department']][] = $day_schedule_shift;
if ($day_schedule_shift['status_id'] == 10) {
//Working
if (isset($schedule_shift_totals[$day_epoch]['total_time'])) {
示例12: array
//Debug::setVerbosity(11);
Debug::Text('Generate Pay Stubs!', __FILE__, __LINE__, __METHOD__, 10);
if (!$permission->Check('pay_period_schedule', 'enabled') or !($permission->Check('pay_period_schedule', 'edit') or $permission->Check('pay_period_schedule', 'edit_own'))) {
$permission->Redirect(FALSE);
//Redirect
}
if (!is_array($pay_period_ids)) {
$pay_period_ids = array($pay_period_ids);
}
TTLog::addEntry($current_company->getId(), 500, TTi18n::gettext('Recalculating Company Pay Stubs for Pay Periods:') . ' ' . implode(',', $pay_period_ids), $current_user->getId(), 'pay_stub');
$init_progress_bar = TRUE;
foreach ($pay_period_ids as $pay_period_id) {
Debug::text('Pay Period ID: ' . $pay_period_id, __FILE__, __LINE__, __METHOD__, 10);
$pplf = TTnew('PayPeriodListFactory');
$pplf->getByIdAndCompanyId($pay_period_id, $current_company->getId());
$epoch = TTDate::getTime();
foreach ($pplf as $pay_period_obj) {
Debug::text('Pay Period Schedule ID: ' . $pay_period_obj->getPayPeriodSchedule(), __FILE__, __LINE__, __METHOD__, 10);
if ($pay_period_obj->isPreviousPayPeriodClosed() == TRUE) {
//Grab all users for pay period
$ppsulf = TTnew('PayPeriodScheduleUserListFactory');
$ppsulf->getByPayPeriodScheduleId($pay_period_obj->getPayPeriodSchedule());
$total_pay_stubs = $ppsulf->getRecordCount();
//echo "Total Pay Stubs: $total_pay_stubs - ". ceil(100 / $total_pay_stubs) ."<Br>\n";
if ($init_progress_bar == TRUE) {
//InitProgressBar( ceil(100 / $total_pay_stubs) );
InitProgressBar();
$init_progress_bar = FALSE;
}
$progress_bar->setValue(0);
$progress_bar->display();
示例13: getPayPeriodReportByUserIdAndEntryNameIdAndStartDateAndEndDate
function getPayPeriodReportByUserIdAndEntryNameIdAndStartDateAndEndDate($id, $entry_name_id, $start_date = NULL, $end_date = NULL, $exclude_id = NULL, $where = NULL, $order = NULL)
{
if ($id == '') {
return FALSE;
}
if ($entry_name_id == '') {
return FALSE;
}
if ($start_date == '') {
$start_date = 0;
}
if ($end_date == '') {
$end_date = TTDate::getTime();
}
$ppf = new PayPeriodFactory();
$ppsuf = new PayPeriodScheduleUserFactory();
$psf = new PayStubFactory();
$uf = new UserFactory();
$ph = array('start_date' => $this->db->BindTimeStamp($start_date), 'end_date' => $this->db->BindTimeStamp($end_date), 'user_id' => $id, 'exclude_id' => (int) $exclude_id);
//Include pay periods with no pay stubs for ROEs.
$query = '
select x.id as pay_period_id,
y.id as user_id,
x.start_date as pay_period_start_date,
x.end_date as pay_period_end_date,
x.transaction_date as pay_period_transaction_date,
tmp.amount as amount,
tmp.units as units
from ' . $ppf->getTable() . ' x
LEFT JOIN ' . $uf->getTable() . ' as y ON x.company_id = y.company_id
LEFT JOIN (
select b.user_id as user_id,
b.pay_period_id as pay_period_id,
sum(amount) as amount,
sum(units) as units
from ' . $this->getTable() . ' as a,
' . $psf->getTable() . ' as b,
' . $ppf->getTable() . ' as c
where a.pay_stub_id = b.id
AND b.pay_period_id = c.id
AND c.start_date >= ?
AND c.start_date < ?
AND b.user_id = ?
AND a.id != ?
AND a.pay_stub_entry_name_id in (' . $this->getListSQL($entry_name_id, $ph) . ')
AND ( a.deleted = 0 AND b.deleted = 0 AND c.deleted = 0 )
group by b.user_id,b.pay_period_id
) as tmp ON y.id = tmp.user_id AND x.id = tmp.pay_period_id ';
$ph[] = $id;
$ph[] = $this->db->BindTimeStamp($start_date);
$ph[] = $this->db->BindTimeStamp($end_date);
$query .= '
where y.id = ?
AND x.start_date >= ?
AND x.start_date < ?
AND x.deleted = 0
';
$query .= $this->getWhereSQL($where);
$query .= $this->getSortSQL($order, FALSE);
Debug::Text('Query: ' . $query, __FILE__, __LINE__, __METHOD__, 10);
$query .= $this->getWhereSQL($where);
$query .= $this->getSortSQL($order);
$this->rs = $this->db->Execute($query, $ph);
return $this;
}
示例14: releaseAllAccruals
static function releaseAllAccruals($user_id, $effective_date = NULL)
{
Debug::Text('Release 100% of all accruals!', __FILE__, __LINE__, __METHOD__, 10);
if ($user_id == '') {
return FALSE;
}
if ($effective_date == '') {
$effective_date = TTDate::getTime();
}
Debug::Text('Effective Date: ' . TTDate::getDate('DATE+TIME', $effective_date), __FILE__, __LINE__, __METHOD__, 10);
$ulf = new UserListFactory();
$ulf->getById($user_id);
if ($ulf->getRecordCount() > 0) {
$user_obj = $ulf->getCurrent();
} else {
return FALSE;
}
//Get all PSE acccount accruals
$psealf = new PayStubEntryAccountListFactory();
$psealf->getByCompanyIdAndStatusIdAndTypeId($user_obj->getCompany(), 10, 50);
if ($psealf->getRecordCount() > 0) {
$ulf->StartTransaction();
foreach ($psealf as $psea_obj) {
//Get PSE account that affects this accrual.
$psealf_tmp = new PayStubEntryAccountListFactory();
$psealf_tmp->getByCompanyIdAndAccrualId($user_obj->getCompany(), $psea_obj->getId());
if ($psealf_tmp->getRecordCount() > 0) {
$release_account_id = $psealf_tmp->getCurrent()->getId();
$psaf = new PayStubAmendmentFactory();
$psaf->setStatus(50);
//Active
$psaf->setType(20);
//Percent
$psaf->setUser($user_obj->getId());
$psaf->setPayStubEntryNameId($release_account_id);
$psaf->setPercentAmount(100);
$psaf->setPercentAmountEntryNameId($psea_obj->getId());
$psaf->setEffectiveDate($effective_date);
$psaf->setDescription('Release Accrual Balance');
if ($psaf->isValid()) {
Debug::Text('Release Accrual Is Valid!!: ', __FILE__, __LINE__, __METHOD__, 10);
$psaf->Save();
}
} else {
Debug::Text('No Release Account for this Accrual!!', __FILE__, __LINE__, __METHOD__, 10);
}
}
//$ulf->FailTransaction();
$ulf->CommitTransaction();
} else {
Debug::Text('No Accruals to release...', __FILE__, __LINE__, __METHOD__, 10);
}
return FALSE;
}
示例15: _outputPDFForm
function _outputPDFForm($format = NULL)
{
$show_background = TRUE;
if ($format == 'pdf_form_print' or $format == 'pdf_form_print_government' or $format == 'efile') {
$show_background = FALSE;
}
Debug::Text('Generating Form... Format: ' . $format, __FILE__, __LINE__, __METHOD__, 10);
$setup_data = $this->getFormConfig();
$filter_data = $this->getFilterConfig();
//Debug::Arr($filter_data, 'Filter Data: ', __FILE__, __LINE__, __METHOD__,10);
$current_company = $this->getUserObject()->getCompanyObject();
if (!is_object($current_company)) {
Debug::Text('Invalid company object...', __FILE__, __LINE__, __METHOD__, 10);
return FALSE;
}
$current_user = $this->getUserObject();
if (!is_object($current_user)) {
Debug::Text('Invalid user object...', __FILE__, __LINE__, __METHOD__, 10);
return FALSE;
}
if ($format == 'efile_xml') {
$return1040 = $this->getRETURN1040Object();
// Ceate the all needed data for Return1040.xsd at here.
$return1040->return_created_timestamp = TTDate::getDBTimeStamp(TTDate::getTime(), FALSE);
$return1040->year = TTDate::getYear($filter_data['end_date']);
$return1040->tax_period_begin_date = TTDate::getDate('Y-m-d', TTDate::getBeginDayEpoch($filter_data['start_date']));
$return1040->tax_period_end__date = TTDate::getDate('Y-m-d', TTDate::getEndDayEpoch($filter_data['end_date']));
$return1040->software_id = '';
$return1040->originator_efin = '';
$return1040->originator_type_code = '';
$return1040->pin_type_code = '';
$return1040->jurat_disclosure_code = '';
$return1040->pin_entered_by = '';
$return1040->signature_date = TTDate::getDate('Y-m-d', TTDate::getTime());
$return1040->return_type = '';
$return1040->ssn = '';
$return1040->name = (isset($setup_data['company_name']) and $setup_data['company_name'] != '') ? $setup_data['company_name'] : $current_company->getName();
$return1040->name_control = '';
$return1040->address1 = (isset($setup_data['address1']) and $setup_data['address1'] != '') ? $setup_data['address1'] : $current_company->getAddress1() . ' ' . $current_company->getAddress2();
$return1040->city = (isset($setup_data['city']) and $setup_data['city'] != '') ? $setup_data['city'] : $current_company->getCity();
$return1040->state = (isset($setup_data['province']) and ($setup_data['province'] != '' and $setup_data['province'] != 0)) ? $setup_data['province'] : $current_company->getProvince();
$return1040->zip_code = (isset($setup_data['postal_code']) and $setup_data['postal_code'] != '') ? $setup_data['postal_code'] : $current_company->getPostalCode();
$return1040->ip_address = '';
$return1040->ip_date = TTDate::getDate('Y-m-d', TTDate::getTime());
$return1040->ip_time = TTDate::getDate('H:i:s', TTDate::getTime());
$return1040->timezone = TTDate::getTimeZone();
$this->getFormObject()->addForm($return1040);
}
$this->sortFormData();
//Make sure forms are sorted.
$fw2 = $this->getFW2Object();
$fw2->setDebug(FALSE);
//if ( $format == 'efile' ) {
// $fw2->setDebug(TRUE);
//}
$fw2->setShowBackground($show_background);
if (stristr($format, 'government')) {
$form_type = 'government';
} else {
$form_type = 'employee';
}
Debug::Text('Form Type: ' . $form_type, __FILE__, __LINE__, __METHOD__, 10);
$fw2->setType($form_type);
$fw2->year = TTDate::getYear($filter_data['end_date']);
//Add support for the user to manually set this data in the setup_data. That way they can use multiple tax IDs for different employees, all beit manually.
$fw2->ein = (isset($setup_data['ein']) and $setup_data['ein'] != '') ? $setup_data['ein'] : $current_company->getBusinessNumber();
$fw2->name = (isset($setup_data['name']) and $setup_data['name'] != '') ? $setup_data['name'] : $this->getUserObject()->getFullName();
$fw2->trade_name = (isset($setup_data['company_name']) and $setup_data['company_name'] != '') ? $setup_data['company_name'] : $current_company->getName();
$fw2->company_address1 = (isset($setup_data['address1']) and $setup_data['address1'] != '') ? $setup_data['address1'] : $current_company->getAddress1() . ' ' . $current_company->getAddress2();
$fw2->company_city = (isset($setup_data['city']) and $setup_data['city'] != '') ? $setup_data['city'] : $current_company->getCity();
$fw2->company_state = (isset($setup_data['province']) and ($setup_data['province'] != '' and $setup_data['province'] != 0)) ? $setup_data['province'] : $current_company->getProvince();
$fw2->company_zip_code = (isset($setup_data['postal_code']) and $setup_data['postal_code'] != '') ? $setup_data['postal_code'] : $current_company->getPostalCode();
$fw2->efile_user_id = (isset($setup_data['efile_user_id']) and $setup_data['efile_user_id'] != '') ? $setup_data['efile_user_id'] : NULL;
$fw2->efile_state = (isset($setup_data['efile_state']) and $setup_data['efile_state'] != '') ? $setup_data['efile_state'] : 0;
$fw2->contact_name = $current_user->getFullName();
$fw2->contact_phone = $current_user->getWorkPhone();
$fw2->contact_phone_ext = $current_user->getWorkPhoneExt();
$fw2->contact_email = $current_user->getWorkEmail();
if (isset($this->form_data) and count($this->form_data) > 0) {
$i = 0;
$n = 1;
foreach ((array) $this->form_data as $row) {
if (!isset($row['user_id'])) {
Debug::Text('User ID not set!', __FILE__, __LINE__, __METHOD__, 10);
continue;
}
$ulf = TTnew('UserListFactory');
$ulf->getById((int) $row['user_id']);
if ($ulf->getRecordCount() == 1) {
$user_obj = $ulf->getCurrent();
$ee_data = array('control_number' => $n, 'first_name' => $user_obj->getFirstName(), 'middle_name' => $user_obj->getMiddleName(), 'last_name' => $user_obj->getLastName(), 'address1' => $user_obj->getAddress1(), 'address2' => $user_obj->getAddress2(), 'city' => $user_obj->getCity(), 'state' => $user_obj->getProvince(), 'employment_province' => $user_obj->getProvince(), 'zip_code' => $user_obj->getPostalCode(), 'ssn' => $user_obj->getSIN(), 'employee_number' => $user_obj->getEmployeeNumber(), 'l1' => $row['l1'], 'l2' => $row['l2'], 'l3' => $row['l3'], 'l4' => $row['l4'], 'l5' => $row['l5'], 'l6' => $row['l6'], 'l7' => $row['l7'], 'l8' => $row['l8'], 'l10' => $row['l10'], 'l11' => $row['l11'], 'l12a_code' => NULL, 'l12a' => NULL, 'l12b_code' => NULL, 'l12b' => NULL, 'l12c_code' => NULL, 'l12c' => NULL, 'l12d_code' => NULL, 'l12d' => NULL, 'l14a_name' => NULL, 'l14a' => NULL, 'l14b_name' => NULL, 'l14b' => NULL, 'l14c_name' => NULL, 'l14c' => NULL, 'l14d_name' => NULL, 'l14d' => NULL);
if ($row['l12a'] > 0 and isset($setup_data['l12a_code']) and $setup_data['l12a_code'] != '') {
$ee_data['l12a_code'] = $setup_data['l12a_code'];
$ee_data['l12a'] = $row['l12a'];
}
if ($row['l12b'] > 0 and isset($setup_data['l12b_code']) and $setup_data['l12b_code'] != '') {
$ee_data['l12b_code'] = $setup_data['l12b_code'];
$ee_data['l12b'] = $row['l12b'];
}
if ($row['l12c'] > 0 and isset($setup_data['l12c_code']) and $setup_data['l12c_code'] != '') {
//.........这里部分代码省略.........