index.phtml 8.2 KB

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