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

@extends('layouts.print')

@section('title')
    Cetak DO Keluar Barang &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  	<a onclick="window.location='{{ 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>
@endsection

@section('breadcrumb')
   @parent
     <li>print do</li>
@endsection

@section('content')

<center>
	<h4>DO Keluar Barang</h4>
</center>

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

	<tr><td width="400" style="font-size:18px"><b>Sukses Wijaya Adikarya</b></td><td class="text-right" width="400" style="font-size:18px">{{ tanggal_indonesia($mdo->out_tgl, false) }}</td></tr>
	<tr><td style="font-size:18px"></td><td style="font-size:18px"><b>NO. DO: {{ $mdo->out_no }}</b></td></tr>
	<tr><td style="font-size:18px">Pengirim: {{ $gdg->nama.' ['.$gdg->kode.']' }}</td><td style="font-size:18px"></td></tr>	
	<tr><td style="font-size:18px">Tujuan: {{ $mdo->tujuan }}</td></tr>
	<tr><td>Ket : {{ $mdo->deskripsi }}</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="200">DESKRIPSI</th>
	<th width="50" class="text-right">---QTY---</th>
	<th width="10"></th>
	<th width="200" class="text-left">NOTES</th>
</tr>

@foreach ($dt as $list)
	
	<tr>
	    <td height="15" align="left" style="font-size:18px">{{ $list->product_name }}</td>
    	<td align="right" style="font-size:18px">{{ format_uang($list->qty).' '.$list->satuan }}</td>
    	<td></td>
    	<td align="left" style="font-size:15px">{{ $list->deskripsi  }}</td>
    </tr>

@endforeach


</table>

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



<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>
@endsection


<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 : "{{ 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>
