<head>
    <style>
        #tblisi th { border-bottom:1px black solid; }
    </style>
</head>



<?php $__env->startSection('title'); ?>
    Cetak Faktur Penjualan &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  	<a onclick="window.location='<?php echo e(route('home')); ?>'" class="btn btn-primary"><i class="fa fa-home"></i> Home </a>
	<a onclick="window.history.go(-1)" class="btn btn-warning"><i class="fa fa-undo"></i> Back </a> 
	<!--a onclick="myFunction()" class="btn btn-success"><i class="fa fa-print"></i>Print Dokumen</a-->
    <a onclick="printmatrix()" class="btn btn-success"><i class="fa fa-print"></i>Print Faktur</a>
    
    <script>
        function myFunction() {
          window.print();
        }
    </script>
<?php $__env->stopSection(); ?>

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

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

<center>
	<h4>Faktur Penjualan</h4>
</center>
<input type="hidden" id="idsale" name="idsale" value="<?php echo e($msl->id); ?>">

<table style="margin-left:-10px;margin-right:-10px; width:100%" id='tblheader'>

	<tr><td width="400" style="font-size:18px"><b>Sriayu Citra Mandiri</b></td><td class="text-right" width="400" style="font-size:18px"><?php echo e(tanggal_indonesia($msl->sale_tgl, false)); ?></td></tr>
	<tr><td style="font-size:18px">Palembang</td><td style="font-size:18px"><b>Faktur: <?php echo e($msl->sale_no); ?></b></td></tr>
	<tr><td>&nbsp;</td><td></td></tr>
	<tr><td style="font-size:18px">Salesman: <?php echo e($sls->sales_name); ?></td><td style="font-size:18px">Outlet: <?php echo e($cus->cus_name); ?></td></tr>	
	<tr><td style="font-size:18px">Jatuh Tempo: <?php echo e(tanggal_indonesia($msl->sale_jt, false)); ?></td><td style="font-size:18px"><?php echo e($cus->cus_address); ?></td></tr>
	<tr><td></td><td style="font-size:18px">Area: <?php echo e($area->area_name); ?></td></tr>
	<tr><td>Ket : <?php echo e($msl->notes); ?></td></tr>
</table>
<br>

<table cellspacing="5" cellpadding="5"  style="width:100%;margin-left:-10px;margin-right:-10px" id="tblisi">

<tr border="1">
	<th width="45" class="text-left">KODE</th>
	<th width="200">DESKRIPSI</th>
	<th width="50" class="text-right">---QTY---</th>
	<th width="70" class="text-right">Harga</th>
	<th width="100" class="text-right">DISC</th>
	<!--th width="100" class="text-right">POTONGAN</th-->
	<th width="100" class="text-right">JUMLAH</th>
</tr>

<?php $__currentLoopData = $dt; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $list): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
	
	<tr>
	    <td height="15" align="left" style="font-size:18px"><?php echo e($list->get_product->kode_brg); ?></td>
    	<td style="font-size:18px"><?php echo e($list->product_name); ?></td>
    	<td align="right" style="font-size:18px"><?php echo e(format_uang($list->qty).' '.$list->kemasan); ?></td>
    	<td align="right" style="font-size:18px"><?php echo e(format_uang($list->harga)); ?></td>
    	<td align="right" style="font-size:18px"><?php echo e(format_uang($list->disc_1)."%"); ?></td>
    	<!--td align="right" style="font-size:18px"><?php echo e(format_uang($list->potongan)); ?></td-->
    	<td align="right" style="font-size:18px"><?php echo e(format_uang(($list->qty*$list->harga)-($list->qty*$list->harga*$list->disc_1/100)- $list->potongan )); ?></td>
    </tr>

<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

<?php $__currentLoopData = $bns; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $bb): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
	<tr>
	    <td height="15" align="left" style="font-size:18px">BONUS</td>
    	<td style="font-size:18px"><?php echo e($bb->bonus_ket); ?></td>
    	<td align="right" style="font-size:18px"><?php echo e(format_uang($bb->bonus_qty).' '.$bb->bonus_stn); ?></td>
    	<td align="right" style="font-size:18px"></td>
    	<td align="right" style="font-size:18px"></td>
    	<!--td align="right" style="font-size:18px"><?php echo e(format_uang($list->potongan)); ?></td-->
    	<td align="right" style="font-size:18px">0</td>
    </tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

<tr><td></td>
	<td></td>
	<td></td>
	<td></td>	
	<td align="left" style="font-size:18px">Sub Total</td>
	<td align="right" style="font-size:18px"><b><?php echo e(format_uang($sub)); ?></b></td>
</tr>

<tr><td></td>
	<td></td>
	<td></td>
	<td></td>	
	<td align="left" style="font-size:18px">Disc. <?php echo e($msl->sale_disc.'%'); ?></td>
	<td align="right" style="font-size:18px"><b><?php echo e(format_uang($dis)); ?></b></td>
</tr>

<?php if($ppn>0): ?>
<tr><td></td>
	<td></td>
	<td></td>
	<td></td>	
	<td align="left" style="font-size:18px">PPN  <?php echo e($msl->sale_ppn.'%'); ?></td>
	<td align="right" style="font-size:18px"><b><?php echo e(format_uang($ppn)); ?></b></td>
</tr>
<?php endif; ?>

<tr>
	<td colspan="3" style="font-style:italic;font-size:16px">Terbilang: #<?php echo e(terbilang($ttl)); ?> rupiah#</td>
	<td></td>
	<td align="left" style="font-size:18px"># TOTAL #</td>
	<td align="right" style="font-size:18px"><b><?php echo e(format_uang($ttl)); ?></b></td>
</tr>

</table>

<!--hr> <!--style="width:96%; margin-top:5px; margin-bottom:5px; background-color: black; height: 1px; border:1;"-->


<h4><b>PENAGIHAN HARUS DISERTAI FAKTUR ASLI !</b></h4>

<table style="width:80%">
    <tr>
        <td width="50"></td><td>Penerima</td>
		<td width="250"></td><td>Hormat Kami</td>
	</tr>
	<tr>
		<td>&nbsp;</td><td></td>
	    <td>&nbsp;</td><td></td>	
	</tr>
	<tr>
		<td>&nbsp;</td><td></td>
	    <td>&nbsp;</td><td></td>	
	</tr>
	<tr>
        <td width="50"></td><td>Cap & Nama Jelas</td>
		<td width="250"></td><td>Admin</td>		
    </tr>
</table>

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


<script type="text/javascript">
    
    function printmatrix(){
        
        var idsl = $('#idsale').val();
        
        var ua = navigator.userAgent.toLowerCase();
        var isAndroid = ua.indexOf("android") > -1; //&& ua.indexOf("mobile");
                	
        if(isAndroid) {
            var tpdevice='android';
        }else{
            var tpdevice='pclaptop';
        }
            
        $.ajax({
            url : "<?php echo e(DIR_APP); ?>sales/"+idsl+"/printfaktur_matrix",
            type : "GET",
            dataType : "JSON",
            success : function(data){
                if(tpdevice=='android'){
                    window.location.href=data.data;
                }else{
                	var socket = new WebSocket("ws://127.0.0.1:40213/");        /* harus dijalankan dulu dari rawbt.bat */
                    socket.bufferType = "arraybuffer";
                    socket.onerror = function(error) {
                	    alert("Error");
                    };			
                	socket.onopen = function() {
                		socket.send(data.data);
                		socket.close(1000, "Work complete");
                	};                    
                }
                    
                //ocation.reload();
        
            },
            error : function(){
                alert("error print...");
            }
        });
    }

</script>

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