The sql output gives 40 opening brackets, but 44 closing brackets???
SELECT supp.supp_name, supp.curr_code, 0_payment_terms.terms,
Sum(IFNULL(IF (trans.type=20 OR trans.type=2
OR (trans.type=0 AND (trans.ov_amount + trans.ov_gst + trans.ov_discount)>0), 1, -1)*
ABS(trans.ov_amount + trans.ov_gst + trans.ov_discount) - trans.alloc),0)) AS Balance,
Sum(IF ((TO_DAYS('2018-06-15') - TO_DAYS(IF (trans.type=20 OR trans.type=21,trans.due_date,trans.tran_date))) > 0,IF (trans.type=20 OR trans.type=2
OR (trans.type=0 AND (trans.ov_amount + trans.ov_gst + trans.ov_discount)>0), 1, -1)*
ABS(trans.ov_amount + trans.ov_gst + trans.ov_discount) - trans.alloc),0)) AS Due,
Sum(IF ((TO_DAYS('2018-06-15') - TO_DAYS(IF (trans.type=20 OR trans.type=21,trans.due_date,trans.tran_date))) > 30,IF (trans.type=20 OR trans.type=2
OR (trans.type=0 AND (trans.ov_amount + trans.ov_gst + trans.ov_discount)>0), 1, -1)*
ABS(trans.ov_amount + trans.ov_gst + trans.ov_discount) - trans.alloc),0)) AS Overdue1,
Sum(IF ((TO_DAYS('2018-06-15') - TO_DAYS(IF (trans.type=20 OR trans.type=21,trans.due_date,trans.tran_date))) > 60,IF (trans.type=20 OR trans.type=2
OR (trans.type=0 AND (trans.ov_amount + trans.ov_gst + trans.ov_discount)>0), 1, -1)*
ABS(trans.ov_amount + trans.ov_gst + trans.ov_discount) - trans.alloc),0)) AS Overdue2,
supp.credit_limit - Sum(IFNULL(IF(trans.type=21, -1, 1)
* (ov_amount + ov_gst + ov_discount),0)) as cur_credit,
supp.tax_group_id
I think the problem is here 4 opening brackets - 5 closing:-
\purchasing\includes\db\suppliers_db.inc
94: $value = "IF (trans.type=".ST_SUPPINVOICE." OR trans.type=".ST_BANKDEPOSIT."
95: OR (trans.type=".ST_JOURNAL." AND (trans.ov_amount + trans.ov_gst + trans.ov_discount)>0), 1, -1)*
96: ABS(trans.ov_amount + trans.ov_gst + trans.ov_discount) - trans.alloc)";
Which makes sense as the OR is called 4 times...
I cannot find when this was changed...
From my understanding of the above Line 96 should be:-
96: ABS(trans.ov_amount + trans.ov_gst + trans.ov_discount) - trans.alloc";
The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/