index.phtml 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <div class="section">
  2. <div class="row">
  3. <div class="small-6 columns">
  4. <h1><i class="fa fa-file"></i> Reports</h1>
  5. </div>
  6. <div class="small-6 columns text-right">
  7. <h1 class="subheader"><?php echo $this->month ?> <?php echo $this->year?></h1>
  8. </div>
  9. </div>
  10. <div class="row">
  11. <div class="small-4 columns">
  12. <ul class="button-group radius left">
  13. <li><a class="button small" href="<?php echo $this->link(array('reports','weekly')) ?>"><i class="fa fa-file"></i> Week Report</a></li>
  14. <li><a class="button small" data-reveal-id="print" href="#"><i class="fa fa-print"></i> Print</a></li>
  15. </ul>
  16. </div>
  17. <div class="small-8 columns">
  18. <ul class="button-group round right">
  19. <li><a class="button small secondary" href="<?php echo $this->link(array('reports',$this->year, $this->previousMonth))?> "><i class="fa fa-caret-left"></i> Previous</a></li>
  20. <li><a class="button small secondary" href="<?php echo $this->link(array('reports',$this->year, $this->nextMonth))?> ">Next <i class="fa fa-caret-right"></i></a></li>
  21. <li><a class="button small secondary" data-reveal-id="yearForm" href="#"><i class="fa fa-calendar"></i> Change Year</a></li>
  22. <li><a id="showAll" class="button small secondary" href="#"><i class="fa fa-eye"></i> Show All</a></li>
  23. <li><a id="hideAll" class="button small secondary" href="#"><i class="fa fa-eye-slash"></i> Hide All</a></li>
  24. </ul>
  25. </div>
  26. </div>
  27. <div class="row">
  28. <div class="small-12 columns">
  29. <?php
  30. $i = 0;
  31. foreach($this->report as $user=>$timesheet)
  32. {
  33. echo "<h3 id='user'.$i.'' class='timeTitle'>$user <i class='fa fa-chevron-down right'></i></h3>";
  34. echo "
  35. <div class=\"wrapper hide\">";
  36. if(count($timesheet) > 0)
  37. {
  38. echo"
  39. <table width='100%'>
  40. <thead>
  41. <tr>
  42. <th>Date</th>
  43. <th>In</th>
  44. <th>Out</th>
  45. <th>Less Time</th>
  46. <th>Hours</th>
  47. <th>Code</th>
  48. <th>Date Stamp</th>
  49. <th>Validated</th>";
  50. if($this->accountLevel >= 900)
  51. {
  52. echo "<th>Action</th>";
  53. }
  54. echo"</tr>
  55. </thead>
  56. ";
  57. }
  58. $totalValidated = 0;
  59. $totalInvalid = 0;
  60. $totalVacation = 0;
  61. $totalSick = 0;
  62. foreach($timesheet as $key=>$entry)
  63. {
  64. echo "
  65. <tr>
  66. <td>".date("l, F jS Y",strtotime($entry['date']))."</td>
  67. <td>".date("g:i A",$entry['inTime'])."</td>
  68. <td>".date("g:i A",$entry['outTime'])."</td>
  69. <td>".$entry['lessTime']." <small>Hours</small></td>
  70. <td>".$entry['timeWorked']."</td>
  71. <td>".$entry['code']."</td>
  72. <td>".date("M. jS Y @ G:i A",strtotime($entry['timestamp']))."</td>
  73. <td><div class='text-center'>";
  74. if($entry['validated'] == 1)
  75. {
  76. echo "<i class=\"fa fa-check green\"></i>";
  77. }
  78. else
  79. {
  80. echo "<i class=\"fa fa-close red\"></i>";
  81. }
  82. echo "</td>";
  83. if($this->accountLevel >= 900)
  84. {
  85. echo "<td><a class='button tiny radius warning' href=\"".$this->link(array('timesheet','remove',$key))."\"><i class=\"fa fa-trash\"></i> Delete</a></td>";
  86. }
  87. echo "</tr>";
  88. if(strlen($entry['note']) > 0)
  89. {
  90. echo "
  91. <tr>
  92. <td colspan='9'>
  93. <b>Note:</b> ".$entry['note']."
  94. </td>
  95. </tr>
  96. ";
  97. }
  98. if($entry['validated'] == 1)
  99. {
  100. $totalValidated += $entry['timeWorked'];
  101. }
  102. if($entry['validated'] == 0)
  103. {
  104. $totalInvalid += $entry['timeWorked'];
  105. }
  106. if($entry['code'] == "Vacation")
  107. {
  108. $totalVacation += $entry['timeWorked'];
  109. }
  110. if($entry['code'] == "Sick")
  111. {
  112. $totalSick += $entry['timeWorked'];
  113. }
  114. }
  115. if(count($timesheet) > 0)
  116. {
  117. echo "</table>";
  118. echo "<div class=\"row\">";
  119. echo "<div class=\"small-6 medium-4 large-3 columns\">";
  120. echo "<div class=\"card successBg\">
  121. <div class=\"title\">Validated</div>
  122. <div class=\"value\">".$totalValidated." <small>Hours</small></div>
  123. </div>";
  124. echo "</div>";
  125. echo "<div class=\"small-6 medium-4 large-3 columns\">";
  126. echo "<div class=\"card warning\">
  127. <div class=\"title\">Not Validated</div>
  128. <div class=\"value\">".$totalInvalid." <small>Hours</small></div>
  129. </div>";
  130. echo "</div>";
  131. echo "<div class=\"small-6 medium-4 large-3 columns end\">";
  132. echo "<div class=\"card\">
  133. <div class=\"title\">Sick</div>
  134. <div class=\"value\">".$totalSick." <small>Hours</small></div>
  135. </div>";
  136. echo "</div>";
  137. echo "<div class=\"small-6 medium-4 large-3 columns end\">";
  138. echo "<div class=\"card\">
  139. <div class=\"title\">Vacation</div>
  140. <div class=\"value\">".$totalVacation." <small>Hours</small></div>
  141. </div>";
  142. echo "</div>";
  143. echo "</div>";
  144. }
  145. else
  146. {
  147. echo "<div class=\"text-center\">No time submitted</div>";
  148. }
  149. $i++;
  150. echo "</div><hr>";
  151. }
  152. ?>
  153. </div>
  154. </div>
  155. </div>
  156. <div id="yearForm" class="reveal-modal small" data-reveal aria-labelledby="Change Year" aria-hidden="true" role="dialog">
  157. <h2 id="modalTitle">Select a Year</h2>
  158. <?php echo $this->yearForm ?>
  159. <a class="close-reveal-modal" aria-label="Close">&#215;</a>
  160. </div>
  161. <div id="print" class="reveal-modal small" data-reveal aria-labelledby="Print Report" aria-hidden="true" role="dialog">
  162. <h2>Print Individual Time Sheet</h2>
  163. <?php echo $this->printTimeSheetForm ?>
  164. <a class="close-reveal-modal" aria-label="Close">&#215;</a>
  165. </div>
  166. <script>
  167. $(function() {
  168. $(".timeTitle").click(function() {
  169. $(this).next(".wrapper").slideToggle("slow");
  170. $(this).find("i").toggleClass("fa-chevron-up fa-chevron-down")
  171. return false;
  172. });
  173. $("#hideAll").click(function() {
  174. $(".wrapper").slideUp();
  175. $(".timeTitle").find("i").removeClass("fa-chevron-up")
  176. $(".timeTitle").find("i").addClass("fa-chevron-down")
  177. return false;
  178. });
  179. $("#showAll").click(function() {
  180. $(".wrapper").slideDown();
  181. $(".timeTitle").find("i").removeClass("fa-chevron-down")
  182. $(".timeTitle").find("i").addClass("fa-chevron-up")
  183. return false;
  184. });
  185. });
  186. </script>