}
     $pplf->CommitTransaction();
     Redirect::Page(URLBuilder::getURL(NULL, 'ClosePayPeriod.php'));
     break;
 case 'generate_pay_stubs':
     Debug::Text('Generate Pay Stubs ', __FILE__, __LINE__, __METHOD__, 10);
     //var_dump($pay_stub_pay_period_ids);
     Redirect::Page(URLBuilder::getURL(array('action' => 'generate_paystubs', 'pay_period_ids' => $pay_stub_pay_period_ids, 'next_page' => '../payperiod/ClosePayPeriod.php'), '../progress_bar/ProgressBarControl.php'));
     break;
 default:
     //Step 1, get all open pay periods that have ended and are before the transaction date.
     $pplf = new PayPeriodListFactory();
     $ppslf = new PayPeriodScheduleListFactory();
     $open_pay_periods = FALSE;
     //$pplf->getByCompanyIdAndTransactionDate( $current_company->getId(), TTDate::getTime() );
     $pplf->getByCompanyIdAndStatus($current_company->getId(), array(10, 12, 15));
     if ($pplf->getRecordCount() > 0) {
         foreach ($pplf as $pay_period_obj) {
             $pay_period_schedule = $ppslf->getById($pay_period_obj->getPayPeriodSchedule())->getCurrent();
             if ($pay_period_schedule != FALSE and $pay_period_obj->getEndDate() < TTDate::getTime()) {
                 $elf = new ExceptionListFactory();
                 $elf->getSumExceptionsByPayPeriodIdAndBeforeDate($pay_period_obj->getId(), $pay_period_obj->getEndDate());
                 $low_severity_exceptions = 0;
                 $med_severity_exceptions = 0;
                 $high_severity_exceptions = 0;
                 if ($elf->getRecordCount() > 0) {
                     Debug::Text(' Found Exceptions: ' . $elf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
                     foreach ($elf as $e_obj) {
                         if ($e_obj->getColumn('severity_id') == 10) {
                             $low_severity_exceptions = $e_obj->getColumn('count');
                         }