Browse Source

Adjusted the date/time format for reviewed timesheet entries.

Adam Day 9 years ago
parent
commit
919fac95e6

+ 1 - 1
application/models/reviewModel.php

@@ -148,7 +148,7 @@ class reviewModel extends Staple_Model
 
                 $date = new DateTime();
                 $date->setTimestamp(strtotime($result['reviewDate']));
-                $data[$account['lastName'].", ".$account['firstName']]['reviewDateFormatted'] = $date->format('F jS Y');
+                $data[$account['lastName'].", ".$account['firstName']]['reviewDateFormatted'] = $date->format('F jS Y @ g:i A');
 
                 $data[$account['lastName'].", ".$account['firstName']]['supervisor'] = $account2['firstName']." ".$account2['lastName'];
             }

+ 10 - 1
application/models/timesheetModel.php

@@ -386,6 +386,7 @@
 				$codeId = $timeCode->getIdFor($code);
 				$totals[$code] = $this->calculatedTotals($codeId['id'],$this->startDate,$this->endDate,$uid);
 			}
+
 			$totals['Total Time'] = array_sum($totals);
 
 			$this->setTotals($totals);
@@ -470,7 +471,7 @@
 				$userId = $account['id'];
 			}
 
-			$sql = "SELECT inTime, outTime, lessTime FROM timeEntries WHERE inTime > UNIX_TIMESTAMP('$startDate 00:00:00') AND outTime < UNIX_TIMESTAMP('$endDate 23:59:59') AND userId = $userId AND codeId = $code;";
+			$sql = "SELECT codeId, inTime, outTime, lessTime FROM timeEntries WHERE inTime > UNIX_TIMESTAMP('$startDate 00:00:00') AND outTime < UNIX_TIMESTAMP('$endDate 23:59:59') AND userId = $userId AND codeId = $code;";
 
 			if($this->db->query($sql)->fetch_row() > 0)
 			{
@@ -507,6 +508,14 @@
 					$decimalHours = $this->timeToDecimal($lapseHours);
 					$total = $total + $decimalHours;
 					$total = $total - $lessTime;
+
+					$code = new codeModel();
+					$codeId = $code->getIdFor("Unpaid Leave");
+
+					if($codeId['id'] == $result['codeId'])
+					{
+						$total = (-1)*$total;
+					}
 				}
 
 				return $total;

+ 8 - 4
application/views/reports/payroll.phtml

@@ -76,6 +76,9 @@
                     <tbody>
 
                     <?php
+                    //Gets the unpaid leave time code ID. These entries will not be reflected in the total.
+                    $code = new codeModel();
+                    $codeId = $code->getIdFor("Unpaid Leave");
 
                     foreach($this->report as $account)
                     {
@@ -99,16 +102,17 @@
                         }
 
                         $grandTotal = 0;
-                        foreach($account['totals'] as $total)
+                        foreach($account['totals'] as $key => $value)
                         {
-                            $grandTotal = $grandTotal + $total;
+                            if($key != $codeId['id'])
+                            {
+                                $grandTotal = $grandTotal + $value;
+                            }
                         }
 
                         echo "<td class='text-center'><b>$grandTotal</b></td>";
                         echo "</tr>";
                     }
-
-
                     ?>
                     </tbody>
                 </table>