diff --git a/src/main/java/info/bukova/isspst/services/invoicing/InvoicingServiceImpl.java b/src/main/java/info/bukova/isspst/services/invoicing/InvoicingServiceImpl.java index 0f1bb35e..001fb6b1 100644 --- a/src/main/java/info/bukova/isspst/services/invoicing/InvoicingServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/invoicing/InvoicingServiceImpl.java @@ -9,15 +9,20 @@ import info.bukova.isspst.services.LazyLoader; import java.math.BigDecimal; import org.hibernate.Hibernate; +import org.hibernate.Query; import org.springframework.transaction.annotation.Transactional; public class InvoicingServiceImpl extends AbstractOwnedService implements InvoicingService { @Override + @Transactional public BigDecimal totalInvoicedForWorkgroup(Workgroup workgroup) { - // TODO Auto-generated method stub - return null; + Query q = dao.getQuery("select sum(inv.totalInvoiced) " + + "from Invoicing inv join inv.requirement rq join rq.workgroup w " + + "where w = :workgroup "); + q.setParameter("workgroup", workgroup); + return (BigDecimal) q.uniqueResult(); } @Override diff --git a/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java b/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java index 67e66537..d3d6d990 100644 --- a/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java @@ -72,7 +72,7 @@ public class RequirementServiceImpl extends RequirementBaseServiceImpl> groupRoles; private Map workgroupSpent; @@ -47,7 +47,7 @@ public class DashBoardVM extends DocumentViewModel { for (Workgroup w : wg) { List r = workgroupService.getUserWorkgroupRoles(w, user); groupRoles.put(w, r); - workgroupSpent.put(w, orderService.totalOrderedForWorkgroup(w)); + workgroupSpent.put(w, invoicingService.totalInvoicedForWorkgroup(w)); } } diff --git a/src/main/java/info/bukova/isspst/ui/main/invoicing/InvoicingForm.java b/src/main/java/info/bukova/isspst/ui/main/invoicing/InvoicingForm.java index 978617d8..6d21a94f 100644 --- a/src/main/java/info/bukova/isspst/ui/main/invoicing/InvoicingForm.java +++ b/src/main/java/info/bukova/isspst/ui/main/invoicing/InvoicingForm.java @@ -20,7 +20,7 @@ public class InvoicingForm extends FormViewModel { @Init(superclass = true) public void init() { - + selectedIndex = -1; } private void selectItem(InvoicingItem item) {