entity.setItsQuantity(entity.getItsQuantity().negate()); entity.setSubtotal(entity.getSubtotal().negate()); entity.setTotalTaxes(entity.getTotalTaxes().negate());
/** * <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 pEntityPb Entity to process * @return Entity processed for farther process or null * @throws Exception - an exception **/ @Override public final SalesReturnLine process( final Map<String, Object> pAddParam, final SalesReturnLine pEntityPb, final IRequestData pRequestData) throws Exception { SalesReturnLine 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; }
final boolean isEntityDetached) throws Exception { if (pEntity.getIsNew()) { if (pEntity.getItsQuantity().doubleValue() == 0) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "quantity_is_0"); if (pEntity.getItsQuantity().doubleValue() < 0 && pEntity.getReversedId() == null) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, SalesReturn.class, pEntity.getItsOwner().getItsId()); pEntity.setItsOwner(itsOwner); pEntity.setItsQuantity(pEntity.getItsQuantity().setScale( getSrvAccSettings().lazyGetAccSettings().getQuantityPrecision(), getSrvAccSettings().lazyGetAccSettings().getRoundingMode())); .lazyGetAccSettings().getPricePrecision(), getSrvAccSettings() .lazyGetAccSettings().getRoundingMode())); pEntity.setTheRest(pEntity.getItsQuantity()); BigDecimal totalTaxes = BigDecimal.ZERO; String taxesDescription = ""; "Attempt to double reverse" + pAddParam.get("user")); if (!reversed.getItsQuantity().equals(reversed.getTheRest())) { throw new ExceptionWithCode(ExceptionWithCode .WRONG_PARAMETER, "where_is_withdrawals_from_this_source");
"Attempt to double reverse" + pReqVars.get("user")); if (!reversed.getItsQuantity().equals(reversed.getTheRest())) { throw new ExceptionWithCode(ExceptionWithCode .WRONG_PARAMETER, "where_is_withdrawals_from_this_source"); pEntity.setTaxesDescription(reversed.getTaxesDescription()); pEntity.setTotalTaxes(reversed.getTotalTaxes().negate()); pEntity.setItsQuantity(reversed.getItsQuantity().negate()); pEntity.setItsCost(reversed.getItsCost()); pEntity.setItsPrice(reversed.getItsPrice()); if (pEntity.getItsQuantity().doubleValue() == 0) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "quantity_is_0");
for (SalesReturnLine reversedLine : reversedLines) { if (reversedLine.getReversedId() == null) { if (!reversedLine.getItsQuantity() .equals(reversedLine.getTheRest())) { throw new ExceptionWithCode(PurchaseInvoice.SOURSE_IS_IN_USE, reversingLine.setUnitOfMeasure(reversedLine.getUnitOfMeasure()); reversingLine.setItsCost(reversedLine.getItsCost()); reversingLine.setItsQuantity(reversedLine.getItsQuantity() .negate()); reversingLine.setItsTotal(reversedLine.getItsTotal().negate());
for (SalesReturnLine reversedLine : reversedLines) { if (reversedLine.getReversedId() == null) { if (!reversedLine.getItsQuantity() .equals(reversedLine.getTheRest())) { throw new ExceptionWithCode(PurchaseInvoice.SOURSE_IS_IN_USE, reversingLine.setUnitOfMeasure(reversedLine.getUnitOfMeasure()); reversingLine.setItsCost(reversedLine.getItsCost()); reversingLine.setItsQuantity(reversedLine.getItsQuantity() .negate()); reversingLine.setItsTotal(reversedLine.getItsTotal().negate());