payperiod.phtml 3.8 KB

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