<script type="text/javascript" src="<?= VIS_PATH_SCRIPT; ?>datatables/data-tables/DT_bootstrap.js"></script>
<?  
    global $vis_language;
    if($report!=-1) { 
	    $total_ticket_cnt=count($total_ticket); ?>
<table cellpadding="0" cellspacing="0" border="0" class="table table-hover b-t b-light m-b-none" id="datatable">
		<thead class="table_head">
		<tr>
			<th colspan="2" align="center"><? echo $vis_language['TXTTOTALBILLTIME'].":".$total_bill_time.' ('.$vis_language['TXTMIN'].')'; ?></th>
			<th colspan="1" align="center"><? echo $vis_language['TXTTOTALWORKTIME'].":".$total_work_time.' ('.$vis_language['TXTMIN'].')'; ?></th>
			<th colspan="2" align="center"><? echo $vis_language['TXTTOTALAMOUNT'].":".number_format($total_amount,2).' '.$currency; ?></th>
			<th colspan="6"></th>
		</tr>
		<tr>
			<th><? echo $vis_language['TXTTICKETHASH']; ?></th>
            <th><? echo $vis_language['TXTSUBJECT']; ?></th>
			<th><? echo $vis_language['TXTDESCRIPTION']; ?></th>
			<th><? echo $vis_language['TXTSTAFF']; ?></th>
			<th><? echo $vis_language['TXTCLIENTNAME']; ?></th>
			<th><? echo $vis_language['TXTEMAIL']; ?></th>
			<th><? echo $vis_language['TXTORGN']; ?></th>
			<th><? echo $vis_language['TXTCREATEDON']; ?></th>
			<th><? echo $vis_language['TXTBILLTIME'].' ('.$vis_language['TXTMIN'].')'; ?></th>
			<th><? echo $vis_language['TXTWORKTIME'].' ('.$vis_language['TXTMIN'].')'; ?></th>
			<th><? echo $vis_language['TXTAMOUNT'].' ('.$currency.')'; ?></th>				
												
		</tr>	
		</thead>
        <tbody>       
        <?   foreach($report as $ticket_id => $details) {
            echo '<tr><td> <a href="#/ticket/ticket_details/'.$details['ticket_hash'].'/'.$details['ticket_id'].'">'.$details['ticket_hash'].'</a> </td><td>'.$details['subject'].'</td><td>'.$details['description'].'</td><td>'.$details['staff_name'].'</td><td>'.$details['first_name'].' '.$details['last_name'].'</td><td>'.$details['email'].'</td><td>'.$details['group_name'].'</td><td>'.format_datetime($details['created_date']).'</td><td>'.$details['bill_time'].'</td><td>'.$details['work_time'].'</td><td>'.$details['amount'].'</td></tr>';
        } ?>
		</tbody>
               
</table>
        <script>
			$("#vis_export_rpt_<?= $operation['vis_operation'] ?>").show(); 
			$("#vis_export_rpt_<?= $operation['vis_operation'] ?>").html('<a href="javascript:void(0);" class="vis_button_export btn btn-primary btn-sm" data-toggle="ajaxModal" data-modal-arguments="vis_module=report&vis_operation=add_report_inqueue&vis_static_area=vis_open_new_dialog&duration=<? echo $data['duration']; ?>&from_date=<? echo strtotime($data['from_date']); ?>&to_date=<? echo strtotime($data['to_date']);?>&staff_id=<?=$data['staff_id']?>&client_id=<?=$data['client_id']?>&vis_client_id=<? echo $data['vis_client_id'];?>&group_id=<?=$data['group_id']?>&domain_id=<? echo $data['domain_id'];?>&department_id=<? echo $data['department_id'];?>&vis_criteria=<? $data['vis_criteria'];?>&report_type=<?=$report_type?>" onclick="" type="button"><? echo $vis_language['TXTEXPORT']; ?></a>');
			
			$("#vis_schedule_rpt_<?= $operation['vis_operation'] ?>").show(); 
			$("#vis_schedule_rpt_<?= $operation['vis_operation'] ?>").html('<a href="javascript:void(0);" class="vis_button_export btn btn-primary btn-sm" data-toggle="ajaxModal" data-modal-arguments="vis_module=report&vis_operation=add_schedule_report_inqueue&vis_static_area=vis_open_new_dialog&duration=<? echo $data['duration']; ?>&from_date=<? echo strtotime($data['from_date']); ?>&to_date=<? echo strtotime($data['to_date']);?>&staff_id=<?=$data['staff_id']?>&client_id=<?=$data['client_id']?>&vis_client_id=<? echo $data['vis_client_id'];?>&group_id=<?=$data['group_id']?>&domain_id=<? echo $data['domain_id'];?>&department_id=<? echo $data['department_id'];?>&vis_criteria=<? $data['vis_criteria'];?>&report_type=<?=$report_type?>" onclick="" type="button"><? echo $vis_language['TXTSCHEDULE']; ?></a>');
		</script> <?
    }
    else  {
	     $operation['no_record']=1;
         include(VIS_PATH_TEMPLATE.'no_record_yet.php');
        ?>
             <script> $("#vis_export_rpt_<?= $operation['vis_operation'] ?>").hide();
             $("#vis_schedule_rpt_<?= $operation['vis_operation'] ?>").hide();</script>          
        <?php
    } ?>
	<script>
$(document).ready(function() {	
$('#datatable').dataTable({		
        "bPaginate" : true,
        "aaSorting":  [],
        "iDisplayLength": <?php echo SECURITY_DATA_PER_PAGE;?>,
		"sDom": '<"top"iflp<"clear">>rt<"bottom"iflp<"clear">>', 		
	    "bFilter" : false,
		"bLengthChange": false,
		"bInfo": false,
		"aoColumns": [			
		 	{ "bSortable": true },
		  	{ "bSortable": true },	
			{ "bSortable": true },
			{ "bSortable": true },			  
		  	{ "bSortable": true },
			{ "bSortable": true },
			{ "bSortable": true },
		  	{ "bSortable": true },
			{ "bSortable": true },
			{ "bSortable": true },
		  	{ "bSortable": true }
		]
	});
});	
</script>
