SQL Query for Vendor Balances

SOLVED

Hi,

I am trying to get Accounts Payable / AP Transactions Report/ Aged Payable (summary) report from SQL query. I have done something and get report with query below, but there are minor differencies which realized that those differencies are becouse of AP adjustments. Is there a simple way to get payable balances frim SQL ? Thanks in advance

My query.

SELECT L.IDVEND ,V.VENDNAME, L.CODECURN, SUM(AMTINVCHC) PAYABLEFUNCT, SUM(AMTINVCTC) PAYABLESRC
FROM APOBL L
LEFT JOIN APVEN V ON L.IDVEND=V.VENDORID
WHERE (((L.SWPAID = 0 OR L.SWPAID = 1) AND L.DATEINVC <= 20140930)  )
GROUP BY L.IDVEND,V.VENDNAME, L.CODECURN