/** * <p>Retrieve owned list of entities for itsOwner. * E.g. invoices lines for invoice</p> * @param pAddParam additional param * @param pEntityItsOwner itsOwner * @return owned list of business objects * @throws Exception - an exception */ @Override public final List<SalesReturnLine> retrieveOwnedList( final Map<String, Object> pAddParam, final SalesReturn pEntityItsOwner) throws Exception { addAccSettingsIntoAttrs(pAddParam); return getSrvOrm().retrieveEntityOwnedlist(SalesReturnLine.class, SalesReturn.class, pEntityItsOwner.getItsId()); }
/** * <p>Lazy get querySalesReturnLineTaxes.</p> * @return querySalesReturnLineTaxes * @throws Exception - an exception **/ public final String lazyGetQuerySalesReturnLineTaxes() throws Exception { if (this.querySalesReturnLineTaxes == null) { String flName = "/" + "accounting" + "/" + "trade" + "/" + "salesReturnLineTaxes.sql"; this.querySalesReturnLineTaxes = loadString(flName); } return this.querySalesReturnLineTaxes; }
List<SalesReturnTaxLine> sitl = getSrvOrm().retrieveListWithConditions( SalesReturnTaxLine.class, "where ITSOWNER=" + pOwnerId); String query = lazyGetQuerySalesReturnLineTaxes().replace(":ITSOWNER", pOwnerId.toString()); int countUpdatedSitl = 0; IRecordSet<RS> recordSet = null; try { recordSet = getSrvDatabase().retrieveRecords(query); if (recordSet.moveToFirst()) { do { Long taxId = getSrvDatabase().getSrvRecordRetriever() .getLong(recordSet.getRecordSet(), "TAXID"); Double totalTax = getSrvDatabase().getSrvRecordRetriever() .getDouble(recordSet.getRecordSet(), "TOTALTAX"); SalesReturnTaxLine sit; countUpdatedSitl++; } else { sit = getSrvOrm().createEntityWithOwner( SalesReturnTaxLine.class, SalesReturn.class, pOwnerId); sit.setTax(tax); sit.setItsTotal(BigDecimal.valueOf(totalTax).setScale( getSrvAccSettings().lazyGetAccSettings().getPricePrecision(), getSrvAccSettings().lazyGetAccSettings().getRoundingMode())); if (sit.getIsNew()) { getSrvOrm().insertEntity(sit);
pEntity.setInvItem(getSrvOrm().retrieveEntity(pEntity.getInvItem())); SalesReturn itsOwner = getSrvOrm().retrieveEntityById( SalesReturn.class, pEntity.getItsOwner().getItsId()); pEntity.setItsOwner(itsOwner); pEntity.setItsQuantity(pEntity.getItsQuantity().setScale( getSrvAccSettings().lazyGetAccSettings().getQuantityPrecision(), getSrvAccSettings().lazyGetAccSettings().getRoundingMode())); pEntity.setItsPrice(pEntity.getItsPrice().setScale(getSrvAccSettings() .lazyGetAccSettings().getPricePrecision(), getSrvAccSettings() .lazyGetAccSettings().getRoundingMode())); pEntity.setItsCost(pEntity.getItsCost().setScale(getSrvAccSettings() .lazyGetAccSettings().getCostPrecision(), getSrvAccSettings() .lazyGetAccSettings().getRoundingMode())); pEntity.setSubtotal(pEntity.getItsTotal().setScale(getSrvAccSettings() .lazyGetAccSettings().getPricePrecision(), getSrvAccSettings() .lazyGetAccSettings().getRoundingMode())); pEntity.setTheRest(pEntity.getItsQuantity()); BigDecimal totalTaxes = BigDecimal.ZERO; String taxesDescription = ""; if (getSrvAccSettings().lazyGetAccSettings() .getIsExtractSalesTaxFromPurchase() && pEntity.getInvItem().getTaxCategory() != null) { List<InvItemTaxCategoryLine> pstl = getSrvOrm() .retrieveListWithConditions( InvItemTaxCategoryLine.class, "where ITSOWNER=" || ETaxType.SALES_TAX_INITEM.equals(pst.getTax().getItsType())) { BigDecimal addTx = pEntity.getSubtotal().multiply(pst
/** * <p>Retrieve owned list of entities for itsOwner. * E.g. invoices lines for invoice</p> * @param pAddParam additional param * @param pIdEntityItsOwner ID itsOwner * @return owned list of business objects * @throws Exception - an exception */ @Override public final List<SalesReturnLine> retrieveOwnedListById( final Map<String, Object> pAddParam, final Object pIdEntityItsOwner) throws Exception { return getSrvOrm().retrieveEntityOwnedlist(SalesReturnLine.class, SalesReturn.class, pIdEntityItsOwner); }
/** * <p>Create Sales return service.</p> * @param pSrvName Service Name * @return SrvSalesReturn SalesReturn service * @throws Exception - an exception */ public final synchronized SrvSalesReturn<RS> createSrvSalesReturn(final String pSrvName) throws Exception { SrvSalesReturn<RS> srvEntity = new SrvSalesReturn<RS>(factoryAppBeans.lazyGetSrvOrm(), lazyGetSrvAccSettings(), lazyGetSrvAccEntry(), factoryAppBeans.lazyGetSrvI18n(), lazyGetEntryDateFormatter(), lazyGetSrvWarehouseEntry(), lazyGetSrvUseMaterialEntry(), lazyGetSrvCogsEntry()); factoryAppBeans.getBeansMap().put(pSrvName, srvEntity); Object srvEntityLine = new SrvSalesReturnLine<RS>(factoryAppBeans.lazyGetSrvOrm(), factoryAppBeans.lazyGetSrvDatabase(), lazyGetSrvAccSettings(), lazyGetSrvWarehouseEntry()); factoryAppBeans.getBeansMap().put("srv" + SalesReturnLine .class.getSimpleName(), srvEntityLine); Object srvTaxLine = new SrvAccEntityOwnedSimple<SalesReturnTaxLine, SalesReturn>(SalesReturnTaxLine.class, SalesReturn.class, factoryAppBeans.lazyGetSrvOrm(), lazyGetSrvAccSettings()); factoryAppBeans.getBeansMap().put("srv" + SalesReturnTaxLine .class.getSimpleName(), srvTaxLine); return srvEntity; }
/** * <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 SalesReturnLine createEntityWithOwner( final Map<String, Object> pAddParam, final SalesReturn pEntityItsOwner) throws Exception { SalesReturnLine entity = new SalesReturnLine(); entity.setIsNew(true); entity.setIdDatabaseBirth(getSrvOrm().getIdDatabase()); entity.setItsOwner(pEntityItsOwner); addAccSettingsIntoAttrs(pAddParam); return entity; }
/** * <p>Create entity with its itsOwner e.g. invoice line * for invoice.</p> * @param pAddParam additional param * @param pIdEntityItsOwner entity itsOwner ID * @return entity instance * @throws Exception - an exception **/ @Override public final SalesReturnLine createEntityWithOwnerById( final Map<String, Object> pAddParam, final Object pIdEntityItsOwner) throws Exception { SalesReturnLine entity = new SalesReturnLine(); entity.setIdDatabaseBirth(getSrvOrm().getIdDatabase()); entity.setIsNew(true); SalesReturn itsOwner = new SalesReturn(); itsOwner.setItsId(Long.valueOf(pIdEntityItsOwner.toString())); entity.setItsOwner(itsOwner); addAccSettingsIntoAttrs(pAddParam); return entity; }
/** * <p>Create entity.</p> * @param pAddParam additional param * @return entity instance * @throws Exception - an exception **/ @Override public final SalesReturnLine createEntity( final Map<String, Object> pAddParam) throws Exception { SalesReturnLine entity = new SalesReturnLine(); entity.setIdDatabaseBirth(getSrvOrm().getIdDatabase()); entity.setIsNew(true); SalesReturn itsOwner = new SalesReturn(); entity.setItsOwner(itsOwner); addAccSettingsIntoAttrs(pAddParam); return entity; }
final Map<String, Object> pAddParam, final Object pId) throws Exception { SalesReturnLine entity = getSrvOrm().retrieveCopyEntity( SalesReturnLine.class, pId); @SuppressWarnings("unchecked") addAccSettingsIntoAttrs(pAddParam); return entity;