<style type="text/css">
.tr-active { background-color: #cfe9ff; }
.subrow-items td { background: #f8fbff; padding: 6px 10px; }
.item-line { padding: 2px 0; font-size: 12px; border-bottom: 1px dashed #e3e8f0; }
.item-line:last-child { border-bottom: none; }
.item-num { display:inline-block; min-width:36px; text-align:center; background:#e3f3f0; color:#0f766e; font-weight:800; border-radius:7px; padding:1px 6px; font-size:10px; margin-right:6px; }
</style>
<?php
if ($data->num_rows() == 0) {
?>
<div class="alert alert-danger">Data tidak valid</div>
<?php
}
else {
?>
<?php
$role_name = $this->session->userdata('role_name');
$the_title = 'HALAMAN KASIR';
if ($page_type == 'driver') { $the_title = 'HALAMAN DRIVER'; }
else if ($page_type == 'production') { $the_title = 'HALAMAN PRODUKSI'; }
echo "<h3 align='center'>".$the_title."</h3>";
$show_verif = in_array($page_type, array('driver','production'));
$colspan = $show_verif ? 10 : 9;
?>
<hr>
<input type="hidden" id="hd_type" value="<?php echo $page_type;?>">
<input type="hidden" id="hd_iddstb" value="<?php echo az_encode_url($data->row()->iddstb_process);?>">
<div class="row">
<div class="col-md-6">
<table>
<tr>
<td>
<img style="display:inline-block" src="https://quickchart.io/qr?size=150&text=<?php echo $data->row()->dstb_code;?>">
</td>
<td>
<div style="font-size:30px;font-weight:bold;">DSTB PROSES <?php echo $data->row()->outlet_name;?></div>
<table cellspacing="0">
<tr>
<td style="font-size:20px;font-weight:bold;">Tgl</td>
<td align="center" width="10px">:</td>
<td style="font-size:20px;font-weight:bold;"><?php echo Date('d-m-y H:i:s', strtotime($data->row()->dstb_date));?></td>
<td align="center" width="10px">,</td>
</tr>
<tr>
<td>No</td>
<td align="center">:</td>
<td><?php echo $data->row()->dstb_number;?></td>
</tr>
<tr>
<td colspan="3"><?php echo $data->row()->dstb_code;?></td>
</tr>
<tr>
<td>Kasir</td>
<td align="center">:</td>
<td><?php echo $data->row()->cashier_name;?></td>
</tr>
<tr>
<td>Driver</td>
<td align="center">:</td>
<td><?php echo $data->row()->driver_name;?></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table width="100%">
<tr>
<td align="center">Total Bill: <?php echo $data->row()->total_bill;?></td>
<td align="center">Total Pcs: <?php echo $data->row()->total_pcs_dstb;?></td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<div>
<?php
$lbl_status = '';
if (strlen($data->row()->tgl_dijemput) > 0) {
$lbl_status .= "<label class='label label-info'>Diterima: ".Date('d-m-y H:i', strtotime($data->row()->tgl_dijemput))."</label>";
}
if (strlen($data->row()->tgl_diproses) > 0) {
$lbl_status .= "&nbsp;<label class='label label-success'>Diproses: ".Date('d-m-y H:i', strtotime($data->row()->tgl_diproses))."</label>";
}
echo $lbl_status;
?>
</div>
</td>
</tr>
</table>
</div>
<div class="col-md-6">
Catatan DSTB: <?php echo $data->row()->dstb_note;?>
</div>
</div>
<hr>
<form id="form_dstb" class="form-horizontal">
<table class="table table-bordered table-condensed" id="table_dstb_list">
<tr>
<th width="10px">No</th>
<th>No Bill</th>
<th>Nama</th>
<th>Status</th>
<th>Jumlah PCS</th>
<th>Tgl Masuk</th>
<th>Tgl Selesai</th>
<th>Detail</th>
<?php if ($show_verif) { ?>
<th>Verifikasi</th>
<?php } ?>
<th>Catatan Bill</th>
</tr>
<?php
foreach ($data->result() as $key => $value) {
$tr_class = '';
if ($value->dstb_status == 'SELESAI') { $value->dstb_status = 'DIPROSES'; }
if ($page_type == 'driver') {
if (in_array($value->dstb_status, array('DIJEMPUT', 'DIPROSES'))) { $tr_class = 'tr-active'; }
}
else if ($page_type == 'production') {
if ($value->dstb_status == 'DIPROSES') { $tr_class = 'tr-active'; }
}
// ---- status verifikasi per role ----
$st = $value->dstb_status;
$verified = ($page_type == 'driver') ? ($st != 'BARU') : in_array($st, array('DIPROSES','DIANTAR','END PROCESS','SELESAI'));
// ---- rincian item bill ini ----
$this->db->select('transaction.idtransaction, product.product_name, item.item_code, transaction.trx_note');
$this->db->from('transaction');
$this->db->join('item', 'transaction.iditem = item.iditem', 'left');
$this->db->join('product', 'item.idproduct = product.idproduct', 'left');
$this->db->where('transaction.idtransaction_group', $value->idtransaction_group);
$this->db->where('transaction.status', 1);
$this->db->order_by('transaction.idtransaction ASC');
$items_q = $this->db->get()->result();
$total_items = count($items_q);
$no_item = 0;
?>
<tr class="<?php echo $tr_class;?>">
<td align="center"><?php echo ($key + 1);?></td>
<td><?php echo $value->code;?></td>
<td><?php echo $value->customer_name;?></td>
<td><?php echo $value->dstb_status;?></td>
<td><?php echo $value->total_pcs;?></td>
<td><?php echo Date('d-m-Y', strtotime($value->date));?></td>
<td><?php echo Date('d-m-Y', strtotime($value->duedate));?></td>
<td align="center" width="10px"><button class="btn btn-info btn-xs btn-detail-bill" type="button" data-code="<?php echo $value->code;?>" data-id="<?php echo $value->idtransaction_group;?>"><i class="fa fa-list"></i> Detail Baju</button></td>
<?php if ($show_verif) { ?>
<td align="center">
<?php if ($verified) { echo '<label class="label label-success">Sudah</label>'; } else { echo '<button class="btn btn-success btn-xs btn-verif-bill" type="button" data-code="'.$value->code.'"><i class="fa fa-check"></i> Verifikasi</button>'; } ?>
</td>
<?php } ?>
<td><?php echo $value->note;?></td>
</tr>
<tr class="subrow-items">
<td colspan="<?php echo $colspan;?>">
<b>Item bill ini (<?php echo $total_items;?>):</b>
<?php foreach ($items_q as $it) { $no_item++; ?>
<div class="item-line"><span class="item-num"><?php echo $no_item.'/'.$total_items;?></span>&bull; <?php echo htmlspecialchars($it->product_name.' ('.$it->item_code.')'); ?><?php if (strlen($it->trx_note)>0) { echo ' &mdash; '.htmlspecialchars($it->trx_note); } ?></div>
<?php } ?>
</td>
</tr>
<?php
}
?>
</table>
</form>
<?php
if ($show_verif) {
?>
<button class="btn btn-info" type="button" data-id="<?php echo $page_type;?>" id="btn_scan"><i class="fa fa-qrcode"></i> Scan QR Code Bill</button>
<div class="box-manual-scan">
<div class="input-group">
<input type="text" class="form-control" name="inp_code" id="inp_code" placeholder="Masukkan Kode Bill">
<span class="input-group-addon btn-go-data" data-id="<?php echo $page_type;?>"><i class="fa fa-refresh"></i></span>
</div>
</div>
<?php
}
?>
<hr>
<a href="<?php echo app_url();?>dstb_process"><button class="btn btn-default" type="button"><i class="fa fa-arrow-left"></i> Kembali</button></a>&nbsp;
<a href="<?php echo app_url();?>dstb_process/print_detail/?id=<?php echo az_encode_url($data->row()->iddstb_process).'&type='.$page_type;?>" target="_blank"><button class="btn btn-info" type="button"><i class="fa fa-print"></i> Cetak</button></a>&nbsp;
<?php
if ($page_type == 'driver') {
?>
<button class="btn btn-warning" type="button" id="btn_verif_driver"><i class="fa fa-check"></i> Verifikasi Driver</button>
<?php
}
else if ($page_type == 'production') {
?>
<button class="btn btn-success" type="button" id="btn_verif_driver"><i class="fa fa-check"></i> Verifikasi Produksi</button>
<?php
}
?>
<?php
}
?>