<?php
/**
 * File			: laporan_list.php
 * Description  : View untuk halaman laporan penjualan
 * Created By	: Hendi
 * Created Date : 13 apr 2021
 * Last Update  : 14 Apr 2021
**/
?>
<div class="container-fluid">
	<div class="row">
		<div class="col-md-2 no-print">
			<div class="card">
				<div class="card-header card-header-info">
					<h4 class="card-title">Lap Penjualan</h4>
					<p id="from-laporan-category" class="card-category">Preview</p>
				</div>
				<div class="card-body">
					<?php 
						# jika menggunakan form_open(), maka csrf token otomatis sudah dibuat.
						# esc() berfungsi menjaga serangan xss (cross site scripting)
					?>
					<?= form_open('laporan', ['id' => 'form-laporan', 'method' => 'GET']) ?>
						<div class="row">
							<div class="col-md-12">
								<label>Dari Tanggal</label>
								<div class="form-group">
									<input type="date" id="tgl-awal" name="tgl_awal" class="form-control" value="<?=$tgl_awal?>" required />
									<small></small>
								</div>
							</div>
						    <div class="col-md-12">
								<label>Sampai Tanggal</label>
								<div class="form-group">
									<input type="date" id="tgl-akhir" name="tgl_akhir" class="form-control" value="<?=$tgl_akhir?>" required />
									<small></small>
								</div>
							</div>
						</div>
						<button type="submit" class="btn btn-info pull-right">Preview</button>
						<div class="clearfix"></div>
					<?= form_close() ?>
				</div>
			</div>
		</div>
		<div id="list-laporan" class="col-md-10">
			<div class="card">
				<div class="card-header card-header-info">
					<h4 class="card-title">Laporan Penjualan</h4>
					<p class="card-category"><?=date_format(date_create($tgl_awal), 'd M Y')?> sd. <?=date_format(date_create($tgl_akhir), 'd M Y')?></p>
				</div>
				<div class="card-body">
				    <div class="toolbar">
						<button id="btn-print" class="btn btn-info no-print" title="Cetak ke printer"><i class="fa fa-print"></i>&nbsp;&nbsp;&nbsp;Cetak</button>
					</div>
					<div class="material-datatables">
						<table id="dt-<?= $mod ?>" class="table table-striped table-no-bordered table-hover dataTable dtr-inline" cellspacing="0" width="100%" role="grid">
							<thead>
								<tr role="row">
									<th>NO</th>
									<th>TANGGAL</th>
									<th>NO TRANSAKSI</th>
									<th>TOTAL</th>
									<th>PAJAK</th>
									<th>TOTAL BAYAR</th> 
									<th>CATATAN</th> 
								</tr>
							</thead>
							<tbody></tbody>
							<tfoot>
                              <tr>
                                  <th colspan="5" style="text-align:right">TOTAL</th>
                                  <th></th>
                                  <th></th>
                              </tr>
                            </tfoot>
						</table>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script>
	//_mod dideklarasikan di myscrypt.js
	_mod = '<?= $mod ?>';
	_tglawal = '<?= $tgl_awal ?>';
	_tglakhir = '<?= $tgl_akhir ?>';
</script>