Пример #1
0
 //Grab all users for pay period
 $ppsulf = new 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();
 //Delete existing pay stub. Make sure we only
 //delete pay stubs that are the same as what we're creating.
 $pslf = new PayStubListFactory();
 $pslf->getByPayPeriodId($pay_period_obj->getId());
 foreach ($pslf as $pay_stub_obj) {
     Debug::text('Existing Pay Stub: ' . $pay_stub_obj->getId(), __FILE__, __LINE__, __METHOD__, 10);
     //Check PS End Date to match with PP End Date
     //So if an ROE was generated, it won't get deleted when they generate all other Pay Stubs
     //later on.
     if ($pay_stub_obj->getStatus() <= 25 and $pay_stub_obj->getTainted() === FALSE and $pay_stub_obj->getEndDate() == $pay_period_obj->getEndDate()) {
         Debug::text('Pay stub matched advance flag, deleting: ' . $pay_stub_obj->getId(), __FILE__, __LINE__, __METHOD__, 10);
         $pay_stub_obj->setDeleted(TRUE);
         $pay_stub_obj->Save();
     } else {
         Debug::text('Pay stub does not need regenerating, or it is LOCKED!', __FILE__, __LINE__, __METHOD__, 10);
     }
 }
 $i = 1;
 foreach ($ppsulf as $pay_period_schdule_user_obj) {
Пример #2
0
switch ($action) {
    case 'Submit':
    default:
        $pplf = new PayPeriodListFactory();
        $slf = new ShiftListFactory();
        if (!isset($pay_period_id)) {
            Debug::text(' Pay Period ID NOT SET: ' . $pay_period_id, __FILE__, __LINE__, __METHOD__, 10);
            $pay_period_id = $pplf->getByCompanyId($current_company->getId(), 1, 2, NULL, array('start_date' => 'desc'))->getCurrent()->getId();
        }
        Debug::text(' Pay Period ID: ' . $pay_period_id, __FILE__, __LINE__, __METHOD__, 10);
        $psenlf = new PayStubEntryNameListFactory();
        $ulf = new UserListFactory();
        $blf = new BranchListFactory();
        //Get all pay stubs for this pay period
        $pslf = new PayStubListFactory();
        $pslf->getByPayPeriodId($pay_period_id, NULL, array('advance' => '= \'f\''));
        $pager = new Pager($pslf);
        $entry_name_ids = array(10, 22);
        foreach ($pslf as $pay_stub_obj) {
            Debug::text(' Pay Stub ID: ' . $pay_stub_obj->getId(), __FILE__, __LINE__, __METHOD__, 10);
            $pself = new PayStubEntryListFactory();
            //Order is very important here. We want the "last" entries to go last, as they should
            //have the most up to date YTD values.
            $pself->getByPayStubId($pay_stub_obj->getId());
            $entries = NULL;
            foreach ($pself as $pay_stub_entry_obj) {
                $pay_stub_entry_name_obj = $psenlf->getById($pay_stub_entry_obj->getPayStubEntryNameId())->getCurrent();
                if (in_array($pay_stub_entry_obj->getPayStubEntryNameId(), $entry_name_ids)) {
                    Debug::text(' Found valid entry name ID: ' . $pay_stub_entry_name_obj->getName() . ' Amount: ' . $pay_stub_entry_obj->getAmount(), __FILE__, __LINE__, __METHOD__, 10);
                    if (isset($show_ytd) and $show_ytd == 1) {
                        $amount = $pay_stub_entry_obj->getYTDAmount();
Пример #3
0
             $pending_time_sheets = 0;
             if ($pptsvlf->getRecordCount() > 0) {
                 foreach ($pptsvlf as $pptsv_obj) {
                     if ($pptsv_obj->getAuthorized() == TRUE) {
                         $verified_time_sheets++;
                     } elseif ($pptsv_obj->getStatus() == 30) {
                         $pending_time_sheets++;
                     }
                 }
             }
             //Get total employees with time for this pay period.
             $udtlf = new UserDateTotalListFactory();
             $total_worked_users = $udtlf->getWorkedUsersByPayPeriodId($pay_period_obj->getId());
             //Count how many pay stubs for each pay period.
             $pslf = new PayStubListFactory();
             $total_pay_stubs = $pslf->getByPayPeriodId($pay_period_obj->getId())->getRecordCount();
             if ($pay_period_obj->getStatus() != 20) {
                 $open_pay_periods = TRUE;
             }
             $pay_periods[] = array('id' => $pay_period_obj->getId(), 'company_id' => $pay_period_obj->getCompany(), 'pay_period_schedule_id' => $pay_period_obj->getPayPeriodSchedule(), 'name' => $pay_period_schedule->getName(), 'type' => Option::getByKey($pay_period_schedule->getType(), $pay_period_schedule->getOptions('type')), 'status' => Option::getByKey($pay_period_obj->getStatus(), $pay_period_obj->getOptions('status')), 'start_date' => TTDate::getDate('DATE+TIME', $pay_period_obj->getStartDate()), 'end_date' => TTDate::getDate('DATE+TIME', $pay_period_obj->getEndDate()), 'transaction_date' => TTDate::getDate('DATE+TIME', $pay_period_obj->getTransactionDate()), 'low_severity_exceptions' => $low_severity_exceptions, 'med_severity_exceptions' => $med_severity_exceptions, 'high_severity_exceptions' => $high_severity_exceptions, 'pending_requests' => $pending_requests, 'verified_time_sheets' => $verified_time_sheets, 'pending_time_sheets' => $pending_time_sheets, 'total_worked_users' => $total_worked_users, 'total_ps_amendments' => $total_ps_amendments, 'total_pay_stubs' => $total_pay_stubs, 'deleted' => $pay_period_obj->getDeleted());
         }
         unset($total_shifts, $total_ps_amendments, $total_pay_stubs, $verified_time_sheets, $total_worked_users);
     }
 } else {
     Debug::Text('No pay periods pending transaction ', __FILE__, __LINE__, __METHOD__, 10);
 }
 $smarty->assign_by_ref('open_pay_periods', $open_pay_periods);
 $smarty->assign_by_ref('pay_periods', $pay_periods);
 $total_pay_periods = count($pay_periods);
 $smarty->assign_by_ref('total_pay_periods', $total_pay_periods);
 $smarty->assign_by_ref('sort_column', $sort_column);
 function setPayStubStatus($status)
 {
     Debug::text('setPayStubStatus: ' . $status, __FILE__, __LINE__, __METHOD__, 10);
     $this->StartTransaction();
     $pslf = new PayStubListFactory();
     $pslf->getByPayPeriodId($this->getId());
     foreach ($pslf as $pay_stub) {
         //Only change status of advance pay stubs if we're in the advance part of the pay period.
         //What if the person is too late, set status anyways?
         if ($pay_stub->getStatus() != $status) {
             Debug::text('Changing Status of Pay Stub ID: ' . $pay_stub->getId(), __FILE__, __LINE__, __METHOD__, 10);
             $pay_stub->setStatus($status);
             $pay_stub->save();
         }
     }
     $this->CommitTransaction();
     return TRUE;
 }