Browse Source

Added total hours per pay period to the Month report and print preview.

Adam Day 9 years ago
parent
commit
227d290b6c

+ 12 - 3
application/views/reports/payroll.phtml

@@ -80,9 +80,9 @@
                     $code = new codeModel();
                     $codeId = $code->getIdFor("Unpaid Leave");
 
+                    $grandTotal = 0;
                     foreach($this->report as $account)
                     {
-
                         echo "<tr>";
                         echo "<td style='border-bottom:1px solid #ccc;'><b>".$account['userInfo']['lastName'].", ".$account['userInfo']['firstName']."</b></td>";
 
@@ -101,18 +101,27 @@
                             echo "</td>";
                         }
 
-                        $grandTotal = 0;
+
+                        $accountTotal = 0;
                         foreach($account['totals'] as $key => $value)
                         {
                             if($key != $codeId['id'])
                             {
+                                $accountTotal = $accountTotal + $value;
                                 $grandTotal = $grandTotal + $value;
                             }
                         }
 
-                        echo "<td class='text-center'><b>$grandTotal</b></td>";
+                        echo "<td class='text-center'><b>$accountTotal</b></td>";
                         echo "</tr>";
                     }
+                    $codeCount = count($account['totals'])+2;
+                    echo "
+                        <tr>
+                            <td class='text-center' colspan=\"$codeCount\"><b>Total Pay Period Hours:</b> $grandTotal </td>
+                        </tr>
+                    ";
+
                     ?>
                     </tbody>
                 </table>

+ 11 - 3
application/views/reports/payrollprint.phtml

@@ -43,7 +43,7 @@
     </thead>
     <tbody>
     <?php
-
+    $grandTotal = 0;
     foreach($this->report as $account)
     {
 
@@ -65,15 +65,23 @@
             echo "</td>";
         }
 
-        $grandTotal = 0;
+        $accountTotal = 0;
         foreach($account['totals'] as $total)
         {
+            $accountTotal = $accountTotal + $total;
             $grandTotal = $grandTotal + $total;
         }
 
-        echo "<td class='text-center'><b>$grandTotal</b></td>";
+        echo "<td class='text-center'><b>$accountTotal</b></td>";
         echo "</tr>";
     }
+
+    $codeCount = count($account['totals'])+2;
+    echo "
+            <tr>
+                <td class='text-center' colspan=\"$codeCount\"><b>Total Pay Period Hours:</b> $grandTotal </td>
+            </tr>
+        ";
     ?>
     </tbody>
 </table>