<?php
mysql_select_db($database_sistem, $sistem);
$query_saldobank = "SELECT sum(debet)as ttl_dbt, sum(kredit)as ttl_krd FROM transaksi_bank_tb where bulan='$bulan' and tahun='$tahun' and no_rek='$r[no_rek]' and kode_unit='$_SESSION[kode]'";
$saldobank = mysql_query($query_saldobank, $sistem) or die(mysql_error());
$row_saldobank = mysql_fetch_assoc($saldobank);
$totalRows_saldobank = mysql_num_rows($saldobank);
?>
<?php
if($r['kode_bank']=='Bank 1'){
	$saldoawalbank=$row_saldo_awal['col_1120a'];
}
elseif($r['kode_bank']=='Bank 2'){
	$saldoawalbank=$row_saldo_awal['col_1120b'];
}
elseif($r['kode_bank']=='Bank 3'){
	$saldoawalbank=$row_saldo_awal['col_1120c'];
}
elseif($r['kode_bank']=='Bank 4'){
	$saldoawalbank=$row_saldo_awal['col_1120d'];
}
elseif($r['kode_bank']=='Bank 5'){
	$saldoawalbank=$row_saldo_awal['col_1120e'];
}
elseif($r['kode_bank']=='Bank 6'){
	$saldoawalbank=$row_saldo_awal['col_1120f'];
}
elseif($r['kode_bank']=='Bank 7'){
	$saldoawalbank=$row_saldo_awal['col_1120g'];
}
elseif($r['kode_bank']=='Bank 8'){
	$saldoawalbank=$row_saldo_awal['col_1120h'];
}
elseif($r['kode_bank']=='Bank 9'){
	$saldoawalbank=$row_saldo_awal['col_1120i'];
}
else{
	$saldoawalbank=$row_saldo_awal['col_1120j'];
}
$saldoakhir_bank=($saldoawalbank+$row_saldobank['ttl_dbt'])-$row_saldobank['ttl_krd'];
echo formatRupiah($saldoakhir_bank);
?>