From 8f248de0945f5a1b167d5973ba60188a7b6451e1 Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Mon, 27 Oct 2014 09:25:14 +0100 Subject: [PATCH] =?UTF-8?q?Limit=20komise=20se=20nyn=C3=AD=20po=C4=8D?= =?UTF-8?q?=C3=ADt=C3=A1=20z=20vyfakturovan=C3=A9=20=C4=8D=C3=A1stky=20zad?= =?UTF-8?q?an=C3=A9=20ve=20fakturaci=20po=C5=BEadavk=C5=AF.=20closes=20#16?= =?UTF-8?q?7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../isspst/services/invoicing/InvoicingServiceImpl.java | 9 +++++++-- .../services/requirement/RequirementServiceImpl.java | 2 +- .../info/bukova/isspst/ui/dashboard/DashBoardVM.java | 6 +++--- .../bukova/isspst/ui/main/invoicing/InvoicingForm.java | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) 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) {