Add UG computing in Sale order & Customer invoice
This commit is contained in:
@@ -40,6 +40,7 @@ import com.axelor.rpc.Context;
|
|||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
@@ -401,4 +402,23 @@ public class InvoiceLineController {
|
|||||||
}
|
}
|
||||||
response.setValue("fixedAssetCategory", fixedAssetCategory);
|
response.setValue("fixedAssetCategory", fixedAssetCategory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void updateQtyUg(ActionRequest request, ActionResponse response) throws AxelorException{
|
||||||
|
Context context = request.getContext();
|
||||||
|
InvoiceLine invoiceLine = context.asType(InvoiceLine.class);
|
||||||
|
|
||||||
|
BigDecimal qtyUg = invoiceLine.getProduct().getUg();
|
||||||
|
BigDecimal qty = invoiceLine.getQty();
|
||||||
|
BigDecimal totalQty = qty.add(qty.multiply(qtyUg).divide(new BigDecimal(100), 4,RoundingMode.HALF_EVEN));
|
||||||
|
Product product = invoiceLine.getProduct();
|
||||||
|
if(product.getUg() != null && product.getUg().compareTo(BigDecimal.ZERO) > 0){
|
||||||
|
BigDecimal ug = invoiceLine.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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,6 +141,10 @@
|
|||||||
|
|
||||||
<boolean name="allowToForcePurchaseQty" title="Allow to force purchases quantities"/>
|
<boolean name="allowToForcePurchaseQty" title="Allow to force purchases quantities"/>
|
||||||
|
|
||||||
|
<decimal name="pvg" title="PVG" />
|
||||||
|
<decimal name="stklim" title="Stklim" />
|
||||||
|
<decimal name="ug" title="UG" />
|
||||||
|
|
||||||
<extra-code>
|
<extra-code>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
// PRODUCT TYPE SELECT
|
// PRODUCT TYPE SELECT
|
||||||
|
|||||||
@@ -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 {
|
public void resetPackLine(ActionRequest request, ActionResponse response) throws AxelorException {
|
||||||
|
|
||||||
Context context = request.getContext();
|
Context context = request.getContext();
|
||||||
|
|||||||
Reference in New Issue
Block a user