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;
 }
Example #2
0
             $ugsf->setBatchID($ugsf->getNextBatchId());
             $ugsf->setQueue(UserGenericStatusFactory::getStaticQueue());
             $ugsf->saveQueue();
             $next_page = URLBuilder::getURL(array('batch_id' => $ugsf->getBatchID(), 'batch_title' => 'Generating Pay Stubs', 'batch_next_page' => $next_page), '../users/UserGenericStatusList.php');
             unset($ugsf);
         }
     }
     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 = new 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();