$o = array('status' =>'invalid_no_post' ); }else{ $disc = getField('nilai','psb_disctunai','replid',$_POST['replid']); // var_dump($disc);exit(); $o = array( 'status' =>(($disc!=null || $disc!='')?'sukses':'gagal'), 'nilai' =>$disc ); }$out = json_encode($o); break; case 'getDiscAngsuran': if(!isset($_POST['discAngsuran'])){ $o = array('status' =>'invalid_no_post' ); }else{ $disc = getDiscAngsuran($_POST['regNum'],$_POST['discAngsuran']); $o = array( 'status' =>(($disc!=null || $disc!='')?'sukses':'gagal'), 'discNum' =>$disc ); }$out = json_encode($o); break; // add / edit ----------------------------------------------------------------- case 'simpan': switch ($_POST['subaksi']) { case 'siswadokumen': if(isset($_POST['siswadokumenTB'])){ $stat = true; $dbstat = $upstat = $dfstat = true; // pr($_POST);
function getDisc($typ, $siswa) { if ($typ == 'disctunai') { // diskon tunai $s = 'SELECT nilai FROM psb_disctunai WHERE replid =' . getSiswaBy($typ, $siswa); $e = mysql_query($s); $r = mysql_fetch_assoc($e); $biaya = getBiaya('registration', $siswa); $ret = $r['nilai'] * $biaya / 100; } elseif ($typ == 'discangsuran') { // diskon angsuran $angsuran = getSiswaBy('angsuran', $siswa); // suadara || subsisi $ret = getDiscAngsuran(getBiaya('registration', $siswa), $angsuran); } else { // saudara || subsidi $ret = getSiswaBy($typ, $siswa); } return $ret; }
LEFT JOIN psb_calonsiswa_ayah a ON a.calonsiswa = c.replid LEFT JOIN psb_calonsiswa_ibu i ON i.calonsiswa = c.replid LEFT JOIN psb_calonsiswa_kontakdarurat d ON d.calonsiswa = c.replid LEFT JOIN psb_calonsiswa_keluarga k ON k.calonsiswa = c.replid LEFT JOIN psb_setbiaya b ON b.replid = c.setbiaya WHERE c.replid='.$_POST['replid']; $e = mysql_query($s) or die(mysql_error()); $r = mysql_fetch_assoc($e); // print_r($r);exit(); $stat = ($e)?'sukses':'gagal'; $regNum = setuang(getBiaya('dpp',$_POST['replid'])); $regNumNet = setuang(getBiayaNet('dpp',$_POST['replid'])); $nopendaftaran = getNoPendaftaran($_POST['replid'],$r['kelompok'])['full']; $proses = getField('proses','psb_kelompok','replid',$r['kelompok']); $discangsuran = setuang(getDiscAngsuran($regNum, $r['angsuran'])); $disctunai = setuang(getDisc('disctunai',$_POST['replid'])); // var_dump($discangsuran);exit(); $out = json_encode(array( 'status' =>$stat, // pembayaran 'setbiaya' =>$r['setbiaya'], 'dpp' =>$regNum, 'angsuran' =>$r['angsuran'], 'discangsuran' =>$discangsuran, 'discsubsidi' =>setuang($r['discsubsidi']), 'discsaudara' =>setuang($r['discsaudara']), 'iddisctunai' =>$r['disctunai'], 'disctunai' =>$disctunai, 'disctotal' =>setuang(getDiscTotal($_POST['replid'])), 'dppnet' =>$regNumNet,