<?php
    $nama_file = 'Data Pembayaran Konaspi';
    header("Content-type: application/vnd-ms-excel");
    header("Content-Disposition: attachment; filename=$nama_file.xls");
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Data Pembayaran KONASPI 2024</title>

<style type="text/css">
	body{
        background-color: #FFF;
    }
	.num {
        mso-number-format:"\@";
    }
    .title-sm{
        /*font-family: 'myriadproregular'; */
        font-size: 15pt; font-weight: bold;
    }
    .title-lg{
        /*font-family: 'myriadproregular';  */
        font-size: 24pt; font-weight: bold;
    }
    body{ font-size: 11pt;
        /*font-family: 'myriadproregular'; */
    }
    .title-jurusan{
        /*font-family: 'myriadproregular';  */
        font-size: 20pt; font-weight: bold;
    }
    #head-title{
       /*font-family: MyriadPro-Regular; */
       src: url("{{ asset('assets/font/MyriadPro-Regular.otf') }}");
       font-family:MyriadPro-Regular;
       font-weight:bold;
    }
    #head-big{
       /*font-family:MyriadPro-Cond; */
       font-weight:bold;
       font-size:22pt;
    }
    #container td{
       /*font-family:MyriadPro-Regular;*/
    }
    .page-break {
        page-break-after: always;
    }
    div.ui-menu li {
	    list-style:none;
	    background-image:none;
	    background-repeat:none;
	    background-position:0;
	}
	ul{
	    list-style-type:none;
	    padding:0px;
	    margin:0px;
	}
	li{
	    background-image:url(sqpurple.gif);
	    background-repeat:no-repeat;
	    background-position:0px 5px;
	    padding-left:14px;
	}
    .responsive {
        width: 100%;
        height: auto;
    }
    .kotak {
        border: 1px solid #000;
        width: 15px;
        height: 15px;
        font-weight: bold;
        font-size:9pt
    }
</style>

<style> .str{ mso-number-format:\@; } </style>

<center>
  DATA PEMBAYARAN KONASPI 2024
</center>

<table>
    <thead>
        <tr style="text-align: center;">
            <th style="text-align: center;">No.</th>
            <th style="text-align: center;">Kode Registrasi</th>
            <th style="text-align: center;">Nama</th>
            <th style="text-align: center;">Instansi</th>
            <th style="text-align: center;">No. VA</th>
            <th style="text-align: center;">Tagihan</th>
            <th style="text-align: center;">Jumlah Pembayaran</th>
            <th style="text-align: center;">Tanggal Pembayaran</th>
        </tr>
    </thead>
    <tbody>
        @php
            $no = 1;
            $total_tagihan = 0;
            $total_pembayaran = 0;
        @endphp
        @foreach ($data as $val)
            <tr style="text-align: center">
                <td>{{$no}}</td>
                <td>{{$val['konaspi']->kode_registrasi}}</td>
                <td style="text-align: left">{{$val['konaspi']->nama}}</td>
                <td style="text-align: left">{{$val['konaspi']->instansi}}</td>
                <td>{{"'".$val['va']->va}}</td>
                <td style="text-align: right">{{ number_format($val['va']->tagihan, 2, ',', '.') }}</td>
                <td style="text-align: right">{{ number_format($val['va']->terbayar, 2, ',', '.') }}</td>
                <td>{{$val['tglbayar']}}</td>
            </tr>

            @php
                $no++;
                $total_tagihan += $val['va']->tagihan;
                $total_pembayaran += $val['va']->terbayar;
            @endphp
        @endforeach
            <tr>
                <td colspan="5" style="text-align: center"><b>Total</b></td>
                <td>{{ number_format($total_tagihan, 2, ',', '.') }}</td>
                <td>{{ number_format($total_pembayaran, 2, ',', '.') }}</td>
            </tr>
    </tbody>
</table>
