Tuesday, August 28, 2018

NAV - Update posted dates to match document dates for posted purchase invoices

Invoices and receipts were posted to the wrong dates, this fixes those dates.
However, this does not fix inventory if it was already posted to the wrong date.
The correct way to fix this is to reverse all transactions, then re-enter them on the correct date.
-------------------------------------------------------------------------------------------------------------

update [dbo].[CRONUS$Purch_ Inv_ Header] set [Posting Date] = [Document Date]



update [dbo].[CRONUS$G_L Entry] set [Posting Date] = [Document Date]



update [dbo].[CRONUS$VAT Entry] set [Posting Date] = [Document Date]



update [dbo].[CRONUS$Vendor Ledger Entry] set [Posting Date] = [Document Date]



update [dbo].[CRONUS$Value Entry] set [Posting Date] = [Document Date]



update DEST

Set DEST.[Posting Date] = SRC.[Posting Date]

From [dbo].[CRONUS$Detailed Vendor Ledg_ Entry] as DEST

INNER JOIN [dbo].[CRONUS$Vendor Ledger Entry] as SRC on DEST.[Document No_]= SRC.[Document No_]

---------------------------------------------
update [dbo].[CRONUS$Purch_ Rcpt_ Header] set [Posting Date] = [Document Date] where [Posting Date] = '2018-08-28'

update DEST
Set DEST.[Posting Date] = SRC.[Posting Date]
From [dbo].[CRONUS$Purch_ Rcpt_ Line] as DEST
INNER JOIN [dbo].[CRONUS$Purch_ Rcpt_ Header] as SRC on DEST.[Document No_]= SRC.[No_]
WHERE DEST.[Posting Date] = '2018-08-28'


select * from [CRONUS$Purch_ Rcpt_ Header]
select * from [CRONUS$Purch_ Rcpt_ Line]

update DEST
Set DEST.[Posting Date] = SRC.[Posting Date]
From [dbo].[CRONUS$G_L Entry] as DEST
INNER JOIN [dbo].[CRONUS$Purch_ Inv_ Header] as SRC on DEST.[Document No_]= SRC.[No_]
WHERE DEST.[Posting Date] = '2018-08-28'

No comments:

Post a Comment