/** * <p>Create entity.</p> * @param pAddParam additional param * @return entity instance * @throws Exception - an exception **/ @Override public final PurchaseReturnLine createEntity( final Map<String, Object> pAddParam) throws Exception { PurchaseReturnLine entity = new PurchaseReturnLine(); entity.setIdDatabaseBirth(getSrvOrm().getIdDatabase()); entity.setIsNew(true); PurchaseReturn itsOwner = new PurchaseReturn(); entity.setItsOwner(itsOwner); addAccSettingsIntoAttrs(pAddParam); return entity; }
/** * <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; }
/** * <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); entity.setItsOwner(this.prcAccEntityPbCopy .getSrvOrm().retrieveEntity(pAddParam, entity.getItsOwner())); entity.setPurchaseInvoiceLine(null); entity.setPurchInvLnAppearance(null); entity.setItsQuantity(BigDecimal.ZERO); entity.setItsTotal(BigDecimal.ZERO); entity.setTotalTaxes(BigDecimal.ZERO); entity.setSubtotal(BigDecimal.ZERO); entity.setTaxesDescription(null); return entity; }
if (parameterMap.get("actionAdd") != null && "reverse".equals(parameterMap.get("actionAdd")[0])) { if (entity.getReversedId() != null) { throw new ExceptionWithCode(ExceptionWithCode.FORBIDDEN, "Attempt to double reverse" + pAddParam.get("user")); entity.setReversedId(Long.valueOf(pId.toString())); entity.setItsQuantity(entity.getItsQuantity().negate()); entity.setSubtotal(entity.getSubtotal().negate()); entity.setTotalTaxes(entity.getTotalTaxes().negate()); entity.setItsTotal(entity.getItsTotal().negate()); } else { entity.setPurchaseInvoiceLine(null); entity.setPurchInvLnAppearance(null); entity.setItsQuantity(BigDecimal.ZERO); entity.setItsTotal(BigDecimal.ZERO); entity.setTotalTaxes(BigDecimal.ZERO); entity.setSubtotal(BigDecimal.ZERO); entity.setTaxesDescription(null); entity.setIsNew(true); addAccSettingsIntoAttrs(pAddParam); return entity;
PurchaseReturn.class, pEntity.getReversedId()); for (PurchaseReturnLine reversedLine : reversedLines) { if (reversedLine.getReversedId() == null) { PurchaseReturnLine reversingLine = new PurchaseReturnLine(); reversingLine.setIdDatabaseBirth(getSrvOrm().getIdDatabase()); reversingLine.setReversedId(reversedLine.getItsId()); reversingLine.setPurchaseInvoiceLine(reversedLine .getPurchaseInvoiceLine()); reversingLine.setItsQuantity(reversedLine.getItsQuantity() .negate()); reversingLine.setItsTotal(reversedLine.getItsTotal().negate()); reversingLine.setSubtotal(reversedLine.getSubtotal().negate()); reversingLine.setTotalTaxes(reversedLine.getTotalTaxes().negate()); reversingLine.setTaxesDescription(reversedLine .getTaxesDescription()); reversingLine.setIsNew(true); reversingLine.setItsOwner(pEntity); reversingLine.setDescription(getSrvI18n().getMsg("reversed_n") + reversedLine.getIdDatabaseBirth() + "-" + reversedLine.getItsId()); getSrvOrm().insertEntity(reversingLine); getSrvWarehouseEntry().reverseDraw(pAddParam, reversingLine); pEntity.getItsDate(), pEntity.getItsId()); String descr; if (reversedLine.getDescription() == null) { descr = ""; } else { descr = reversedLine.getDescription();
final PurchaseReturnLine pEntity, final IRequestData pRequestData) throws Exception { if (pEntity.getIsNew()) { ndFlInv.add("hasMadeAccEntries"); pReqVars.put("PurchaseInvoiceneededFields", ndFlInv); pEntity.setItsOwner(getSrvOrm() .retrieveEntity(pReqVars, pEntity.getItsOwner())); pReqVars.remove("DebtorCreditorneededFields"); pReqVars.remove("PurchaseInvoiceneededFields"); pReqVars.remove("PurchaseInvoicevendordeepLevel"); pReqVars.put("PurchaseInvoiceLineitsOwnerdeepLevel", 1); pEntity.setPurchaseInvoiceLine(getSrvOrm() .retrieveEntity(pReqVars, pEntity.getPurchaseInvoiceLine())); pReqVars.remove("PurchaseInvoiceLineitsOwnerdeepLevel"); AccSettings as = getSrvAccSettings().lazyGetAccSettings(pReqVars); boolean isAggrOnlyRate = as.getSalTaxUseAggregItBas(); RoundingMode rm = as.getSalTaxRoundMode(); if (pEntity.getPurchaseInvoiceLine().getTaxCategory() != null && pEntity.getItsOwner().getPurchaseInvoice().getVendor() .getTaxDestination() != null) { isItemBasis = !pEntity.getItsOwner().getPurchaseInvoice().getVendor() .getTaxDestination().getSalTaxIsInvoiceBase(); isAggrOnlyRate = pEntity.getItsOwner().getPurchaseInvoice() .getVendor().getTaxDestination().getSalTaxUseAggregItBas(); rm = pEntity.getItsOwner().getPurchaseInvoice().getVendor() .getTaxDestination().getSalTaxRoundMode();
final PurchaseReturnLine pEntity, 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, "Reversed Line is null!" + pAddParam.get("user")); if (pEntity.getPurchaseInvoiceLine() == null) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "wrong_purchaseInvoiceLine"); pEntity.setItsQuantity(pEntity.getItsQuantity().setScale( getSrvAccSettings().lazyGetAccSettings().getQuantityPrecision(), getSrvAccSettings().lazyGetAccSettings().getRoundingMode())); pEntity.setPurchaseInvoiceLine(getSrvOrm().retrieveEntity(pEntity .getPurchaseInvoiceLine())); if (pEntity.getPurchaseInvoiceLine() == null) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "wrong_purchaseInvoiceLine"); pEntity.setPurchInvLnAppearance(getSrvI18n().getMsg(PurchaseInvoiceLine .class.getSimpleName() + "short") + " #" + pEntity .getPurchaseInvoiceLine().getIdDatabaseBirth() + "-" //local
for (PurchaseInvoiceServiceLine ttl : pTacCatTotLns) { for (PurchaseReturnLine igl : igls) { if (igl.getPurchaseInvoiceLine().getTaxCategory().getItsId() .equals(ttl.getTaxCategory().getItsId())) { ilnt.add(igl); for (int i = 0; i < ilnt.size(); i++) { if (i + 1 == ilnt.size()) { ilnt.get(i).setItsTotal(ilnt.get(i).getSubtotal().add(txRest)); ilnt.get(i).setTotalTaxes(txRest); } else { BigDecimal taxTot; taxTot = ttl.getTotalTaxes().multiply(ilnt.get(i).getSubtotal()) .divide(ttl.getSubtotal(), pAs.getPricePrecision(), RoundingMode.HALF_UP); ilnt.get(i).setItsTotal(ilnt.get(i).getSubtotal().add(taxTot)); ilnt.get(i).setTotalTaxes(taxTot); txRest = txRest.subtract(taxTot);
typeCodeMap.put(new PurchaseReturn().constTypeCode(), PurchaseReturn.class); typeCodeMap.put(new PurchaseReturnLine().constTypeCode(), PurchaseReturnLine.class); typeCodeMap.put(new BeginningInventory().constTypeCode(),
ndFlInv.add("hasMadeAccEntries"); pReqVars.put("PurchaseInvoiceneededFields", ndFlInv); entity.setItsOwner(this.prcEntityCreate.getSrvOrm() .retrieveEntity(pReqVars, entity.getItsOwner())); pReqVars.remove("DebtorCreditorneededFields"); pReqVars.remove("PurchaseInvoiceneededFields");
/** * <p>Get Owner Type if exist e.g. PurchaseInvoice 1.</p> * @return Integer **/ @Override public final Integer getOwnerType() { return this.getItsOwner().constTypeCode(); }
/** * <p>Setter for unitOfMeasure.</p> * @param pUnitOfMeasure reference **/ @Override public final UnitOfMeasure getUnitOfMeasure() { return getPurchaseInvoiceLine().getUnitOfMeasure(); }
@Override public final int compare(final PurchaseReturnLine o1, final PurchaseReturnLine o2) { return o1.getItsTotal().compareTo(o2.getItsTotal()); } }
PurchaseReturnLine prl = new PurchaseReturnLine(); PurchaseReturn reversed = new PurchaseReturn(); reversed.setItsId(pEntity.getReversedId()); prl.setItsOwner(reversed); List<PurchaseReturnLine> reversedLines = getSrvOrm(). retrieveListForField(pAddParam, prl, "itsOwner"); String langDef = (String) pAddParam.get("langDef"); for (PurchaseReturnLine reversedLine : reversedLines) { if (reversedLine.getReversedId() == null) { PurchaseReturnLine reversingLine = new PurchaseReturnLine(); reversingLine.setIdDatabaseBirth(getSrvOrm().getIdDatabase()); reversingLine.setReversedId(reversedLine.getItsId()); reversingLine.setPurchaseInvoiceLine(reversedLine .getPurchaseInvoiceLine()); reversingLine.setItsQuantity(reversedLine.getItsQuantity() .negate()); reversingLine.setItsTotal(reversedLine.getItsTotal().negate()); reversingLine.setSubtotal(reversedLine.getSubtotal().negate()); reversingLine.setTotalTaxes(reversedLine.getTotalTaxes().negate()); reversingLine.setTaxesDescription(reversedLine .getTaxesDescription()); reversingLine.setIsNew(true); reversingLine.setItsOwner(pEntity); reversingLine.setDescription(getSrvI18n() .getMsg("reversed_n", langDef) + reversedLine .getIdDatabaseBirth() + "-" + reversedLine.getItsId()); getSrvOrm().insertEntity(pAddParam, reversingLine); reversingLine.setIsNew(false); getSrvWarehouseEntry().reverseDraw(pAddParam, reversingLine);
typeCodeMap.put(new PurchaseReturn().constTypeCode(), PurchaseReturn.class); typeCodeMap.put(new PurchaseReturnLine().constTypeCode(), PurchaseReturnLine.class); typeCodeMap.put(new BeginningInventory().constTypeCode(),
/** * <p>Get for document Date.</p> * @return Date **/ @Override public final Date getDocumentDate() { return this.getItsOwner().getItsDate(); }
/** * <p>Setter for unitOfMeasure.</p> * @param pUnitOfMeasure reference **/ @Override public final UnitOfMeasure getUnitOfMeasure() { return getPurchaseInvoiceLine().getUnitOfMeasure(); }
/** * <p>Create entity with its itsOwner e.g. invoice line * for invoice.</p> * @param pAddParam additional param * @param pEntityItsOwner itsOwner * @return entity instance * @throws Exception - an exception **/ @Override public final PurchaseReturnLine createEntityWithOwner( final Map<String, Object> pAddParam, final PurchaseReturn pEntityItsOwner) throws Exception { PurchaseReturnLine entity = new PurchaseReturnLine(); entity.setIsNew(true); entity.setIdDatabaseBirth(getSrvOrm().getIdDatabase()); //BeigeORM refresh: PurchaseReturn entityItsOwner = getSrvOrm() .retrieveEntity(pEntityItsOwner); entity.setItsOwner(entityItsOwner); return entity; }
/** * <p>Get for document Date.</p> * @return Date **/ @Override public final Date getDocumentDate() { return this.getItsOwner().getItsDate(); }
/** * <p>Setter for invItem.</p> * @param pInvItem reference **/ @Override public final InvItem getInvItem() { return getPurchaseInvoiceLine().getInvItem(); }