Tampilan Data Barang Tampilan Kode Program
108
TransitionalEN http:www.w3.orgTRxhtml1DTDxhtml1-
transitional.dtd html xmlns=http:www.w3.org1999xhtml
link href=style.css rel=stylesheet type=textcss script
type=textjavascript src=includejQuery_v1.6.4.jsscript
script type=textjavascript
src=hapusbarang.jsscript ?php include lib_func.php; ?
?php include koneksi_db.php;? head
meta
http-equiv=Content-Type content=texthtml;
charset=utf-8 titleData barang | PT. AJPtitle
head body
?php include_onceheader.php? div id=page
hr ?php include navigation.php?
div class=navigation align=center div
div id=contentpage div id=wraper
div id=judulhalamanPengolahan Data Produkdiv hr
div class=tombolsubmit
width=500pxa href=tambah_barang.php+ Tambaha
form method=post
action=?php echo
_SERVER[PHP_SELF];? input
type=text class=isian
name=keyword input
type=submit value=cari
class=tombolkirim name=tblcari form
div ?php
link=koneksi_db; batas =10;
ifisset_GET[halaman]{ halaman=_GET[halaman];}
ifemptyhalaman{ posisi=0;
halaman=1; }
109
else { posisi = halaman-1batas;
} sql=SELECT
b.id_barang, b.kode_barang,
b.nama_barang,b.harga,b.hpp,b.tanggal_posting,b.ditampilk an,k.nama_kategori
FROM barang b JOIN
kategori k
ON k.id_kategori = b.id_kategori;
ifisset_POST[keyword]{ keyword= _POST[keyword];}
ifisset_POST[tblcari]{ if _POST[tblcari]==cari{
sql=sql. where
b.nama_barang like
keyword; }} else{
sql.= ORDER BY b.nama_barang ASC LIMIT posisi,batas;
} res = mysql_querysql,link;
rows = mysql_num_rowsres;
ifres rows0{ ?
?php ifisset_GET[proses]{
if _GET[proses]==sukses{ ?
div class=suksesData
Berhasil Dihapusdiv
?php } else if_GET[proses]==berhasil
{? div
class=suksesData Berhasil
Ditambahdiv ?php
} else if_GET[proses]==ubahberhasil {?
div class=suksesData
Berhasil Diubahdiv
?php }else
if _GET[proses]==error
isset_SESSION[error] { ?
110
div class=warningProses Gagal : ?php echo _SESSION[error];?div
?php unset _SESSION[error];
} }
? table border=0 id=tabelview align=left
tr class=judultable td width=7Notd
td width=20Nama
Barangtd td width=15Kategoritd
td width=20HargaRp.td td width=20HPPRp.td
td width=15Tanggal
Masuktd td width=10Tampiltd
td width=12
colspan=2Aksitd tr
?php no=1;
whiledata=mysql_fetch_arrayres{ tgl_masuk=
date data[tanggal_posting];
idbarang= data[id_barang]; ?
tr class=isitabel td?php echo no ? td
td?php echo
data[nama_barang];?td td?php
echo data[nama_kategori];?td
td align=rightRp. ?php echo rpdata[harga];?td
td align=rightRp. ?php echo rpdata[hpp];?td
td?php echo tgl_masuk;?td td
align=center?php ifdata[ditampilkan]==1{
echo Y;} else
if
111
data[ditampilkan]==0{ echo T;}?td
tda href=ubah_barang.php?id=?php echo idbarang;?Edit
a | a onclick=return HapusBarang?php echo data[id_barang]; ?,?php echo data[nama_barang];
? style=cursor:pointer;hapusatd
tr ?php
no++; } ?
table div class=notee- pilih menu edit untuk mengubah
dan menambahkan detail barangdiv ?php
total data dan halaman tampil2=mysql_querySelect from barang;
jmldata= mysql_num_rowstampil2; jmlhal= ceiljmldatabatas;
echo div class=paging; link halaman sebelumnya
ifhalaman 1 { prev=halaman-1;
echospan class=prevnext a
href=._SERVER[PHP_SELF].?halaman=.prev. a
span;} else {
echo span class=disable span; }
link 1,2,3 ... fori=1;i=jmlhal;i++
if i = halaman{ echo
a href=._SERVER[PHP_SELF].?halaman=.i.
i a;
} else {
echo span class=currentispan; }
tampilkan halaman berikutnya if halamanjmlhal{
next=halaman+1; echo span class=prevnext
a
112
href=._SERVER[PHP_SELF].?halaman=.next. a
span;} else{
echospan class=disablespan; }
echo div; }else{
? div
class=warningData Barang
Tidak Ditemukandiv
div ?php
} ?
div div
div ?php include_oncefooter.php;?
body html
?php } else {header location:index.php; }
?