web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

Challenge with Payment Terms

(0) ShareShare
ReportReport
Posted on by 12

Situation

Client would like to have all invoices that are entered in the current month to show up with Due Date and Discount Date set to the end of the FOLLOWING month.

Currently in the system (GP2015 2016) I have not been able to make this work.

We have attempted to change the Calculate Date from – no difference

Outcome

The desired outcome is pretty simple, here is an example of what we want.

Invoice Date: June 12, 2018

Due Date : July 31, 2018

Discount Date: July 31, 2018

Challenge is that we have not been able to figure out a combination of settings in the window that will allow us to make this happen.

If we are missing something simple, please show me.  If this has been discussed and a solution has been posted, simply paste the link to the solution and we are done.

*This post is locked for comments

I have the same question (0)
  • Bill Campbell Profile Picture
    12 on at

    Anyone out there ? Wondering if anyone has any suggestions.

  • Suggested answer
    MG-16101311-0 Profile Picture
    26,225 on at

    Sorry I am late to this party! Take a look at my article "End of Month + Net Days" payment terms due date calculation. You can adopt it to your specific needs.

  • Bill Campbell Profile Picture
    12 on at

    Ok so I think I can make this work, but I have a bit of a twist and not sure how to address this piece.

    If I use EOM + 31 to get to the end of the month following - that only works for months with 31 days - all the 30 day months then have the invoices due on the 1st of the next month.

    Am I missing something?  

    Desire is to have June 11, 2018 invoice show as due on July 31, 2018.  So use EOM + 31 and it works.

    But if we have a January 12, 2019 invoice and use the same terms, it would show due on March 3, 2018  

    Client wants to be able to build the check batch and use Due Date Cut off of ( last day of that month ) and catch all the invoices that were entered ( dated ) for the month prior.

    What am I missing ?  BTW I get the scripts and what to do with them, but not sure how to make the final adjustment to get to the last day of each month.

    Thanks for the starting point.

  • Suggested answer
    MG-16101311-0 Profile Picture
    26,225 on at

    Bill, 

    This should get you the end of next month for PM, based on document date:

    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%')

    This should get you the end of next month for RM, based on document date:

      UPDATE A SET A.DUEDATE = DATEADD(d, -1, DATEADD(mm, DATEDIFF(m, 0, I.DOCDATE) + 2, 0))  
        FROM RM20101 A
        INNER JOIN INSERTED I ON (A.CUSTNMBR = I.CUSTNMBR) AND (A.DOCNUMBR = I.DOCNUMBR)
          AND (A.RMDTYPAL = I.RMDTYPAL)
        LEFT OUTER JOIN SY03300 B ON (I.PYMTRMID = B.PYMTRMID)
      WHERE (I.RMDTYPAL= 1) AND (I.PYMTRMID LIKE 'EOMNXTMT%')
    
     


    Note that I changed the name of the payment term to reflect what you are asking for too. If you want the due date to always reflect end of next month regardless of document date, change I.DOCDATE for getdate(). If you do that, you will need to remove the time portion from the date to be compliant with how GP stores dates.

  • Bill Campbell Profile Picture
    12 on at

    Mariano, thanks so much for your assistance - I am waiting on the IT Team to confirm that the TEST system is in place and represents a good version of the live data.  Of course we will be building and testing in the TEST system and will prefect the code for our needs - thanks for the great solution and I am sure that this client ( as many others before ) will be more than pleased with your coding assistance.

    Bill

  • MG-16101311-0 Profile Picture
    26,225 on at

    Bill,

    Hope all is well. Just following up to see if this ever worked for you. Thanks my friend!

  • Bill Campbell Profile Picture
    12 on at

    Mariano - the scripts seem to work correctly -  I have been able to get the scripts created, but I can not test without getting them deployed - right?

    So I have added the trigger for the EOMNXMT and I have added Payment Term in the system and added it to a VENDOR.

    I then created a transaction with the following details.

    Vendor: Bartle

    Voucher: 000000018308

    Date: 02/01/18

    Doc #: 123456

    Amount: 10,000

    When I post I get the following message.

    Error-on-Posting.PNG

    And the batch is sitting in Recovery, but it will not recover - it stays in the same loop.  I am sure that I missed something in the scripting, but I am not sure what.

  • Suggested answer
    MG-16101311-0 Profile Picture
    26,225 on at

    Bill,

    In reviewing this issue, what's happening is, the datepart parameter being passed to the DATEADD() function within the UPDATE statement in the trigger is adding seconds to the resulting date value. That's a constraint violation of GP date columns which cannot store the time portion of the date. Change the DATEADD expression as follows:

    DATEADD(d, -1, DATEADD(mm, DATEDIFF(m, 0, I.DOCDATE) + 2, 0))


    There's no need to create a transaction to that update block, since the posting routine is transactional anyways.

  • Bill Campbell Profile Picture
    12 on at

    Mariano thanks for the assist - the changes worked as expected and the dates entered on a series of invoices all over the calendar generated the correct EOM date regardless of the transaction date.  Now just have to get the client to finish their tests - and we are done.

    As always a true MVP comes to the assistance when needed.

    Enjoy Tech @Fargo

  • Bill Campbell Profile Picture
    12 on at

    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%')

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
mtabor Profile Picture

mtabor 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans