Thanks
Dexter Southerland
Frank Hamelly
MCP-GP, MCT, MVP
East Coast Dynamics
www.eastcoast-dynamics.com
get your GPtip42today at www.gp2themax.blogspot.com
declare @document_number char(20)
declare @document_date datetime
declare @document_due_date datetime
declare @document_type char(20)
set @document_number = '116854'
set @document_date = '11/03/2006'
set @document_due_date = '12/04/2006'
set @document_type = 'invoice' -- values 'invoice', 'payment'
-- check and update RM Keys table
if exists(select * from RM00401 where docnumbr = @document_number)
update RM00401 set docdate = @document_date where docnumbr = @document_number
-- check and update RM Open table
if exists(select * from RM20101 where docnumbr = @document_number)
update RM20101 set docdate = @document_date, duedate = @document_due_date,
postdate = @document_date, glpostdt = @document_date where docnumbr =
@document_number
-- check and update RM History table
if exists(select * from RM30101 where docnumbr = @document_number)
update RM30101 set docdate = @document_date, duedate = @document_due_date,
postdate = @document_date, glpostdt = @document_date where docnumbr =
@document_number
-- check and update GL Open table
if exists(select * from GL20000 where ordocnum = @document_number)
update GL20000 set trxdate = @document_date where ordocnum =
@document_number and series = 3
-- fix the RM distributions
if exists(select * from RM10101 where docnumbr = @document_number)
update RM10101 set POSTEDDT = @document_date where docnumbr =
@document_number
-- check RM Distribution History file
if exists(select * from RM30301 where docnumbr = @document_number)
update RM30301 set POSTEDDT = @document_date where docnumbr =
@document_number
if @document_type = 'invoice'
begin
-- check RM apply open table
if exists(select * from RM20201 where APTODCNM = @document_number)
update RM20201 set APTODCDT = @document_date, ApplyToGLPostDate =
@document_date where APTODCNM = @document_number
-- check RM Apply History table
if exists(select * from RM30201 where APTODCNM = @document_number)
update RM30201 set APTODCDT = @document_date, ApplyToGLPostDate =
@document_date where APTODCNM = @document_number
end
if @document_type = 'payment'
begin
-- check RM apply open table
if exists(select * from RM20201 where APFRDCNM = @document_number)
update RM20201 set APFRDCDT = @document_date, ApplyFromGLPostDate =
@document_date where APFRDCNM = @document_number
-- check RM Apply History table
if exists(select * from RM30201 where APFRDCNM = @document_number)
update RM30201 set APFRDCDT = @document_date, ApplyFromGLPostDate =
@document_date where APFRDCNM = @document_number
end
--
This script is provided "AS IS" with no warranties express or implied. You
accept all responsibilities for its use or misuse.
Best regards,
--
MG.-
Mariano Gomez, MIS, MCP, PMP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com
The Dynamics GP Blogster at http://dynamicsgpblogster.blogspot.com
> .
>
As you may have gathered from these posts, changing document dates from the
'back end' is really a bad idea. A better idea is to void the errant document
and enter it correctly.
So many times I've seen this happen because workers didn't want to 'document
that a mistake was made'. It's OK, just void the bad document and move
forward.
My 1 cent.
Kind regards,
Leslie