debtor.name,
branch.br_name,
debtor.curr_code,
+ @bal := @bal+trans.ov_amount,
(trans.ov_amount + trans.ov_gst + trans.ov_freight
+ trans.ov_freight_tax + trans.ov_discount) AS TotalAmount,
trans.alloc AS Allocated,
AND trans.branch_code = branch.branch_code";
if ($_POST['customer_id'] != ALL_TEXT)
- $sql .= " AND trans.debtor_no = '" . $_POST['customer_id'] . "'";
+ $sql .= " AND trans.debtor_no = ".db_escape($_POST['customer_id']);
if ($_POST['filterType'] != ALL_TEXT)
{
if ($_POST['filterType'] == '1')
{
- $sql .= " AND (trans.type = ".ST_SALESINVOICE." OR trans.type = ST_BANKPAYMENT) ";
+ $sql .= " AND (trans.type = ".ST_SALESINVOICE." OR trans.type = ".ST_BANKPAYMENT.") ";
}
elseif ($_POST['filterType'] == '2')
{
}
//------------------------------------------------------------------------------------------------
+db_query("set @bal:=0");
$cols = array(
_("Type") => array('fun'=>'systype_name', 'ord'=>''),
_("Customer") => array('ord'=>''),
_("Branch") => array('ord'=>''),
_("Currency") => array('align'=>'center'),
+ _("RB"),
_("Debit") => array('align'=>'right', 'fun'=>'fmt_debit'),
_("Credit") => array('align'=>'right','insert'=>true, 'fun'=>'fmt_credit'),
array('insert'=>true, 'fun'=>'gl_view'),
$table =& new_db_pager('trans_tbl', $sql, $cols);
$table->set_marker('check_overdue', _("Marked items are overdue."));
-if (get_post('RefreshInquiry')) {
- $table->set_sql($sql);
- $table->set_columns($cols);
-}
$table->width = "85%";
start_form();