private boolean positionInInvoiceExists(final AuftragsPositionDO position) { if (position.getId() != null) { Set<RechnungsPositionVO> invoicePositionList = rechnungCache.getRechnungsPositionVOSetByAuftragsPositionId(position.getId()); return invoicePositionList != null && invoicePositionList.isEmpty() == false; } return false; }
public Set<RechnungsPositionVO> getRechnungsPositionVOSetByAuftragId(final Integer auftragId) { checkRefresh(); return invoicePositionMapByAuftragId.get(auftragId); }
@Override protected void afterSaveOrModify(final RechnungDO obj) { getRechnungCache().setExpired(); // Expire the cache because assignments to order position may be changed. }
rechnungDao.save(rechnung2); Set<RechnungsPositionVO> set = rechnungDao.getRechnungCache().getRechnungsPositionVOSetByAuftragId(auftrag.getId()); assertEquals("3 invoice positions expected.", 3, set.size()); final Iterator<RechnungsPositionVO> it = set.iterator(); .getRechnungsPositionVOSetByAuftragsPositionId(auftrag.getPosition((short) 1).getId()); assertEquals("2 invoice positions expected.", 2, set.size()); assertTrue(new BigDecimal("500").compareTo(RechnungDao.getNettoSumme(set)) == 0); .getRechnungsPositionVOSetByAuftragsPositionId(auftrag.getPosition((short) 2).getId()); assertEquals("1 invoice positions expected.", 1, set.size()); assertTrue(new BigDecimal("200").compareTo(RechnungDao.getNettoSumme(set)) == 0); rechnung.getPosition(0).setAuftragsPosition(null); rechnungDao.update(rechnung); set = rechnungDao.getRechnungCache().getRechnungsPositionVOSetByAuftragId(auftrag.getId()); assertEquals("2 invoice positions expected.", 2, set.size()); assertTrue(new BigDecimal("300").compareTo(RechnungDao.getNettoSumme(set)) == 0);
mapping.add(OrderCol.COMPLETELY_INVOICED, order.isVollstaendigFakturiert() == true ? "x" : ""); final Set<RechnungsPositionVO> invoicePositions = rechnungCache .getRechnungsPositionVOSetByAuftragId(order.getId()); mapping.add(OrderCol.INVOICES, getInvoices(invoicePositions)); mapping.add(OrderCol.PERIOD_OF_PERFORMANCE_BEGIN, order.getPeriodOfPerformanceBegin());
/** * Refreshes the caches: TaskTree, userGroupCache and kost2. * * @return the name of the refreshed caches. */ public String refreshCaches() { final TenantRegistry tenantRegistry = TenantRegistryMap.getInstance().getTenantRegistry(); tenantRegistry.getUserGroupCache().forceReload(); tenantRegistry.getTaskTree().forceReload(); kontoCache.forceReload(); kostCache.forceReload(); rechnungCache.forceReload(); systemInfoCache.forceReload(); return "UserGroupCache, TaskTree, KontoCache, KostCache, RechnungCache, SystemInfoCache"; }
private void calculateIstSum(Map<PosCol, BigDecimal> istSumMap, Calendar startDate, AuftragsPositionDO pos) { final Set<RechnungsPositionVO> invoicePositions = rechnungCache.getRechnungsPositionVOSetByAuftragsPositionId(pos.getId()); if (invoicePositions == null) { return; } Calendar beginActualMonth = Calendar.getInstance(); beginActualMonth.set(Calendar.DAY_OF_MONTH, 1); for (RechnungsPositionVO rpo : invoicePositions) { Calendar rDate = Calendar.getInstance(); rDate.setTime(rpo.getDate()); if (rDate.before(beginActualMonth)) { int monthCol = this.getMonthIndex(rDate, startDate); if (monthCol >= 0 && monthCol <= 11) { istSumMap.replace(monthCols[monthCol], istSumMap.get(monthCols[monthCol]).add(rpo.getNettoSumme())); } } } }
public Set<RechnungsPositionVO> getRechnungsPositionVOSetByAuftragsPositionId(final Integer auftragsPositionId) { checkRefresh(); return invoicePositionMapByAuftragsPositionId.get(auftragsPositionId); }
/** * Get all invoices and set the field fakturiertSum for the given order. * * @param order * @see RechnungCache#getRechnungsPositionVOSetByAuftragsPositionId(Integer) */ public void calculateInvoicedSum(final AuftragDO order) { if (order == null) { return; } if (order.getPositionenExcludingDeleted() != null) { for (final AuftragsPositionDO pos : order.getPositionenExcludingDeleted()) { final Set<RechnungsPositionVO> set = rechnungCache .getRechnungsPositionVOSetByAuftragsPositionId(pos.getId()); if (set != null) { pos.setFakturiertSum(RechnungDao.getNettoSumme(set)); } } } }
mapping.add(PosCol.COMPLETELY_INVOICED, pos.isVollstaendigFakturiert() ? "x" : ""); final Set<RechnungsPositionVO> invoicePositions = rechnungCache .getRechnungsPositionVOSetByAuftragsPositionId(pos.getId()); mapping.add(PosCol.INVOICES, getInvoices(invoicePositions)); if (PeriodOfPerformanceType.OWN.equals(pos.getPeriodOfPerformanceType())) {
mapping.add(PosCol.COMPLETELY_INVOICED, pos.isVollstaendigFakturiert() == true ? "x" : ""); final Set<RechnungsPositionVO> invoicePositions = rechnungCache .getRechnungsPositionVOSetByAuftragsPositionId(pos.getId()); mapping.add(PosCol.INVOICES, getInvoices(invoicePositions)); if (PeriodOfPerformanceType.OWN.equals(pos.getPeriodOfPerformanceType())) {
.getRechnungsPositionVOSetByAuftragsPositionId(position.getId()); final boolean showInvoices = CollectionUtils.isNotEmpty(invoicePositionsByOrderPositionId);