224 lines
9.6 KiB
PHP
224 lines
9.6 KiB
PHP
<style type="text/css">
|
|
table,
|
|
th,
|
|
tr,
|
|
td {
|
|
text-align: center;
|
|
}
|
|
|
|
.swal2-popup {
|
|
font-family: inherit;
|
|
font-size: 1.2rem;
|
|
}
|
|
|
|
.btn-group,
|
|
.btn-group-vertical {
|
|
position: relative;
|
|
display: initial;
|
|
vertical-align: middle;
|
|
}
|
|
</style>
|
|
|
|
<section class="content">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="box box-info">
|
|
<div class='box-header with-border'>
|
|
<h1 class='box-title'>Data Laporan Detail</h1>
|
|
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-xs-12">
|
|
<?php echo form_open('laporandetail', array('role' => "form", 'id' => "myForm", 'data-toggle' => "validator")); ?>
|
|
<div class="col-md-3">
|
|
<div class="input-daterange">
|
|
<div class="form-group">
|
|
<label for="start_date" class="control-label">Tanggal Awal</label>
|
|
<div class="input-group">
|
|
<input type="text" class="form-control" name="start_date" id="start_date" data-error="Tanggal Awal harus diisi" required />
|
|
<span class="input-group-addon">
|
|
<span class="fa fa-calendar"></span>
|
|
</span>
|
|
</div>
|
|
<div class="help-block with-errors"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<div class="input-daterange">
|
|
<div class="form-group">
|
|
<label for="end_date" class="control-label">Tanggal Akhir</label>
|
|
<div class="input-group">
|
|
<input type="text" class="form-control" name="end_date" id="end_date" data-error="Tanggal Akhir harus diisi" required />
|
|
<span class="input-group-addon">
|
|
<span class="fa fa-calendar"></span>
|
|
</span>
|
|
</div>
|
|
<div class="help-block with-errors"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<div class="form-group">
|
|
<label for="metode" class="control-label">Metode</label>
|
|
<div class="input-group">
|
|
<select class="form-control" name="metode" id="metode">
|
|
<option value="">Pilih Semua</option>
|
|
<?php
|
|
foreach ($metode as $m) {
|
|
echo "<option value=' $m->id_byr'>$m->metode</option>";
|
|
}
|
|
?>
|
|
</select>
|
|
<span class="input-group-addon">
|
|
<span class="fa fa-list"></span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2" style="padding-top:25px;">
|
|
<button type="submit" name="search" id="search" value="Search" class="btn btn-info"> Search</button>
|
|
<a href="#" id="print" class="btn btn-info">Print PDF</a>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<div class="box-body">
|
|
<table id="myTable" class="table table-bordered table-hover">
|
|
<thead>
|
|
<tr>
|
|
<th>No.</th>
|
|
<th>Tgl. Transaksi</th>
|
|
<th>No. Transaksi</th>
|
|
<th>NIS</th>
|
|
<th>Nama Siswa</th>
|
|
<th>Kelas</th>
|
|
<th>Status</th>
|
|
<th>Nama Barang</th>
|
|
<th>Qty</th>
|
|
<th>Harga beli</th>
|
|
<th>Harga jual</th>
|
|
<th>Diskon</th>
|
|
<th>Total</th>
|
|
<th>Petugas</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php $no = 0;
|
|
$total = 0; // Inisialisasi total
|
|
$hitung = 0;
|
|
foreach ($laporan as $row) {
|
|
$diskon= ($row->diskon / 100) * $row->sub_total;
|
|
$totalnya = $row->sub_total - $diskon;
|
|
$total += $totalnya;
|
|
?>
|
|
<tr>
|
|
<td><?php echo ++$no; ?></td>
|
|
<td><?php echo $row->tgl_trf; ?></td>
|
|
<td><?php echo $row->no_trf; ?></td>
|
|
<td><?php echo $row->nis_siswa; ?></td>
|
|
<td><?php echo $row->nama_siswa; ?></td>
|
|
<td><?php echo $row->kelas; ?></td>
|
|
<td><?php echo $row->status; ?></td>
|
|
<td><?php echo $row->nama_barang; ?></td>
|
|
<td><?php echo $row->jumlah_stok; ?></td>
|
|
<td><?php echo number_format($row->harga_beli); ?></td>
|
|
<td><?php echo number_format($row->harga); ?></td>
|
|
<td><?php echo $row->diskon; ?>%</td>
|
|
<td><?php echo number_format($totalnya); ?></td>
|
|
<td><?php echo $row->operator; ?></td>
|
|
|
|
</tr>
|
|
<?php } ?>
|
|
|
|
</tbody>
|
|
<tfoot>
|
|
<tr>
|
|
<td colspan="12" style="text-align: right;"><b>Grand Total :</b></td>
|
|
<td><b><?php echo number_format($total); ?></b></td>
|
|
<td></td> <!-- Kolom operator tidak ada total -->
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<script src="<?php echo base_url() ?>assets/app/js/alert.js"></script>
|
|
<script>
|
|
var total = <?php echo $total; ?>;
|
|
var beli = <?php echo $beli; ?>;
|
|
</script>
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('.input-daterange').datepicker({
|
|
todayBtn: 'linked',
|
|
format: "yyyy-mm-dd",
|
|
autoclose: true
|
|
});
|
|
$('#myTable').DataTable({
|
|
"dom": '<"top row"<"col-md-4" l ><"col-md-4" B ><"col-md-4" and f>>rt<"bottom row"<"col-md-6" i> <"col-md-6" p>>',
|
|
|
|
|
|
buttons: [{
|
|
extend: 'csvHtml5',
|
|
exportOptions: {
|
|
columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
|
|
},
|
|
},
|
|
{
|
|
extend: 'excelHtml5',
|
|
title: 'LAPORAN PENJUALAN',
|
|
messageTop: 'KOPERASI DHARMA AL MUHTADIN DEPOK',
|
|
customize: function(xlsx) {
|
|
// Menambahkan baris kosong di awal
|
|
var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
|
var data = '<row><c></c></row>'; // Baris kosong
|
|
$('sheetData', sheet).prepend(data); // Menambahkan baris kosong ke awal sheet
|
|
},
|
|
exportOptions: {
|
|
columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
|
|
},
|
|
},
|
|
{
|
|
extend: 'copyHtml5',
|
|
title: 'LAPORAN PENJUALAN',
|
|
exportOptions: {
|
|
columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
|
|
},
|
|
},
|
|
|
|
{
|
|
extend: 'print',
|
|
oriented: 'portrait',
|
|
pageSize: 'A4',
|
|
title: 'LAPORAN PENJUALAN',
|
|
exportOptions: {
|
|
columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
|
|
},
|
|
},
|
|
],
|
|
columnDefs: [
|
|
{ width: 'auto', targets: '_all' }
|
|
]
|
|
});
|
|
|
|
});
|
|
</script>
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('#print').on('click', function(e) {
|
|
e.preventDefault(); // Mencegah tindakan default dari anchor
|
|
|
|
var startDate = $('#start_date').val(); // Mendapatkan tanggal awal
|
|
var endDate = $('#end_date').val(); // Mendapatkan tanggal akhir
|
|
var metode = $('#metode').val(); // Mendapatkan metode
|
|
var url = '<?php echo base_url('laporandetail/print_pdf'); ?>?start_date=' + startDate + '&end_date=' + endDate + '&metode=' + metode; // URL untuk cetak PDF
|
|
window.open(url, '_blank'); // Membuka PDF dalam tab baru
|
|
});
|
|
});
|
|
</script>
|