有没有办法以编程方式对购买账单进行折扣?

问题描述 投票:1回答:1

我们要求在订单项级别“对税前购买帐单应用折扣”。为此,我们在订单项级别创建了一个折扣字段。应根据“折扣”自定义字段中的值打折率。金额将根据数量和费率进行更新。

我已尝试使用工作流程,但它无法正常工作。任何人都可以帮助我编写脚本吗?

netsuite
1个回答
0
投票

假设您将使用客户端脚本,则可以使用validateLine函数,该函数将在单击“项目子列表”上的“添加”按钮后触发。

function checkDiscount(type){
    var getDiscount = nlapiGetCurrentLineItemValue('item', 'internalID of discount field');
    var currRate = nlapiGetCurrentLineItemValue('item', 'rate');
    var newRate = currRate * getDiscount; // depending on the value stored in Discount, you may need to modify this further
    nlapiSetCurrentLineItemValue('item', 'rate'); 

    return true;
}
© www.soinside.com 2019 - 2024. All rights reserved.