Query to fetch Accounting Status
I am trying to fetch the Accounting Status of an invoice based on invoice_id from ap_invoice_distributions_all. I tried multiple ways but haven't had any luck.
So for example, if an invoice has 3 distribution lines out of which 2 are posted and 1 isn't, meaning, if 2 lines have posted_flag = 'Y' and 1 line has posted flag as 'N' then it should return the result as "Partial". If all 3 lines have posted_flag = 'N' then it should return the result as "Not Accounted" and lastly, if all 3 lines have posted_flag = 'Y' then it should return the result as "Accounted".