Function to get internal ID of Stock unit in account with Multiple units of measure

/** * @description Function to get internal ID of the stock unit * @param unitname – unit name * @param Wine_packsize – size need to be find out * @returns {*number*} */ function getStockUnit(unitTypeInternalID, unitname, wine_packsize) { log.debug(“unitname”, unitname); if (checkForParameter(unitTypeInternalID)) { var unitRec = record.load({ type: record.Type.UNITS_TYPE, id: unitTypeInternalID, isDynamic: false }); var linecount… Continue reading Function to get internal ID of Stock unit in account with Multiple units of measure

Single Saved search for fetching multiple SKUs

Saved search for fetching the items based on the SKUs /** * @description Saved search for fetching the items based on the SKUs * @param itemArray {Array}- Array of items in each Wineye order * @returns {Array} */ function fetchItemID(itemArray) { var stringArr = ”; var filter_name = ‘itemid’; for (var i = 0; itemArray.length… Continue reading Single Saved search for fetching multiple SKUs

To fix a float number to specified decimal parts

/** * @description To fix a float number to specified decimal parts * @param {Number|String} value * @param {Number|String} decimals * @returns {Number|String} */ const fixFloat = (value, decimals) => { decimals = (decimals) ? decimals : 2; // return roundFloat(parseFloat(value), parseInt(decimals)).toFixed(parseInt(decimals)); return parseFloat(value).toFixed(decimals); };

Round a float number

/** * @description To round a float number * @param {Number|String} value * @param {Number|String} decimals * @returns {Number} Floating Point Number with the given precision */ const roundFloat = (value, decimals) => { decimals = (decimals) ? decimals : 2; return Number(Math.round(parseFloat(value) + ‘e’ + parseInt(decimals)) + ‘e-‘ + parseInt(decimals)); };

Assign default value

/** * @description To assign a default value if the value argument is empty * @param {String|Number|Boolean|Object|Array|null|undefined} value * @param {String|Number|Boolean|Object|Array} defaultValue * @returns {*} either value or defaultValue */ const assignDefaultValue = function assignDefaultValue(value, defaultValue) { if (checkForParameter(value)) return value; else return defaultValue; }

Transforming transfer order based on item fulfillment

/** * * @param docNum * @param IFDetails * @param ifInternalId * @return {*|number} */ function IRcreation(docNum, IFDetails, ifInternalId) { try { let trecord = record.transform({ fromType: record.Type.TRANSFER_ORDER, fromId: docNum, toType: record.Type.ITEM_RECEIPT, isDynamic: true, defaultValues: {‘itemfulfillment’: ifInternalId.toString()} }); let itemCount = trecord.getLineCount({sublistId: ‘item’}); log.debug(‘in itemCount’, itemCount); for (let i = 0; i < itemCount; i++)… Continue reading Transforming transfer order based on item fulfillment