Using Pick, Pack and Ship and advanced PDF HTML templates, NetSuite cannot display the qty remaining to pick. So if we do a partial pick, we cannot show the warehouse the remaining balance. The math is simple, here is the script and function I would like to see (based on forum feedback). Will this work and what is the best way to deploy this script such that the result is stored in the custom column until another pick takes place? The value is to be calculated at time of changes, but available to all related transaction records.
function SetQtytoPick(type){
if(type == 'item'){
var qtyordered = nlapiGetCurrentLineItemValue('item', 'quantity');
var qtypicked = nlapiGetCurrentLineItemValue('item', 'quantitypicked');
var qtytopick = qtyordered-qtypicked
nlapiSetCurrentLineItemValue('item', 'custcol_qty_to_pick', qtytopick);
}
}
Actually one of the really fun things about the Advanced HTML/PDF templates is that you don't need your code. When print the packing slip the template supplies the item fulfillment (as record) and the sales order (as salesorder).
You can get the value you need from the Sales Order's Item Line's quantityfulfilled value.
the following snippet was from a customized packing slip where the customer wanted the PS to always show all the Sales Order's items. It doesn't directly solve your problem but you can see that the template itself can be used to calculate the items remaining to ship at the time of printing.
The other way to do this would be to put your script into a user event script before submit event. You'd deploy it on Item Fulfillments