<style type="text/css">
<!--
.style8 {color: #FFFFFF}
.style8 {color: #FFFFFF}
-->
</style>
<table width="100%"  border="0" cellspacing="8" cellpadding="8">
  <tr>
    <td width="59%">Masukkan rekapan data tilang mingguan anda disamping. Yang anda butuhkan hanya total nilai setoran PNPB yang disetorkan ke kas negara (Hasil dari P49)</td>
    <td width="41%"><a href="index_rekapaninput.php" onClick="NewWindow(this.href,'mywin','700','500','yes','center');return false" onFocus="this.blur()" " class="menu">INPUT DATA TILANG MINGGUAN </a></td>
  </tr>
  <tr>
    <td colspan="2"><table width="100%"  border="0" cellspacing="2" cellpadding="2">
      <tr>
        <td bgcolor="#FF0000" class="style2"><table width="100%"  border="0" cellspacing="8" cellpadding="8">
            <tr>
              <td><span class="style8"><strong>REKAPAN PENDAPATAN PNBP MINGGUAN DENDA TILANG </strong></span></td>
            </tr>
        </table></td>
      </tr>
      <tr>
        <td bgcolor="#FFEAEA" class="style2"><?php
mysql_connect("localhost","root","benk")or die(mysql_error());
mysql_select_db("cma_tilang") or die(mysql_error());
include("config.php");
?>
            <table width="100%" border="0">
              <tr>
                <th width="7%"><div align="left">No Urut </div></th>
                <th width="6%"><div align="left"></div>                  <div align="left">Bulan</div></th>
                <th width="14%"><div align="left">Tgl Sidang </div></th>
                <th width="66%"><div align="left">Nilai PNPB</div></th>
                <th width="7%"><div align="left">Delete</div></th>
              </tr>
              <?php
    $sql2="SELECT * FROM t_tilang";
    $query2=mysql_query($sql2);
    while($data=mysql_fetch_array($query2)){
        $no++;
        $out_nilai_a=$data['t_nilai'];
		$a = number_format($out_nilai_a, 2, ',', '.');
		$bulan=$data['t_bulan'];
		$tglsidang=$data['t_tglsidang'];
       // $out_jumlah=$data['jumlah_nilai'];
	//  $out_jumlah = $out_nilai_a+$out_nilai_b+$out_nilai_c+$out_nilai_d+$out_nilai_e;
		//$jumlah = number_format($out_jumlah, 2, ',', '.');
        ?>
              <tr bgcolor="#FFFFFF">
                <td><?php echo $no; ?></td>
                <td>                <?php 
if ($bulan == "1") {print ('Januari');} 
elseif ($bulan == "2") {print ('Pebruari');} 
elseif ($bulan == "3") {print ('Maret');} 
elseif ($bulan == "4") {print ('April');} 
elseif ($bulan == "5") {print ('Mei');}  
elseif ($bulan == "6") {print ('Juni');}  
elseif ($bulan == "7") {print ('Juli');}  
elseif ($bulan == "8") {print ('Agustus');}  
elseif ($bulan == "9") {print ('September');}  
elseif ($bulan == "10") {print ('Oktober');}  
elseif ($bulan == "11") {print ('Nopember');}  
elseif ($bulan == "12") {print ('Desember');}  
?></td>
                <td><?php echo $tglsidang; ?></td>
                <td><?php echo "Rp. ".$a; ?></td>
                <td><a href="index_rekapanhapus.php?id=<?php echo $no; ?>" onClick="NewWindow(this.href,'mywin','200','100','yes','center');return false" onFocus="this.blur()" " class="menupidum">HAPUS</a></td>
              </tr>
              <?php
        }
    ?>
              <tr>
                <td>&nbsp;</td>
                <td colspan="4">&nbsp; </td>
              </tr>
              <tr>
                <td><div align="right"></div></td>
                <td colspan="4"><table width="100%"  border="0" cellspacing="8" cellpadding="8">
                    <tr>
                      <td width="10%"><div align="right">Jumlah</div></td>
                      <td width="90%" bgcolor="#FFFFFF"><?php
		//--------------
		
	function penyebut($nilai) {
		$nilai = abs($nilai);
		$huruf = array("", "satu", "dua", "tiga", "empat", "lima", "enam", "tujuh", "delapan", "sembilan", "sepuluh", "sebelas");
		$temp = "";
		if ($nilai < 12) {
			$temp = " ". $huruf[$nilai];
		} else if ($nilai <20) {
			$temp = penyebut($nilai - 10). " belas";
		} else if ($nilai < 100) {
			$temp = penyebut($nilai/10)." puluh". penyebut($nilai % 10);
		} else if ($nilai < 200) {
			$temp = " seratus" . penyebut($nilai - 100);
		} else if ($nilai < 1000) {
			$temp = penyebut($nilai/100) . " ratus" . penyebut($nilai % 100);
		} else if ($nilai < 2000) {
			$temp = " seribu" . penyebut($nilai - 1000);
		} else if ($nilai < 1000000) {
			$temp = penyebut($nilai/1000) . " ribu" . penyebut($nilai % 1000);
		} else if ($nilai < 1000000000) {
			$temp = penyebut($nilai/1000000) . " juta" . penyebut($nilai % 1000000);
		} else if ($nilai < 1000000000000) {
			$temp = penyebut($nilai/1000000000) . " milyar" . penyebut(fmod($nilai,1000000000));
		} else if ($nilai < 1000000000000000) {
			$temp = penyebut($nilai/1000000000000) . " trilyun" . penyebut(fmod($nilai,1000000000000));
		}     
		return $temp;
	}
 
	function terbilang($nilai) {
		if($nilai<0) {
			$hasil = "minus ". trim(penyebut($nilai));
		} else {
			$hasil = trim(penyebut($nilai));
		}     		
		return $hasil;
	}
 
 
	
	//-----------------------
        $qry_jumlah_a=mysql_query("SELECT SUM(t_nilai) FROM t_tilang");
        $data_a=mysql_fetch_array($qry_jumlah_a);
		$jumlah_tot =$data_a[0];
		$tot = number_format($jumlah_tot, 2, ',', '.');
        echo "Rp. ".$tot;
		
        ?></td>
                    </tr>
                </table></td>
              </tr>
              <tr>
                <td><div align="right"></div></td>
                <td colspan="4">
                  <table width="100%"  border="0" cellspacing="8" cellpadding="8">
                    <tr>
                      <td width="10%"><div align="right">Terbilang</div></td>
                      <td width="90%" bgcolor="#FFFFFF"><?PHP echo terbilang($jumlah_tot); ?></td>
                    </tr>
                </table></td>
              </tr>
          </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td colspan="2"><table width="100%"  border="0" cellspacing="6" cellpadding="6">
  <tr>
    <td colspan="2"><strong>Total Per bulan </strong></td>
    <td><strong>TOTAL PNPB </strong></td>
  </tr>
  <tr>
    <td width="8%"><div align="center">1.</div></td>
    <td bgcolor="#FFCCFF">Januari</td>
    <td width="76%" bgcolor="#CCCCCC"><?php
	
	$qry_jumlah2=mysql_query("SELECT SUM(t_nilai) FROM t_tilang where t_bulan = '1'");
        $data2=mysql_fetch_array($qry_jumlah2);
		$jumlah_tot2 =$data2[0];
		$tot2 = number_format($jumlah_tot2, 2, ',', '.');
        echo "Rp. ".$tot2;
		$query = "UPDATE t_rekap Set t_januari = '$jumlah_tot2' where t_id='$tahun_now'";  
$result = mysql_query($query); 

 ?></td>
  </tr>
  <tr>
    <td><div align="center">2.</div></td>
    <td width="16%" bgcolor="#FFCCFF">Februari</td>
    <td bgcolor="#CCCCCC">      <?php
	
	$qry_jumlah2=mysql_query("SELECT SUM(t_nilai) FROM t_tilang where t_bulan = '2'");
        $data2=mysql_fetch_array($qry_jumlah2);
		$jumlah_tot2 =$data2[0];
		$tot2 = number_format($jumlah_tot2, 2, ',', '.');
        echo "Rp. ".$tot2;
		$query = "UPDATE t_rekap Set t_pebruari = '$jumlah_tot2' where t_id='$tahun_now'";  
$result = mysql_query($query); 

 ?></td>
  </tr>
  <tr>
    <td><div align="center">3.</div></td>
    <td bgcolor="#FFCCFF">Maret</td>
    <td bgcolor="#CCCCCC"><?php
	
	$qry_jumlah2=mysql_query("SELECT SUM(t_nilai) FROM t_tilang where t_bulan = '3'");
        $data2=mysql_fetch_array($qry_jumlah2);
		$jumlah_tot2 =$data2[0];
		$tot2 = number_format($jumlah_tot2, 2, ',', '.');
        echo "Rp. ".$tot2;
		$query = "UPDATE t_rekap Set t_maret = '$jumlah_tot2' where t_id='$tahun_now'";  
$result = mysql_query($query); 

 ?></td>
  </tr>
  <tr>
    <td><div align="center">4.</div></td>
    <td bgcolor="#FFCCFF">April</td>
    <td bgcolor="#CCCCCC"><?php
	
	$qry_jumlah2=mysql_query("SELECT SUM(t_nilai) FROM t_tilang where t_bulan = '4'");
        $data2=mysql_fetch_array($qry_jumlah2);
		$jumlah_tot2 =$data2[0];
		$tot2 = number_format($jumlah_tot2, 2, ',', '.');
        echo "Rp. ".$tot2;
		$query = "UPDATE t_rekap Set t_april = '$jumlah_tot2' where t_id='$tahun_now'";  
$result = mysql_query($query); 

 ?></td>
  </tr>
  <tr>
    <td><div align="center">5.</div></td>
    <td bgcolor="#FFCCFF">Mei</td>
    <td bgcolor="#CCCCCC"><?php
	
	$qry_jumlah2=mysql_query("SELECT SUM(t_nilai) FROM t_tilang where t_bulan = '5'");
        $data2=mysql_fetch_array($qry_jumlah2);
		$jumlah_tot2 =$data2[0];
		$tot2 = number_format($jumlah_tot2, 2, ',', '.');
        echo "Rp. ".$tot2;
		$query = "UPDATE t_rekap Set t_mei = '$jumlah_tot2' where t_id='$tahun_now'";  
$result = mysql_query($query); 

 ?></td>
  </tr>
  <tr>
    <td><div align="center">6.</div></td>
    <td bgcolor="#FFCCFF">Juni</td>
    <td bgcolor="#CCCCCC"><?php
	
	$qry_jumlah2=mysql_query("SELECT SUM(t_nilai) FROM t_tilang where t_bulan = '6'");
        $data2=mysql_fetch_array($qry_jumlah2);
		$jumlah_tot2 =$data2[0];
		$tot2 = number_format($jumlah_tot2, 2, ',', '.');
        echo "Rp. ".$tot2;
		$query = "UPDATE t_rekap Set t_juni = '$jumlah_tot2' where t_id='$tahun_now'";  
$result = mysql_query($query); 

 ?></td>
  </tr>
  <tr>
    <td><div align="center">7.</div></td>
    <td bgcolor="#FFCCFF">Juli</td>
    <td bgcolor="#CCCCCC"><?php
	
	$qry_jumlah2=mysql_query("SELECT SUM(t_nilai) FROM t_tilang where t_bulan = '7'");
        $data2=mysql_fetch_array($qry_jumlah2);
		$jumlah_tot2 =$data2[0];
		$tot2 = number_format($jumlah_tot2, 2, ',', '.');
        echo "Rp. ".$tot2;
		$query = "UPDATE t_rekap Set t_juli = '$jumlah_tot2' where t_id='$tahun_now'";  
$result = mysql_query($query); 

 ?></td>
  </tr>
  <tr>
    <td><div align="center">8.</div></td>
    <td bgcolor="#FFCCFF">Agustus</td>
    <td bgcolor="#CCCCCC"><?php
	
	$qry_jumlah2=mysql_query("SELECT SUM(t_nilai) FROM t_tilang where t_bulan = '8'");
        $data2=mysql_fetch_array($qry_jumlah2);
		$jumlah_tot2 =$data2[0];
		$tot2 = number_format($jumlah_tot2, 2, ',', '.');
        echo "Rp. ".$tot2;
		$query = "UPDATE t_rekap Set t_agustus = '$jumlah_tot2' where t_id='$tahun_now'";  
$result = mysql_query($query); 

 ?></td>
  </tr>
  <tr>
    <td><div align="center">9.</div></td>
    <td bgcolor="#FFCCFF">September</td>
    <td bgcolor="#CCCCCC"><?php
	
	$qry_jumlah2=mysql_query("SELECT SUM(t_nilai) FROM t_tilang where t_bulan = '9'");
        $data2=mysql_fetch_array($qry_jumlah2);
		$jumlah_tot2 =$data2[0];
		$tot2 = number_format($jumlah_tot2, 2, ',', '.');
        echo "Rp. ".$tot2;
		$query = "UPDATE t_rekap Set t_september = '$jumlah_tot2' where t_id='$tahun_now'";  
$result = mysql_query($query); 

 ?></td>
  </tr>
  <tr>
    <td><div align="center">10</div></td>
    <td bgcolor="#FFCCFF">Oktober</td>
    <td bgcolor="#CCCCCC"><?php
	
	$qry_jumlah2=mysql_query("SELECT SUM(t_nilai) FROM t_tilang where t_bulan = '10'");
        $data2=mysql_fetch_array($qry_jumlah2);
		$jumlah_tot2 =$data2[0];
		$tot2 = number_format($jumlah_tot2, 2, ',', '.');
        echo "Rp. ".$tot2;
		$query = "UPDATE t_rekap Set t_oktober = '$jumlah_tot2' where t_id='$tahun_now'";  
$result = mysql_query($query); 

 ?></td>
  </tr>
  <tr>
    <td><div align="center">11</div></td>
    <td bgcolor="#FFCCFF">Nopember</td>
    <td bgcolor="#CCCCCC"><?php
	
	$qry_jumlah2=mysql_query("SELECT SUM(t_nilai) FROM t_tilang where t_bulan = '11'");
        $data2=mysql_fetch_array($qry_jumlah2);
		$jumlah_tot2 =$data2[0];
		$tot2 = number_format($jumlah_tot2, 2, ',', '.');
        echo "Rp. ".$tot2;
		$query = "UPDATE t_rekap Set t_nopember = '$jumlah_tot2' where t_id='$tahun_now'";  
$result = mysql_query($query); 

 ?></td>
  </tr>
  <tr>
    <td><div align="center">12.</div></td>
    <td bgcolor="#FFCCFF">Desember</td>
    <td bgcolor="#CCCCCC"><?php
	
	$qry_jumlah2=mysql_query("SELECT SUM(t_nilai) FROM t_tilang where t_bulan = '12'");
        $data2=mysql_fetch_array($qry_jumlah2);
		$jumlah_tot2 =$data2[0];
		$tot2 = number_format($jumlah_tot2, 2, ',', '.');
        echo "Rp. ".$tot2;
		$query = "UPDATE t_rekap Set t_desember = '$jumlah_tot2' where t_id='$tahun_now'";  
$result = mysql_query($query); 

 ?></td>
  </tr>
</table></td>
  </tr>
</table>
