<div>&nbsp;</div>
<table class="table table-hover table-bordered" id="tabelstokis">
<thead>
<tr>
    <th width="2%" scope="col">No.</th>
    <th scope="col">Tanggal</th>
    <th scope="col">Jumlah Barang</th>
    <th scope="col">HPP Sistem</th>
    <th scope="col">HPP Sebenarnya</th>
    <th scope="col">Selisih HPP</th>
    <th scope="col">Pelaksana</th>
    <th scope="col" width="2%"></th>
</tr>
</thead>
<tbody>
<?php
$totalsistem=0;
$totalnyata=0;
if (@$arropname['tanggal']) {
    $no=1;
    foreach ($arropname['tanggal'] as $key => $value) {
        $sistem=@array_sum($arropname['hrgsistem'][$key]);
        $nyata=@array_sum($arropname['hrgnyata'][$key]);
        $selisih=$nyata-$sistem;
        ?>
        <tr>
            <td><?php echo $no ?></td>
            <td><?php echo date('d-m-Y',strtotime($value)) ?></td>
            <td><?php echo @count($arropname['barang'][$key]) ?></td>
            <td><?php echo number_format($sistem,0,',','.') ?></td>
            <td><?php echo number_format($nyata,0,',','.') ?></td>
            <td><?php echo number_format($selisih,0,',','.') ?></td>
            <td><?php echo @$arropname['pegawai'][$key] ?></td>
            <td><a href="<?php echo base_url('stok/cetak_opname?id='.$key) ?>" target="_blank" class="btn btn-xs bg-gradient-secondary"><i class="fa fa-print"></i></a></td>
        </tr>
        <?php
        $totalsistem=$totalsistem+$sistem;
        $totalnyata=$totalnyata+$nyata;
        $no++;
    }
}
$totalselisih=$totalnyata-$totalsistem;
?>
</tbody>
<tfoot>
<tr>
    <th colspan="3">Jumlah Total</th>
    <th><?php echo number_format($totalsistem,0,',','.') ?></th>
    <th><?php echo number_format($totalnyata,0,',','.') ?></th>
    <th><?php echo number_format($totalselisih,0,',','.') ?></th>
    <th colspan="2"></th>
</tr>
</tfoot>
</table>