payperiodprint.phtml 2.3 KB

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