Package java.math

Examples of java.math.BigDecimal.subtract()


        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(UtilProperties.getMessage(resource,
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

        }

        String itemStatus = orderItem.getString("statusId");
        BigDecimal orderQty = orderItem.getBigDecimal("quantity");
        if (orderItem.getBigDecimal("cancelQuantity") != null) {
            orderQty = orderQty.subtract(orderItem.getBigDecimal("cancelQuantity"));
        }

        // get the returnable quantity
        BigDecimal returnableQuantity = BigDecimal.ZERO;
        if (returnable && (itemStatus.equals("ITEM_APPROVED") || itemStatus.equals("ITEM_COMPLETED"))) {
View Full Code Here

          computedResult = new BigDecimal(n.toString());
        }
        else
        {
          //noinspection ObjectToString
          computedResult = computedResult.subtract(new BigDecimal(n.toString()));
        }
      }
    }

    if (computedResult != null)
View Full Code Here


    if (toType.isFlagSet(Type.TIME_TYPE))
    {
      final BigDecimal o = fromSerialDate.setScale(LibFormulaBoot.GLOBAL_SCALE, BigDecimal.ROUND_UP);
      return o.subtract(new BigDecimal(o.intValue()));
      // only return the decimal part
      // final Double d = new Double(fromSerialDate.doubleValue()
      // - fromSerialDate.intValue());
      // return d;
    }
View Full Code Here

      //UPDATE - account should be credited during completeOrder
      BigDecimal price = quote.getPrice();
      BigDecimal orderFee = order.getOrderFee();
      BigDecimal balance = account.getBalance();
      total   = (new BigDecimal(quantity).multiply(price)).add(orderFee);
      account.setBalance(balance.subtract(total));     
     
      if (orderProcessingMode == TradeConfig.SYNCH)
        completeOrderInternal(order.getOrderID());
      else if (orderProcessingMode == TradeConfig.ASYNCH)
        // Invoke the queueOrderOnePhase method w/ TXN requires new attribute
View Full Code Here

      } else {
        Tuple next = increment(last, term.longValue(), variableId);
        ranges.add(new TupleRange(schema, last, next));
      }
      last = ranges.get(ranges.size() - 1).getEnd();
      reminder = reminder.subtract(term);
    }

    return ranges.toArray(new TupleRange[ranges.size()]);
  }
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

                            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);
                                counter--;
                                break;
                            } else if (orderItems.size() == counter) {
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.