1 Reply Latest reply on Oct 4, 2013 6:06 AM by philmodjunk

# payment date calculation

### Title

payment date calculation

### Post

need a invoice payment date field that calculates customer cut off invoice payment date.. for example if invoice date field is from 5th to 20th , the invoice payment date field should be 20th , and invoice dates from 21st to 5th of succeeding month, invoice payment date field should be 5th of that month.

• ###### 1. Re: payment date calculation

A case function can return the correct date, but I am not sure I follow your description of the results you want so you may need to modify this example:

Let ( [ D = Invoice::InvoiceDate  ; // refer to your date field here
dd = Day ( D ) ];
Case ( dd < 6 ; Date ( Month ( D ) + 1 ; 5 ; year ( D ) ) ; //days 1...5
dd < 21 ; Date ( Month ( D ) + 1 ; 20 ; year ( D ) ) ; //days 6...20
Date ( Date ( Month ( D ) + 1 ; 5 ; year ( D ) ) // days 21...31 this result doesn't seem correct but it's how I read your post
) // case
) // Let