$todate = date2sql($to);
$sql = "SELECT
- SUM(IF(trans_type=".ST_SUPPCREDIT.",-1,1)*
+ SUM(IF(trans_type=".ST_CUSTCREDIT.",-1,1)*
IF((reg_type=".TR_OUTPUT.")"
- ." || ((trans_type IN(".ST_SUPPINVOICE.",".ST_SUPPCREDIT.") OR (trans_type=".ST_JOURNAL." AND reg_type=".TR_INPUT."))
+ ." || ((trans_type IN(".ST_SALESINVOICE.",".ST_CUSTCREDIT.") OR (trans_type=".ST_JOURNAL." AND reg_type=".TR_INPUT."))
), net_amount*ex_rate,0)
) net_output,
- SUM(IF(trans_type=".ST_SUPPCREDIT.",-1,1)*
+ SUM(IF(trans_type=".ST_CUSTCREDIT.",-1,1)*
IF((reg_type=".TR_OUTPUT.")"
- ." || ((trans_type IN(".ST_SUPPINVOICE.",".ST_SUPPCREDIT.") OR (trans_type=".ST_JOURNAL." AND reg_type=".TR_INPUT."))
+ ." || ((trans_type IN(".ST_SALESINVOICE.",".ST_CUSTCREDIT.") OR (trans_type=".ST_JOURNAL." AND reg_type=".TR_INPUT."))
), amount*ex_rate,0)) payable,
SUM(IF(trans_type IN(".ST_SUPPCREDIT."),-1,1)*
{
$payable = $tx['payable'];
- $collectible = $tx['collectible'];
+ $collectible = -$tx['collectible'];
$net = $collectible + $payable;
$total += $net;
alt_table_row_color($k);
label_cell($tx['name'] . " " . $tx['rate'] . "%");
label_cell(_("Paid on purchases") . " (" . _("Input Tax")."):");
amount_cell($collectible);
- amount_cell($tx['net_input']);
+ amount_cell(-$tx['net_input']);
end_row();
alt_table_row_color($k);
label_cell("<b>".$tx['name'] . " " . $tx['rate'] . "%</b>");