<?php $__env->startSection('title'); ?>
	
<?php $__env->stopSection(); ?>

<?php $__env->startSection('breadcrumb'); ?>
   ##parent-placeholder-6e5ce570b4af9c70279294e1a958333ab1037c86##
   <li>history pembelian</li>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>  

<div class="row">
	<div class="container-fluid">
		<div class="card">
			<div class="card-block">
			    
    <table class="table table-striped table-padding table-responsive" id="tblpembelian" width="100%">
        <thead>
            <tr class="tblheader">
                <th>No.Intern</th>
                <th>No.Invoice</th>
                <th width="25px">GDG</th>
        	    <th width="80px">Tgl.Inv</th>
        	    <th width="80px">J.Tempo</th>
                <th>Supplier</th>
        	    <th width="20px">PPN</th>
        	    <th width="25px">Disc</th>
        	    <th width="100px">Total Invoice</th>
        	    <th width="10px">LNS</th>
                <th width="15px">Act</th> 	  
        	</tr>
        
        </thead>
        <tbody></tbody>
    
    </table>

			</div>
		</div>
	</div>	
</div>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('invoice.form_detail', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

<?php $__env->startSection('script'); ?>
<script type="text/javascript">
var table, save_method;

$(function(){
   table = $('.table').DataTable({
     "processing" : true,
     "lengthMenu": [[8, 25, 50, -1], [8, 25, 50, "All"]],       //pilihan jumlah record show
     "ajax" : {
       "url" : "<?php echo e(route('invoice.history_header')); ?>",
       "type" : "GET"
     }
   }); 
   
});

function showDetail(id){
   $('#form-detail').modal('show');
   $('#form-detail form')[0].reset();   
   tampilHeader(id);
   tampilDetail(id);
   loadSummary();
}

function tampilHeader(id){
    $('#idinv').val(id);
    $.ajax({
        url : "<?php echo e(DIR_APP); ?>invoice/"+id+"/edit",
        type : "GET",
        dataType : "JSON",
        success : function(data){
            $('#sup_id').val(data.supp_id);
            $('#sup').text(data.sup_nama+" - "+data.sup_alamat);
            $('#nofaktur').text("NO.Faktur: "+data.inv_no);
            $('#keterangan').text("Disc Faktur: "+data.inv_disc+"%"+'\xa0\xa0\xa0\xa0\xa0\xa0\xa0'+"PPN: "+data.inv_ppn+"%");
            $('#btndetail').addClass('hide');
            $('#btnposting').addClass('hide');

	    },
        error : function(){
            alert("Tidak dapat menampilkan data!");
        }
    });   
}

function loadSummary(){
    
    var id=$('#idinv').val();
    
    $.ajax({
        url : "<?php echo e(DIR_APP); ?>invoice/"+id+"/loadsummary",
        type : "GET",
        dataType : "JSON",
        success : function(data){

            $('#totalftr').text("Total incl PPN : \xa0\xa0\xa0"+data.totalftr);

	    },
        error : function(){
            alert("Tidak dapat menampilkan data!");
        }
    });   
}

    tbdetail = $('#tbldetail').DataTable({
        "scrollY": '55vh',
        "scrollCollapse": true,
        "bSort": false,
        "destroy": true,
        "processing" : true,
	    "paging" : false,
	    "dom" : 'bti',
    });
    
function tampilDetail(id){

    tbdetail.ajax.url("<?php echo e(DIR_APP); ?>invoice/"+id+"/datadetail");
	tbdetail.ajax.reload();
}    

function printFaktur(){
    var id = $('#idinv').val();
    window.location="<?php echo e(DIR_APP); ?>invoice/"+id+"/printfaktur";
}

</script>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/myprojeq/public_html/sriayu/resources/views/invoice/history.blade.php ENDPATH**/ ?>