<?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;
}
}

mysql_select_db($database_sistem, $sistem);
$query_hitung_pdp = "SELECT sum(debet)as debet, sum(kredit)as kredit FROM transaksi_tb where tahun='$tahun' and  no_perkiraan='$r[perkiraan]'";
$hitung_pdp = mysql_query($query_hitung_pdp, $sistem) or die(mysql_error());
$row_hitung_pdp = mysql_fetch_assoc($hitung_pdp);
$totalRows_hitung_pdp = mysql_num_rows($hitung_pdp);

mysql_free_result($hitung_pdp);
?>
<?php
echo formatRupiah($row_hitung_pdp['debet']);
?>