<script type="text/javascript">
$(document).ready(function() {
    $(function() {
        $("#theList tr:even").addClass("stripe1");
        $("#theList tr:odd").addClass("stripe2");

        $("#theList tr").hover(
            function() {
                $(this).toggleClass("highlight");
            },
            function() {
                $(this).toggleClass("highlight");
            }
        );
    });
});
</script>

<?php
include '../../inc/inc.koneksi.php';
include '../../inc/fungsi_tanggal.php';

$kode = $_GET[kode];
echo "<table id='theList' width='100%'>
		<tr>			
			<th>No.Faktur</th>
			<th>Tanggal</th>
			<th>Saldo</th>
			<th>Bayar Tunai</th>
			<th>Nomor BG</th>
			<th>Bank</th>
			<th>Bayar BG</th>
			<th>Tanggal JT</th>
			<th>Potongan</th>
			<th>Sisa</th>
		</tr>";
		
		$query = "SELECT * FROM jurppi WHERE kode_ppi='$kode' AND batal=''";
		$sql= mysql_query($query);
		$tpiut=0;
		$ttunai=0;
		$tbg=0;
		$tpot=0;
		$tsisa=0;
		$no=1;
		
		while($r=mysql_fetch_array($sql)){
			echo "<tr>
				<td align='center'>$r[nofak]</td>
				<td align='center'>".jin_date_str($r[tgl_fak])."</td>
				<td align='right'>".number_format($r[jml_piut],0)."</td>
				<td align='right'>".number_format($r[tunai],0)."</td>
				<td align='center'>$r[nomor_bg]</td>
				<td align='center'>$r[bank]</td>
				<td align='right'>".number_format($r[jumlah_bg],0)."</td>
				<td align='center'>".jin_date_str($r[tanggal_jt])."</td>
				<td align='right'>".number_format($r[potongan],0)."</td>
				<td align='right'>".number_format($r[sisa],0)."</td>
			</tr>";
			$no++;
			$tpiut=$tpiut+$r[jml_piut];
			$ttunai=$ttunai+$r[tunai];
			$tbg=$tbg+$r[jumlah_bg];
			$tpot=$tpot+$r[potongan];
			$tsisa=$tsisa+$r[sisa];
		}
		echo "<tr>
				<td></td>
				<td>Total</td>
				<td align='right'>".number_format($tpiut,0)."</td>
				<td align='right'>".number_format($ttunai,0)."</td>
				<td></td>
				<td></td>
				<td align='right'>".number_format($tbg,0)."</td>
				<td></td>
				<td align='right'>".number_format($tpot,0)."</td>
				<td align='right'>".number_format($tsisa,0)."</td>
			</tr>
		</table>";
?>