@Override public void calculate(IPricingContext pricingCtx, IPricingResult result) { // // Check product price final int productID = pricingCtx.getM_Product_ID(); BigDecimal price = productId2price.get(productID); if (price == null) { price = priceToReturn; } result.setPriceLimit(price); result.setPriceList(price); result.setPriceStd(price); result.setPrecision(precision); result.setC_TaxCategory_ID(100); final I_C_UOM priceUOM = productId2priceUOM.get(productID); if (priceUOM != null) { result.setPrice_UOM_ID(priceUOM.getC_UOM_ID()); } result.setCalculated(true); }
public I_C_UOM_Conversion createUOMConversion( final int productId, final I_C_UOM uomFrom, final I_C_UOM uomTo, final BigDecimal multiplyRate, final BigDecimal divideRate) { final I_C_UOM_Conversion conversion = InterfaceWrapperHelper.create(Env.getCtx(), I_C_UOM_Conversion.class, ITrx.TRXNAME_None); conversion.setM_Product_ID(productId); conversion.setC_UOM_ID(uomFrom.getC_UOM_ID()); conversion.setC_UOM_To_ID(uomTo.getC_UOM_ID()); conversion.setMultiplyRate(multiplyRate); conversion.setDivideRate(divideRate); InterfaceWrapperHelper.save(conversion, ITrx.TRXNAME_None); return conversion; }
public I_M_Product createProduct(final String name, final I_C_UOM uom) { final I_M_Product product = InterfaceWrapperHelper.newInstance(I_M_Product.class, contextProvider); product.setValue(name); product.setName(name); product.setM_Product_Category_ID( productCategoryDefault == null ? -1 : productCategoryDefault.getM_Product_Category_ID()); product.setC_UOM_ID(uom.getC_UOM_ID()); product.setLowLevel(0); InterfaceWrapperHelper.save(product); return product; }
public I_C_UOM createUOM(final String name, final int stdPrecision) { final I_C_UOM uom = InterfaceWrapperHelper.newInstance(I_C_UOM.class, contextProvider); uom.setName(name); uom.setUOMSymbol(name); uom.setX12DE355(name); uom.setStdPrecision(stdPrecision); uom.setCostingPrecision(0); InterfaceWrapperHelper.save(uom); return uom; }