- if (in_array($trans['trans_type'], array(2,10,11))) {
- $taxes[$trans['tax_type_id']]['taxout'] += $trans['amount'];
- $taxes[$trans['tax_type_id']]['out'] += $trans['net_amount'];
- } else {
- $taxes[$trans['tax_type_id']]['taxin'] += $trans['amount'];
- $taxes[$trans['tax_type_id']]['in'] += $trans['net_amount'];
+ $tax_type = $trans['tax_type_id'];
+ if ($trans['trans_type']==ST_JOURNAL && $trans['reg_type']==TR_INPUT) {
+ $taxes[$tax_type]['taxin'] += $trans['amount'];
+ $taxes[$tax_type]['in'] += $trans['net_amount'];
+ }
+ elseif ($trans['trans_type']==ST_JOURNAL && $trans['reg_type']==TR_OUTPUT) {
+ $taxes[$tax_type]['taxout'] += $trans['amount'];
+ $taxes[$tax_type]['out'] += $trans['net_amount'];
+ }
+ elseif (in_array($trans['trans_type'], array(ST_BANKDEPOSIT,ST_SALESINVOICE,ST_CUSTCREDIT))) {
+ $taxes[$tax_type]['taxout'] += $trans['amount'];
+ $taxes[$tax_type]['out'] += $trans['net_amount'];
+ } elseif ($trans['reg_type'] !== NULL) {
+ $taxes[$tax_type]['taxin'] += $trans['amount'];
+ $taxes[$tax_type]['in'] += $trans['net_amount'];