<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title><?php echo @$title ?></title>
    <style type="text/css">
    body {
        font-family: tahoma;
        font-size: 8pt;
    }
    hr { 
        display: block;
        margin-top: 0.5em;
        margin-bottom: 0.5em;
        margin-left: auto;
        margin-right: auto;
        border-style: inset;
        border-width: 1px;
    } 
    .container {
        padding: 10px 15px 10px 15px;
        aspect-ratio: 100 / 29;
    }
    .tabelku {
        width: 100%;
        font-size: 8pt;
        font-family: calibri; 
        border-collapse: collapse;
    }
    .tabelku  td {
        padding-left:5px;
        border-bottom: 1px double black;
    }
    </style>
</head>
<body>
<div class="container">
    <center>
        <h4>KARTU STOK BARANG<br>
            PERIODE <?php echo @strtoupper($awal) ?> SAMPAI <?php echo @strtoupper($akhir) ?></h4>
    </center>
    <table width="100%">
    <tr>
        <td>Kode Barang</td>
        <td width="2%">:</td>
        <td><?php echo @$kdbarang ?></td>
        <td width="25%"></td>
        <td>Barcode</td>
        <td width="2%">:</td>
        <td><?php echo @$barcode ?></td>
    </tr>
    <tr>
        <td>Nama Barang</td>
        <td>:</td>
        <td><?php echo @$barang ?></td>
        <td></td>
        <td>Satuan</td>
        <td>:</td>
        <td><?php echo @$satuan ?></td>
    </tr>
    </table>
    <hr>
    <table class="tabelku" border="1">
    <thead>
    <tr>
        <th width="10%">Tanggal</th>
        <th>Keterangan</th>
        <th>Masuk</th>
        <th>Keluar</th>
        <th>Penyesuaian</th>
        <th>Stok Akhir</th>
    </tr>
    </thead>
    <tbody>
    <?php
    $i=1;
    $saldo=0;
    foreach ($datakartu as $hasil) {
        ?>
        <tr>
            <td><?php echo date('d-m-Y H:i:s',strtotime($hasil->tanggal)) ?></td>
            <td><?php echo $hasil->keterangan ?></td>
            <td><?php echo $hasil->masuk ?></td>
            <td><?php echo $hasil->keluar ?></td>
            <td><?php echo $hasil->penyesuaian ?></td>
            <td><?php echo $hasil->saldo ?></td>
        </tr>
        <?php
    }
    ?>
    </tbody>
    </table>
</div>
<script type="text/javascript">
    window.print();
</script>
</body>
</html>