Selaa lähdekoodia

Fixed small date calculation bug in the weekly report.

Adam Day 9 vuotta sitten
vanhempi
commit
ab259590c5

+ 12 - 4
application/controllers/reportsController.php

@@ -415,21 +415,25 @@ class reportsController extends Staple_Controller
     {
         if ($year == null)
         {
-            $date = new DateTime('first day of this month');
+            $date = new DateTime();
+
             if($date->format('d') >= 26)
             {
                 $date->modify('+1 month');
             }
+
             $year = $date->format('Y');
         }
 
         if ($month == null)
         {
-            $date = new DateTime('first day of this month');
+            $date = new DateTime();
+
             if($date->format('d') >= 26)
             {
                 $date->modify('+1 month');
             }
+
             $month = $date->format('m');
         }
 
@@ -438,7 +442,6 @@ class reportsController extends Staple_Controller
         $date->setTime(0,0,0);
 
         $this->view->year = $date->format('Y');
-
         $this->view->date = $date->format("F Y");
 
         $date->modify('+1 year');
@@ -463,6 +466,11 @@ class reportsController extends Staple_Controller
         $this->view->accountLevel = $this->authLevel;
 
         $date = new DateTime();
+        if($date->format('d') >= 26)
+        {
+            $date->modify('+1 month');
+        }
+
         $date->setDate($year, $month, 1);
         $this->view->monthName = $date->format('F');
 
@@ -476,7 +484,7 @@ class reportsController extends Staple_Controller
                 $data = $printInactiveTimeSheetForm->exportFormData();
 
                 $this->layout->addScriptBlock("
-                    window.open('".$this->_link(array("reports","printpreview",$year,$month,$data['account']))."');
+                    window.open('".$this->_link(array("reports","inactive","printpreview",$year,$month,$data['account']))."');
                     ");
                 $this->view->printTimeSheetForm = $printInactiveTimeSheetForm;
             }

+ 99 - 0
application/models/reviewModel.php

@@ -0,0 +1,99 @@
+<?php
+class reviewModel extends Staple_Model
+{
+    private $db;
+
+    private $id;
+    private $accountId;
+    private $payPeriodMonth;
+    private $payPeriodYear;
+    private $supervisorId;
+
+    /**
+     * @return mixed
+     */
+    public function getId()
+    {
+        return $this->id;
+    }
+
+    /**
+     * @param mixed $id
+     */
+    public function setId($id)
+    {
+        $this->id = $id;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getAccountId()
+    {
+        return $this->accountId;
+    }
+
+    /**
+     * @param mixed $accountId
+     */
+    public function setAccountId($accountId)
+    {
+        $this->accountId = $accountId;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getPayPeriodMonth()
+    {
+        return $this->payPeriodMonth;
+    }
+
+    /**
+     * @param mixed $payPeriodMonth
+     */
+    public function setPayPeriodMonth($payPeriodMonth)
+    {
+        $this->payPeriodMonth = $payPeriodMonth;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getPayPeriodYear()
+    {
+        return $this->payPeriodYear;
+    }
+
+    /**
+     * @param mixed $payPeriodYear
+     */
+    public function setPayPeriodYear($payPeriodYear)
+    {
+        $this->payPeriodYear = $payPeriodYear;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getSupervisorId()
+    {
+        return $this->supervisorId;
+    }
+
+    /**
+     * @param mixed $supervisorId
+     */
+    public function setSupervisorId($supervisorId)
+    {
+        $this->supervisorId = $supervisorId;
+    }
+
+    function __construct($year, $month, $uid)
+    {
+        $this->db = Staple_DB::get();
+
+        echo $uid;
+    }
+}
+?>

+ 16 - 0
application/models/timesheetModel.php

@@ -28,6 +28,8 @@
 
 		private $totals;
 
+		private $review;
+
 		/**
 		 * @return string
 		 */
@@ -300,7 +302,21 @@
 			$this->userId = $userId;
 		}
 
+		/**
+		 * @return mixed
+		 */
+		public function getReview()
+		{
+			return $this->review;
+		}
 
+		/**
+		 * @param mixed $review
+		 */
+		public function setReview($review)
+		{
+			$this->review = $review;
+		}
 
 		function __construct($year, $month, $uid = null)
 		{

+ 6 - 6
application/views/reports/index.phtml

@@ -165,12 +165,6 @@
                 if(count($timesheet) > 0)
                 {
                 echo "</table>";
-                echo "
-                    <div class='row'>
-                        <div class='small-12 columns text-right'>";
-
-                    echo"</div>
-                    </div>";
 
                 echo "<div class=\"row\">";
                 echo "<div class=\"small-6 medium-4 large-3 columns\">";
@@ -199,6 +193,12 @@
                 echo "</div>";
 
                 echo "</div>";
+                    echo "
+                    <div class='row'>
+                        <div class='small-12 columns text-center'>";
+                    echo "<a class='button radius' href=\"\">Mark as reviewed</a>";
+                    echo"</div>
+                    </div>";
 
                 }
                 else