<script type="text/javascript" src="js/jquery-2.1.4.min.js"></script>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO rab_tb (akun, perkiraan, kode, nominal, keterangan, bln_terapan, januari, februari, maret, april, mei, juni, juli, agustus, september, oktober, november, desember, thn_ajuan, jenis) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['akun'], "text"),
                       GetSQLValueString($_POST['perkiraan'], "text"),
                       GetSQLValueString($_POST['kode'], "text"),
                       GetSQLValueString($_POST['nominal'], "text"),
                       GetSQLValueString($_POST['keterangan'], "text"),
                       GetSQLValueString($_POST['bln_terapan'], "text"),
                       GetSQLValueString(isset($_POST['januari']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString(isset($_POST['februari']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString(isset($_POST['maret']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString(isset($_POST['april']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString(isset($_POST['mei']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString(isset($_POST['juni']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString(isset($_POST['juli']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString(isset($_POST['agustus']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString(isset($_POST['september']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString(isset($_POST['oktober']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString(isset($_POST['november']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString(isset($_POST['desember']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString($_POST['thn_ajuan'], "text"),
                       GetSQLValueString($_POST['jenis'], "text"));

  mysql_select_db($database_sistem, $sistem);
  $Result1 = mysql_query($insertSQL, $sistem) or die(mysql_error());
}

mysql_select_db($database_sistem, $sistem);
$query_rab = "SELECT * FROM rab_tb where kode='$_SESSION[kode]' and thn_ajuan='$_SESSION[tahun]' and jenis='Pendapatan' group by perkiraan asc";
$rab = mysql_query($query_rab, $sistem) or die(mysql_error());
$row_rab = mysql_fetch_assoc($rab);
$totalRows_rab = mysql_num_rows($rab);

mysql_select_db($database_sistem, $sistem);
$query_rabpnl = "SELECT * FROM rab_tb where kode='$_SESSION[kode]' and thn_ajuan='$_SESSION[tahun]' and jenis='Pengeluaran' group by perkiraan asc";
$rabpnl = mysql_query($query_rabpnl, $sistem) or die(mysql_error());
$row_rabpnl = mysql_fetch_assoc($rabpnl);
$totalRows_rabpnl = mysql_num_rows($rabpnl);
?>

        <style>
* {
  box-sizing: border-box;
}

#myInput {
  background-image: url('/css/searchicon.png');
  background-position: 10px 10px;
  background-repeat: no-repeat;
  width: 100%;
  font-size: 16px;
  padding: 12px 20px 12px 40px;
  border: 1px solid #ddd;
  margin-bottom: 5px;
}

#myTable {
  border-collapse: collapse;
  width: 100%;
  border: 0px solid #ddd;
  font-size: 12px;
}

#myTable th, #myTable td {
  text-align: left;
  padding: 4px;
}

#myTable tr {
  border-bottom: 0px solid #ddd;
}

#myTable tr.header, #myTable tr:hover {
  background-color: #f1f1f1;
}
      </style>
        <style>
* {
  box-sizing: border-box;
}

#myInput3 {
  background-image: url('/css/searchicon.png');
  background-position: 10px 10px;
  background-repeat: no-repeat;
  width: 100%;
  font-size: 16px;
  padding: 12px 20px 12px 40px;
  border: 1px solid #ddd;
  margin-bottom: 5px;
}

#myTable3 {
  border-collapse: collapse;
  width: 100%;
  border: 0px solid #ddd;
  font-size: 12px;
}

#myTable3 th, #myTable3 td {
  text-align: left;
  padding: 4px;
}

#myTable3 tr {
  border-bottom: 0px solid #ddd;
}

#myTable3 tr.header, #myTable3 tr:hover {
  background-color: #f1f1f1;
}
      </style>
<table width="100%">
  <tr>
    <td width="30" colspan="2" valign="top"><table width="100%">
      <tr valign="middle">
        <td width="335"><h3><span style="color:#033"><a href="?section=Setting&module=print&amp;bb=rab_realisasi"><img src="images/cetak1.png" width="41" height="32" /></a>Realisasi Rencana Anggaran Pendapatan dan Belanja</span></h3></td>
      </tr>
  </table></td>
  </tr>
  <tr>
    <td colspan="2" valign="top"><hr /></td>
  </tr>
  <tr>
    <td colspan="2" valign="top">
      <p>

        <input type="text" id="myInput" onkeyup="myFunction()" placeholder="mencari berdasarkan akun..." title="Type in akun" />
      </p>
      <table id="myTable" border="0" cellpadding="2" cellspacing="2">
        <tr class="">
          <td width="5" rowspan="2">No</td>
          <td width="10" rowspan="2">Akun</td>
          <td width="10" rowspan="2">Perkiraan</td>
          <td colspan="2">Januari</td>
          <td colspan="2">Februari</td>
          <td colspan="2">Maret</td>
          <td colspan="2">April</td>
          <td colspan="2">Mei</td>
          <td colspan="2">Juni</td>
          <td colspan="2">Juli</td>
          <td colspan="2">Agustus</td>
          <td colspan="2">September</td>
          <td colspan="2">Oktober</td>
          <td colspan="2">November</td>
          <td colspan="2">Desember</td>
          <td colspan="2">Total</td>
          <td width="10" rowspan="2">Tahun</td>
        </tr>
        <tr>
          <td align="center">RAB</td>
          <td align="center">Realisasi</td>
          <td align="center">RAB</td>
          <td align="center">Realisasi</td>
          <td align="center">RAB</td>
          <td align="center">Realisasi</td>
          <td align="center">RAB</td>
          <td align="center">Realisasi</td>
          <td align="center">RAB</td>
          <td align="center">Realisasi</td>
          <td align="center">RAB</td>
          <td align="center">Realisasi</td>
          <td align="center">RAB</td>
          <td align="center">Realisasi</td>
          <td align="center">RAB</td>
          <td align="center">Realisasi</td>
          <td align="center">RAB</td>
          <td align="center">Realisasi</td>
          <td align="center">RAB</td>
          <td align="center">Realisasi</td>
          <td align="center">RAB</td>
          <td align="center">Realisasi</td>
          <td align="center">RAB</td>
          <td align="center">Realisasi</td>
          <td>RAB</td>
          <td>Realisasi</td>
        </tr>
        <?php
		$total_1=0;
		$total_2=0;
		$total_3=0;
		$total_4=0;
		$total_5=0;
		$total_6=0;
		$total_7=0;
		$total_8=0;
		$total_9=0;
		$total_10=0;
		$total_11=0;
		$total_12=0;
		$i=1;
		 do { 
		 $jan=$row_rab['januari']*$row_rab['nominal'];
		 $feb=$row_rab['februari']*$row_rab['nominal'];
		 $mar=$row_rab['maret']*$row_rab['nominal'];
		 $april=$row_rab['april']*$row_rab['nominal'];
		 $mei=$row_rab['mei']*$row_rab['nominal'];
		 $jun=$row_rab['juni']*$row_rab['nominal'];
		 $jul=$row_rab['juli']*$row_rab['nominal'];
		 $ags=$row_rab['agustus']*$row_rab['nominal'];
		 $sep=$row_rab['september']*$row_rab['nominal'];
		 $okt=$row_rab['oktober']*$row_rab['nominal'];
		 $nov=$row_rab['november']*$row_rab['nominal'];
		 $des=$row_rab['desember']*$row_rab['nominal'];
		 $total_1=$total_1+$jan;
		 $total_2=$total_2+$feb;
		 $total_3=$total_3+$mar;
		 $total_4=$total_4+$april;
		 $total_5=$total_5+$mei;
		 $total_6=$total_6+$jun;
		 $total_7=$total_7+$jul;
		 $total_8=$total_8+$ags;
		 $total_9=$total_9+$sep;
		 $total_10=$total_10+$okt;
		 $total_11=$total_11+$nov;
		 $total_12=$total_12+$des;
		 ?>
        <tr>
          <td><?php $jenis='Pendapatan'; echo $i; ?></td>
          <td><?php echo $row_rab['akun']; ?></td>
          <td><?php echo $row_rab['perkiraan']; ?></td>
          <?php include 'module/_report/januari.php';?>
          <td><?php 		
			echo formatRupiah($row_rab1['rab']); ?></td>
          <td bgcolor="<?php if($row_rab1['rab']<$row_saldojan['nomin']){
			  echo"#FFFF00";
		  }else{
			  echo "";
		  }?>"><?php echo formatRupiah($row_saldojan['nomin']);?></td>
          <?php include 'module/_report/februari.php';?>
          <td><?php 		
			echo formatRupiah($row_rab2['rab']); ?></td>
          <td bgcolor="<?php if($row_rab2['rab']<$row_saldofeb['nomin']){
			  echo"#FFFF00";
		  }else{
			  echo "";
		  }?>"><?php echo formatRupiah($row_saldofeb['nomin']);?></td>
          <?php include 'module/_report/maret.php';?>
          <td><?php 
				echo formatRupiah($row_rab3['rab']); ?></td>
          <td bgcolor="<?php if($row_rab3['rab']<$row_saldomar['nomin']){
			  echo"#FFFF00";
		  }else{
			  echo "";
		  }?>"><?php echo formatRupiah($row_saldomar['nomin']);?></td>
          <?php include 'module/_report/april.php';?>
          <td><?php 
				echo formatRupiah($row_rab4['rab']); ?></td>
          <td bgcolor="<?php if($row_rab4['rab']<$row_saldoap['nomin']){
			  echo"#FFFF00";
		  }else{
			  echo "";
		  }?>"><?php echo formatRupiah($row_saldoap['nomin']);?></td>
          <?php include 'module/_report/mei.php';?>
          <td><?php 
				echo formatRupiah($row_rab5['rab']); ?></td>
          <td bgcolor="<?php if($row_rab5['rab']<$row_saldomei['nomin']){
			  echo"#FFFF00";
		  }else{
			  echo "";
		  }?>"><?php echo formatRupiah($row_saldomei['nomin']);?></td>
          <?php include 'module/_report/juni.php';?>
          <td><?php 
				echo formatRupiah($row_rab6['rab']); ?></td>
          <td bgcolor="<?php if($row_rab6['rab']<$row_saldojun['nomin']){
			  echo"#FFFF00";
		  }else{
			  echo "";
		  }?>"><?php echo formatRupiah($row_saldojun['nomin']);?></td>
          <?php include 'module/_report/juli.php';?>
          <td><?php 
				echo formatRupiah($row_rab7['rab']); ?></td>
          <td bgcolor="<?php if($row_rab7['rab']<$row_saldojul['nomin']){
			  echo"#FFFF00";
		  }else{
			  echo "";
		  }?>"><?php echo formatRupiah($row_saldojul['nomin']);?></td>
          <?php include 'module/_report/agustus.php';?>
          <td><?php 
				echo formatRupiah($row_rab8['rab']); ?></td>
          <td bgcolor="<?php if($row_rab8['rab']<$row_saldoag['nomin']){
			  echo"#FFFF00";
		  }else{
			  echo "";
		  }?>"><?php echo formatRupiah($row_saldoag['nomin']);?></td>
          <?php include 'module/_report/september.php';?>
          <td><?php 
				echo formatRupiah($row_rab9['rab']);?></td>
          <td bgcolor="<?php if($row_rab9['rab']<$row_saldosep['nomin']){
			  echo"#FFFF00";
		  }else{
			  echo "";
		  }?>"><?php echo formatRupiah($row_saldosep['nomin']);?></td>
          <?php include 'module/_report/oktober.php';?>
          <td><?php 
				echo formatRupiah($row_rab10['rab']); ?></td>
          <td bgcolor="<?php if($row_rab10['rab']<$row_saldook['nomin']){
			  echo"#FFFF00";
		  }else{
			  echo "";
		  }?>"><?php echo formatRupiah($row_saldook['nomin']);?></td>
          <?php include 'module/_report/november.php';?>
          <td><?php 
				echo formatRupiah($row_rab11['rab']); ?></td>
          <td bgcolor="<?php if($row_rab11['rab']<$row_saldonov['nomin']){
			  echo"#FFFF00";
		  }else{
			  echo "";
		  }?>"><?php echo formatRupiah($row_saldonov['nomin']);?></td>
          <?php include 'module/_report/desember.php';?>
          <td><?php 
				echo formatRupiah($row_rab12['rab']); ?></td>
          <td bgcolor="<?php if($row_rab12['rab']<$row_saldodes['nomin']){
			  echo"#FFFF00";
		  }else{
			  echo "";
		  }?>"><?php echo formatRupiah($row_saldodes['nomin']);?></td>
          <td><?php
            $ttl=$row_rab1['rab']+$row_rab2['rab']+$row_rab3['rab']+$row_rab4['rab']+$row_rab5['rab']+$row_rab6['rab']+$row_rab7['rab']+$row_rab8['rab']+$row_rab9['rab']+$row_rab10['rab']+$row_rab11['rab']+$row_rab12['rab'];
			echo formatRupiah($ttl);?></td>
          <td bgcolor="<?php
		  $ttl_real=$row_saldojan['nomin']+$row_saldofeb['nomin']+$row_saldomar['nomin']+$row_saldoap['nomin']+$row_saldomei['nomin']+$row_saldojun['nomin']+$row_saldojul['nomin']+$row_saldoag['nomin']+$row_saldosep['nomin']+$row_saldook['nomin']+$row_saldonov['nomin']+$row_saldodes['nomin'];
		   if($ttl<$ttl_real){
			  echo"#00CC00";
		  }else{
			  echo "#FFFF00";
		  }?>"><?php
            $ttl_real=$row_saldojan['nomin']+$row_saldofeb['nomin']+$row_saldomar['nomin']+$row_saldoap['nomin']+$row_saldomei['nomin']+$row_saldojun['nomin']+$row_saldojul['nomin']+$row_saldoag['nomin']+$row_saldosep['nomin']+$row_saldook['nomin']+$row_saldonov['nomin']+$row_saldodes['nomin'];
			echo formatRupiah($ttl_real);?></td>
          <td><?php echo $row_rab['thn_ajuan']; ?></td>
        </tr>
        <?php 
		$i++;
		} while ($row_rab = mysql_fetch_assoc($rab)); ?>
        <tr>
        <?php 
		include 'module/_report/ttl_januari.php';
		include 'module/_report/ttl_februari.php';
		include 'module/_report/ttl_maret.php';
		include 'module/_report/ttl_april.php';
		include 'module/_report/ttl_mei.php';
		include 'module/_report/ttl_juni.php';
		include 'module/_report/ttl_juli.php';
		include 'module/_report/ttl_agustus.php';
		include 'module/_report/ttl_september.php';
		include 'module/_report/ttl_oktober.php';
		include 'module/_report/ttl_november.php';
		include 'module/_report/ttl_desember.php';
		
		?>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td><?php echo formatRupiah($row_ttl_jan['rab']);?></td>
          <td>&nbsp;</td>
          <td><?php echo formatRupiah($row_ttl_feb['rab']);?></td>
          <td>&nbsp;</td>
          <td><?php echo formatRupiah($row_ttl_mar['rab']);?></td>
          <td>&nbsp;</td>
          <td><?php echo formatRupiah($row_ttl_ap['rab']);?></td>
          <td>&nbsp;</td>
          <td><?php echo formatRupiah($row_ttl_mei['rab']);?></td>
          <td>&nbsp;</td>
          <td><?php echo formatRupiah($row_ttl_jun['rab']);?></td>
          <td>&nbsp;</td>
          <td><?php echo formatRupiah($row_ttl_jul['rab']);?></td>
          <td>&nbsp;</td>
          <td><?php echo formatRupiah($row_ttl_ag['rab']);?></td>
          <td>&nbsp;</td>
          <td><?php echo formatRupiah($row_ttl_sep['rab']);?></td>
          <td>&nbsp;</td>
          <td><?php echo formatRupiah($row_ttl_ok['rab']);?></td>
          <td>&nbsp;</td>
          <td><?php echo formatRupiah($row_ttl_nov['rab']);?></td>
          <td>&nbsp;</td>
          <td><?php echo formatRupiah($row_ttl_des['rab']);?></td>
          <td>&nbsp;</td>
          <td><?php
            $ttl_pdp=$total_1+$total_2+$total_3+$total_4+$total_5+$total_6+$total_7+$total_8+$total_9+$total_10+$total_11+$total_12;
			echo formatRupiah($ttl_pdp);?></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
      </table>
      <p>
        <script>
function myFunction() {
  var input, filter, table, tr, td, i, txtValue;
  input = document.getElementById("myInput");
  filter = input.value.toUpperCase();
  table = document.getElementById("myTable");
  tr = table.getElementsByTagName("tr");
  for (i = 0; i < tr.length; i++) {
    td = tr[i].getElementsByTagName("td")[1];
    if (td) {
      txtValue = td.textContent || td.innerText;
      if (txtValue.toUpperCase().indexOf(filter) > -1) {
        tr[i].style.display = "";
      } else {
        tr[i].style.display = "none";
      }
    }       
  }
}
        </script>
      </p>
      <p>
        <style>
* {
  box-sizing: border-box;
}

#myInput2 {
  background-image: url('/css/searchicon.png');
  background-position: 10px 10px;
  background-repeat: no-repeat;
  width: 100%;
  font-size: 16px;
  padding: 12px 20px 12px 40px;
  border: 1px solid #ddd;
  margin-bottom: 5px;
}

#myTable2 {
  border-collapse: collapse;
  width: 100%;
  border: 0px solid #ddd;
  font-size: 12px;
}

#myTable2 th, #myTable2 td {
  text-align: left;
  padding: 4px;
}

#myTable2 tr {
  border-bottom: 0px solid #ddd;
}

#myTable2 tr.header, #myTable2 tr:hover {
  background-color: #f1f1f1;
}
        </style>
        <input type="text" id="myInput2" onkeyup="myFunction2()" placeholder="mencari berdasarkan akun..." title="Type in akun" />
      </p>
      </p>
      <table id="myTable2" border="0" cellpadding="2" cellspacing="2">
        <tr class="">
          <td width="5" rowspan="2">No</td>
          <td width="10" rowspan="2">Akun</td>
          <td width="10" rowspan="2">Perkiraan</td>
          <td colspan="2">Januari</td>
          <td colspan="2">Februari</td>
          <td colspan="2">Maret</td>
          <td colspan="2">April</td>
          <td colspan="2">Mei</td>
          <td colspan="2">Juni</td>
          <td colspan="2">Juli</td>
          <td colspan="2">Agustus</td>
          <td colspan="2">September</td>
          <td colspan="2">Oktober</td>
          <td colspan="2">November</td>
          <td colspan="2">Desember</td>
          <td colspan="2">Total</td>
          <td width="10" rowspan="2">Tahun</td>
        </tr>
        <tr>
          <td align="center">RAB</td>
          <td align="center">Realisasi</td>
          <td align="center">RAB</td>
          <td align="center">Realisasi</td>
          <td align="center">RAB</td>
          <td align="center">Realisasi</td>
          <td align="center">RAB</td>
          <td align="center">Realisasi</td>
          <td align="center">RAB</td>
          <td align="center">Realisasi</td>
          <td align="center">RAB</td>
          <td align="center">Realisasi</td>
          <td align="center">RAB</td>
          <td align="center">Realisasi</td>
          <td align="center">RAB</td>
          <td align="center">Realisasi</td>
          <td align="center">RAB</td>
          <td align="center">Realisasi</td>
          <td align="center">RAB</td>
          <td align="center">Realisasi</td>
          <td align="center">RAB</td>
          <td align="center">Realisasi</td>
          <td align="center">RAB</td>
          <td align="center">Realisasi</td>
          <td>RAB</td>
          <td>Realisasi</td>
        </tr>
        <?php
		$total_1=0;
		$total_2=0;
		$total_3=0;
		$total_4=0;
		$total_5=0;
		$total_6=0;
		$total_7=0;
		$total_8=0;
		$total_9=0;
		$total_10=0;
		$total_11=0;
		$total_12=0;
		$i=1;
		 do { 
		 $jan=$row_rabpnl['januari']*$row_rabpnl['nominal'];
		 $feb=$row_rabpnl['februari']*$row_rabpnl['nominal'];
		 $mar=$row_rab['maret']*$row_rabpnl['nominal'];
		 $april=$row_rabpnl['april']*$row_rabpnl['nominal'];
		 $mei=$row_rabpnl['mei']*$row_rabpnl['nominal'];
		 $jun=$row_rabpnl['juni']*$row_rabpnl['nominal'];
		 $jul=$row_rabpnl['juli']*$row_rabpnl['nominal'];
		 $ags=$row_rabpnl['agustus']*$row_rabpnl['nominal'];
		 $sep=$row_rabpnl['september']*$row_rabpnl['nominal'];
		 $okt=$row_rabpnl['oktober']*$row_rabpnl['nominal'];
		 $nov=$row_rabpnl['november']*$row_rabpnl['nominal'];
		 $des=$row_rabpnl['desember']*$row_rabpnl['nominal'];
		 $total_1=$total_1+$jan;
		 $total_2=$total_2+$feb;
		 $total_3=$total_3+$mar;
		 $total_4=$total_4+$april;
		 $total_5=$total_5+$mei;
		 $total_6=$total_6+$jun;
		 $total_7=$total_7+$jul;
		 $total_8=$total_8+$ags;
		 $total_9=$total_9+$sep;
		 $total_10=$total_10+$okt;
		 $total_11=$total_11+$nov;
		 $total_12=$total_12+$des;
		 ?>
        <tr>
          <td><?php $jenis='Pengeluaran'; echo $i; ?></td>
          <td><?php echo $row_rabpnl['akun']; ?></td>
          <td><?php echo $row_rabpnl['perkiraan']; ?></td>
          <?php include 'module/_report/januari.php';?>
          <td><?php 		
			echo formatRupiah($row_rab1['rab']); ?></td>
          <td bgcolor="<?php if($row_rab1['rab']<$row_saldojan['nomin']){
			  echo"#FFFF00";
		  }else{
			  echo "";
		  }?>"><?php echo formatRupiah($row_saldojan['nomin']);?></td>
          <?php include 'module/_report/februari.php';?>
          <td><?php 		
			echo formatRupiah($row_rab2['rab']); ?></td>
          <td bgcolor="<?php if($row_rab2['rab']<$row_saldofeb['nomin']){
			  echo"#FFFF00";
		  }else{
			  echo "";
		  }?>"><?php echo formatRupiah($row_saldofeb['nomin']);?></td>
          <?php include 'module/_report/maret.php';?>
          <td><?php 
				echo formatRupiah($row_rab3['rab']); ?></td>
          <td bgcolor="<?php if($row_rab3['rab']<$row_saldomar['nomin']){
			  echo"#FFFF00";
		  }else{
			  echo "";
		  }?>"><?php echo formatRupiah($row_saldomar['nomin']);?></td>
          <?php include 'module/_report/april.php';?>
          <td><?php 
				echo formatRupiah($row_rab4['rab']); ?></td>
          <td bgcolor="<?php if($row_rab4['rab']<$row_saldoap['nomin']){
			  echo"#FFFF00";
		  }else{
			  echo "";
		  }?>"><?php echo formatRupiah($row_saldoap['nomin']);?></td>
          <?php include 'module/_report/mei.php';?>
          <td><?php 
				echo formatRupiah($row_rab5['rab']); ?></td>
          <td bgcolor="<?php if($row_rab5['rab']<$row_saldomei['nomin']){
			  echo"#FFFF00";
		  }else{
			  echo "";
		  }?>"><?php echo formatRupiah($row_saldomei['nomin']);?></td>
          <?php include 'module/_report/juni.php';?>
          <td><?php 
				echo formatRupiah($row_rab6['rab']); ?></td>
          <td bgcolor="<?php if($row_rab6['rab']<$row_saldojun['nomin']){
			  echo"#FFFF00";
		  }else{
			  echo "";
		  }?>"><?php echo formatRupiah($row_saldojun['nomin']);?></td>
          <?php include 'module/_report/juli.php';?>
          <td><?php 
				echo formatRupiah($row_rab7['rab']); ?></td>
          <td bgcolor="<?php if($row_rab7['rab']<$row_saldojul['nomin']){
			  echo"#FFFF00";
		  }else{
			  echo "";
		  }?>"><?php echo formatRupiah($row_saldojul['nomin']);?></td>
          <?php include 'module/_report/agustus.php';?>
          <td><?php 
				echo formatRupiah($row_rab8['rab']); ?></td>
          <td bgcolor="<?php if($row_rab8['rab']<$row_saldoag['nomin']){
			  echo"#FFFF00";
		  }else{
			  echo "";
		  }?>"><?php echo formatRupiah($row_saldoag['nomin']);?></td>
          <?php include 'module/_report/september.php';?>
          <td><?php 
				echo formatRupiah($row_rab9['rab']);?></td>
          <td bgcolor="<?php if($row_rab9['rab']<$row_saldosep['nomin']){
			  echo"#FFFF00";
		  }else{
			  echo "";
		  }?>"><?php echo formatRupiah($row_saldosep['nomin']);?></td>
          <?php include 'module/_report/oktober.php';?>
          <td><?php 
				echo formatRupiah($row_rab10['rab']); ?></td>
          <td bgcolor="<?php if($row_rab10['rab']<$row_saldook['nomin']){
			  echo"#FFFF00";
		  }else{
			  echo "";
		  }?>"><?php echo formatRupiah($row_saldook['nomin']);?></td>
          <?php include 'module/_report/november.php';?>
          <td><?php 
				echo formatRupiah($row_rab11['rab']); ?></td>
          <td bgcolor="<?php if($row_rab11['rab']<$row_saldonov['nomin']){
			  echo"#FFFF00";
		  }else{
			  echo "";
		  }?>"><?php echo formatRupiah($row_saldonov['nomin']);?></td>
          <?php include 'module/_report/desember.php';?>
          <td><?php 
				echo formatRupiah($row_rab12['rab']); ?></td>
          <td bgcolor="<?php if($row_rab12['rab']<$row_saldodes['nomin']){
			  echo"#FFFF00";
		  }else{
			  echo "";
		  }?>"><?php echo formatRupiah($row_saldodes['nomin']);?></td>
          <td><?php
            $ttl=$row_rab1['rab']+$row_rab2['rab']+$row_rab3['rab']+$row_rab4['rab']+$row_rab5['rab']+$row_rab6['rab']+$row_rab7['rab']+$row_rab8['rab']+$row_rab9['rab']+$row_rab10['rab']+$row_rab11['rab']+$row_rab12['rab'];
			echo formatRupiah($ttl);?></td>
          <td bgcolor="<?php
		  $ttl_real=$row_saldojan['nomin']+$row_saldofeb['nomin']+$row_saldomar['nomin']+$row_saldoap['nomin']+$row_saldomei['nomin']+$row_saldojun['nomin']+$row_saldojul['nomin']+$row_saldoag['nomin']+$row_saldosep['nomin']+$row_saldook['nomin']+$row_saldonov['nomin']+$row_saldodes['nomin'];
		   if($ttl<$ttl_real){
			  echo"#FFFF00";
		  }else{
			  echo "#00CC00";
		  }?>"><?php
            $ttl_real=$row_saldojan['nomin']+$row_saldofeb['nomin']+$row_saldomar['nomin']+$row_saldoap['nomin']+$row_saldomei['nomin']+$row_saldojun['nomin']+$row_saldojul['nomin']+$row_saldoag['nomin']+$row_saldosep['nomin']+$row_saldook['nomin']+$row_saldonov['nomin']+$row_saldodes['nomin'];
			echo formatRupiah($ttl_real);?></td>
          <td><?php echo $row_rabpnl['thn_ajuan']; ?></td>
        </tr>
        <?php 
		$i++;
		} while ($row_rab = mysql_fetch_assoc($rabpnl)); ?>
        <tr>
          <?php 
		include 'module/_report/ttl_januari.php';
		include 'module/_report/ttl_februari.php';
		include 'module/_report/ttl_maret.php';
		include 'module/_report/ttl_april.php';
		include 'module/_report/ttl_mei.php';
		include 'module/_report/ttl_juni.php';
		include 'module/_report/ttl_juli.php';
		include 'module/_report/ttl_agustus.php';
		include 'module/_report/ttl_september.php';
		include 'module/_report/ttl_oktober.php';
		include 'module/_report/ttl_november.php';
		include 'module/_report/ttl_desember.php';
		
		?>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td><?php echo formatRupiah($row_ttl_jan_pnl['rab']);?></td>
          <td>&nbsp;</td>
          <td><?php echo formatRupiah($row_ttl_feb_pnl['rab']);?></td>
          <td>&nbsp;</td>
          <td><?php echo formatRupiah($row_ttl_mar_pnl['rab']);?></td>
          <td>&nbsp;</td>
          <td><?php echo formatRupiah($row_ttl_ap_pnl['rab']);?></td>
          <td>&nbsp;</td>
          <td><?php echo formatRupiah($row_ttl_mei_pnl['rab']);?></td>
          <td>&nbsp;</td>
          <td><?php echo formatRupiah($row_ttl_jun_pnl['rab']);?></td>
          <td>&nbsp;</td>
          <td><?php echo formatRupiah($row_ttl_jul_pnl['rab']);?></td>
          <td>&nbsp;</td>
          <td><?php echo formatRupiah($row_ttl_ag_pnl['rab']);?></td>
          <td>&nbsp;</td>
          <td><?php echo formatRupiah($row_ttl_sep_pnl['rab']);?></td>
          <td>&nbsp;</td>
          <td><?php echo formatRupiah($row_ttl_ok_pnl['rab']);?></td>
          <td>&nbsp;</td>
          <td><?php echo formatRupiah($row_ttl_nov_pnl['rab']);?></td>
          <td>&nbsp;</td>
          <td><?php echo formatRupiah($row_ttl_des_pnl['rab']);?></td>
          <td>&nbsp;</td>
          <td><?php
            $ttl_pnl=$total_1+$total_2+$total_3+$total_4+$total_5+$total_6+$total_7+$total_8+$total_9+$total_10+$total_11+$total_12;
			echo formatRupiah($ttl_pnl);?></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
      </table></td>
  </tr>
</table>
<p>&nbsp;</p>
<?php
mysql_free_result($rab);
mysql_free_result($rabpnl);
?>
        <script type="text/javascript">
		
		var rupiah = document.getElementById('rupiah');
		rupiah.addEventListener('keyup', function(e){
			// tambahkan 'Rp.' pada saat form di ketik
			// gunakan fungsi formatRupiah() untuk mengubah angka yang di ketik menjadi format angka
			rupiah.value = formatRupiah(this.value, 'Rp. ');
		});
			var rupiah = document.getElementById('rupiah2');
		rupiah.addEventListener('keyup', function(e){
			// tambahkan 'Rp.' pada saat form di ketik
			// gunakan fungsi formatRupiah() untuk mengubah angka yang di ketik menjadi format angka
			rupiah.value = formatRupiah(this.value, 'Rp. ');
		});
 
		/* Fungsi formatRupiah */
		function formatRupiah(angka, prefix){
			var number_string = angka.replace(/[^,\d]/g, '').toString(),
			split   		= number_string.split(','),
			sisa     		= split[0].length % 3,
			rupiah     		= split[0].substr(0, sisa),
			ribuan     		= split[0].substr(sisa).match(/\d{3}/gi);
 
			// tambahkan titik jika yang di input sudah menjadi angka ribuan
			if(ribuan){
				separator = sisa ? '.' : '';
				rupiah += separator + ribuan.join('.');
			}
 
			rupiah = split[1] != undefined ? rupiah + ',' + split[1] : rupiah;
			return prefix == undefined ? rupiah : (rupiah ? 'Rp. ' + rupiah : '');
		}
	</script>