fin2@agn
BNI-PT
Man-PT
KasKecil
BCA 671
Man 709
Account Tree
db backup
eBook #1
eBook #2
eBook #3
Tax eBook #4
Color
Logout
Mutasi BNI PT
Mutasi Mandiri PT
Mutasi Mandiri 709
Mutasi Mandiri 202
Mutasi BCA 671
Mutasi BCA 471
Mutasi Jago
Action
Transaction
Journal
Report
FilePHP
Tes cURL [1]
Copy This
Save
folder
slug
param
method
body
remark
php
Copy
/home/u902783705/domains/azkapersada.com/public_html/sub/fin/
app.function.php
<?php function to_money($ang) { $sid = preg_replace("/[^0-9\+\-]/","",$ang); return $sid; } function ExportJago($id) { global $db,$ar; $sql4 = "select * from jago_mutasi where id=".$id; $res4 = mysqli_query($db, $sql4); $r4 = mysqli_fetch_assoc($res4); //echo "<pre>"; print_r($r4); echo "</pre>"; if($r4['debit']==0) { $amount=$r4['kredit']; $inout=2; $payto="Jago ".substr($r4['rek'],0,4); $payfrom=""; } else { $amount=$r4['debit']; $inout=1; $payfrom="Jago ".substr($r4['rek'],0,4); $payto=""; } $sql3 = "select * from action where bank=9 and amount=".$amount." and seq=".$r4['seq']." and tgl='".$r4['tgl']."'"; echo $sql3."<br>"; $res3 = mysqli_query($db, $sql3); if(mysqli_num_rows($res3)>0) { $r3 = mysqli_fetch_assoc($res3); //echo "<pre>"; print_r($r3); echo "</pre>"; $udt=array( 'action_id'=>$r3['id'], ); Update($db,"jago_mutasi",$udt,"id=".$r4['id'],1); } else { $sql2 = "select id from action where id2=id order by id desc limit 1"; $res2 = mysqli_query($db, $sql2); $r2 = mysqli_fetch_assoc($res2); $id2=$r2['id']+1; $idt=array( 'id'=>$id2, 'action_at'=>$r4['tgl2'], 'tgl'=>$r4['tgl'], 'month'=>$r4['month'], 'year'=>$r4['year'], 'descr'=>$r4['keterangan'], 'pay_to'=>$payto, 'pay_from'=>$payfrom, 'cat'=>$inout, 'seq'=>$r4['seq'], 'inout'=>$inout, 'bank'=>9, 'amount'=>$amount, 'st'=>1, 'update_at'=>time(), ); Insert($db,"action",$idt,1); tool_id3("action"); $udt=array( 'action_id'=>$id2, ); Update($db,"jago_mutasi",$udt,"id=".$r4['id'],1); } } function ExportfBca($id) { global $db,$ar; $sql4 = "select * from bca_mutasi where id=".$id; $res4 = mysqli_query($db, $sql4); $r4 = mysqli_fetch_assoc($res4); //echo "<pre>"; print_r($r4); echo "</pre>"; if($r4['debit']==0) { $amount=$r4['kredit']; $inout=2; $payto="BCA ".substr($r4['rek'],0,4); $payfrom=""; } else { $amount=$r4['debit']; $inout=1; $payfrom="BCA ".substr($r4['rek'],0,4); $payto=""; } $sql3 = "select * from action where bank=4 and amount=".$amount." and seq=".$r4['seq']." and tgl='".$r4['tgl']."'"; echo $sql3."<br>"; $res3 = mysqli_query($db, $sql3); if(mysqli_num_rows($res3)>0) { $r3 = mysqli_fetch_assoc($res3); //echo "<pre>"; print_r($r3); echo "</pre>"; $udt=array( 'action_id'=>$r3['id'], ); Update($db,"bca_mutasi",$udt,"id=".$r4['id'],1); } else { $sql2 = "select id from action where id2=id order by id desc limit 1"; $res2 = mysqli_query($db, $sql2); $r2 = mysqli_fetch_assoc($res2); $id2=$r2['id']+1; $idt=array( 'id'=>$id2, 'action_at'=>$r4['tgl2'], 'tgl'=>$r4['tgl'], 'month'=>$r4['month'], 'year'=>$r4['year'], 'descr'=>$r4['keterangan'], 'pay_to'=>$payto, 'pay_from'=>$payfrom, 'cat'=>$inout, 'seq'=>$r4['seq'], 'inout'=>$inout, 'bank'=>4, 'amount'=>$amount, 'st'=>1, 'update_at'=>time(), ); Insert($db,"action",$idt,1); tool_id3("action"); $udt=array( 'action_id'=>$id2, ); Update($db,"bca_mutasi",$udt,"id=".$r4['id'],1); } } function ExportfBni($id) { global $db,$ar; $sql4 = "select * from bnipt_mutasi where id=".$id; $res4 = mysqli_query($db, $sql4); $r4 = mysqli_fetch_assoc($res4); //echo "<pre>"; print_r($r4); echo "</pre>"; if($r4['debit']==0) { $amount=$r4['kredit']; $inout=2; $payto="BNI PT IDR "; $payfrom=""; } else { $amount=$r4['debit']; $inout=1; $payfrom="BNI PT IDR "; $payto=""; } $sql3 = "select * from action where bank=1 and amount=".$amount." and tgl='".$r4['tgl']."'"; echo $sql3."<br>"; $res3 = mysqli_query($db, $sql3); if(mysqli_num_rows($res3)>0) { $r3 = mysqli_fetch_assoc($res3); //echo "<pre>"; print_r($r3); echo "</pre>"; $udt=array( 'action_id'=>$r3['id'], ); Update($db,"bnipt_mutasi",$udt,"id=".$r4['id'],1); } else { $sql2 = "select id from action where id2=id order by id desc limit 1"; $res2 = mysqli_query($db, $sql2); $r2 = mysqli_fetch_assoc($res2); $id2=$r2['id']+1; $idt=array( 'id'=>$id2, 'action_at'=>$r4['tgl2'], 'tgl'=>$r4['tgl'], 'month'=>$r4['month'], 'year'=>$r4['year'], 'descr'=>$r4['keterangan'], 'pay_to'=>$payto, 'pay_from'=>$payfrom, 'cat'=>$inout, 'seq'=>$r4['seq'], 'inout'=>$inout, 'bank'=>1, 'amount'=>$amount, 'st'=>1, 'update_at'=>time(), ); Insert($db,"action",$idt,1); tool_id3("action"); $udt=array( 'action_id'=>$id2, ); Update($db,"bnipt_mutasi",$udt,"id=".$r4['id'],1); } } function ExportfMandiri($id) { global $db,$ar; $sql4 = "select * from mandiript_mutasi where id=".$id; $res4 = mysqli_query($db, $sql4); $r4 = mysqli_fetch_assoc($res4); //echo "<pre>"; print_r($r4); echo "</pre>"; if($r4['debit']==0) { $amount=$r4['kredit']; $inout=2; $payto="Mandiri 16709 IDR "; $payfrom=""; } else { $amount=$r4['debit']; $inout=1; $payfrom="Mandiri 16709 IDR "; $payto=""; } $sql3 = "select * from action where bank=2 and amount=".$amount." and tgl='".$r4['tgl']."'"; echo $sql3."<br>"; $res3 = mysqli_query($db, $sql3); if(mysqli_num_rows($res3)>0) { $r3 = mysqli_fetch_assoc($res3); //echo "<pre>"; print_r($r3); echo "</pre>"; $udt=array( 'action_id'=>$r3['id'], ); Update($db,"mandiript_mutasi",$udt,"id=".$r4['id'],1); } else { $sql2 = "select id from action where id2=id order by id desc limit 1"; $res2 = mysqli_query($db, $sql2); $r2 = mysqli_fetch_assoc($res2); $id2=$r2['id']+1; $idt=array( 'id'=>$id2, 'action_at'=>$r4['tgl2'], 'tgl'=>$r4['tgl'], 'month'=>$r4['month'], 'year'=>$r4['year'], 'descr'=>$r4['keterangan'], 'pay_to'=>$payto, 'pay_from'=>$payfrom, 'cat'=>$inout, 'seq'=>$r4['seq'], 'inout'=>$inout, 'bank'=>2, 'amount'=>$amount, 'st'=>1, 'update_at'=>time(), ); Insert($db,"action",$idt,1); tool_id3("action"); $udt=array( 'action_id'=>$id2, ); Update($db,"mandiript_mutasi",$udt,"id=".$r4['id'],1); } } function ExportfMandiri2($id) { global $db,$ar; $sql4 = "select * from csv_m where id=".$id; $res4 = mysqli_query($db, $sql4); $r4 = mysqli_fetch_assoc($res4); //echo "<pre>"; print_r($r4); echo "</pre>"; if($r4['debit']==0) { $amount=$r4['kredit']; $inout=2; $payto="Mandiri IDR ".substr($r4['rek'],-3); $payfrom=""; } else { $amount=$r4['debit']; $inout=1; $payfrom="Mandiri IDR ".substr($r4['rek'],-3); $payto=""; } if($r4['payto']!='') { $payto2=$r4['payto']; } else { $payto2=$payto; } $sql3 = "select * from action where bank=3 and amount=".$amount." and tgl='".$r4['tgl']."'"; echo $sql3."<br>"; $res3 = mysqli_query($db, $sql3); if(mysqli_num_rows($res3)>0) { $r3 = mysqli_fetch_assoc($res3); //echo "<pre>"; print_r($r3); echo "</pre>"; $udt=array( 'action_id'=>$r3['id'], ); Update($db,"csv_m",$udt,"id=".$r4['id'],1); } else { $sql2 = "select id from action where id2=id order by id desc limit 1"; $res2 = mysqli_query($db, $sql2); $r2 = mysqli_fetch_assoc($res2); $id2=$r2['id']+1; $idt=array( 'id'=>$id2, 'action_at'=>$r4['tgl2'], 'tgl'=>$r4['tgl'], 'month'=>$r4['month'], 'year'=>$r4['year'], 'descr'=>$r4['keterangan']." ".$r4['remark'], 'pay_to'=>$payto2, 'pay_from'=>$payfrom, 'cat'=>$inout, 'seq'=>$r4['seq'], 'inout'=>$inout, 'bank'=>$ar['manp'][$r4['rek']], 'amount'=>$amount, 'st'=>1, 'update_at'=>time(), ); Insert($db,"action",$idt,1); tool_id3("action"); $udt=array( 'action_id'=>$id2, ); Update($db,"csv_m",$udt,"id=".$r4['id'],1); } } function JournalCount($year) { global $db,$ar; $sql6="update account set sel2=0"; $res6=mysqli_query($db,$sql6); $sql3="SELECT * from action order by action_at,seq"; $res3=mysqli_query($db,$sql3); while($r3=mysqli_fetch_assoc($res3)) { $udt3=array( 'seq'=>$r3['seq'], ); Update($db,"journal",$udt3,"action_id=".$r3['id'],0); Update($db,"transaction",$udt3,"action_id=".$r3['id'],0); } $sql="SELECT account_code from journal group by account_code"; $res=mysqli_query($db,$sql); while($r1=mysqli_fetch_assoc($res)) { $sql2="SELECT * from journal where year=".$year." and account_code='".$r1['account_code']."' order by action_at asc, seq asc"; //echo $sql2."<br>"; $res2=mysqli_query($db,$sql2); $bal=0; $seq2=1; while($r2=mysqli_fetch_assoc($res2)) { $bal=$bal+$r2['debit']-$r2['credit']; $udt=array( 'balance'=>$bal, 'seq2'=>$seq2, 'update_at'=>time(), ); Update($db,"journal",$udt,"id=".$r2['id'],1); $seq2++; } $udt4=array( 'sel2'=>1, ); Update($db,"account",$udt4,"code='".$r1['account_code']."'",0); } } function tool_id3($tbl) { global $db,$ar; $sql4 = "select id from ".$tbl." where id2=id order by id desc limit 1"; $res4 = mysqli_query($db, $sql4); $rw4 = mysqli_fetch_assoc($res4); $sql = "select * from ".$tbl." where id>".$rw4['id']." order by id"; $res = mysqli_query($db, $sql); $id2=$rw4['id']+1; while($rw = mysqli_fetch_assoc($res)) { $udt=array( 'id2'=>$id2, ); Update($db,$tbl,$udt,"id=".$rw['id'],0); $id2++; } } function tool_id2($tbl) { global $db,$ar; $sql = "select * from ".$tbl." order by id"; $res = mysqli_query($db, $sql); $id2=1; while($rw = mysqli_fetch_assoc($res)) { $udt=array( 'id2'=>$id2, ); Update($db,$tbl,$udt,"id=".$rw['id'],0); $id2++; } } function account_equation($trx) { global $db,$ar; //cek kolom apa saja yg diupdate $sql = "SELECT lev2 from account where code='".$trx['debit']."'"; echo $sql."<br>"; $res = mysqli_query($db,$sql); $r1 = mysqli_fetch_assoc($res); $col_debit=$r1['lev2']; $sql2 = "SELECT lev2,min from account where code='".$trx['credit']."'"; $res2 = mysqli_query($db,$sql2); $r2 = mysqli_fetch_assoc($res2); $col_credit=$r2['lev2']; if($col_credit=='c11110' or $col_credit=='c11120' or $col_credit=='c11130' or $col_credit=='c11140' or $col_credit=='c11150' ) { $val_credit=-to_numeric($trx['amount']); } else { $val_credit=to_numeric($trx['amount']); } if($r2['min']=='-') { $val_debit=-to_numeric($trx['amount']); } else { $val_debit=to_numeric($trx['amount']); } $sql4 = "select * from account_equation where id2=id order by id desc limit 1"; $res4 = mysqli_query($db, $sql4); $rw4 = mysqli_fetch_assoc($res4); if(isset($rw4['id'])) { $id2=$rw4['id']+1; } else { $id2=1; } foreach ($ar['equ'] as $k => $v) { $udt6=array( $v=>0, ); Update($db,"account_equation",$udt6,"transaction_id=".$trx['id']); } $idt=array( 'id'=>$id2, 'transaction_id'=>$trx['id'], 'action_at'=>$trx['action_at'], 'action_id'=>$trx['action_id'], 'year'=>date("Y",$trx['action_at']), 'month'=>date("Ym",$trx['action_at']), 'week'=>date("W",$trx['action_at']), 'amount'=>to_numeric($trx['amount']), $col_debit=>$val_debit, $col_credit=>$val_credit, ); $udt=array( 'action_at'=>$trx['action_at'], 'year'=>date("Y",$trx['action_at']), 'month'=>date("Ym",$trx['action_at']), 'week'=>date("W",$trx['action_at']), 'amount'=>to_numeric($trx['amount']), $col_debit=>$val_debit, $col_credit=>$val_credit, ); InsertUpdate($db,"account_equation",$idt,$udt,1); tool_id3("account_equation"); } ?>