3PL Billing Script - "Round up" Estimated Cases field in Storage Activity

3PL Billing Script - "Round up" Estimated Cases field in Storage Activity

As explained in our Using an Infoplus Script to Customize 3PL Billing Invoice Worksheets article, Infoplus scripts can be used to customize 3PL Billing Invoice worksheets.  Please refer to that article for the general variables and objects that are available when creating this script type.  


The content that follows in this article is an example script that looks at input rows that have a Receipt Quantity Per Case value that would go into an Invoice Worksheet & corresponding backup file.  For rows that have this value, the script is calculating what the Estimated Cases value should be, then rounds the Estimated Cases up to the nearest whole number.  This is useful when you want to consider partial cases as full cases when producing invoice worksheets.


The script starts by using a for loop to loop through all input rows, calculating the estimated cases for each row.  It then uses the Math.ceil method to round the estimated cases value up to the nearest whole number.  After the loop is finished, these changes are applied to the invoice worksheet by using utils.setOutputLines();