Topic: FA2.4.4 Aged Supplier Analysis

Reports/Suppliers/ Aged Supplier analysis, with the following settings:

Show alocated = No
Summary = No or Yes
Suppress Zero's = Yes or no
Graphics = No Graphics.

Reports deos not display.

With Show alocated = Yes, Report displays

Please provide solution.

Using latest Firefox, other reports do display.

Wynand

2 (edited by poncho1234 06/15/2018 10:51:38 pm)

Re: FA2.4.4 Aged Supplier Analysis

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/

Re: FA2.4.4 Aged Supplier Analysis

@poncho1234

Thanks for finding this nasty bug. And for your solution. Committed to Repo.

/Joe

Re: FA2.4.4 Aged Supplier Analysis

Thank you all. It is working now.

Wynand