<script type="text/javascript" src="<?= VIS_PATH_SCRIPT; ?>datatables/data-tables/DT_bootstrap.js"></script>
<?  
    global $vis_language;
    if($report!=-1) { ?>
<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> <? echo $vis_language['TXTTOTALINVOICEID']." ";   echo  $details['total_invoice']; ?></th>   
			<th> <?  echo $vis_language['TXTTOTALAMOUNT']." "; echo $details['total_amount']; ?>   </th>
			<th> <? echo $vis_language['TXTTOTALPAID']." "; echo $details['total_paid'];?> </th>
			<th> <? echo $vis_language['TXTTOTALUNPAID']." ";  echo $details['total_unpaid'];  ?></th>  
			<th> <? echo $vis_language['TXTTOTALCANCELLED']." "; echo $details['total_calcelled'];?></th>
			<th></th>
			<th></th> 
			<th></th> -->
			    
			</tr> 
		<tr>
		    <th><? echo $vis_language['TXTINVOICEHASH']; ?></th>
			<th><? echo $vis_language['TXTCLIENTNAME']; ?></th>
			<th><? echo $vis_language['TXTEMAIL']; ?></th>
			<th><? echo $vis_language['TXTORGN']; ?></th>
			<th><? echo $vis_language['TXTDESCRIPTION']; ?></th>
			<th><? echo $vis_language['TXTTRANSACTIONID']; ?></th>
           
			<th><? echo $vis_language['TXTTRANSACTIONDATE']; ?></th>
			<th><? echo $vis_language['TXTAMOUNT'].' ('.$currency.')'; ?></th>
			 <th><? echo $vis_language['TXTSTATUS']; ?></th>
		 											
		</tr>
		</thead>
               
         <? $total=0;
		 $invoice_status = array( 0 => $vis_language['TXTUNPAID'], 1 => $vis_language['TXTPAID'], 2 => $vis_language['TXTCANCELED'], 3 => $vis_language['TXTINPROCESS'] );
				foreach($report as $ticket_id => $details) { 
					
					 
					
					
					if($details ['invoice_status'] == 0)
                        {
							$lableCol = 'vh-danger-bg';
						}
						else if($details ['invoice_status'] == 1)
						{
							$lableCol = 'label vh-green-bg';
						}
						else
						{
							$lableCol = 'label label-default';
						}
					
					 
					 echo '<tr><td> <a href="#/billing/edit_invoice/invoices/'.$details['invoice_id'].'">'.$details['invoice_hash'].'</a></td><td>'.$details['first_name'].' '.$details['last_name'].'</td><td>'.$details['email'].'</td><td>'.$details['group_name'].'</td><td>'.$details['description'].'</td><td>'.$details['transaction_id'].'</td> <td>'.format_datetime($details['entry_date']).'</td><td>'.$details['amount'].'</td>   ';
					 echo '<td><span class="label '.$lableCol.'">'.$invoice_status[$details['invoice_status']].'</span></td>';
					 echo '  </tr>';
				}	 
		 ?>
               
</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=<? echo $data['staff_id'];?>&department_id=<? echo $data['department_id'];?>&vis_status_id=<?echo $data['status_id']; ?>&vis_client_id=<? echo $data['vis_client_id'];?>&vis_criteria=<? $data['vis_criteria'];?>&report_type=28" 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=<? echo $data['staff_id'];?>&department_id=<? echo $data['department_id'];?>&vis_status_id=<?echo $data['status_id']; ?>&vis_client_id=<? echo $data['vis_client_id'];?>&vis_criteria=<? $data['vis_criteria'];?>&report_type=28" onclick="" type="button"><? echo $vis_language['TXTSCHEDULE']; ?></a>');  
		 </script> <?
    }
    else  {
		 $operation['no_record']=1;
         include(VIS_PATH_TEMPLATE.'no_record_yet.php');
        ?>	<script> $("#vis_schedule_rpt_<?= $operation['vis_operation'] ?>").hide();</script>
             <script> $("#vis_export_rpt_<?= $operation['vis_operation'] ?>").hide();</script>          
        <?php
    } ?>
	<script>
$(document).ready(function() {	
$('#totalamt').html(<?=$total?>);
$('#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 }			
		]
	});
});	
</script>
