Prechádzať zdrojové kódy

Working on a monthly report that shows account daily totals.

Adam Day 9 rokov pred
rodič
commit
cdd5f50882

+ 1 - 1
application/models/reportModel.php

@@ -239,7 +239,7 @@ class reportModel extends Staple_Model
             $userId = $account['id'];
             $userName = $account['lastName'].", ".$account['firstName'];
             $sql = "
-                SELECT * FROM timeEntries WHERE inTime >= '".$this->db->real_escape_string($startDate)."' AND inTime <= '".$this->db->real_escape_string($endDate)."' AND userId = '".$this->db->real_escape_string($userId)."';
+                SELECT * FROM timeEntries WHERE inTime >= '".$this->db->real_escape_string($startDate)."' AND inTime <= '".$this->db->real_escape_string($endDate)."' AND userId = '".$this->db->real_escape_string($userId)."' ORDER BY inTime ASC;
             ";
 
             $query = $this->db->query($sql);

+ 3 - 3
application/views/reports/payperiod.phtml

@@ -53,8 +53,9 @@
 
                     foreach($this->report as $user=>$dates)
                     {
+                        $totalTime = array_sum($dates);
                         echo "<tr>";
-                        echo "<td style='border-bottom:1px solid #ccc;'><b>$user</b></td>";
+                        echo "<td style='border-bottom:1px solid #ccc;'><b>$user</b><br>Total: $totalTime</td>";
 
                         $date = new DateTime();
                         $date->setDate($this->year,$this->previousMonth,26);
@@ -70,8 +71,7 @@
                                     $j++;
                                 }
                             }
-
-                            echo "<td class='text-center'> - </td>";
+                            echo "<td class='text-center'>-</td>";
                             $date->modify('+1 day');
                         }
                         echo "</tr>";