} else { // Nilai field default $data = array(); $data['replid'] = 0; $data['harga'] = 0; $data['susut'] = 0; $ttl = 'Tambah'; } $xform->title($ttl . ' data barang baru'); $xform->table_begin(); $xform->col_begin('50%'); // Kolom kiri lebar 50% $xform->group_begin('Informasi Barang'); // Grup field $xform->fl('Lokasi', '[' . lokasi_kode($lok) . '] ' . lokasi_name($lok)); $xform->fl('Grup barang', '[' . grup_kode($gru) . '] ' . grup_name($gru)); $xform->fi('Kode', iText('kode', $data, 'width:50px')); $xform->fi('Nama barang', iText('nama', $data, $xform->fieldws)); $xform->fi('Jenis', iSelect('jenis', $jenis, $data)); $xform->fi('Penyusutan', iText('susut', $data, 'width:40px') . '<l> % per tahun</l>'); $xform->fi('Keterangan', iTextarea('keterangan', $data, $xform->fieldws, 5)); $xform->col_begin('50%'); // Kolom kanan lebar 50% $xform->group_begin('Gambar Barang'); // Grup field $xform->fphoto($data['replid'], 'katalog'); if ($opf == 'kat') { if ($xform->opt == 'uf') { $xform->back_act = 'katalog_form_view(' . $cid . ')'; } else { $xform->back_act = 'katalog_get()';
// delete $q = dbDel($dbtable, "replid='{$cid}'"); } } } $fform->notif($q); } else { $tk = mysql_query("SELECT nama FROM sar_katalog WHERE replid='" . $inp['katalog'] . "'"); $rk = mysql_fetch_array($tk); if ($opt == 'uf' || $opt == 'df') { // Prepocessing form $r = dbSFA("*", $dbtable, "W/replid='{$cid}'"); } else { $r = array(); $r['sumber'] = 0; $r['kode'] = lokasi_kode($inp['lokasi']) . '.' . grup_kode($inp['grup']) . '.' . katalog_kode($inp['katalog']) . '.'; $l = barang_lbarkode(); $r['kode'] .= sprintf("%05d", $l); $r['barkode'] = sprintf("%05d", $l); $r['kondisi'] = 1; } $fform->ptop = 100; $fform->head(); if ($opt == 'af' || $opt == 'uf') { require_once MODDIR . 'control.php'; // Add or Edit form $fform->fl('Nama barang', $rk['nama']); if ($opt == 'af') { //echo '<textarea>'; $fform->fi('Jumlah unit baru', iText('nunit', 1, 'width:50px', '', 'onblur="katalog_unit_cek(this)"')); hiddenval('tkode', $r['kode']);