Version: eXtendAlphaBroder 1.0.3.1 and
above
Audience: Administrator
Overview
You may want to include additional
charges such as shipping, handling, and
taxes on the vendor bill records that are
being automatically created in NetSuite
from AlphaBroder's invoice
information. Custom SuiteScript hook
functions can be used to apply additional
costs and charges on the resulting vendor
bill record.
Configuration
Some sample functions are below
that demonstrate the ability to add
additional shipping, handling, and tax
charges. The functions should be added in
the suite_alpha_transformers.js file
present in your NetSuite account:
setTaxTotal
Function to set tax charges:
/*** @param {Object} args* @property {Object} args.vendorBillRecord* @property {Object} args.sourceRecord* @property {String} args.recordType* @property {String} args.recordId*/function setTaxTotal(args) {var vendorBillRecord = args.vendorBillRecord;var sourceRecord = args.sourceRecord;var recordType = args.recordType;var recordId = args.recordId;log.debug({ title: 'setTaxTotal Initiated' });log.debug({ title: 'setTaxTotal sourceRecord', details: sourceRecord });var totalTax = sourceRecord.taxtotal || '';if (!totalTax) {return;}if (typeof totalTax === 'string') {totalTax = parseFloat(totalTax);}log.debug({ title: 'setTaxTotal totalTax', details: totalTax });if (!totalTax) {return;}// vendorBillRecord.selectNewLine({ sublistId: 'item' });// vendorBillRecord.setCurrentSublistValue({ sublistId: 'item', fieldId: 'item', value: '48186' });// vendorBillRecord.setCurrentSublistValue({ sublistId: 'item', fieldId: 'quantity', value: '1' });// vendorBillRecord.setCurrentSublistValue({ sublistId: 'item', fieldId: 'rate', value: totalTax });// vendorBillRecord.setCurrentSublistValue({ sublistId: 'item', fieldId: 'amount', value: totalTax });// vendorBillRecord.commitLine({ sublistId: 'item' });}
setFreightTotal
Function to set freight charges:
/*** @param {Object} args* @property {Object} args.vendorBillRecord* @property {Object} args.sourceRecord* @property {String} args.recordType* @property {String} args.recordId*/function setFreightTotal(args) {var vendorBillRecord = args.vendorBillRecord;var sourceRecord = args.sourceRecord;var recordType = args.recordType;var recordId = args.recordId;log.debug({ title: 'setFreightTotal Initiated' });log.debug({ title: 'setFreightTotal sourceRecord', details: sourceRecord });var freightTotal = sourceRecord.freighttotal || '';if (!freightTotal) {return;}if (typeof freightTotal === 'string') {freightTotal = parseFloat(freightTotal);}log.debug({ title: 'setFreightTotal freightTotal', details: freightTotal });if (!freightTotal) {return;}// vendorBillRecord.selectNewLine({ sublistId: 'item' });// vendorBillRecord.setCurrentSublistValue({ sublistId: 'item', fieldId: 'item', value: '1009' });// vendorBillRecord.setCurrentSublistValue({ sublistId: 'item', fieldId: 'quantity', value: '1' });// vendorBillRecord.setCurrentSublistValue({ sublistId: 'item', fieldId: 'rate', value: freightTotal });// vendorBillRecord.setCurrentSublistValue({ sublistId: 'item', fieldId: 'amount', value: freightTotal });// vendorBillRecord.commitLine({ sublistId: 'item' });}