forked from yuliusjubair/penjualan_koperasi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
katalog.php
168 lines (151 loc) · 4.37 KB
/
katalog.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<?
include "config/koneksi.php";
$qkat = mysql_query("select distinct a.kode_kategori,b.nama_kategori from mst_barang a,mst_kategori b where a.kode_kategori = b.kode_kategori order by waktu");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0" style="background:#fff;">
<tr>
<td class="baris_header1">KATALOG</td>
</tr>
<tr>
<td height="31" class="judulformlogin"><? echo $tkat[nama_kategori]; ?></td>
</tr>
<tr>
<td class="">
<div class="code">
<ul><!--<img src="images/box_48.png" />--><span style="font-weight:bold"> KATEGORI PRODUK</span>
<?
//$q = mysql_query("select * from mst_kategori ");
//$jml_baris=mysql_num_rows($q);
//while ($t = mysql_fetch_array($q))
//{
?>
<?
$batas=6;
$halaman=$_GET['halaman'];
if (empty($halaman)) {
$posisi=0;
$halaman=1;
}
else {
$posisi = ($halaman-1) * $batas;
}
$query = "select * from mst_kategori where kode_kategori <> 7 LIMIT $posisi,$batas";
$hasil = mysql_query($query) or die (mysql_error());
$jml_baris=mysql_num_rows($hasil);
$kolom=6;
$no=$posisi+1;
echo "
<table border=1 width=90% align=center class='baris_header1'>";
for($i=0; $i<$jml_baris; $i++)
{
$data=mysql_fetch_array($hasil);
if($i % $kolom==0) {
echo "<tr valign=top>";
}
echo "<td> <a href=index.php?pages=view&pagedetail=$data[kd_brg_detail]> </a> </td>";
echo "<td width=50% align='center'>
<font size=1> <b><a href=index.php?act=katalog&aksi=view_kategori&id_kategori=$data[kode_kategori]> $data[nama_kategori]</a> </b> </font> <br>
</td>";
if(($i % $kolom) == ($kolom-1) or ($i+1) == $jml_baris) {
}
$no++;
}
echo "</table>
</center>
";
?>
</ul>
</div>
</td>
</tr>
<?php
$aksi = $_GET[aksi];
$id = $_GET['id_kategori'];
if(!empty($_GET['aksi'])){
?>
</table>
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0" style="background:#fff;">
<tr>
<td class="baris_header1">DETAIL BARANG</td>
</tr>
<?
$batas=2;
$halaman=$_GET['halaman'];
if (empty($halaman)) {
$posisi=0;
$halaman=1;
}
else {
$posisi = ($halaman-1) * $batas;
}
$q = mysql_query("select * from mst_barang where kode_kategori = '$id' order by waktu desc LIMIT $posisi,$batas")or die (mysql_error());
while ($t = mysql_fetch_array($q))
{
//print_r($t);
if($id==7){
}else{
$harga = number_format($t[harga],0,',','.');
$cicilan = $t[harga]/$t[lama_cicilan];
$cicilan = number_format($cicilan,0,',','.');
}
?>
<tr>
<td>
<div class="code">
<table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td height="21" colspan="3" class="namabarang"><a href="<? echo "index.php?act=view&id=$t[id]" ?>"><? echo $t[nama_barang]; ?></a></td>
</tr>
<tr>
<td width="21%" rowspan="3"><? echo "<img src='produk/$t[gambar]' width='100' height='100' />"; ?></td>
<td width="27%" height="30" class="label_form"><? echo "Rp. $harga"; ?> </td>
<td width="52%" rowspan="3" class="isitabelmember"><? echo $t[keterangan]; ?></td>
</tr>
<tr>
<td height="33" class="label_form"><? echo "Discount : $t[diskon] %"; ?></td>
</tr>
<tr>
<td class="label_form"><? echo "Cicilan : $cicilan x $t[lama_cicilan] bln"; ?></td>
</tr>
</table>
</div>
</td>
</tr>
<? }?>
<?php
$qn = mysql_query("select * from mst_barang where kode_kategori = '$id'")or die (mysql_error());
$batas=2;
$jmldata = mysql_num_rows($qn);
$jmlhalaman = ceil($jmldata/$batas);
echo " <br><font size=1> Page : ";
for($i=1;$i<=$jmlhalaman;$i++)
{
if($i !=$halaman) {
echo"<a href=$_SERVER[PHP_SELF]?act=$_GET[act]&aksi=view_kategori&id_kategori=$id&halaman=$i> $i </a> | ";
}
else {
echo"<b>$i</b> | </font>";
}
}
?>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<? } ?>
</body>
</html>