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;
 }
예제 #2
0
                         $ps_obj->reCalculatePayStubYTD($ps_obj->getId());
                         $progress_bar->setValue(Misc::calculatePercent($x, $total_pay_stubs));
                         $progress_bar->display();
                         $x++;
                     }
                 } else {
                     Debug::Text('No Newer Pay Stubs found!', __FILE__, __LINE__, __METHOD__, 10);
                 }
                 unset($main_ps_obj);
             } else {
                 Debug::Text('Pay Stub ID invalid!', __FILE__, __LINE__, __METHOD__, 10);
             }
         }
     }
     //$pslf->FailTransaction();
     $pslf->CommitTransaction();
     break;
 case 'add_mass_punch':
     if (isset($filter_user_id) and is_array($filter_user_id) and count($filter_user_id) > 0) {
         //Debug::setVerbosity(11);
         $init_progress_bar = TRUE;
         if ($init_progress_bar == TRUE) {
             InitProgressBar();
             $init_progress_bar = FALSE;
         }
         $progress_bar->setValue(0);
         $progress_bar->display();
         //This will be slightly off depending on which days of the week they choose.
         $total_punches = count($filter_user_id) * TTDate::getDays($data['end_punch_full_time_stamp'] - $data['start_punch_full_time_stamp']);
         Debug::Text('Total Punches: ' . $total_punches . ' Users: ' . count($filter_user_id) . ' Days: ' . TTDate::getDays($data['end_punch_full_time_stamp'] - $data['start_punch_full_time_stamp']), __FILE__, __LINE__, __METHOD__, 10);
         $pcf = new PunchControlFactory();