<!DOCTYPE html>
<html>
<head>
    <title></title>

    <link href="{{ url("css/bootstrap.min.css")}}" rel="stylesheet" type="text/css">
    <style type="text/css" media="print">
        @media print {
          @page { margin: 0; }
          body { margin: 1cm; }
        }
        .table-bordered>tbody>tr>td, .table-bordered>tbody>tr>th, .table-bordered>tfoot>tr>td, .table-bordered>tfoot>tr>th, .table-bordered>thead>tr>td, .table-bordered>thead>tr>th {
            border: 1px solid #000 !important;
            padding: 5px 8px !important;
            line-height: 1 !important;
        }
    </style>
</head>
<body style="background: #FFF; font-size: 12px;">
    <div class="content">
        
        <table class="table table-bordered">
            <thead>
                <tr>
                    <td class="text-center" colspan="2" style="font-size: 15px; font-weight: bold;">{{ $label_cv=="true" ? "CV KETJUBUNG" : "" }}</td>
                    @php( $akun=App\Perkiraan::where([['id', '=', $detail_data->perkiraanAkun->parent]])->first() )
                    <td class="text-center" colspan="2" style="font-size: 18px; font-weight: bold;">BUKTI {{ strtoupper($akun->nama_perkiraan) }} KELUAR</td>
                    <td colspan="2">
                        Nomor   : {{ $detail_data->nomor_transaksi }}
                    </td>
                </tr>
                <tr>
                    <td colspan="4" rowspan="2">
                        Dibayarkan kepada :
                        <p style="font-size: 15px;font-weight: bold;">{{ $detail_data->penerima_transaksi }}</p>
                    </td>
                    <td colspan="2">
                        Tanggal : {{ date_db($detail_data->tanggal_transaksi, true) }}
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        Lampiran    :
                    </td>
                </tr>
                <tr>
                    <th class="text-center" colspan="4" style="">Uraian</th>
                    <th class="text-center" colspan="2" style="">Jumlah</th>
                </tr>
            </thead>
            <tbody>
                <!-- detail data -->
                @php($total=0)
                @foreach($detail_data->transaksiSumberdana AS $key=>$value)
                @php
                    if($value->tipe_id_akun=='K'){
                        $set_total = "( Rp".rupiah2($value->nominal_transaksi, 2)." )";

                    }else{
                        $set_total = "Rp".rupiah2($value->nominal_transaksi, 2);

                    }
                @endphp
                <tr>
                    <td class="text-left" colspan="4" style="">{{ $value->keterangan }}</td>
                    <td class="text-right" colspan="2" style="">{{ $set_total }}</td>
                </tr>
                @php
                    if($value->tipe_id_akun=='K'){
                        $total -= $value->nominal_transaksi;

                    }else{
                        $total += $value->nominal_transaksi;

                    }
                @endphp
                @endforeach
                <!-- end : detail data -->

                <tr>
                    <td class="text-right" colspan="4" style="">Total</td>
                    <td class="text-right" colspan="2" style="">{{ "Rp".rupiah2($total, 2) }}</td>
                </tr>
                <tr>
                    <td class="text-center" style="width: 16.67%;">Terbilang</td>
                    <td class="text-left" colspan="5" style="">{{ terbilang($total) }}</td>
                </tr>

                @php( $row_span = 3 + ($detail_data == null) ? 0 : 1 + sizeof($detail_data->transaksiSumberdana) )
                <tr>
                    <td rowspan="{{ $row_span }}" class="text-center" style="width: 16.67%; vertical-align: middle !important;">POSTING</td>
                </tr>
                <tr>
                    <td class="text-center" colspan="2" style="">REKENING</td>
                    <td class="text-center" colspan="2" style="">DEBIT/KREDIT</td>
                    <td style="width: 16.67%">Dibuat Oleh :</td>
                </tr>

                <!-- data rekening jurnal -->
                @php($arr_tipe=['D'=>"DEBIT", 'K'=>"KREDIT"])

                @foreach($detail_data->transaksiSumberdana AS $key=>$value)
                @php( $akun = App\Perkiraan::find($value->ke_akun) )
                <tr>
                    <td class="text-left" colspan="2" style="">{{ format_akun_perkiraan($akun) }}</td>
                    <td class="text-left" colspan="2" style="">{{ $arr_tipe[$value->tipe_id_akun] }}</td>
                    @if($key==0)
                    <td rowspan="{{ $row_span }}" style="width: 16.67%">Tgl. {{ $tanggal_cetak }}</td>
                    @endif
                </tr>
                @endforeach

                <tr>
                    <td class="text-left" colspan="2" style="">{{ format_akun_perkiraan($detail_data->perkiraanAkun) }}</td>
                    <td class="text-left" colspan="2" style="">{{ $arr_tipe[$detail_data->tipe_id_akun] }}</td>
                </tr>
                <!-- end : data rekening jurnal -->
            </tbody>
            <tfoot>
                <!-- <tr>
                    <td style="width: 16.67%">Catatan :</td>
                    <td style="width: 16.67%"></td>
                    <td style="width: 16.67%">Pembukuan</td>
                    <td style="width: 16.67%">Mengetahui</td>
                    <td style="width: 16.67%">Menyetuhui</td>
                    <td style="width: 16.67%">Penerima</td>
                </tr> -->
                <tr>
                    <td colspan="2" rowspan="2">
                        Catatan :
                        <p>-</p>
                    </td>
                    <td class="text-center" style="width: 16.67%;">Pembukuan</td>
                    <td class="text-center" style="width: 16.67%;">Mengetahui</td>
                    <td class="text-center" style="width: 16.67%;">Menyetuhui</td>
                    <td class="text-center" style="width: 16.67%;">Penerima</td>
                </tr>
                <tr>
                    <td class="text-center" style="width: 16.67%; height: 80px;"></td>
                    <td class="text-center" style="width: 16.67%; height: 80px;"></td>
                    <td class="text-center" style="width: 16.67%; height: 80px;"></td>
                    <td class="text-center" style="width: 16.67%; height: 80px;"></td>
                </tr>
            </tfoot>
        </table>

    </div>

</body>
</html>