<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <link rel="stylesheet">
        <title><?php echo $this->config->item('app_name') ?> <?php echo isset($title) ? ' | ' . $title : null; ?></title>
        <style type="text/css">


.tbl td,
.tbl th,
.tbl,
.tbl table {
    border-top: 1px solid black;
    border-collapse: collapse;
}

.tbl td.description,
.tbl th.description {
    font-size: 8px;
    width: 5cm;
    max-width: 4cm;
}

.tbl td.quantity,
.tbl th.quantity {
    font-size: 8px;
    width: 1cm;
    max-width: 1cm;
    word-break: break-all;
}

.tbl td.price,
.tbl th.price {
    text-align:center;
    font-size: 8px;
    width: 2cm;
    max-width: 2cm;
    word-break: break-all;
}

.tbl td.no,
.tbl th.no {
    font-size: 8px;
    width: 1cm;
    max-width: 1cm;
}
/*td{
    font-size: 8px;
}*/
.centered {
    font-size: 12px;
    text-align: center;
    align-content: center;
}

.ticket {
    /*font-size: 5px;*/
    /*border*/
    /*border: solid 1px;*/
    /*background: black;*/
    width: 7cm;
    height: 5cm;
    max-height: 5cm;
    max-width: 7cm;
}

/*img {
    max-width: inherit;
    width: inherit;
}*/
.center {
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

@media print {
    .hidden-print,
    .hidden-print * {
        display: none !important;
    }
}
        </style>
    </head>
    <body onload="window.print()">
        <div class="ticket">
            <table style="margin-bottom:-10px;line-height:1px;" width="100%">
                <td style="font-size: 8px;line-height:1px;" align="center">
                      <img class="logo" width="20px" src="<?php echo upload_url('school/' . logo()) ?>" alt="Logo">
                </td>
                <td style="font-size: 8px;line-height:1px;" align="center">
                     <p class="centered"><b><?php echo $setting_school['setting_value'] ?></b>
             
            </table>
          
           
         <div>
            <?php 
                foreach ($siswa as $row) {
                  $nama = $row['student_full_name'];
                  $nis = $row['student_nis'];
                  $kelas = $row['class_name'];
                  
                }

                foreach ( $period as $rw):
                   if($f['n'] == $rw['period_id']) {
                    $ta=$rw['period_start'].'/'.$rw['period_end'];
                   }else {
                     $ta = '';
                   }  
               endforeach;

   $tgl = pretty_date($f['d'],'d F Y',false);
                ?>
             <table class="space">
                 <td style="font-size: 8px;">NIS</td>
                 <td style="font-size: 8px;">:</td>
                 <td style="font-size: 8px; margin-right: 5px;"><?= $nis ?></td>
                 
                  <td style="font-size: 8px;">TA</td>
                 <td style="font-size: 8px;">:</td>
                 <td style="font-size: 8px; margin-right: 5px;"><?= $ta?></td>

                  <td style="font-size: 8px;">Tgl</td>
                 <td style="font-size: 8px;">:</td>
                 <td style="font-size: 8px;"><?= $tgl ?></td>
                 <tr>
                 <td style="font-size: 8px;">Nama</td>
                 <td style="font-size: 8px;">:</td>
                 <td style="font-size: 8px;margin-right: 5px;"><?= $nama ?></td>
                 <td style="font-size: 8px;">Kelas</td>
                 <td style="font-size: 8px;">:</td>
                 <td style="font-size: 8px;"><?= $kelas ?></td>
                 </tr>
                
             </table>
         </div>
            <table class="tbl">
                <thead>
                    <tr style="margin-bottom:-5px;">
                        <th class="quantity" width="20px">No.</th>
                        <th class="description">Pembayaran</th>
                        <th class="price">Total</th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                $i =1;
                foreach ($bulan as $row) :
                    $namePay = $row['pos_name'].' - T.A '.$row['period_start'].'/'.$row['period_end'];
                    $mont = ($row['month_month_id']<=6) ? $row['period_start'] : $row['period_end'];
                 ?>
                    <tr>
                       <td  style="font-size: 8px;border-bottom: 1px solid;"><?php echo $i ?></td>
                        <td style="font-size: 8px;border-bottom: 1px solid;"><?php echo $namePay.' - ('.$row['month_name'].' '. $mont.')' ?></td>
                        <td class="price" style="font-size: 8px;border-bottom: 1px solid"><?php echo 'Rp. ' . number_format($row['bulan_bill'], 0, ',', '.') ?></td>
                    </tr>
                   <?php 
                $i++;
                endforeach ?>
                <?php
                $j =$i;
                foreach ($free as $row) :
                    $namePayFree = $row['pos_name'].' - T.A '.$row['period_start'].'/'.$row['period_end'];
                 ?>
                    <tr>
                        <tr>
                <td style="font-size: 8px;border-bottom: 1px solid;"><?php echo $j ?></td>
                <td style="font-size: 8px;border-bottom: 1px solid;"><?php echo $namePayFree .' - ('.$row['bebas_pay_desc'].')' ?></td>      
                <td style="font-size: 8px;border-bottom: 1px solid; text-align: right;"><?php echo number_format($row['bebas_pay_bill'], 0, ',', '.') ?></td>
            </tr>
            <?php 
                $j++;
                endforeach ?>
                    <tr style="margin-bottom:-5px;">
                        <td class="quantity"></td>
                        <td class="description"><b style="font-size: 8px;">TOTAL</b></td>
                        <td align="center"><b style="font-size: 8px;"><?php echo number_format($summonth+$sumbeb, 0, ',', '.') ?></b></td>
                    </tr>
                </tbody>
            </table>
            <p class="centered" style="font-size: 8px;margin-bottom:-50px;margin-top:-5px;">www.smkpasundan3bdg.sch.id <br><?php echo ucfirst($this->session->userdata('ufullname')); ?></p>
         
        </div>

        <!-- <button id="btnPrint" class="hidden-print">Print</button> -->
       
    </body>
</html>