<?php 
require_once("config/configDB.php"); 
//session_start();
require "userPermission.php";
require 'financial_year_calculation.php';
?>

<!DOCTYPE html>
<html>
<head>
    <?php 
        require 'meta.php';  
        require 'header.php'; 
    ?>
</head>
<body>
    <?php require 'menu.php' ?>
    <div class="col-sm-12 "> <h3 class="text-center"><strong> Fuel And Contract Invoice  details</strong></h3></div>
<div class="container-fluid text-center col-sm-12 dashboard-add">  
<?php if($accOver_Add==1) {  ?>  
<!-- <a href="accOverAdd.php" class="btn btn-primary">Add</a> -->

<?php } ?>


</div>
<div class="container col-sm-12 ">
    <div class="datatable-header ">
        <div class="col-sm-12 box-title"><strong>Manage your Contractor invoice</strong></div>
        <table id="accOverDashboard" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" >
            <thead>
                <tr>				
                    <th>Supplier Code</th>
                    <th>Supplier Name</th>
                    <th>Mobile</th>
                    <th>Purchase Amount</th>
                    <th>Paid Amount</th>
                    <th>Total Balance</th>                    
                    <th>Action</th>
                </tr>
            </thead>
            <tbody></tbody>
           
        </table>
    </div>
    <input class="input-lg accOver-edit"  type="hidden" value="<?php echo $accOver_Edit; ?>"  readonly >
    <input class="input-lg accOver-delete"  type="hidden" value="<?php echo $accOver_Delete; ?>"  readonly >
</div>
<div class="container col-sm-12 "><br></div>

<div class="container col-sm-12 ">
    <div class="datatable-header ">
        <div class="col-sm-12 box-title"><strong>Manage your Accounts invoice</strong></div>
        <table id="accOverDashboardPayment" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" >
            <thead>
                <tr>				
                    <th>Invoice</th>
                    <th>Date</th>
                    <th>Supplier Name</th>
                    <th>Amount</th>
                    <th>Payment Type</th>
                    <th>Category</th>
                                        
                    <th>Action</th>
                </tr>
            </thead>
            <tbody></tbody>
           
        </table>
    </div>
    <input class="input-lg accOver-edit"  type="hidden" value="<?php echo $accOver_Edit; ?>"  readonly >
    <input class="input-lg accOver-delete"  type="hidden" value="<?php echo $accOver_Delete; ?>"  readonly >
</div>

    <?php require 'footer.php' ?>
    <script type="text/javascript">var base_url = "<?= $base_url ?>";</script>
    

    <script>
    
$(document).ready(function() {
			   var dataTable =  $('#accOverDashboard').DataTable( {
                columnDefs: [{ "orderable": false, "targets": 6 } ],
			   	    responsive: {
					details: {
					    renderer: function ( api, rowIdx ) {
						var data = api.cells( rowIdx, ':hidden' ).eq(0).map( function ( cell ) {
						    var header = $( api.column( cell.column ).header() );
						    return  '<p style="color:#00A">'+header.text()+' : '+api.cell( cell ).data()+'</p>';
						} ).toArray().join('');
 
						return data ?    $('<table/>').append( data ) :    false;
					    }
					}
				    },
			   	processing: true,
				serverSide: true,				aaSorting: [[0, 'desc']],
				//ajax: "test.js", // json datasource
				ajax: {
                    url : "accOvergriddata.php",
                    type: 'POST',
                    data:  {
                        userpermissionEdit   : <?php echo $accOver_Edit; ?>,
                        userpermissionDelete : <?php echo $accOver_Delete; ?>
                }
                }
                } );

                var dataTable =  $('#accOverDashboardPayment').DataTable( {
                columnDefs: [{ "orderable": false, "targets": 6 } ],
			   	    responsive: {
					details: {
					    renderer: function ( api, rowIdx ) {
						var data = api.cells( rowIdx, ':hidden' ).eq(0).map( function ( cell ) {
						    var header = $( api.column( cell.column ).header() );
						    return  '<p style="color:#00A">'+header.text()+' : '+api.cell( cell ).data()+'</p>';
						} ).toArray().join('');
 
						return data ?    $('<table/>').append( data ) :    false;
					    }
					}
				    },
			   	processing: true,
				serverSide: true,				aaSorting: [[0, 'desc']],
				//ajax: "test.js", // json datasource
				ajax: {
                    url : "accOverPaymentGridData.php",
                    type: 'POST',
                    data:  {
                        userpermissionEdit   : <?php echo $accOver_Edit; ?>,
                        userpermissionDelete : <?php echo $accOver_Delete; ?>
                }
                }
			    } );
			} );

</script>
</body>
</html>