Skip to Content
avatar image
Former Member

Calculating DueDate by PaymentTerms from a given Start-Date

Hi @All !

Does anybody know a function within B1-SDK which calculates a DueDate by PaymentTerms from a given Start-Date?

I've found the

StartFrom-

NumberOfAdditionalMonths- and

NumberOfAdditionalDays-

propertys of the PaymentTermsTypes Object. The last two are nice for .NET-date calculation-methods.

But StartFrom must be "interpreted" correctly from a given Date. Is there any existing function like

Public Shared Function GetDueDate( _
       ByVal RefDate As System.DateTime, _ 
       ByVal PaymTerms As SAPbobsCOM.PaymentTermsTypes _
) As System.DateTime

which does everything automatically like it's done in an invoice when changing the PaymentTerms in B1 GUI?

Thanks,

Roland

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Sep 17, 2008 at 05:20 AM

    Dear Roland Toschek,

    You could use the PaymentGroupCode property of the document to set the PaymentTerms and the document's

    DueDate will calculate by the DocDate and PaymentTerms.

    Sample code:

    
            myInvoice = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
            myInvoice.CardCode = "C1000"
            myInvoice.DocDate = Now
            myInvoice.PaymentGroupCode = 1   ' --- PaymentTerms : 30 days
    
            myInvoice.Lines.ItemCode = "A1000"
            myInvoice.Lines.Quantity = 1
            myInvoice.Lines.Price = 10
    
            RetVal = myInvoice.Add()
    

    Best Regards

    Jane Jing

    SAP Business One Forums team

    Add comment
    10|10000 characters needed characters exceeded