index.phtml 8.9 KB

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