Mariano, greeting and Happy New Year.
This message goes back to the summer of 2018 when we worked on a solution that I had tested with the client at the time, but then I did nothing else with, until Friday when the client said it was not working correctly.
What I said - how can we wait 5 months to tell me it is not working - what is not working?
It is not putting the last day of the next month as the due date for the invoice - she says.
So I am back to get some additional assistance. I noted in the text of the last correction we discussed that to make this show the last day of the next month you wanted me to adjust the I.DOCDATE
This is where I failed to follow - sorry, but I could really use your assistance in spelling out the change I need to make.
----
Follow up questions - do I have to do this just the PM20000 ? Understand that the PM Keys may come into play, but I think that POSTING to the PM20000 should address that update - correct?
If we are doing this for the RM system is it the same script - replacing CUSTOMER for VENDOR and so on?
----
I have attached the two scripts I have created to this point - and both execute to the PM20000 and create the necessary TRIGGER records (as far as I can tell)
Bill
CREATE TRIGGER pmEOMNxtMnth ON dbo.PM20000 AFTER INSERT
AS
UPDATE A SET A.DUEDATE = DATEADD(d, -1, DATEADD(mm, DATEDIFF(m, 0, I.DOCDATE) + 2, 0))
FROM PM20000 A
INNER JOIN INSERTED I ON (A.VCHRNMBR = I.VCHRNMBR) AND (A.DOCTYPE = I.DOCTYPE)
LEFT OUTER JOIN SY03300 B ON (I.PYMTRMID = B.PYMTRMID)
WHERE (I.DOCTYPE = 1) AND (I.PYMTRMID LIKE 'EOMNXTMT')
GO
CREATE TRIGGER pmEOMPlusNet ON dbo.PM20000 AFTER INSERT
AS
UPDATE A SET A.DUEDATE = DATEADD(d, -1, DATEADD(mm, DATEDIFF(m, 0, I.DOCDATE) + 2, 0))
FROM PM20000 A
INNER JOIN INSERTED I ON (A.VCHRNMBR = I.VCHRNMBR) AND (A.DOCTYPE = I.DOCTYPE)
LEFT OUTER JOIN SY03300 B ON (I.PYMTRMID = B.PYMTRMID)
WHERE (I.DOCTYPE = 1) AND (I.PYMTRMID LIKE 'EOMPLUSND%')