<head>
    <style>
        #tblpiutang th { height:35px; background-color:#6495ED; color: white; font-size: 14px;}
        
        #tblpiutang td,tr { font-size:13px; border:0px gray solid;
            border-bottom:1px gray solid; 
        }
        
    </style>
</head>

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

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

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


<?php $__env->startSection('content'); ?>   
<div class="row">
	<div class="container-fluid">
		<div class="card">
			<div class="card-block">  


<h6 style="margin-bottom:-35px">Pelunasan Faktur Penjualan</h6>

<table class="table table-striped table-padding table-bordered table-responsive" id="tblpiutang" width="100%">    
<thead>
   <tr class="tblhdr">
   
 	    <th width="7%">Tg.Faktur</th>
 	    <th width="12%">No.Faktur</th>
 	    <th width="25%">Customer</th>
 	    <th width="8%">J.Tempo</th>
		<th width="10%" class="text-right">Total</th>
		<th width="8%" class="text-right">Pot</th>
		<th width="10%" class="text-right">Cicilan</th>
		<th width="10%" class="text-right">Bayar</th>
		<th width="25%">Keterangan</th>
        <th width="2%"></th>  	  
 
	</tr>
</thead>
<tbody></tbody>

</table>


        </div>

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

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

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

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

showData();

function showData(){

    $('#burger').click();

    $(document).ready(function(){
        table = $('#tblpiutang').DataTable({
            "processing" : true,
            "bSort": false,
            "destroy": true,
            "dom" : "bftip",
            "lengthMenu": [[8, 10, 20, -1], [10, 10, 20, "All"]],
            "order": [0, 'desc'],
            "ajax" : {
                "url" : "<?php echo e(DIR_APP); ?>pelunasan/history",
                "type" : "GET"
            }
        })
   }); 
}


function memo(id){

    save_method = "add";
    $('input[name=_method]').val('POST');
    $('#modal-form_create').modal('show');
    $('#modal-form_create form')[0].reset();        
    
    tampilHeader(id);
    tampilCicilan(id);
} 	 


function tampilHeader(id){
    $('#id').val(id);
    $.ajax({
        url : "<?php echo e(DIR_APP); ?>pelunasan/"+id+"/tampillunas",
        type : "GET",
        dataType : "JSON",
        success : function(data){
            
            $('#nofaktur').text("NO.Faktur: "+data.sale_no+" -- "+data.cus_name+" - "+data.cus_address+" ");
            $('#tlfaktur').val(data.sale_netto);
            $('#tcicilan').val(data.cicilan);
            
            if(data.is_lunas=="1"){
                $('#tgltrx').val(data.tanggal);
                $('#ttl').val(data.nominal);
                $('#rtr').val(data.retur);
                $('#pot').val(data.potongan);
                $('#ket').val(data.keterangan);
                $('#sts').text("LUNAS");
		        $('#submit-control').attr('disabled','disabled');
            }

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

function tampilCicilan(id){
    tblcicilan.ajax.url("<?php echo e(DIR_APP); ?>pelunasan/"+id+"/cicilan");
	tblcicilan.ajax.reload(); 
}

tblcicilan = $('#tbl-cicilan').DataTable({
    "scrollY": '25vh',
    "scrollCollapse": true,
    "bSort": false,
    "destroy": true,
    "processing" : true,
	"paging" : false,
	"dom" : 'bti',    
})

</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/pelunasan/history.blade.php ENDPATH**/ ?>