Exemplo n.º 1
0
 /**
  * Populate the pay periods up through the current pay period.
  *
  * @return Returns the current timesheet after it is created.
  */
 public function addThroughCurrent()
 {
     // Get the latest pay period.
     $latest = $this->getLatest();
     // Get the milliseconds for right now.
     $now = strtotime(date('Y-m-d'));
     // Make sure the latest pay period was found.
     while (isset($latest) && !PayPeriodHelper::isCurrent($latest)) {
         // Get the next pay period.
         $latest = PayPeriodHelper::getNext($latest);
         // Add this pay period to the database.
         $this->add(array('start' => $latest->start, 'end' => $latest->end, 'type' => $latest->type));
     }
     // Return the latest pay period, which is the current pay period.
     return $latest;
 }