Ejemplo n.º 1
0
 public function payroll($year = null, $month = null)
 {
     if ($year == null) {
         $year = date('Y');
     }
     if ($month == null) {
         $month = date('m');
     }
     $this->view->year = $year;
     $date = new DateTime();
     $date->setDate($year, $month, 26);
     $date->setTime(0, 0, 0);
     $this->view->date = $date->format("F Y");
     $date->modify('+1 year');
     $this->view->nextYear = $date->format('Y');
     $date->modify('-2 year');
     $this->view->previousYear = $date->format('Y');
     $this->view->month = $date->format('m');
     $date->modify('-1 month');
     $this->view->previousMonth = $date->format('m');
     $date->modify('+2 month');
     $this->view->nextMonth = $date->format('m');
     $date2 = new DateTime();
     $date2->setDate($year, $month, 25);
     $date2->setTime(24, 0, 0);
     $interval = date_diff($date, $date2);
     $this->view->span = $interval->days;
     $reports = new reportModel($year, $month);
     $this->view->report = $reports->payroll($year, $month);
     $this->view->startDate = $date->format("F jS Y");
     $days = $interval->days - 1;
     $date->modify("+{$days} days");
     $this->view->endDate = $date->format("F jS Y");
     $date = new dateTime();
     $date->setDate($year, $month, 25);
     $this->view->currentDate = $date->format('Y-m-d');
     $this->view->previousDate = $date->modify('-1 month +1 day')->format('Y-m-d');
     $codes = new codeModel();
     $this->view->codes = $codes->allCodes();
 }