if ($filter != '') { $filter .= " AND"; $fmsg .= ', dan'; } $filter .= " sar_barang.grup='{$gru}'"; $fmsg .= " grup barang: <b>" . grup_name($gru) . "</b>"; } $jen = gpost('jenis'); $jenis = jenis_r($jen, 1); if ($jen != 0) { if ($filter != '') { $filter .= " AND"; $fmsg .= ', dan'; } $filter .= " sar_katalog.jenis='{$jen}'"; $fmsg .= " jenis barang: <b>" . jenis_name($jen) . "</b>"; } $keyword = gpost('keyword'); if ($keyword != '') { if ($filter != '') { $filter .= " AND"; $fmsg .= ", dan"; } $filter .= " (sar_katalog.nama LIKE '%{$keyword}%' OR sar_barang.kode='{$keyword}')"; $fmsg .= " kode atau nama barang: <b>" . $keyword . "</b>"; } $filter = $filter == '' ? '' : " WHERE " . $filter; // Query $t = mysql_query("SELECT sar_barang.*,sar_katalog.nama FROM sar_barang JOIN sar_katalog ON sar_katalog.replid=sar_barang.katalog " . $filter . " ORDER BY sar_barang.kode"); $xtable->ndata = mysql_num_rows($t); $fmsg = $fmsg == '' ? '' : '<div class="infobox">Hasil pencarian ' . $fmsg . ' ditemukan <b>' . $xtable->ndata . '</b> unit.</div>';
?> </td></tr> <tr height="24px"><td width="100px">Total aset:</td><td><?php echo fRp(grup_aset($grup)); ?> </td></tr> </table> </div> <?php if ($xtable->ndata > 0) { // Table head $xtable->head('@kode', '@nama barang', 'jenis', 'Jumlah unit~R', 'Aset~R', 'penyusutan<br/>per tahun~R', 'keterangan', '{40px}'); while ($r = mysql_fetch_array($t)) { $xtable->row_begin(); $n = mysql_num_rows(mysql_query("SELECT replid FROM sar_barang WHERE katalog='" . $r['replid'] . "'")); $xtable->td($r['kode'], 80); $xtable->td($r['nama'], 200); $xtable->td(jenis_name($r['jenis']), 200); $xtable->td($n, 80, 'r'); $xtable->td(fRp(katalog_aset($r['replid'])), 100, 'r'); $xtable->td($r['susut'] . ' %', 120, 'r'); $xtable->td(nl2br($r['keterangan'])); $xtable->opt($r['replid'], 'v'); //'<button class="btn" title="Tambah unit barang baru." onclick="katalog_unit_add(\'<id>\')"><div class="bi_add">Unit</div></button>~50'); $xtable->row_end(); } $xtable->foot(); } else { $xtable->nodata(); } }