$pre='BKK'; break; } $s ='SELECT max(ct)ct from keu_transaksi '; $e =mysql_query($s); $stat =!$e?'gagal_'.mysql_error():'sukses'; if(mysql_num_rows($e)>0){ $r =mysql_fetch_assoc($e); $in =$r['ct']+1; }else{ $in=1; }$kode=$pre.'-'.sprintf("%04d",$in).'/'.date("m").'/'.date("Y"); $out=json_encode(array('status'=>$stat,'kode'=>$kode)); break; }*/ $kode = getNoTrans2($_POST['subaksi']); $out = json_encode(array('status' => $kode != null ? 'sukses' : 'gagal', 'kode' => $kode)); break; // generate kode // case 'cmbakanbayar': // $out=json_encode(array( // 'status' =>(akanBayarOpt($_POST['subaksi'],$_POST['siswa'])==null?'gagal':'sukses'), // 'datax' =>akanBayarOpt($_POST['subaksi'],$_POST['siswa']) // )); // break; // head info ------------------------------------------------------------------ // generate kode // case 'cmbakanbayar': // $out=json_encode(array( // 'status' =>(akanBayarOpt($_POST['subaksi'],$_POST['siswa'])==null?'gagal':'sukses'), // 'datax' =>akanBayarOpt($_POST['subaksi'],$_POST['siswa'])
case 'simpan': // switch ($_POST['subaksi']) { // 1. simpan transaksi $nominal = 0; $sub = $_POST['subaksi']; // ju, in, out $c = count($_POST[$sub . '_rekH']); foreach ($_POST[$sub . '_rekH'] as $i => $v) { $nom = intval(getuang($_POST[$sub . '_nominal' . $v . 'TB'])); if ($nom != '0') { $nominal += $nom; } } $s = 'INSERT INTO keu_transaksi SET tahunbuku =' . getTahunBuku('replid') . ', nominal =' . $nominal . ', nomer ="' . getNoTrans2($_POST['subaksi']) . '", tanggal ="' . date('Y-m-d') . '", uraian ="' . $_POST[$sub . '_uraianTB'] . '" nobukti ="' . $_POST[$sub . '_nobuktiTB'] . '"'; var_dump($s); exit; $e = mysql_query($s); $id = mysql_insert_id(); if (!$e) { $stat = 'gagal_insert_transaksi'; } else { // 2. simpan jurnal $stat2 = true; $nomDebit = $nomKredit = 0; foreach ($_POST[$sub . '_rekH'] as $i => $v) { if ($_POST[$sub . '_jenis' . $v . 'TB'] == 'debit') {
} else { // out_come // 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"';