<?php require_once('Connections/sistem.php'); 
?>
<?php
//contoh
//echo terbilang(1010345650);
  
function satuan($inp)
{
 if ($inp == 1)
 {
  return "satu ";
 }
 else if ($inp == 2)
 {
  return "dua ";
 }
 else if ($inp == 3)
 {
  return "tiga ";
 }
 else if ($inp == 4)
 {
  return "empat ";
 }
 else if ($inp == 5)
 {
  return "lima ";
 }
 else if ($inp == 6)
 {
  return "enam ";
 }
 else if ($inp == 7)
 {
  return "tujuh ";
 }
 else if ($inp == 8)
 {
  return "delapan ";
 }
 else if ($inp == 9)
 {
  return "sembilan ";
 }
 else
 {
  return "";
 }
}


function belasan($inp)
{
 $proses = $inp; //substr($inp, -1);
 if ($proses == '11')
 {
  return "sebelas ";
 }
 else
 {
  $proses = substr($proses,1,1);
  return satuan($proses)."belas ";
 }
}



function puluhan($inp)
{
 $proses = $inp; //substr($inp, 0, -1);
 if ($proses == 1)
 {
  return "sepuluh ";
 }
 else if ($proses == 0)
 {
  return '';
 }
 else
 {
  return satuan($proses)."puluh ";
 }
}


function ratusan($inp)
{
 $proses = $inp; //substr($inp, 0, -2);
 if ($proses == 1)
 {
  return "seratus ";
 }
 else if ($proses == 0)
 {
  return '';
 }
 else
 {
  return satuan($proses)."ratus ";
 }
}


function ribuan($inp)
{
 $proses = $inp; //substr($inp, 0, -3);
 if ($proses == 1)
 {
  return "seribu ";
 }
 else if ($proses == 0)
 {
  return '';
 }
 else
 {
  return satuan($proses)."ribu ";
 }
}


function jutaan($inp)
{
 $proses = $inp; //substr($inp, 0, -6);
 if ($proses == 0)
 {
  return '';
 }
 else
 {
  return satuan($proses)."juta ";
 }
}


function milyaran($inp)
{
 $proses = $inp; //substr($inp, 0, -9);
 if ($proses == 0)
 {
  return '';
 }
 else
 {
  return satuan($proses)."milyar ";
 }
}


function terbilang($rp)
{
 $kata = "";
 $rp = trim($rp);
 if (strlen($rp) >= 10)
 {
  $angka = substr($rp, strlen($rp)-10, -9);
  $kata = $kata.milyaran($angka);
 }
 $tambahan = "";
 if (strlen($rp) >= 9)
 {
  $angka = substr($rp, strlen($rp)-9, -8);
  $kata = $kata.ratusan($angka);
  if ($angka > 0) { $tambahan = "juta "; }
 }
 if (strlen($rp) >= 8)
 {
  $angka = substr($rp, strlen($rp)-8, -7);
  $angka1 = substr($rp, strlen($rp)-7, -6);
  if (($angka == 1) && ($angka1 > 0))
  {
   $angka = substr($rp, strlen($rp)-8, -6);
   //echo " belasan".($angka)." ";
   $kata = $kata.belasan($angka)."juta ";
  }
  else
  {
   $angka = substr($rp, strlen($rp)-8, -7);
   //echo " puluhan".($angka)." ";
   $kata = $kata.puluhan($angka);
   if ($angka > 0) { $tambahan = "juta "; }
   
   $angka = substr($rp, strlen($rp)-7, -6);
   //echo " ribuan".($angka)." ";
   $kata = $kata.ribuan($angka);
   if ($angka == 0) { $kata = $kata.$tambahan; }
  } 
 }
 if (strlen($rp) == 7)
 {
  $angka = substr($rp, strlen($rp)-7, -6);
  $kata = $kata.jutaan($angka);
  if ($angka == 0) { $kata = $kata.$tambahan; }
 }
 $tambahan = "";
 if (strlen($rp) >= 6)
 {
  $angka = substr($rp, strlen($rp)-6, -5);
  $kata = $kata.ratusan($angka);
  if ($angka > 0) { $tambahan = "ribu "; }
 }
 if (strlen($rp) >= 5)
 {
  $angka = substr($rp, strlen($rp)-5, -4);
  $angka1 = substr($rp, strlen($rp)-4, -3);
  if (($angka == 1) && ($angka1 > 0))
  {
   $angka = substr($rp, strlen($rp)-5, -3);
   //echo " belasan".($angka)." ";
   $kata = $kata.belasan($angka)."ribu ";
  }
  else
  {
   $angka = substr($rp, strlen($rp)-5, -4);
   //echo " puluhan".($angka)." ";
   $kata = $kata.puluhan($angka);
   if ($angka > 0) { $tambahan = "ribu "; }
   
   $angka = substr($rp, strlen($rp)-4, -3);
   //echo " ribuan".($angka)." ";
   $kata = $kata.ribuan($angka);
   if ($angka == 0) { $kata = $kata.$tambahan; }
  }
 }
 if (strlen($rp) == 4)
 {
  $angka = substr($rp, strlen($rp)-4, -3);
  //echo " ribuan".($angka)." ";
  $kata = $kata.ribuan($angka);
  if ($angka == 0) { $kata = $kata.$tambahan; }
 }
 if (strlen($rp) >= 3)
 {
  $angka = substr($rp, strlen($rp)-3, -2);
  //echo " ratusan".($angka)." ";
  $kata = $kata.ratusan($angka);
 }
 if (strlen($rp) >= 2)
 {
  $angka = substr($rp, strlen($rp)-2, -1);
  $angka1 = substr($rp, strlen($rp)-1);
  if (($angka == 1) && ($angka1 > 0))
  {
   $angka = substr($rp, strlen($rp)-2);
   //echo " belasan".($angka)." ";
   $kata = $kata.belasan($angka);
  }
  else
  {
   //echo " puluhan".($angka)." ";
   $kata = $kata.puluhan($angka);
   
   $angka = substr($rp, strlen($rp)-1);
   //echo " satuan".($angka)." ";
   $kata = $kata.satuan($angka);
  }
 }
 if (strlen($rp) == 1)
 {
  $angka = substr($rp, strlen($rp)-1);
  //echo " satuan".($angka)." ";
  $kata = $kata.satuan($angka);
 }
 return $kata;
}
function shortdateformat($tgl)
{
 if (($tgl == "") || ($tgl == '0000-00-00'))
 {
  return "";
 }
 else
 {
  return date('d/m/Y',strtotime($tgl));
 }
}
  
function randomPrefix($length)
{
$random= "";
srand((double)microtime()*1000000);
 
$data = "AbcDE123IJKLMN67QRSTUVWXYZ434534356etdtdtdtgMGHRTYGD";
$data .= "aBCdefghijklmn123opq45rs67tuv89wxyz";
$data .= "0FGH45OP89";
 
for($i = 0; $i < $length; $i++)
{
$random .= substr($data, (rand()%(strlen($data))), 1);
}
 
return $random;
}
$reg=randomPrefix(15);
?>

<?php
function formatRupiah($angka){
 $rupiah=number_format($angka,0,',','.');
 return $rupiah;
}
?>
<?php 
$bulan=$_SESSION['bulan'];
$tahun=$_SESSION['tahun'];
//module utama
if ($_GET['module']=='home'){
	include 'home.php';
}
else if($_GET['module']=='homebase'){
	include 'home_base.php';
}
else if($_GET['module']=='Setting'){
	include 'index_setting.php';
}
else if($_GET['module']=='Transaksi'){
	include 'index_transaksi.php';
}
else if($_GET['module']=='Report'){
	include 'index_report.php';
}
//module_report
else if($_GET['module']=='unit'){
	include 'index_report.php';
}
else if($_GET['module']=='kas'){
	include 'index_report.php';
}
else if($_GET['module']=='kas_unit'){
	include 'index_report.php';
}
else if($_GET['module']=='akb_unit'){
	include 'index_report.php';
}
else if($_GET['module']=='bank'){
	include 'index_report.php';
}
else if($_GET['module']=='bank_unit'){
	include 'index_report.php';
}
else if($_GET['module']=='bb_bank'){
	include 'index_report.php';
}
else if($_GET['module']=='deposito'){
	include 'index_report.php';
}
else if($_GET['module']=='bb_depo'){
	include 'index_report.php';
}
else if($_GET['module']=='index_pdp'){
	include 'index_report.php';
}
else if($_GET['module']=='rnc_pdp'){
	include 'index_report.php';
}
else if($_GET['module']=='index_pnl'){
	include 'index_report.php';
}
else if($_GET['module']=='rnc_pnl'){
	include 'index_report.php';
}
else if($_GET['module']=='bb_akun'){
	include 'index_report.php';
}
else if($_GET['module']=='bb_perkir'){
	include 'index_report.php';
}
else if($_GET['module']=='bb_akun_pnl'){
	include 'index_report.php';
}
else if($_GET['module']=='bb_perkir_pnl'){
	include 'index_report.php';
}
else if($_GET['module']=='aktiva'){
	include 'index_report.php';
}
else if($_GET['module']=='index_hutang'){
	include 'index_report.php';
}
else if($_GET['module']=='bb_hutang_perkir'){
	include 'index_report.php';
}
else if($_GET['module']=='bb_hutang'){
	include 'index_report.php';
}
else if($_GET['module']=='bb_aktiva_perkir'){
	include 'index_report.php';
}
else if($_GET['module']=='bb_aktiva'){
	include 'index_report.php';
}
else if($_GET['module']=='ekuitas'){
	include 'index_report.php';
}
else if($_GET['module']=='akb'){
	include 'index_report.php';
}
else if($_GET['module']=='piutang'){
	include 'index_report.php';
}
else if($_GET['module']=='persediaan'){
	include 'index_report.php';
}
else if($_GET['module']=='bdd'){
	include 'index_report.php';
}
else if($_GET['module']=='print'){
	include 'index_report.php';
}
else if($_GET['module']=='la_rug'){
	include 'index_report.php';
}
else if($_GET['module']=='labarug_unit'){
	include 'index_report.php';
}
else if($_GET['module']=='neraca'){
	include 'index_report.php';
}
else if($_GET['module']=='neraca_unit'){
	include 'index_report.php';
}
else if($_GET['module']=='investasi'){
	include 'index_report.php';
}
else if($_GET['module']=='realisasi'){
	include 'index_report.php';
}
//module_setting
else if($_GET['module']=='open_konsol'){
	include 'index_setting.php';
}
else if($_GET['module']=='rab'){
	include 'index_setting.php';
}
else if($_GET['module']=='rab_pick'){
	include 'index_setting.php';
}
else if($_GET['module']=='hapus_rab'){
	include 'index_setting.php';
}
else if($_GET['module']=='daftar_akun'){
	include 'index_setting.php';
}
else if($_GET['module']=='cakupan'){
	include 'index_setting.php';
}
else if($_GET['module']=='update'){
	include 'index_setting.php';
}
else if($_GET['module']=='bank_account'){
	include 'index_setting.php';
}
else if($_GET['module']=='depo_account'){
	include 'index_setting.php';
}
else if($_GET['module']=='nca'){
	include 'index_setting.php';
}
else if($_GET['module']=='set_aktiva'){
	include 'index_setting.php';
}
else if($_GET['module']=='saldo_awal_bank'){
	include 'index_setting.php';
}
else if($_GET['module']=='saldo_awal_depo'){
	include 'index_setting.php';
}
else if($_GET['module']=='account_user'){
	include 'index_setting.php';
}
else if($_GET['module']=='tambahuser'){
	include 'index_setting.php';
}
else if($_GET['module']=='edit_user'){
	include 'index_setting.php';
}
else if($_GET['module']=='edit_user_pusat'){
	include 'index_setting.php';
}
else if($_GET['module']=='proses_update_user'){
	include 'index_setting.php';
}
else if($_GET['module']=='update_neraca'){
	include 'index_setting.php';
}
else if($_GET['module']=='rtext'){
	include 'index_setting.php';
}
else if($_GET['module']=='hapus_rtext'){
	include 'index_setting.php';
}
//transaksi
else if($_GET['module']=='jupdp_kas'){
	include 'index_transaksi.php';
}
else if($_GET['module']=='jupdp_kas_pick'){
	include 'index_transaksi.php';
}
else if($_GET['module']=='jupnl_kas'){
	include 'index_transaksi.php';
}
else if($_GET['module']=='jupnl_kas_pick'){
	include 'index_transaksi.php';
}
else if($_GET['module']=='jupdp_bank_rek'){
	include 'index_transaksi.php';
}
else if($_GET['module']=='jupdp_bank'){
	include 'index_transaksi.php';
}
else if($_GET['module']=='jupdp_bank_pick'){
	include 'index_transaksi.php';
}
else if($_GET['module']=='jupnl_bank_rek'){
	include 'index_transaksi.php';
}
else if($_GET['module']=='jupnl_bank'){
	include 'index_transaksi.php';
}
else if($_GET['module']=='jupnl_bank_pick'){
	include 'index_transaksi.php';
}
else if($_GET['module']=='lr'){
	include 'index_transaksi.php';
}
else if($_GET['module']=='ju'){
	include 'index_transaksi.php';
}
else if($_GET['module']=='ju_pick'){
	include 'index_transaksi.php';
}
else if($_GET['module']=='rekap'){
	include 'index_transaksi.php';
}
else if($_GET['module']=='tb'){
	include 'index_transaksi.php';
}
//proses
else if($_GET['module']=='proses_trn'){
	include 'index_transaksi.php';
}
else if($_GET['module']=='view_proses_pdp'){
	include 'index_transaksi.php';
}
else if($_GET['module']=='view_proses_pnl'){
	include 'index_transaksi.php';
}
else if($_GET['module']=='proses_trn_bank'){
	include 'index_transaksi.php';
}
else if($_GET['module']=='view_proses_trn_bank'){
	include 'index_transaksi.php';
}
else if($_GET['module']=='view_proses_trn_bank_pnl'){
	include 'index_transaksi.php';
}
else if($_GET['module']=='hapus_trn'){
	include 'index_transaksi.php';
}
else if($_GET['module']=='hapus_trn_bank'){
	include 'index_transaksi.php';
}
else if($_GET['module']=='hapus_user'){
	include 'index_setting.php';
}
else if($_GET['module']=='proses_ju'){
	include 'index_transaksi.php';
}
else if($_GET['module']=='nca_percob'){
	include 'index_transaksi.php';
}
//pusat
else if($_GET['module']=='show'){
	include 'index_home.php';
}
else if($_GET['module']=='show_nrc'){
	include 'index_setting.php';
}
else if($_GET['module']=='show_aktiva'){
	include 'index_setting.php';
}
else if($_GET['module']=='okey'){
	include 'index_setting.php';
}
else if($_GET['module']=='hapus_key'){
	include 'index_setting.php';
}
else if($_GET['module']=='show_kas'){
	include 'index_report.php';
}
else if($_GET['module']=='show_bank'){
	include 'index_report.php';
}
else if($_GET['module']=='show_depo'){
	include 'index_report.php';
}
else if($_GET['module']=='bb_akun_all'){
	include 'index_report.php';
}
else if($_GET['module']=='bb_perkir_all'){
	include 'index_report.php';
}
else if($_GET['module']=='bb_akun_pnl_all'){
	include 'index_report.php';
}
else if($_GET['module']=='bb_perkir_pnl_all'){
	include 'index_report.php';
}
else if($_GET['module']=='show_aktiva_now'){
	include 'index_report.php';
}
else if($_GET['module']=='show_index_pdp'){
	include 'index_report.php';
}
else if($_GET['module']=='show_index_pnl'){
	include 'index_report.php';
}
else if($_GET['module']=='show_rnc_pdp'){
	include 'index_report.php';
}
else if($_GET['module']=='show_rnc_pnl'){
	include 'index_report.php';
}
else if($_GET['module']=='show_hutang'){
	include 'index_report.php';
}
else if($_GET['module']=='bb_hutang_perkir'){
	include 'index_report.php';
}
else if($_GET['module']=='bb_hutang_perkir_all'){
	include 'index_report.php';
}
else if($_GET['module']=='bb_hutang_all'){
	include 'index_report.php';
}
else if($_GET['module']=='show_piutang'){
	include 'index_report.php';
}
else if($_GET['module']=='show_ekuitas'){
	include 'index_report.php';
}
else if($_GET['module']=='show_persediaan'){
	include 'index_report.php';
}
else if($_GET['module']=='show_bdd'){
	include 'index_report.php';
}
else if($_GET['module']=='show_inves'){
	include 'index_report.php';
}
else if($_GET['module']=='show_akb'){
	include 'index_report.php';
}
else if($_GET['module']=='show_lr'){
	include 'index_report.php';
}
else if($_GET['module']=='bb_aktiva_all'){
	include 'index_report.php';
}
else if($_GET['module']=='bb_aktiva_perkir_all'){
	include 'index_report.php';
}
else if($_GET['module']=='konsolidasi'){
	include 'index_report.php';
}
else if($_GET['module']=='bbpdp_perkir_konsol'){
	include 'index_report.php';
}
else if($_GET['module']=='bbpdp_akun_konsol'){
	include 'index_report.php';
}
else if($_GET['module']=='bbpnl_perkir_konsol'){
	include 'index_report.php';
}
else if($_GET['module']=='bbpnl_akun_konsol'){
	include 'index_report.php';
}
else if($_GET['module']=='kas_konsol'){
	include 'index_report.php';
}
else if($_GET['module']=='bank_konsol'){
	include 'index_report.php';
}
else if($_GET['module']=='depo_konsol'){
	include 'index_report.php';
}
else if($_GET['module']=='bb_akun_konsol'){
	include 'index_report.php';
}
else if($_GET['module']=='bb_akun_konsol2'){
	include 'index_report.php';
}
else if($_GET['module']=='bb_akun_konsol3'){
	include 'index_report.php';
}
else if($_GET['module']=='rtext'){
	include 'index_setting.php';
}//exit
else if($_GET['module']=='Exit'){
	include 'logout.php';
}
else{
	echo "-";
}
?>