Skip to Content
0
May 20, 2020 at 05:27 PM

APPROVAL QUERY HELP - AP Invoice with Doc Total 10% higher than Purchase Order and/or GRPO

158 Views Last edit May 20, 2020 at 06:09 PM 2 rev

I need to trigger an approval for any AP invoice that is 10% higher than the purchase order or the GRPO. Thank you!

SELECT distinct 'true' FROM OPOR T0 INNER JOIN POR1 T1 ON T0.DocEntry = T1.DocEntry left join PCH1 T2 on T2.[BaseEntry] = t1.docentry and T2.[BaseLine] = T1.[LineNum] INNER JOIN OPCH T3 ON T2.DocEntry = T3.DocEntry WHERE T0.DocTotal*1.10 > T3.DocTotal