$r['callnumber'] = $r1['kode']; $t1 = mysql_query("SELECT nama FROM pus_pengarang WHERE replid='" . $rk['pengarang'] . "' LIMIT 0,1"); $r1 = mysql_fetch_array($t1); $r1 = substr($r1['nama'], 0, 3); $r['callnumber'] .= " " . $r1; $jud = strtolower(substr($rk['judul'], 0, 1)); $r['callnumber'] .= " " . $jud; $t1 = mysql_query("SELECT kode FROM pus_lokasi WHERE replid='{$lok}' LIMIT 0,1"); $r1 = mysql_fetch_array($t1); $klok = $r1['kode']; $t1 = mysql_query("SELECT kode FROM pus_tingkatbuku WHERE replid='{$tingb}' LIMIT 0,1"); $r1 = mysql_fetch_array($t1); $ktingb = $r1['kode']; $r['idbuku'] = buku_getidbuku($lok, $tingb); $r['barkode'] = buku_idbukutobarkode($r['idbuku']); $r['urut'] = buku_idbukugeturut($r['idbuku']); $r['tanggal'] = date("Y-m-d"); $r['harga'] = 0; } $fform->dimension(450, 120); $fform->ptop = 20; $fform->head(); if ($opt == 'af' || $opt == 'uf') { require_once MODDIR . 'control.php'; // Add or Edit form $fform->fg('Data Koleksi'); $fform->fl('Judul', '<b>' . buku_judul($rk['judul']) . '</b>'); if ($opt == 'af') { $fform->fi('Jumlah koleksi baru', iText('nbuku', 1, 'width:30px;text-align:center', '', 'onblur="katalog_buku_cek()"') . ' item'); hiddenval('tbarkode', $r['barkode']); hiddenval('tidbuku', $r['idbuku']);
<?php $lok = gpost('lokasi'); $tingb = gpost('tingkatbuku'); $opt = gpost('opt'); $lid = gpost('idbuku'); if ($opt == 'af') { $idbuku = buku_getidbuku($lok, $tingb); $barkode = buku_idbukutobarkode($idbuku); } else { $urut = buku_idbukugeturut($lid); $idbuku = buku_getidbuku($lok, $tingb, 1, $urut); $barkode = buku_idbukutobarkode($idbuku); } echo $barkode . '-' . $idbuku;