Jelajahi Sumber

Added print view for pay period report.

Adam Day 9 tahun lalu
induk
melakukan
67f4de875a

+ 37 - 0
application/controllers/reportsController.php

@@ -241,4 +241,41 @@ class reportsController extends Staple_Controller
             header("location:".$this->_link(array('reports','payperiod'))."");
         }
     }
+
+    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->month = $date->format('m');
+        $date->modify('-1 month');
+        $this->view->previousMonth = $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");
+    }
 }

+ 8 - 0
application/models/reportModel.php

@@ -270,4 +270,12 @@ class reportModel extends Staple_Model
         }
         return $data;
     }
+
+    function payroll($year, $month)
+    {
+        $users = new userModel();
+        $accounts = $users->listAll();
+
+
+    }
 }