cicilan = ' . $nominal . ', siswa = ' . $_POST['idsiswaH']; $e = mysql_query($s); $id = mysql_insert_id(); if (!$e) { $stat = 'gagal_insert_pembayaran'; } else { // 2. simpan transaksi $s2 = 'INSERT INTO keu_transaksi SET tahunbuku =' . getTahunBuku('replid') . ', pembayaran =' . $id . ', nominal =' . $nominal . ', nomer ="' . getNoTrans($_POST['subaksi']) . '", tanggal ="' . date('Y-m-d') . '", uraian ="' . $_POST['uraianTB'] . '", rekkas =' . $_POST['rekkasH'] . ', detjenistrans=' . getDetJenisTrans('replid', 'kode', $detjenistrans) . ', rekitem =' . $_POST['rekitemH']; $e2 = mysql_query($s2); $id2 = mysql_insert_id(); if (!$e2) { $stat = 'gagal_insert_transaksi'; } else { // 3. simpan jurnal $s3 = 'INSERT INTO keu_jurnal SET transaksi =' . $id2 . ', rek =' . $_POST['rekkasH'] . ', jenis = "d", nominal =' . $nominal; $s4 = 'INSERT INTO keu_jurnal SET transaksi =' . $id2 . ', rek =' . $_POST['rekitemH'] . ',jenis = "k", nominal =' . $nominal; // $s3 = 'INSERT INTO keu_jurnal SET transaksi ='.$id2.', rek ='.$_POST['rekkasH'].', debet ='.$nominal; // $s4 = 'INSERT INTO keu_jurnal SET transaksi ='.$id2.', rek ='.$_POST['rekitemH'].', kredit ='.$nominal; $e3 = mysql_query($s3); $e4 = mysql_query($s4); if (!$e3 or !$e4) { $stat = 'gagal_insert_jurnal';
// print_r($s2);exit(); $e2 = mysql_query($s2) or die(mysql_error()); $out .= '<table width="100%" class="isi"> <thead> <tr class="head"> <th width="12%">Tanggal </th> <th width="18%">No. Transaksi</th> <th width="30%">Uraian</th> <th width="20%">Debet</th> <th width="20%">Kredit</th> </tr> </thead> <tbody>'; $debitTot = $kreditTot = 0; while ($r2 = mysql_fetch_assoc($e2)) { $jenis = getJenisTrans('kode', getDetJenisTrans('jenistrans', 'replid', $r2['detjenistrans'])); if ($jenis == 'ju') { // ju $debit = 99; $kredit = 0; } else { if ($jenis == 'out') { // outcome $debit = $r2['rekkas'] == $r2['rek'] ? 0 : $r2['nominal']; $kredit = $r2['rekitem'] == $r2['rek'] ? 0 : $r2['nominal']; } else { // income $debit = $r2['rekkas'] == $r2['rek'] ? $r2['nominal'] : 0; $kredit = $r2['rekitem'] == $r2['rek'] ? $r2['nominal'] : 0; } }
<td align="center">No. Jurnal/Jenis Bukti/No.Bukti</td> <td align="center">Uraian</td> <td align="center">Detil Jurnal</td> </tr>'; $nox = 1; $totbayar = 0; if ($n1 == 0) { $out .= '<tr> <td>-</td> <td>-</td> <td>-</td> <td>-</td> </tr>'; } else { while ($r1 = mysql_fetch_assoc($e1)) { $jDetTrans = getDetJenisTrans('jenistrans', 'replid', $r1['detjenistrans']); $jTrans = getJenisTrans('kode', $jDetTrans); if ($jTrans == 'ju') { $j = 'ju'; } else { $j = $jTrans . '_come'; } $s2 = ' SELECT replid,rek,nominal,jenis FROM keu_jurnal WHERE transaksi =' . $r1['replid'] . ' ORDER BY jenis ASC'; $e2 = mysql_query($s2); // var_dump($s2);exit(); $tb2 = '';
// 1. simpan transaksi $totNominal = 0; $rekArr = $_POST[$sub . '_idTR']; $stat1 = $stat2 = $stat3 = true; // var_dump($rekArr);exit(); foreach ($rekArr as $i => $v) { $nom = intval(getuang($_POST[$sub . '_nominal' . $v . 'TB'])); // $jenis = $_POST[$sub.'_jenis'.$v.'TB']; $s1 = 'keu_transaksi SET tahunbuku =' . getTahunBuku('replid') . ', rekkas =' . $_POST['rekkasH'] . ', uraian ="' . $_POST[$sub . '_uraian' . $v . 'TB'] . '", rekitem =' . $_POST[$sub . '_rek' . $v . 'H'] . ', nominal =' . $nom . ', nomer ="' . getNoTrans2($sub) . '", tanggal ="' . tgl_indo6($_POST['tanggalTB']) . '", detjenistrans =' . getDetJenisTrans('replid', 'kode', $_POST['detjenistransH']) . ', detilanggaran =' . $_POST['detilanggaranH'] . ', nobukti ="' . $_POST['nobuktiTB'] . '"'; $s = (isset($_POST['idformH']) and $_POST['idformH'] != '') ? 'UPDATE ' . $s1 . ' WHERE replid=' . $_POST['idformH'] : 'INSERT INTO ' . $s1; $e = mysql_query($s); $idx = mysql_insert_id(); $id = ($idx != '' or !empty($idx)) ? $idx : $_POST['idformH']; // $id = (mysql_insert_id()!='' OR !empty(mysql_insert_id()))?mysql_insert_id():$_POST['idformH']; // 2. simpan jurnal umum if (!$e) { $stat1 = false; } else { // jurnal debit & kredit $sjd = ' keu_jurnal SET rek =' . $_POST['rekkasH'] . ',nominal =' . $nom . ',jenis="k"'; $sjk = ' keu_jurnal SET rek =' . $_POST[$sub . '_rek' . $v . 'H'] . ',nominal =' . $nom . ',jenis="d"'; if ($_POST[$sub . '_mode' . $v . 'H'] == 'edit') {