<?php
mysql_select_db($database_sistem, $sistem);
$query_saldodepo = "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]'";
$saldodepo = mysql_query($query_saldodepo, $sistem) or die(mysql_error());
$row_saldodepo = mysql_fetch_assoc($saldodepo);
$totalRows_saldodepo = mysql_num_rows($saldodepo);
?>
<?php
if($r['kode_bank']=='Deposito 1'){
	$saldoawaldepo=$row_saldo_awal['col_1130a'];
}
elseif($r['kode_bank']=='Deposito 2'){
	$saldoawaldepo=$row_saldo_awal['col_1130b'];
}
elseif($r['kode_bank']=='Deposito 3'){
	$saldoawaldepo=$row_saldo_awal['col_1130c'];
}
elseif($r['kode_bank']=='Deposito 4'){
	$saldoawaldepo=$row_saldo_awal['col_1130d'];
}
else{
	$saldoawaldepo=$row_saldo_awal['col_1130e'];
}
$saldoakhir_depo=($saldoawaldepo+$row_saldodepo['ttl_dbt'])-$row_saldodepo['ttl_krd'];
echo formatRupiah($saldoakhir_depo);
?>