/** * <p>Process entity request.</p> * @param pAddParam additional param, e.g. return this line's * document in "nextEntity" for farther process * @param pRequestData Request Data * @param pEntity Entity to process * @return Entity processed for farther process or null * @throws Exception - an exception **/ @Override public final PurchaseReturnLine process( final Map<String, Object> pAddParam, final PurchaseReturnLine pEntityPb, final IRequestData pRequestData) throws Exception { PurchaseReturnLine entity = this.prcAccEntityPbCopy .process(pAddParam, pEntityPb, pRequestData); if (entity.getReversedId() != null) { throw new ExceptionWithCode(ExceptionWithCode.FORBIDDEN, "attempt_to_reverse_reversed"); } entity.setReversedId(pEntityPb.getItsId()); entity.setItsQuantity(entity.getItsQuantity().negate()); entity.setSubtotal(entity.getSubtotal().negate()); entity.setTotalTaxes(entity.getTotalTaxes().negate()); entity.setItsTotal(entity.getItsTotal().negate()); return entity; }
entity.setItsQuantity(entity.getItsQuantity().negate()); entity.setSubtotal(entity.getSubtotal().negate()); entity.setTotalTaxes(entity.getTotalTaxes().negate());
pEntity.setTaxesDescription(reversed.getTaxesDescription()); pEntity.setTotalTaxes(reversed.getTotalTaxes().negate()); pEntity.setItsQuantity(reversed.getItsQuantity().negate()); pEntity.setSubtotal(reversed.getSubtotal().negate()); pEntity.setItsTotal(reversed.getItsTotal().negate()); pEntity.getItsOwner().getItsId()); } else { if (pEntity.getItsQuantity().doubleValue() <= 0) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "quantity_less_or_equal_zero"); .getItsQuantity(), as.getCostPrecision(), as.getRoundingMode()); if (sourceCostNt.compareTo(curCostNt) != 0) { if (pEntity.getDescription() == null) { pEntity.getWarehouseSiteFo()); srvUseMaterialEntry.withdrawalFrom(pReqVars, pEntity, pEntity.getPurchaseInvoiceLine(), pEntity.getItsQuantity());
final boolean isEntityDetached) throws Exception { if (pEntity.getIsNew()) { if (pEntity.getItsQuantity().doubleValue() == 0) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "Quantity is 0!" + pAddParam.get("user")); if (pEntity.getItsQuantity().doubleValue() < 0 && pEntity.getReversedId() == null) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "wrong_purchaseInvoiceLine"); pEntity.setItsQuantity(pEntity.getItsQuantity().setScale( getSrvAccSettings().lazyGetAccSettings().getQuantityPrecision(), getSrvAccSettings().lazyGetAccSettings().getRoundingMode())); .getMsg("rest_was") + "=" + pEntity.getPurchaseInvoiceLine() .getTheRest()); pEntity.setSubtotal(pEntity.getItsQuantity().multiply(pEntity .getPurchaseInvoiceLine().getItsCost()).setScale(getSrvAccSettings() .lazyGetAccSettings().getPricePrecision(), getSrvAccSettings() pEntity.getWarehouseSiteFo()); srvUseMaterialEntry.withdrawalFrom(pAddParam, pEntity, pEntity.getPurchaseInvoiceLine(), pEntity.getItsQuantity());
reversingLine.setPurchaseInvoiceLine(reversedLine .getPurchaseInvoiceLine()); reversingLine.setItsQuantity(reversedLine.getItsQuantity() .negate()); reversingLine.setItsTotal(reversedLine.getItsTotal().negate());
reversingLine.setPurchaseInvoiceLine(reversedLine .getPurchaseInvoiceLine()); reversingLine.setItsQuantity(reversedLine.getItsQuantity() .negate()); reversingLine.setItsTotal(reversedLine.getItsTotal().negate());