payperiod.phtml 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <div class="section">
  2. <div class="row">
  3. <div class="small-12 columns">
  4. <h2><i class="fa fa-file"></i> Pay Period Report</h2>
  5. </div>
  6. </div>
  7. <?php echo $this->spanDays ?>
  8. <div class="row full">
  9. <div class="small-12 columns full">
  10. <style>
  11. table {
  12. border:1px solid #ccc;
  13. }
  14. th {
  15. border:1px solid #ccc;
  16. padding:0px;
  17. margin:0px;
  18. background-color: #eaeaea;
  19. }
  20. td {
  21. border:1px solid #ccc;
  22. padding:0px;
  23. margin:0px;
  24. }
  25. </style>
  26. <table>
  27. <thead>
  28. <tr>
  29. <th style="width:150px;"></th>
  30. <?php
  31. $date3 = new DateTime();
  32. $date3->setDate($this->year,$this->previousMonth,26);
  33. for($i=1;$i<=$this->span;$i++)
  34. {
  35. if($date3->format('d') >= 26)
  36. {
  37. echo "<th style='background-color:#fff;border-bottom:1px solid #ccc; '>".$date3->format('D')."<br>".$date3->format('n')."/".$date3->format('j')."</th>";
  38. }
  39. else
  40. {
  41. echo "<th style='border-bottom:1px solid #ccc;'>".$date3->format('D')."<br>".$date3->format('n')."/".$date3->format('j')."</th>";
  42. }
  43. $date3->modify('+1 day');
  44. }
  45. ?>
  46. </tr>
  47. </thead>
  48. <tbody>
  49. <?php
  50. foreach($this->report as $user=>$dates)
  51. {
  52. $totalTime = array_sum($dates);
  53. echo "<tr>";
  54. echo "<td style='border-bottom:1px solid #ccc;'><b>$user</b><br>Total: $totalTime</td>";
  55. $date = new DateTime();
  56. $date->setDate($this->year,$this->previousMonth,26);
  57. for($j=1;$j<=$this->span;$j++)
  58. {
  59. foreach ($dates as $entryDate => $total)
  60. {
  61. $newDate = explode("-", $entryDate);
  62. $dayOfMonth = $newDate[2];
  63. if($dayOfMonth == $date->format('d'))
  64. {
  65. echo "<td class='text-center' style='border-bottom:1px solid #ccc;'>$total</td>";
  66. $j++;
  67. }
  68. }
  69. echo "<td class='text-center'>-</td>";
  70. $date->modify('+1 day');
  71. }
  72. echo "</tr>";
  73. }
  74. ?>
  75. </tbody>
  76. </table>
  77. </div>
  78. </div>
  79. </div>
  80. <pre>
  81. <?php
  82. print_r($this->report);
  83. ?>
  84. </pre>