99 lines
3.0 KiB
PHP
99 lines
3.0 KiB
PHP
<?php
|
|
session_start();
|
|
include("core/main.php");
|
|
|
|
|
|
$sql="SELECT
|
|
kode_barang,
|
|
nama_barang,
|
|
group_barang,
|
|
(SELECT saldo FROM t_barang_stok
|
|
WHERE kode_barang = m_barang.kode_barang
|
|
ORDER BY tanggal, kode_barang DESC LIMIT 1) as stok,
|
|
satuan,
|
|
harga
|
|
FROM m_barang
|
|
ORDER BY nama_barang";
|
|
|
|
$qry_order = $db->query($sql);
|
|
$order = $qry_order->fetchAll()[0];
|
|
?>
|
|
<div id="addbarang"></div>
|
|
<div align="center">
|
|
<div id="frame">
|
|
<div id="frame_title"><h5>LIST MASTER DATA BARANG</h5></div>
|
|
<div align="right" style="margin:5px;">
|
|
<div id="table_search">
|
|
<table width="95%" style="margin:10px;" border="0" cellspacing="0" cellspading="0" class="tb">
|
|
<tr align="center">
|
|
<th>Kode Barang</th>
|
|
<th>Nama Barang</th>
|
|
<th>Group</th>
|
|
<th>Stok</th>
|
|
<th>Satuan</th>
|
|
<th>Harga</th>
|
|
<th width="10%">Option</th>
|
|
</tr>
|
|
<?php
|
|
|
|
$pager = paginate( $sql, 15, 5, "param1=valu1¶m2=value2");
|
|
|
|
//The paginate() function returns a mysql result set
|
|
|
|
|
|
$x= 1;
|
|
foreach($pager['list'] as $data) {?>
|
|
<div id="del<?=$data['kode_barang'];?>" >
|
|
<tr <?php echo "class =";
|
|
$count++;
|
|
if ($count % 2) {
|
|
echo "tr1"; }
|
|
else {
|
|
echo "tr2";
|
|
}
|
|
?>>
|
|
<td><a href="#" onclick="document.getElementById('idobat').value = '<?php echo $data['kode_barang'];?>';" ><?php echo $data['kode_barang']; ?></a></td>
|
|
<td><?php echo $data['nama_barang']; ?></td>
|
|
<td><?php switch($data['group_barang']){
|
|
case "1" :
|
|
echo "ATK";
|
|
break;
|
|
case "2" :
|
|
echo "Cetakan";
|
|
break;
|
|
case "3" :
|
|
echo "ART";
|
|
break;
|
|
case "4" :
|
|
echo "Alat Bersih dan Pembersih";
|
|
break;
|
|
case "5" :
|
|
echo "Lain - Lain";
|
|
break;
|
|
}?></td>
|
|
<td><?php if(empty($data['stok'])){echo"0";}else{ echo $data['stok']; } ?></td>
|
|
<td><?php echo $data['satuan']; ?></td>
|
|
<td><?php echo $data['harga']; ?></td>
|
|
<td><a href="#" onclick="javascript: MyAjaxRequest('addbarang','logistik/prosesbarang.php?opt=1');" >Add</a> | <a href="#" onclick="javascript: MyAjaxRequest('addbarang','logistik/prosesbarang.php?opt=2&idxbarang=<?=$data['kode_barang']?>');" >Edit</a> | <a href="#" onclick="javascript: if(confirm('Yakin Dihapus.')){
|
|
MyAjaxRequest('del<?=$data['kode_barang']?>','logistik/prosesbarang.php?opt=3&idxbarang=<?=$data['kode_barang']?>'); window.location='<?php echo _BASE_;?>index.php?link=92'; return false; }else{ return false;}" >Del</a></td>
|
|
</tr></div>
|
|
<?php $x++;}
|
|
|
|
//Display the full navigation in one go
|
|
echo $pager['nav'];
|
|
?>
|
|
|
|
</table>
|
|
<?php
|
|
|
|
//Display the full navigation in one go
|
|
echo $pager['nav'];
|
|
?>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="msg" ></div>
|
|
<p></p>
|