Ver código fonte

Time entry model now calculates out a users worked time and other various meta data about the entry. The timesheet model now passes back all information pertaining to the timesheet for a authenticated user.

Adam Day 9 anos atrás
pai
commit
d347a02cec

+ 22 - 14
application/controllers/timesheetController.php

@@ -6,7 +6,7 @@ class timesheetController extends Staple_Controller
 
     }
 
-    public function index($month = null, $year = null)
+    public function index($year = null, $month = null)
     {
         //Typecast variables
         $month = (int) $month;
@@ -64,19 +64,24 @@ class timesheetController extends Staple_Controller
             $this->view->insertTimeForm = $form;
         }
 
-        //Load timesheet for user.
-        $timesheet = new timesheetModel($month,$year);
-        echo $timesheet->getStartDate()."<br>";
-        echo $timesheet->getEndDate();
+        //Set year and month variables if undefined.
+        if($year == null)
+        {
+            $date = new DateTime();
+            $year = $date->format('Y');
+        }
+
+        if($month == null)
+        {
+            $date = new DateTime();
+            $month = $date->format('m');
+        }
 
-        //View
-        $this->view->year = $timesheet->getYear();
-        $this->view->nextYear = $timesheet->getNextYear();
-        $this->view->previousYear = $timesheet->getPreviousYear();
+        //Load timesheet for user.
+        $timesheet = new timesheetModel($year,$month);
 
-        $this->view->month = $timesheet->getMonth();
-        $this->view->previousMonth = $timesheet->getPreviousMonth();
-        $this->view->nextMonth = $timesheet->getNextMonth();
+        //Pass timesheet object to view
+        $this->view->timesheet = $timesheet;
     }
 
     public function remove($id)
@@ -112,11 +117,14 @@ class timesheetController extends Staple_Controller
     {
         if($id != null)
         {
-            $entry = new timeEntryModel();
-            if($entry->load($id))
+            $entry = new timeEntryModel($id);
+            if($entry)
             {
                 $form = new editTimeForm();
                 $form->setAction($this->_link(array('timesheet','edit',$id)));
+                //$form->addData();
+
+                $this->view->form = $form;
 
             }
             else

+ 1 - 1
application/forms/layouts/insertFormLayout.phtml

@@ -56,7 +56,7 @@
     $(document).ready(function() {
 
         $(function() {
-            $( "#date" ).datepicker({ minDate: "<?php echo date("m/d/Y", strtotime("-1 month + 23 days")) ?>", maxDate: "<?php echo date("m/d/Y", strtotime("+6 month")) ?>" });
+            $( "#date" ).datepicker({ minDate: "<?php echo date("m/d/Y", strtotime("-2 month + 23 days")) ?>", maxDate: "<?php echo date("m/d/Y", strtotime("+6 month")) ?>" });
         });
 
         $('#entryToggle').click(function()

+ 18 - 2
application/models/codeModel.php

@@ -81,7 +81,8 @@
 		function load($id = NULL)
 		{
 			$sql = "SELECT * FROM timeCodes WHERE id = '" . $this->db->real_escape_string($id) . "'";
-			if ($this->db->query($sql)->fetch_row() > 0) {
+			if($this->db->query($sql)->fetch_row() > 0)
+			{
 				$query = $this->db->query($sql);
 				$result = $query->fetch_assoc();
 
@@ -96,7 +97,7 @@
 		function allCodes()
 		{
 			$sql = "SELECT id, name FROM timeCodes WHERE 1";
-			if ($this->db->query($sql)->fetch_row() > 0)
+			if($this->db->query($sql)->fetch_row() > 0)
 			{
 				$query = $this->db->query($sql);
 
@@ -104,8 +105,23 @@
                 {
                     $data[$result['id']] = $result['name'];
                 }
+
 				return $data;
 			}
 		}
+
+		function getIdFor($term = null)
+		{
+			if($term !== null)
+			{
+				$sql = "SELECT id FROM timeCodes WHERE name like '%".$this->db->real_escape_string($term)."%'";
+				if($this->db->query($sql)->fetch_row() > 0)
+				{
+					$query = $this->db->query($sql);
+					$result = $query->fetch_assoc();
+					return $result;
+				}
+			}
+		}
 	}
 ?>

+ 187 - 5
application/models/timeEntryModel.php

@@ -6,10 +6,16 @@
 
 		private $id;
         private $date;
-		private $inTime;
-		private $outTime;
+        private $inTime;
+        private $inTimeRaw;
+        private $roundedInTime;
+        private $outTime;
+		private $outTimeRaw;
+        private $roundedOutTime;
 		private $lessTime;
 		private $codeId;
+        private $codeName;
+        private $timeWorked;
 
         /**
          * @return mixed
@@ -75,6 +81,38 @@
             $this->outTime = $outTime;
         }
 
+        /**
+         * @return mixed
+         */
+        public function getInTimeRaw()
+        {
+            return $this->inTimeRaw;
+        }
+
+        /**
+         * @param mixed $inTimeRaw
+         */
+        public function setInTimeRaw($inTimeRaw)
+        {
+            $this->inTimeRaw = $inTimeRaw;
+        }
+
+        /**
+         * @return mixed
+         */
+        public function getOutTimeRaw()
+        {
+            return $this->outTimeRaw;
+        }
+
+        /**
+         * @param mixed $outTimeRaw
+         */
+        public function setOutTimeRaw($outTimeRaw)
+        {
+            $this->outTimeRaw = $outTimeRaw;
+        }
+
         /**
          * @return mixed
          */
@@ -107,6 +145,70 @@
             $this->codeId = $codeId;
         }
 
+        /**
+         * @return mixed
+         */
+        public function getCodeName()
+        {
+            return $this->codeName;
+        }
+
+        /**
+         * @param mixed $codeName
+         */
+        public function setCodeName($codeName)
+        {
+            $this->codeName = $codeName;
+        }
+
+        /**
+         * @return mixed
+         */
+        public function getTimeWorked()
+        {
+            return $this->timeWorked;
+        }
+
+        /**
+         * @param mixed $timeWorked
+         */
+        public function setTimeWorked($timeWorked)
+        {
+            $this->timeWorked = $timeWorked;
+        }
+
+        /**
+         * @return mixed
+         */
+        public function getRoundedInTime()
+        {
+            return $this->roundedInTime;
+        }
+
+        /**
+         * @param mixed $roundedInTime
+         */
+        public function setRoundedInTime($roundedInTime)
+        {
+            $this->roundedInTime = $roundedInTime;
+        }
+
+        /**
+         * @return mixed
+         */
+        public function getRoundedOutTime()
+        {
+            return $this->roundedOutTime;
+        }
+
+        /**
+         * @param mixed $roundedOutTime
+         */
+        public function setRoundedOutTime($roundedOutTime)
+        {
+            $this->roundedOutTime = $roundedOutTime;
+        }
+
 		function __construct($id = null)
 		{
             $this->db = Staple_DB::get();
@@ -119,11 +221,65 @@
                     $query = $this->db->query($sql);
                     $result = $query->fetch_assoc();
 
+                    //Set ID and Date
+                    $this->setId($result['id']);
                     $this->setDate(date("m/d/Y",$result['inTime']));
-                    $this->setInTime(date("h:i A",$result['inTime']));
-                    $this->setOutTime(date("h:i A",$result['outTime']));
+
+                    //Set inTime
+                    $inTime = new DateTime();
+                    $inTime->setTimestamp($result['inTime']);
+                    $this->setInTime($inTime->format('h:i A'));
+                    $this->setInTimeRaw($result['inTime']);
+                    $this->setRoundedInTime($this->nearestQuarterHour($result['inTime']));
+
+                    //Out Time
+                    $outTime = new DateTime();
+                    $outTime->setTimestamp($result['outTime']);
+                    $this->setOutTime($outTime->format('h:i A'));
+                    $this->setOutTimeRaw($result['outTime']);
+                    $this->setRoundedOutTime($this->nearestQuarterHour($result['outTime']));
+
                     $this->setLessTime($result['lessTime']);
+
+                    //Calculate Time Worked
+                    switch($result['lessTime'])
+                    {
+                        case 60:
+                            $lessTime = 1;
+                            break;
+                        case 30:
+                            $lessTime = 0.5;
+                            break;
+                        case 15:
+                            $lessTime = 0.25;
+                            break;
+                        default:
+                            $lessTime = 0;
+                    }
+
+                    //Total Worked Time
+                    $dateTime1 = new DateTime($this->roundedInTime);
+                    $dateTime2 = new DateTime($this->roundedOutTime);
+                    $interval = $dateTime1->diff($dateTime2);
+
+                    $timeWorked = $this->timeToDecimal($interval->h.":".$interval->i)-$lessTime;
+
+                    if($timeWorked !== 0)
+                    {
+                        $this->setTimeWorked($timeWorked);
+                    }
+                    else
+                    {
+                        $this->setTimeWorked(0);
+                    }
+
+                    //Get Code Information
+                    $code = new codeModel();
                     $this->setCodeId($result['codeId']);
+                    $code->load($result['codeId']);
+                    $this->setCodeName($code->getName());
+
+                    return true;
                 }
             }
 		}
@@ -188,6 +344,32 @@
 				return true;
 			}
 		}
-	}
 
+        function nearestQuarterHour($time)
+        {
+            //$time = strtotime($time);
+            $round = 15*60;
+            $rounded = round($time/$round)*$round;
+
+            return date("g:i A", $rounded);
+        }
+
+        function timeToDecimal($time)
+        {
+            $timeArr = explode(':', $time);
+            $hours = $timeArr[0]*1;
+            $minutes = $timeArr[1]/60;
+            $dec = $hours + $minutes;
+
+            if($dec > 0)
+            {
+                return round($dec,2);
+            }
+            else
+            {
+                return 0;
+            }
+        }
+
+	}
 ?>

+ 260 - 74
application/models/timesheetModel.php

@@ -4,35 +4,74 @@
 	{
 		private $db;
 
-		private $userId;
+		private $currentYear;
+		private $currentMonth;
+		private $currentMonthText;
 		private $startDate;
-		private $month;
+		private $startDateTimeString;
+		private $endDate;
+		private $endDateTimeString;
+
 		private $nextMonth;
-		private $previousMonth;
+		private $nextMonthText;
 		private $nextYear;
+
+		private $previousMonth;
+		private $previousMonthText;
 		private $previousYear;
-		private $year;
-		private $endDate;
+
 		private $entries;
 
 		/**
-		 * @return mixed
+		 * @return string
 		 */
-		public function getUserId()
+		public function getCurrentYear()
 		{
-			return $this->userId;
+			return $this->currentYear;
 		}
 
 		/**
-		 * @param mixed $userId
+		 * @param string $currentYear
 		 */
-		public function setUserId($userId)
+		public function setCurrentYear($currentYear)
 		{
-			$this->userId = $userId;
+			$this->currentYear = $currentYear;
 		}
 
 		/**
-		 * @return mixed
+		 * @return string
+		 */
+		public function getCurrentMonth()
+		{
+			return $this->currentMonth;
+		}
+
+		/**
+		 * @param string $currentMonth
+		 */
+		public function setCurrentMonth($currentMonth)
+		{
+			$this->currentMonth = $currentMonth;
+		}
+
+		/**
+		 * @return string
+		 */
+		public function getCurrentMonthText()
+		{
+			return $this->currentMonthText;
+		}
+
+		/**
+		 * @param string $currentMonthText
+		 */
+		public function setCurrentMonthText($currentMonthText)
+		{
+			$this->currentMonthText = $currentMonthText;
+		}
+
+		/**
+		 * @return string
 		 */
 		public function getStartDate()
 		{
@@ -40,7 +79,7 @@
 		}
 
 		/**
-		 * @param mixed $startDate
+		 * @param string $startDate
 		 */
 		public function setStartDate($startDate)
 		{
@@ -48,23 +87,23 @@
 		}
 
 		/**
-		 * @return mixed
+		 * @return DateTime
 		 */
-		public function getMonth()
+		public function getEndDate()
 		{
-			return $this->month;
+			return $this->endDate;
 		}
 
 		/**
-		 * @param mixed $month
+		 * @param DateTime $endDate
 		 */
-		public function setMonth($month)
+		public function setEndDate($endDate)
 		{
-			$this->month = $month;
+			$this->endDate = $endDate;
 		}
 
 		/**
-		 * @return mixed
+		 * @return string
 		 */
 		public function getNextMonth()
 		{
@@ -72,7 +111,7 @@
 		}
 
 		/**
-		 * @param mixed $nextMonth
+		 * @param string $nextMonth
 		 */
 		public function setNextMonth($nextMonth)
 		{
@@ -80,23 +119,23 @@
 		}
 
 		/**
-		 * @return mixed
+		 * @return string
 		 */
-		public function getPreviousMonth()
+		public function getNextMonthText()
 		{
-			return $this->previousMonth;
+			return $this->nextMonthText;
 		}
 
 		/**
-		 * @param mixed $previousMonth
+		 * @param string $nextMonthText
 		 */
-		public function setPreviousMonth($previousMonth)
+		public function setNextMonthText($nextMonthText)
 		{
-			$this->previousMonth = $previousMonth;
+			$this->nextMonthText = $nextMonthText;
 		}
 
 		/**
-		 * @return mixed
+		 * @return string
 		 */
 		public function getNextYear()
 		{
@@ -104,7 +143,7 @@
 		}
 
 		/**
-		 * @param mixed $nextYear
+		 * @param string $nextYear
 		 */
 		public function setNextYear($nextYear)
 		{
@@ -112,51 +151,51 @@
 		}
 
 		/**
-		 * @return mixed
+		 * @return string
 		 */
-		public function getPreviousYear()
+		public function getPreviousMonth()
 		{
-			return $this->previousYear;
+			return $this->previousMonth;
 		}
 
 		/**
-		 * @param mixed $previousYear
+		 * @param string $previousMonth
 		 */
-		public function setPreviousYear($previousYear)
+		public function setPreviousMonth($previousMonth)
 		{
-			$this->previousYear = $previousYear;
+			$this->previousMonth = $previousMonth;
 		}
 
 		/**
-		 * @return mixed
+		 * @return string
 		 */
-		public function getYear()
+		public function getPreviousMonthText()
 		{
-			return $this->year;
+			return $this->previousMonthText;
 		}
 
 		/**
-		 * @param mixed $year
+		 * @param string $previousMonthText
 		 */
-		public function setYear($year)
+		public function setPreviousMonthText($previousMonthText)
 		{
-			$this->year = $year;
+			$this->previousMonthText = $previousMonthText;
 		}
 
 		/**
-		 * @return mixed
+		 * @return string
 		 */
-		public function getEndDate()
+		public function getPreviousYear()
 		{
-			return $this->endDate;
+			return $this->previousYear;
 		}
 
 		/**
-		 * @param mixed $endDate
+		 * @param string $previousYear
 		 */
-		public function setEndDate($endDate)
+		public function setPreviousYear($previousYear)
 		{
-			$this->endDate = $endDate;
+			$this->previousYear = $previousYear;
 		}
 
 		/**
@@ -175,42 +214,189 @@
 			$this->entries = $entries;
 		}
 
-		function __construct($month = null,$year = null)
+		/**
+		 * @return int
+		 */
+		public function getEndDateTimeString()
+		{
+			return $this->endDateTimeString;
+		}
+
+		/**
+		 * @param int $endDateTimeString
+		 */
+		public function setEndDateTimeString($endDateTimeString)
+		{
+			$this->endDateTimeString = $endDateTimeString;
+		}
+
+		/**
+		 * @return int
+		 */
+		public function getStartDateTimeString()
+		{
+			return $this->startDateTimeString;
+		}
+
+		/**
+		 * @param int $startDateTimeString
+		 */
+		public function setStartDateTimeString($startDateTimeString)
+		{
+			$this->startDateTimeString = $startDateTimeString;
+		}
+
+		function __construct($year, $month)
 		{
 			$this->db = Staple_DB::get();
 
+			//Current Dates
+			$currentDate = new DateTime();
+			$currentDate->setDate($year, $month, 1);
+
+			$this->currentYear = $currentDate->format('Y');
+			$this->currentMonth = $currentDate->format('m');
+			$this->currentMonthText = $currentDate->format('F');
+			$this->startDate = $currentDate->modify('-1 month +25 day')->format('Y-m-d');
+			$this->startDateTimeString = strtotime($this->startDate);
+			$currentDate->setDate($year, $month, 1);
+			$this->endDate = $currentDate->modify('+24 day')->format('Y-m-d');
+			$this->endDateTimeString = strtotime($this->endDate);
+
+			//Previous Dates
+			$previousDate = new DateTime();
+			$previousDate->setDate($year, $month, 1);
+			$previousDate->modify('-1 month');
+			$this->previousMonth = $previousDate->format('m');
+			$this->previousMonthText = $previousDate->format('F');
+			$previousDate->setDate($year, $month, 1);
+			$previousDate->modify('-1 year');
+			$this->previousYear = $previousDate->format('Y');
+
+			//Future Dates
+			$furtureDate = new DateTime();
+			$furtureDate->setDate($year, $month, 1);
+			$furtureDate->modify('+1 month');
+			$this->nextMonth = $furtureDate->format('m');
+			$this->nextMonthText = $furtureDate->format('F');
+			$furtureDate->setDate($year, $month, 1);
+			$furtureDate->modify('+1 year');
+			$this->nextYear = $furtureDate->format('Y');
+
+			//Time Entries
+			$this->entries = $this->entries($this->startDate, $this->endDate);
+
+			//Totals
+			$vacationTotal = $this->vacationEntries($this->startDate, $this->endDate);
+		}
+
+		function entries($startDate,$endDate)
+		{
 			//Get user ID from Auth
 			$user = new userModel();
-			$this->userId = $user->getId();
+			$userId = $user->getId();
 
-			if ($month == NULL) {
-				$month = new DateTime();
-				$month = $month->format('n');
-			}
+			$sql = "SELECT id FROM timeEntries WHERE inTime BETWEEN $this->startDateTimeString AND $this->endDateTimeString AND userId = $userId ORDER BY inTime ASC";
+			if($this->db->query($sql)->num_rows > 0)
+			{
+				$query = $this->db->query($sql);
 
-			if ($year == NULL) {
-				$year = new DateTime();
-				$year = $year->format('Y');
+				while($result = $query->fetch_assoc())
+				{
+					$entry = new timeEntryModel($result['id']);
+					$data[] = $entry;
+				}
+				return $data;
+			}
+			else
+			{
+				return array();
 			}
+		}
+
+		function vacationEntries($startDate,$endDate)
+		{
+			//Get user ID from Auth
+			$user = new userModel();
+			$userId = $user->getId();
+
+			//Get vacation timecode ID.
+			$code = new codeModel();
+			$codes = $code->getIdFor('vacation');
+			$timeCode = $codes['id'];
+
+			$sql = "SELECT * FROM timeEntries WHERE inTime BETWEEN $this->startDateTimeString AND $this->endDateTimeString AND userId = $userId AND codeId = $timeCode";
+
+			echo $sql;
 
-			$dateObj = new DateTime();
-			$dateObj->setDate($year, $month, 1);
-			$end = $dateObj->modify('+24 day');
-			$endTime = strtotime($end->format('Y-m-d'));
-			$endDate = $end->format('Y-m-d');
-			$this->setEndDate($endDate);
-			$this->setMonth($end->format('F'));
-			$this->setNextMonth($end->modify('+1 month')->format('m'));
-			$this->setPreviousMonth($end->modify('-1 month')->format('m'));
-
-			$this->setYear($end->format('Y'));
-			$this->setNextYear($end->modify('+1 year')->format('Y'));
-			$this->setPreviousYear($end->modify('-1 year')->format('Y'));
-
-			$start = $dateObj->modify('-1 month +1 day');
-			$startTime = strtotime($start->format('Y-m-d'));
-			$startDate = $start->format('Y-m-d');
-			$this->setStartDate($startDate);
+			if($this->db->query($sql)->fetch_row() > 0)
+			{
+				$query = $this->db->query($sql);
+				$result = $query->fetch_assoc();
+
+				//Set inTime
+				$inTime = new DateTime();
+				$inTime->setTimestamp($result['inTime']);
+
+				//$this->setInTime($inTime->format('h:i A'));
+				$vacationInTime = $inTime->format('h:i A');
+
+				//$this->setInTimeRaw($result['inTime']);
+				$vacationInTimeRaw = $result['inTime'];
+
+				//$this->setRoundedInTime($this->nearestQuarterHour($result['inTime']));
+
+				/*
+				//Out Time
+				$outTime = new DateTime();
+				$outTime->setTimestamp($result['outTime']);
+				$this->setOutTime($outTime->format('h:i A'));
+				$this->setOutTimeRaw($result['outTime']);
+				$this->setRoundedOutTime($this->nearestQuarterHour($result['outTime']));
+
+				$this->setLessTime($result['lessTime']);
+
+				//Calculate Time Worked
+				switch($result['lessTime'])
+				{
+					case 60:
+						$lessTime = 1;
+						break;
+					case 30:
+						$lessTime = 0.5;
+						break;
+					case 15:
+						$lessTime = 0.25;
+						break;
+					default:
+						$lessTime = 0;
+				}
+
+				//Total Worked Time
+				$dateTime1 = new DateTime($this->roundedInTime);
+				$dateTime2 = new DateTime($this->roundedOutTime);
+				$interval = $dateTime1->diff($dateTime2);
+
+				$timeWorked = $this->timeToDecimal($interval->h.":".$interval->i)-$lessTime;
+
+				if($timeWorked !== 0)
+				{
+					$this->setTimeWorked($timeWorked);
+				}
+				else
+				{
+					$this->setTimeWorked(0);
+				}
+
+				//Get Code Information
+				$code = new codeModel();
+				$this->setCodeId($result['codeId']);
+				$code->load($result['codeId']);
+				$this->setCodeName($code->getName());
+
+				return true;
+				*/
+			}
 		}
 	}
 

+ 11 - 11
application/views/timesheet/index.phtml

@@ -2,12 +2,12 @@
 <div class="section">
     <div class="row">
         <div class="small-12 medium-4 text-left columns">
-            <h3><?php echo $this->month." ".$this->year?></h3>
+            <h3><?php echo $this->timesheet->currentMonthText." ".$this->timesheet->currentYear ?></h3>
         </div>
         <div class="small-12 medium-8 text-right columns">
             <ul class="button-group radius even-4 stack-for-small">
-                <li><a class="button secondary" href="<?php echo $this->link(array('timesheet',$this->previousMonth, $this->year)) ?>"><i class="fa fa-caret-left"></i> Prev.</a></li>
-                <li><a class="button secondary" href="<?php echo $this->link(array('timesheet',$this->nextMonth, $this->year)) ?>">Next <i class="fa fa-caret-right"></i></a></li>
+                <li><a class="button secondary" href="<?php echo $this->link(array('timesheet',$this->timesheet->currentYear,$this->timesheet->previousMonth)) ?>"><i class="fa fa-caret-left"></i> Prev.</a></li>
+                <li><a class="button secondary" href="<?php echo $this->link(array('timesheet',$this->timesheet->currentYear,$this->timesheet->nextMonth)) ?>">Next <i class="fa fa-caret-right"></i></a></li>
                 <li><a class="button"><i class="fa fa-print"></i> Print</a></li>
                 <?php
                     if($this->validateRange)
@@ -20,7 +20,7 @@
     </div>
 
 <?php
-    if(count($this->timesheet) > 0)
+    if(count($this->timesheet->entries) > 0)
     {
         echo "
             <div class=\"row\">
@@ -46,27 +46,27 @@
             </div>
         ";
 
-        foreach($this->timesheet as $entry)
+        foreach($this->timesheet->entries as $entry)
         {
             echo "
             <div class=\"row\">
                 <div class=\"small-4 medium-2 columns\">
-                    <a href=\"".$this->link(array('timesheet','edit',$entry['id']))."\" class=\"button secondary radius expand\">".$entry['date']['dayShort']." ".$entry['date']['mdy']."</a>
+                    <a href=\"".$this->link(array('timesheet','edit',$entry->id))."\" class=\"button secondary radius expand\">".$entry->date."</a>
                 </div>
                 <div class=\"small-4 medium-2 columns\">
-                    <span data-tooltip aria-haspopup=\"true\" class=\"has-tip\" title=\"Entered as: ".$entry['rawInTime']."\">".$entry['roundedInTime']."</span>
+                    <span data-tooltip aria-haspopup=\"true\" class=\"has-tip\" title=\"Entered as: ".$entry->inTime."\">".$entry->roundedInTime."</span>
                 </div>
                 <div class=\"small-4 medium-2 columns\">
-                    <span data-tooltip aria-haspopup=\"true\" class=\"has-tip\" title=\"Entered as: ".$entry['rawOutTime']."\">".$entry['roundedOutTime']."</span>
+                    <span data-tooltip aria-haspopup=\"true\" class=\"has-tip\" title=\"Entered as: ".$entry->outTime."\">".$entry->roundedOutTime."</span>
                 </div>
                 <div class=\"small-4 medium-2 columns\">
-                    ".$entry['lessTime']." <small>Min.</small>
+                    ".$entry->lessTime." <small>Min.</small>
                 </div>
                 <div class=\"small-4 medium-2 columns\">
-                    <b>".$entry['timeWorkedDec']."</b> <small>Hours</small>
+                    <b>".$entry->timeWorked."</b> <small>Hours</small>
                 </div>
                 <div class=\"small-4 medium-2 columns\">
-                    ".$entry['code']."
+                    ".$entry->codeName."
                 </div>
                 <hr>
             </div>