function preSave() { $this->StartTransaction(); if ($this->isNew() == TRUE) { $this->setCreateInitialPayPeriods(TRUE); } if ($this->getShiftAssignedDay() == FALSE) { $this->setShiftAssignedDay(10); //Day shifts start on } elseif ($this->getShiftAssignedDay() == 40) { //Split at midnight $this->setNewDayTriggerTime(0); //Minimum Time-off between shifts must be 0 in these cases. } if ($this->getType() != 5) { //If schedule is other then manual, automatically calculate annual pay periods $this->setAnnualPayPeriods($this->calcAnnualPayPeriods()); } if ($this->getDeleted() == TRUE) { //Delete pay periods assigned to this schedule. $pplf = new PayPeriodListFactory(); $pplf->getByPayPeriodScheduleId($this->getId()); if ($pplf->getRecordCount() > 0) { Debug::text('Delete Pay Periods: ' . $pplf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10); foreach ($pplf as $pp_obj) { $pp_obj->setDeleted(TRUE); $pp_obj->Save(); } } } return TRUE; }
function getAllPayPeriods() { $pplf = new PayPeriodListFactory(); //$pplf->getByCompanyId( $this->company_id ); $pplf->getByPayPeriodScheduleId($this->pay_period_schedule_id); if ($pplf->getRecordCount() > 0) { foreach ($pplf as $pp_obj) { Debug::text('Pay Period... Start: ' . TTDate::getDate('DATE+TIME', $pp_obj->getStartDate()) . ' End: ' . TTDate::getDate('DATE+TIME', $pp_obj->getEndDate()), __FILE__, __LINE__, __METHOD__, 10); $this->pay_period_objs[] = $pp_obj; } } $this->pay_period_objs = array_reverse($this->pay_period_objs); return TRUE; }
function getInsurablePayPeriodStartDate($pay_periods) { Debug::Text('Pay Periods to Consider: ' . $pay_periods, __FILE__, __LINE__, __METHOD__, 10); Debug::Text('First Day Worked: ' . TTDate::getDate('DATE+TIME', $this->getFirstDate()) . ' Last Worked Day: ' . TTDate::getDate('DATE+TIME', $this->getLastDate()), __FILE__, __LINE__, __METHOD__, 10); $start_date = FALSE; $pplf = new PayPeriodListFactory(); $pay_period_obj = $pplf->getByUserIdAndEndDate($this->getUser(), $this->getLastDate())->getCurrent(); Debug::Text('Pay Period ID: ' . $pay_period_obj->getId(), __FILE__, __LINE__, __METHOD__, 10); $pplf->getByPayPeriodScheduleId($pay_period_obj->getPayPeriodSchedule(), NULL, NULL, NULL, array('start_date' => 'desc')); $i = 1; foreach ($pplf as $pay_period) { //Make sure if there are more pay periods inserted AFTER the last day, we DO NOT include //those in the count. Debug::Text('Pay Period: Start Date: ' . TTDate::getDate('DATE+TIME', $pay_period->getStartDate()) . ' End Date: ' . TTDate::getDate('DATE+TIME', $pay_period->getEndDate()), __FILE__, __LINE__, __METHOD__, 10); //if ( $this->getLastDate() >= $pay_period->getStartDate() ) { if ($this->getFirstDate() <= $pay_period->getEndDate() and $this->getLastDate() >= $pay_period->getStartDate()) { Debug::Text($i . '. Including Pay Period...', __FILE__, __LINE__, __METHOD__, 10); //If there aren't enough pay periods yet, use what we have... $start_date = $pay_period->getStartDate(); if ($i == $pay_periods) { break; } $i++; } } Debug::Text('Pay Period Report Start Date: ' . TTDate::getDate('DATE+TIME', $start_date), __FILE__, __LINE__, __METHOD__, 10); return $start_date; }
if (is_object($user_data->getCurrencyObject())) { $wage_data['currency_symbol'] = $user_data->getCurrencyObject()->getSymbol(); $wage_data['iso_code'] = $user_data->getCurrencyObject()->getISOCode(); } //Get pay period boundary dates for this user. //Include user hire date in the list. $pay_period_boundary_dates[TTDate::getDate('DATE', $user_data->getHireDate())] = TTi18n::gettext('(Hire Date)') . ' ' . TTDate::getDate('DATE', $user_data->getHireDate()); $pay_period_boundary_dates = Misc::prependArray(array(-1 => TTi18n::gettext('(Choose Date)')), $pay_period_boundary_dates); $ppslf = new PayPeriodScheduleListFactory(); $ppslf->getByUserId($user_id); if ($ppslf->getRecordCount() > 0) { $pay_period_schedule_id = $ppslf->getCurrent()->getId(); $pay_period_schedule_name = $ppslf->getCurrent()->getName(); Debug::Text('Pay Period Schedule ID: ' . $pay_period_schedule_id, __FILE__, __LINE__, __METHOD__, 10); $pplf = new PayPeriodListFactory(); $pplf->getByPayPeriodScheduleId($pay_period_schedule_id, 10, NULL, NULL, array('transaction_date' => 'desc')); $pay_period_dates = NULL; foreach ($pplf as $pay_period_obj) { //$pay_period_boundary_dates[TTDate::getDate('DATE', $pay_period_obj->getEndDate() )] = '('. $pay_period_schedule_name .') '.TTDate::getDate('DATE', $pay_period_obj->getEndDate() ); if (!isset($pay_period_boundary_dates[TTDate::getDate('DATE', $pay_period_obj->getStartDate())])) { $pay_period_boundary_dates[TTDate::getDate('DATE', $pay_period_obj->getStartDate())] = '(' . $pay_period_schedule_name . ') ' . TTDate::getDate('DATE', $pay_period_obj->getStartDate()); } } } else { $smarty->assign('pay_period_schedule', FALSE); $uwf->Validator->isTrue('employee', FALSE, TTi18n::getText('Employee is not currently assigned to a pay period schedule.') . ' <a href="' . URLBuilder::getURL(NULL, '../payperiod/PayPeriodScheduleList.php') . '">' . TTi18n::getText('Click here</a> to assign')); } $smarty->assign_by_ref('user_data', $user_data); $smarty->assign_by_ref('wage_data', $wage_data); $smarty->assign_by_ref('tmp_effective_date', $tmp_effective_date); $smarty->assign_by_ref('pay_period_boundary_date_options', $pay_period_boundary_dates);
BreadCrumb::setCrumb($title); $pplf = new PayPeriodListFactory(); $pplf->getByIdAndCompanyId($id, $current_company->getId()); foreach ($pplf as $pp_obj) { //Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10); $data = array('id' => $pp_obj->getId(), 'company_id' => $pp_obj->getCompany(), 'pay_period_schedule_id' => $pp_obj->getPayPeriodSchedule(), 'pay_period_schedule_type_id' => $pp_obj->getPayPeriodScheduleObject()->getType(), 'start_date' => $pp_obj->getStartDate(), 'end_date' => $pp_obj->getEndDate(), 'transaction_date' => $pp_obj->getTransactionDate(), 'advance_end_date' => $pp_obj->getAdvanceEndDate(), 'advance_transaction_date' => $pp_obj->getAdvanceTransactionDate(), 'deleted' => $pp_obj->getDeleted(), 'created_date' => $pp_obj->getCreatedDate(), 'created_by' => $pp_obj->getCreatedBy(), 'updated_date' => $pp_obj->getUpdatedDate(), 'updated_by' => $pp_obj->getUpdatedBy(), 'deleted_date' => $pp_obj->getDeletedDate(), 'deleted_by' => $pp_obj->getDeletedBy()); } } else { if (isset($pay_period_schedule_id) and $pay_period_schedule_id != '') { $ppslf = new PayPeriodScheduleListFactory(); $ppslf->getByIdAndCompanyId($pay_period_schedule_id, $current_company->getId()); if ($ppslf->getRecordCount() > 0) { $data['pay_period_schedule_type_id'] = $ppslf->getCurrent()->getType(); } $data['pay_period_schedule_id'] = $pay_period_schedule_id; //Get end date of previous pay period, and default the start date of the new pay period to that. $pplf = new PayPeriodListFactory(); $pplf->getByPayPeriodScheduleId($pay_period_schedule_id, 1, NULL, NULL, array('start_date' => 'desc')); if ($pplf->getRecordCount() > 0) { foreach ($pplf as $pp_obj) { $data['start_date'] = $pp_obj->getEndDate() + 1; $data['end_date'] = $pp_obj->getEndDate() + 86400; } } } } $smarty->assign_by_ref('data', $data); break; } $smarty->assign_by_ref('ppf', $ppf); $smarty->display('payperiod/EditPayPeriod.tpl');
$pplf->GetByIdAndCompanyId($pay_period_id, $current_company->getId()); foreach ($pplf as $pay_period) { $pay_period->setDeleted($delete); $pay_period->Save(); } } //$pplf->FailTransaction(); $pplf->CommitTransaction(); Redirect::Page(URLBuilder::getURL(array('id' => $id), 'PayPeriodList.php')); break; default: $pplf = new PayPeriodListFactory(); $ppslf = new PayPeriodScheduleListFactory(); //$pplf->GetByCompanyId($current_company->getId(), $current_user_prefs->getItemsPerPage(), $page, NULL, array($sort_column => $sort_order) ); //$pplf->GetByPayPeriodScheduleId($id, $current_user_prefs->getItemsPerPage(), $page, NULL, array($sort_column => $sort_order) ); $pplf->getByPayPeriodScheduleId($id, $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array); $pager = new Pager($pplf); if ($pplf->getRecordCount() >= 1) { if (is_numeric($projected_pay_periods)) { $max_projected_pay_periods = $projected_pay_periods; } else { $max_projected_pay_periods = 1; } } else { $max_projected_pay_periods = 24; } Debug::Text('Projected Pay Periods: ' . $max_projected_pay_periods, __FILE__, __LINE__, __METHOD__, 10); //Now project in to the future X pay periods... if ($sort_column == '' and $page == '' or $page == 1) { $ppslf->getById($id); foreach ($ppslf as $pay_period_schedule) {