<?
global $vis_language;
if($time_track_count!= 0)
{
?>
<table class="table table-hover b-t b-light m-b-none" data-ride="datatables">
   <thead class="table_head">
      <tr>
         <th><? echo $vis_language['TXTDESCRIPTION']; ?></th>
			<th><? echo $vis_language['TXTBILLTIME']; ?></th>
			<th><? echo $vis_language['TXTWORKTIME']; ?></th>
			<? if($module_setting[0]['content']==1){?><th><? echo $vis_language['TXTAMOUNT']; ?></th><? } ?>
			<th><? echo $vis_language['TXTSTAFF']; ?></th>
			<th><? echo $vis_language['TXTCREATEDON']; ?></th>
			<th><? echo $vis_language['TXTMODIFIEDON']; ?></th>
			<th></th>
      </tr>
   </thead>
   <tbody>
      <?  $total_bill_time = 0;
		  $total_work_time = 0;
		  $total_amount = 0.00;
		  for($i=0;$i<$time_track_count;$i++) {
			$work_time = floor($time_track_details[$i]['work_time']/60).':'.$time_track_details[$i]['work_time'] % 60;
			$bill_time = floor($time_track_details[$i]['bill_time']/60).':'.$time_track_details[$i]['bill_time'] % 60;
			echo '<tr>
			<td  data-toggle="ajaxModal"  class="vis-pointer" data-modal-arguments="vis_module=ticket&vis_operation=edit_time_track&vis_static_area=vis_add_timetrack_dialog&vis_time_tracker_id='.$time_track_details[$i]['time_tracker_id'].'&vis_department_id='.$operation['vis_department_id'].'">'.$time_track_details[$i]['description'].'</td>
			<td>'.$bill_time.'</td>
			<td>'.$work_time.'</td>';?>
			<? if($module_setting[0]['content']==1){?><td><? echo $time_track_details[$i]['amount'];?></td><? } ?>
			<? echo '<td>'.$time_track_details[$i]['staff_name'].'</td>
			<td>'.format_datetime($time_track_details[$i]['created_date']).'</td>
			<td>'.format_datetime($time_track_details[$i]['modified_date']).'</td><td align="right"><a class="text-muted" href="javascript:void(0);" data-toggle="ajaxModal" data-modal-arguments="vis_module=ticket&vis_operation=confirm_delete_time_track&vis_time_tracker_id='.$time_track_details[$i]['time_tracker_id'].'&vis_ticket_id='.$time_track_details[$i]['ticket_id'].'&vis_static_area=vis_client_delete_form&vis_department_id='.$operation['vis_department_id'].'" title="'.$vis_language['TXTDELETE'].'"><i class="vh vh-delete-round"></i></a></td></tr>';
			  $total_bill_time += $time_track_details[$i]['bill_time'];
			  $total_work_time += $time_track_details[$i]['work_time'];
			  $total_amount	   += $time_track_details[$i]['amount'];
		  }
		  $work_total_time = floor($total_work_time/60).':'.$total_work_time % 60;
		  $bill_total_time = floor($total_bill_time/60).':'.$total_bill_time % 60;
		?>
		<tr><td align="center" class="font-bold"><? echo $vis_language['TXTTOTAL']; ?></td><td><?php echo $bill_total_time; ?></td><td><?php echo $work_total_time; ?></td><? if($module_setting[0]['content']==1){?><td><?php echo number_format($total_amount,2).' '.$currency; ?></td><? } ?><td colspan="4"></td></tr>
   </tbody>
</table>
<?php
	}
    else {
        echo '<div class="m">'.$vis_language['TXTNOMATCHFOUND'].'</div>';
    }
?>
