@extends('layouts.print')

<head>
    <style>
        tr, td {font-size:1.50rem; }
    
        @page {
            size: A4;
            margin: 10mm 1mm 20mm 1mm;    

            @bottom-center {
                content: counter(page);
            }
        }
        
        @page :left: header {
            content: "Page " decimal(pageno), , first(chapter);
            font-variant: small-caps
        }
        @page :right :header {
            content: last(section), , "Page " decimal(pageno);
            font-variant: small-caps
        }    
    
        table.report-container {
            page-break-after:always;
        }
        thead.report-header {
            display:table-header-group;
        }
        tfoot.report-footer {
            display:table-footer-group;
        }    
    
        #tblisi th,td { border-bottom:1px black solid; }
        #tbl-header th, td, tr{ border:none; }
        .tbl-footer td { border-bottom:1px black solid; }
        
    </style>    
</head>

<body>
        
    <script type="text/javascript">
         //window.onload = addPageNumbers;

        function addPageNumbers() {
            var totalPages = Math.ceil(document.body.scrollHeight / 600);  //842px A4 pageheight for 72dpi, 1123px A4 pageheight for 96dpi, 
            for (var i = 1; i <= totalPages; i++) {
              var pageNumberDiv = document.createElement("div");
              var pageNumber = document.createTextNode("Page " + i + " of " + totalPages);
              pageNumberDiv.style.position = "absolute";
              pageNumberDiv.style.marginTop = "calc((" + i + " * (297mm )) - 400mm - 0.5px)"; //297mm A4 pageheight; 0,5px unknown needed necessary correction value; additional wanted 40px margin from bottom(own element height included)
              pageNumberDiv.style.marginTop = 1000px;
              pageNumberDiv.style.marginRight = 50px;
              pageNumberDiv.style.height = "16px";
              pageNumberDiv.appendChild(pageNumber);
              document.body.insertBefore(pageNumberDiv, document.getElementById("content"));
              pageNumberDiv.style.left = "calc(100% - (" + pageNumberDiv.offsetWidth + "px + 20px))";
            }
          }
    </script>


@section('title')
    Report Penjualan Detail&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 Report</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>report</li>
@endsection

@section('content')

<h4>REPORT PENJUALAN DETAIL</h4>


<div style="font-size:18px">

<table id="tbl-header">
    <tr>
        <td width="50"></td><td width="135"><li>Perumahan</li></td><td width="5">:&nbsp;</td><td width="400">{{ $project->project_name }}</td>
    </tr>
    <tr>
        @if($rmh->cluster=='')
            <td></td><td><li>Type/Blok/No</li></td><td>:&nbsp;</td><td>{{ $rmh->luasrumah.'/'.$rmh->block.'/'.$rmh->nomor }}</td>
        @else
            <td></td><td><li>Type/Blok/No</li></td><td>:&nbsp;</td><td>{{ $rmh->luasrumah.'/'.$rmh->cluster.'/'.$rmh->block.'/'.$rmh->nomor }}</td>
        @endif
    </tr>
    <tr>
        <td></td><td><li>Luas Tanah</li></td><td width="5">:&nbsp;</td><td width="400">{{ $rmh->luastanah }}</td>
    </tr>
    <tr>
        <td></td><td><li>Harga</li></td><td width="5">:&nbsp;</td><td width="400"><b>RP. {{ format_uang($trx->harga_rumah) }}</b></td>
    </tr>
    <tr>
        <td></td><td><li>Nama Pembeli</li></td><td width="5">:&nbsp;</td><td width="400">{{ $cus->cus_name  }}</td>
    </tr>
    <tr>
        <td></td><td><li>Tgl. Pembelian</li></td><td width="5">:&nbsp;</td><td width="400">{{ tanggal_indonesia($trx->tgl_book, false) }}</td>
    </tr>    
    
</table>

<br>

<table cellspacing="3" cellpadding="3"  style="width:95%;" id="tblisi">
    
        <tr>
        	<th width="30">NO</th>
        	<th width="130" class="text-center">Tanggal</th>
        	<th width="130" class="text-left">NO.KWT</th>
        	<th width="100" class="text-left">CARA BAYAR</th>
        	<th width="120" class="text-right">NOMINAL</th>
        	<th width="5px">&nbsp;&nbsp;</th>
        	<th width="80" class="text-left">NOTES</th>
        </tr>
    
    
    @foreach ($dt as $list)
    	<tr>
    	    <td width="3" align="right" style="font-size:16px">{{ $no++ }}</td>
    	   	<td width="130" align="center" style="font-size:16px">{{ tanggal_indonesia($list->cicil_tgl, false) }}</td>
        	<td style="font-size:16px">{{ $list->cicil_no }}</td>
        	<td style="font-size:16px">{{ $list->tipe }}</td>
        	<td align="right" style="font-size:16px">{{ format_uang($list->cicil_nominal) }}</td>
        	<td></td>
        	<td></td>
        </tr>
    @endforeach
    
    <tr>
       	<td></td>
       	<td></td>
    	<td><b>TOTAL</b></td>
    	<td></td>
    	<td align="right"><b>{{ format_uang($ccl) }}</b></td>
    	<td></td>
    	<td></td>
    </tr>
    <tr>
       	<td></td>
       	<td></td>
    	<td><b>SISA CICILAN</b></td>
    	<td></td>
    	<td align="right"><b>{{ format_uang($trx->harga_rumah-$ccl) }}</b></td>
    	<td></td>
    	<td></td>
    </tr>            

</table>

<table class="tbl-footer" width="95%">
        <tr>
        	<td width="500">end of report {{ now() }}</td>
        </tr>
</table>

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

@endsection

