Im trying to get a list of invoices and vouchers AND include the date that it was actually paid.
-- AR
SELECT TOP 100 * FROM dbo.RM20101 r ORDER BY r.GLPOSTDT DESC
SELECT TOP 100 * FROM dbo.RM30101 r ORDER BY r.GLPOSTDT DESC
-- Paid date = POSTDATE ? or GLPOSTDT?
-- AP
SELECT TOP 100 * FROM PM20000 p ORDER BY p.DOCDATE DESC
SELECT TOP 100 * FROM PM30200 p ORDER BY p.DOCDATE DESC
I guess its not quite that easy since there could be multiple apply records assocaited with an invoice? So then I started looking a bit deeper, and found this.
https://victoriayudin.com/2008/10/22/sql-view-ap-apply-in-gp/
So where the last join happens for P2, eg.
left outer join
(select VCHRNMBR, DOCTYPE, DOCNUMBR, DOCDATE
from PM20000
where DOCTYPE > 3 and VOIDED = 0
union all
select VCHRNMBR, DOCTYPE, DOCNUMBR, DOCDATE
from PM30200
where DOCTYPE > 3 and VOIDED = 0)
This is the group that the payment date is pulled from, the docdate from either PM2000 or PM30200
Is it safe to say that if a voucher is in the history (PM30200) table, then its been "paid" in full?
However, what I need now is something similar for the AR side. Could I do something similar, except using the RM20101 and RM30101 tables?
Hello ShiftBit!
If your just looking for a quick check, you can use the column DINVPDOF in the RM20101, RM30101 and the PM30200.
If your looking to see what was actually applied against the documents that paid off the transactions, you would want to link in the apply tables (PM30300 for PM and RM20201 or RM30201 for RM depending on if the doc was moved to history with paid transaction removal).
In Payables, transactions should automatically move to history when they are "Paid Off". The same is NOT true with Receivables.
With Receivables, "Paid Off" transactions don't move to history until (1) they are paid off and (2) paid transaction removal is completed for a Cut-off date at/beyond the Paid Off date.
If you work from the ReceivablesTransaction view, instead of the RM open/history tables, you'll have everything together and then you'll just need to join to the Apply Records.
Victoria has an RM Apply view here:
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,522 Super User 2024 Season 2
Martin Dráb 228,441 Most Valuable Professional
nmaenpaa 101,148