suitescript设置自定义列值netsuite [英] suitescript set custom column value netsuite

查看:154
本文介绍了suitescript设置自定义列值netsuite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用拣配,包装和运送以及高级PDF HTML模板,NetSuite无法显示剩余的拣配数量.因此,如果我们进行部分拣货,我们将无法显示仓库的剩余余额.数学很简单,这是我希望看到的脚本和功能(基于论坛的反馈).请问这是否可行,最好的部署此脚本的方法是什么,以便将结果存储在自定义列中,直到再次进行选择为止?该值将在更改时计算,但可用于所有相关的交易记录.

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);
  }
}

推荐答案

实际上,高级HTML/PDF模板的真正有趣之处之一是您不需要代码.在打印装箱单时,模板会提供项目履行(作为记录)和销售订单(作为销售订单).

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.

以下摘录来自一个定制的装箱单,客户希望PS始终显示所有销售订单的物料.它并不能直接解决您的问题,但是您可以看到模板本身可以用来计算在打印时剩余的要运送的物品.

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.

<#list salesorder.item as tranline>
    <#assign shipped=0>
    <#assign prevShipped=tranline.quantityfulfilled>
    <#assign qtyRemaining=tranline.quantity - prevShipped>
    <#if (tranline.quantitybackordered gt 0)> <#assign qtyRemaining=tranline.quantitybackordered></#if>
    <#list record.item as item><#if tranline.line==item.orderline>
        <#assign shipped=item.quantity>
        <#assign prevShipped=tranline.quantityfulfilled-item.quantity>
    </#if></#list>
    <tr>
    <td colspan="12"><span class="itemname">${tranline.item}</span><#if tranline.itemtype =='NonInvtPart'>**<#assign anyNonInvt='T'></#if><br />${tranline.description?html}</td>
    <td align="center" colspan="3"><#if shipped gt 0><b>${shipped}</b><#else>0</#if></td>
    <td align="center" colspan="3">${tranline.quantity}</td>
    <td align="center" colspan="3">${prevShipped}</td>
    <td align="center" colspan="3">${qtyRemaining}</td>
    <td colspan="4">${tranline.options?html}</td>

    </tr>
    </#list>
</#if>

另一种方法是在提交事件之前将脚本放入用户事件脚本中.您可以将其部署在商品实现

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

这篇关于suitescript设置自定义列值netsuite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆