Here is the very simple code:
function setDealerListPricing(name, type)
{
if (type == 'custitem_ecs_pricesheet')
{
var inPriceList = nlapiGetFieldValue('custitem_ecs_pricesheet');
var specialDealer = nlapiGetLineItemMatrixValue('price', 'price', 5, 1);
var bidPrice = nlapiGetLineItemMatrixValue('price', 'price', 2, 1);
var itemCost = nlapiGetFieldValue('cost'); //Cost is currently not in NetSuite
var itemWeight = nlapiGetFieldValue('weight');
var itemMargin = nlapiGetFieldValue('custitem_ecs_margin');
var freightCharge = nlapiGetFieldValue('custitem_ecs_freight');
var freightCalc = (itemWeight / 2000) * freightCharge;
var manPrice = specialDealer + freightCalc;
var minPrice = bidPrice + freightCalc;
var truckPrice = itemCost + itemMargin + freightCharge;
if (inPriceList == 'T')
{
nlapiSetFieldValue('custitem_ecs_feedmanprice', manPrice, null, null);
nlapiSetFieldValue('custitem_ecs_minprice', minPrice, null, null);
nlapiSetFieldValue('custitem_ecs_truckload', truckPrice, null, null);
}
else
{
nlapiSetFieldValue('custitem_ecs_feedmanprice', '', null, null);
nlapiSetFieldValue('custitem_ecs_minprice', '', null, null);
nlapiSetFieldValue('custitem_ecs_truckload', '', null, null);
}
}
}
I had alerts set up to show the value of some select fields...the fields all have valid numbers that I'm adding, but the step where I add values together is concatenating the values!!:h_a_w: If I change the addition steps to subtraction the work fine. Am I missing something with the addition operator? I thought it was a simple +.