Nothing Special   »   [go: up one dir, main page]

Laporan Data Barang

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

MODUL LAPORAN MASTER BARANG (DATA BARANG)

Berikut Tampilan Laporan Data Barang Keseluruhan :


Buat file untuk menampilkan Laporan data barang dengan nama file : lap_barang.php simpan dalam
folder data :

<script>
$(function () {
$('#databarang').DataTable()
$('#databarang').DataTable({
'paging' : true,
'lengthChange': false, Ini merupakan name dari table
'searching' : false,
'ordering' : true, yang akan dibuat
'info' : true,
'autoWidth' : false
})
})
</script>
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<center> <h3 class="box-title">Laporan Data Barang</h3></center>
</div>
<!-- /.box-header -->
<div class="box-body">
<table id="judul" class="table table-bordered table-striped">
<thead>
<?php
include 'koneksi.php';
$sql_view = mysql_query("SELECT * FROM barang ORDER BY kdbrg ASC");
$total = mysql_num_rows($sql_view);
?>
<button style="margin-left:5%" class="btn btn-success btn-
sm btnTambah">Cetak Laporan</button>
<script>
function print_d(){
window.open("data/print.php","_blank");
}
</script>
<br /><br />
<table id="databarang" name="databarang" class="table table-bordered table-hover">
<thead>
<tr>
<th>No</th>
<th>Kode Barang</th>
<th>Nama Barang</th>
<th>Satuan</th>
<th>Harga Barang</th>
<th>Stok Barang</th>
</tr>
</thead>
<tbody>
<?php
$nomor = 1;
while ($data = mysql_fetch_array($sql_view)) {
?>
<tr>
<td><?php echo $nomor ?></td>
<td><?php echo $data['kdbrg'] ?></td>
<td><?php echo $data['namabrg'] ?></td>
<td><?php echo $data['satuanbrg'] ?></td>
<td><?php echo $data['hargabrg'] ?></td>
<td><?php echo $data['stokbrg'] ?></td>
</tr>

<?php
$nomor++;}
?>
</tbody>
</table>
</div>
</div>
</div>
Selanjutnya buat file baru dengan nama : print.php dan simpan didalam folder data,
<?php
include 'koneksi.php';
$data = mysql_query("select * from barang");
?>
<html>
<head>
<title>Print Document</title>
</head>
<body>
<div class="box-header">
<center> <h3 class="box-title">Laporan Data Barang</h3></center>
</div>
<table border="1" width="90%" style="border-
collapse:collapse;" align="center">
<tr class="tableheader">
<th rowspan="1">Kode Barang</th>
<th>Nama Barang</th>
<th>Satuan Barang</th>
<th>Harga Barang</th>
<th>Stok Barang</th>
</tr>
<?php while($hasil = mysql_fetch_array($data)){ ?>
<tr id="rowHover">
<td width="10%" align="center"><?php echo $hasil['kdbrg']; ?></td>
<td width="25%" id="column_padding"><?php echo $hasil['namabrg']; ?><
/td>
<td width="10%" id="column_padding"><?php echo $hasil['satuanbrg']; ?
></td>
<td width="10%" id="column_padding"><?php echo $hasil['hargabrg']; ?>
</td>
<td width="10%" id="column_padding"><?php echo $hasil['stokbrg']; ?><
/td>
</tr>
<?php } ?>
</table>
<script>
window.load = print_d();
function print_d(){
window.print();
}
</script>
<br />
<br />
<div class="box-footer">
<h5 class="box-title" align="left">Padang,________________________
<br />
<br /><br />
<br /><br />
<br /><br />
<br /> Ahmad Fikri Fajri</h5>
</div>
</body>
</html>

You might also like