Last active
August 6, 2020 14:50
-
-
Save W3BGUY/0c68be045e65e543d3f57a76ead92c3f to your computer and use it in GitHub Desktop.
Simple function to calculate the due date based on an invoice date and terms ID.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function calculateDueDate(termID,invDate){ | |
var dueDate='' | |
try{ | |
var daysToAdd=search.lookupFields({type:'term',id:termID,columns:['daysuntilnetdue']}).daysuntilnetdue; | |
dueDate=new Date(format.parse({value:invDate,type:format.Type.DATE})); | |
dueDate.setDate(dueDate.getDate()+parseInt(daysToAdd)); | |
}catch(err01){ | |
log.error('calculateDueDate.err01',JSON.stringify(err01)); | |
handleErrorAndSendNotification(err01,'calculateDueDate'); | |
}finally{ | |
return dueDate; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment