Package java.math

Examples of java.math.BigDecimal.subtract()


                            List<GenericValue> orderShipments = shipment.getRelatedByAnd("OrderShipment" , UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId));
                            for(GenericValue orderShipment : orderShipments) {
                                verifiedQuantity = verifiedQuantity.add(orderShipment.getBigDecimal("quantity"));
                            }
                        }
                        qtyToVerify = orderedQuantity.subtract(verifiedQuantity);
                        if (qtyToVerify.compareTo(quantity) > -1) {
                            readyToVerifyQty = pickSession.getReadyToVerifyQuantity(orderId,orderItemSeqId);
                            qtyToVerified =  orderedQuantity.subtract(readyToVerifyQty);
                            if (qtyToVerified.compareTo(quantity) > -1) {
                                pickSession.createRow(orderId, orderItemSeqId, shipGroupSeqId, productId, quantity, facilityId, orderItem);
View Full Code Here


                            }
                        }
                        qtyToVerify = orderedQuantity.subtract(verifiedQuantity);
                        if (qtyToVerify.compareTo(quantity) > -1) {
                            readyToVerifyQty = pickSession.getReadyToVerifyQuantity(orderId,orderItemSeqId);
                            qtyToVerified =  orderedQuantity.subtract(readyToVerifyQty);
                            if (qtyToVerified.compareTo(quantity) > -1) {
                                pickSession.createRow(orderId, orderItemSeqId, shipGroupSeqId, productId, quantity, facilityId, orderItem);
                            } else {
                                throw new GeneralException("Quantity to Verify is more than the Quantity left to Verify (orderedQuantity - readyToVerifiedQty)");
                            }
View Full Code Here

     */
    public static BigDecimal availableToCapture(GenericValue billingAccount) throws GenericEntityException {
        BigDecimal netBalance = getBillingAccountNetBalance(billingAccount.getDelegator(), billingAccount.getString("billingAccountId"));
        BigDecimal accountLimit = billingAccount.getBigDecimal("accountLimit");

        return accountLimit.subtract(netBalance).setScale(decimals, rounding);
    }

    public static Map calcBillingAccountBalance(DispatchContext dctx, Map context) {
        GenericDelegator delegator = dctx.getDelegator();
        String billingAccountId = (String) context.get("billingAccountId");
View Full Code Here

    public void clearLine(PackingSessionLine line) {
        this.packLines.remove(line);
        BigDecimal packageWeight = this.packageWeights.get(line.packageSeq);
        if (packageWeight != null) {
            packageWeight = packageWeight.subtract(line.weight);
            if (packageWeight.compareTo(BigDecimal.ZERO) < 0) {
                packageWeight = BigDecimal.ZERO;
            }
            this.packageWeights.put(line.packageSeq, packageWeight);
        }
View Full Code Here

            if (tmpResults.get("availableToPromiseTotal") != null) {
                existingAtp = (BigDecimal) tmpResults.get("availableToPromiseTotal");
            }
            // if the order is immediately fulfilled, adjust the atp to compensate for it not reserved
            if (isImmediatelyFulfilled) {
                existingAtp = existingAtp.subtract(orderItem.getBigDecimal("quantity"));
            }

            if (Debug.verboseOn()) { Debug.logVerbose("Order item [" + orderItem + "] Existing ATP = [" + existingAtp + "]", module); }
            // we only need to produce more marketing packages if there isn't enough in stock.
            if (existingAtp.compareTo(ZERO) < 0) {
View Full Code Here

        if (inventoryType.equals("NON_SERIAL_INV_ITEM")) {
            // add an adjusting InventoryItemDetail so set ATP back to QOH: ATP = ATP + (QOH - ATP), diff = QOH - ATP
            BigDecimal atp = inventoryItem.get("availableToPromiseTotal") == null ? BigDecimal.ZERO : inventoryItem.getBigDecimal("availableToPromiseTotal");
            BigDecimal qoh = inventoryItem.get("quantityOnHandTotal") == null ? BigDecimal.ZERO : inventoryItem.getBigDecimal("quantityOnHandTotal");
            Map<String, Object> createDetailMap = UtilMisc.toMap("availableToPromiseDiff", qoh.subtract(atp),
                    "inventoryItemId", inventoryItem.get("inventoryItemId"), "userLogin", userLogin);
            try {
                Map<String, Object> result = dctx.getDispatcher().runSync("createInventoryItemDetail", createDetailMap);
                if (ServiceUtil.isError(result)) {
                    return ServiceUtil.returnError("Inventory Item Detail create problem in complete inventory transfer", null, null, result);
View Full Code Here

        // re-set the fields on the item
        if (inventoryType.equals("NON_SERIAL_INV_ITEM")) {
            // add an adjusting InventoryItemDetail so set ATP back to QOH: ATP = ATP + (QOH - ATP), diff = QOH - ATP
            BigDecimal atp = inventoryItem.get("availableToPromiseTotal") == null ? BigDecimal.ZERO : inventoryItem.getBigDecimal("availableToPromiseTotal");
            BigDecimal qoh = inventoryItem.get("quantityOnHandTotal") == null ? BigDecimal.ZERO : inventoryItem.getBigDecimal("quantityOnHandTotal");
            Map<String, Object> createDetailMap = UtilMisc.toMap("availableToPromiseDiff", qoh.subtract(atp),
                                                 "inventoryItemId", inventoryItem.get("inventoryItemId"),
                                                 "userLogin", userLogin);
            try {
                Map<String, Object> result = dctx.getDispatcher().runSync("createInventoryItemDetail", createDetailMap);
                if (ServiceUtil.isError(result)) {
View Full Code Here

                    BigDecimal remainingQty = (BigDecimal)currentDateMap.get("remainingQty");
                    if (remainingQty.compareTo(ZERO) == 0) {
                        continue;
                    }
                    if (remainingQty.compareTo(quantityNotAvailableRem) >= 0) {
                        remainingQty = remainingQty.subtract(quantityNotAvailableRem);
                        currentDateMap.put("remainingQty", remainingQty);
                        GenericValue orderItemShipGrpInvRes = delegator.findByPrimaryKey("OrderItemShipGrpInvRes", UtilMisc.toMap("orderId", genericResult.getString("orderId"),
                                                                                                                                  "shipGroupSeqId", genericResult.getString("shipGroupSeqId"),
                                                                                                                                  "orderItemSeqId", genericResult.getString("orderItemSeqId"),
                                                                                                                                  "inventoryItemId", genericResult.getString("inventoryItemId")));
View Full Code Here

        BigDecimal orderQty = orderItem.getBigDecimal("quantity");

        if (cancelQty == null) cancelQty = ZERO;
        if (orderQty == null) orderQty = ZERO;

        return orderQty.subtract(cancelQty).setScale(scale, rounding);
    }

    public static BigDecimal getOrderItemShipGroupQuantity(GenericValue shipGroupAssoc) {
        BigDecimal cancelQty = shipGroupAssoc.getBigDecimal("cancelQuantity");
        BigDecimal orderQty = shipGroupAssoc.getBigDecimal("quantity");
View Full Code Here

        BigDecimal orderQty = shipGroupAssoc.getBigDecimal("quantity");

        if (cancelQty == null) cancelQty = BigDecimal.ZERO;
        if (orderQty == null) orderQty = BigDecimal.ZERO;

        return orderQty.subtract(cancelQty);
    }

    public static GenericValue getProductStoreFromOrder(GenericDelegator delegator, String orderId) {
        GenericValue orderHeader = getOrderHeader(delegator, orderId);
        if (orderHeader == null) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.