Add UG computing in Sale order & Customer invoice
This commit is contained in:
@@ -386,6 +386,23 @@ public class SaleOrderLineController {
|
||||
}
|
||||
}
|
||||
|
||||
public void updateQtyUg(ActionRequest request, ActionResponse response) throws AxelorException{
|
||||
Context context = request.getContext();
|
||||
SaleOrderLine saleOrderLine = context.asType(SaleOrderLine.class);
|
||||
|
||||
BigDecimal qtyUg = saleOrderLine.getProduct().getUg();
|
||||
BigDecimal qty = saleOrderLine.getQty();
|
||||
BigDecimal totalQty = qty.add(qty.multiply(qtyUg).divide(new BigDecimal(100), 4,RoundingMode.HALF_EVEN));
|
||||
Product product = saleOrderLine.getProduct();
|
||||
if(product.getUg() != null && product.getUg().compareTo(BigDecimal.ZERO) > 0){
|
||||
BigDecimal ug = saleOrderLine.getProduct().getUg().divide(new BigDecimal(100), 10, RoundingMode.HALF_EVEN);
|
||||
BigDecimal ugAmount = ug.divide(ug.add(BigDecimal.ONE),10, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100));
|
||||
response.setValue("discountTypeSelect", 1);
|
||||
response.setValue("discountAmount", ugAmount);
|
||||
response.setValue("qty", totalQty);
|
||||
}
|
||||
}
|
||||
|
||||
public void resetPackLine(ActionRequest request, ActionResponse response) throws AxelorException {
|
||||
|
||||
Context context = request.getContext();
|
||||
|
||||
Reference in New Issue
Block a user