." || (trans_type=".ST_JOURNAL ." AND amount<0)"
." || trans_type=".ST_CUSTCREDIT.", amount*ex_rate,0)) payable,
- SUM(IF(trans_type=".ST_CUSTCREDIT." || trans_type=".ST_SUPPINVOICE.",-1,1)*
+ SUM(IF(trans_type=".ST_CUSTCREDIT." || trans_type=".ST_SUPPINVOICE." || trans_type=".ST_JOURNAL.",-1,1)*
IF(trans_type=".ST_BANKDEPOSIT." || trans_type=".ST_SALESINVOICE
." || (trans_type=".ST_JOURNAL ." AND amount<0)"
." || trans_type=".ST_CUSTCREDIT.", 0, net_amount*ex_rate)) net_input,
- SUM(IF(trans_type=".ST_CUSTCREDIT." || trans_type=".ST_SUPPINVOICE.",-1,1)*
+ SUM(IF(trans_type=".ST_CUSTCREDIT." || trans_type=".ST_SUPPINVOICE." || trans_type=".ST_JOURNAL.",-1,1)*
IF(trans_type=".ST_BANKDEPOSIT." || trans_type=".ST_SALESINVOICE
." || (trans_type=".ST_JOURNAL ." AND amount<0)"
." || trans_type=".ST_CUSTCREDIT.", 0, amount*ex_rate)) collectible,
}
}
if ($trans['trans_type']==ST_JOURNAL && $trans['amount']<0) {
- $taxes[$trans['tax_type_id']]['taxout'] -= $trans['amount'];
- $taxes[$trans['tax_type_id']]['out'] -= $trans['net_amount'];
+ $taxes[$trans['tax_type_id']]['taxin'] += $trans['amount'];
+ $taxes[$trans['tax_type_id']]['in'] += $trans['net_amount'];
+ }
+ elseif ($trans['trans_type']==ST_JOURNAL && $trans['amount']>=0) {
+ $taxes[$trans['tax_type_id']]['taxout'] += $trans['amount'];
+ $taxes[$trans['tax_type_id']]['out'] += $trans['net_amount'];
}
elseif (in_array($trans['trans_type'], array(ST_BANKDEPOSIT,ST_SALESINVOICE,ST_CUSTCREDIT))) {
$taxes[$trans['tax_type_id']]['taxout'] += $trans['amount'];