Limit komise se nyní počítá z vyfakturované částky zadané ve fakturaci

požadavků.
closes #167
Verze_1.0
Josef Rokos 10 years ago
parent 6ccd2a91a3
commit 8f248de094

@ -9,15 +9,20 @@ import info.bukova.isspst.services.LazyLoader;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.hibernate.Hibernate; import org.hibernate.Hibernate;
import org.hibernate.Query;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
public class InvoicingServiceImpl extends AbstractOwnedService<Invoicing> implements public class InvoicingServiceImpl extends AbstractOwnedService<Invoicing> implements
InvoicingService { InvoicingService {
@Override @Override
@Transactional
public BigDecimal totalInvoicedForWorkgroup(Workgroup workgroup) { public BigDecimal totalInvoicedForWorkgroup(Workgroup workgroup) {
// TODO Auto-generated method stub Query q = dao.getQuery("select sum(inv.totalInvoiced) "
return null; + "from Invoicing inv join inv.requirement rq join rq.workgroup w "
+ "where w = :workgroup ");
q.setParameter("workgroup", workgroup);
return (BigDecimal) q.uniqueResult();
} }
@Override @Override

@ -72,7 +72,7 @@ public class RequirementServiceImpl extends RequirementBaseServiceImpl<Requireme
if (entity.getWorkgroup() != null && entity.getWorkgroup().getLimit() != null && entity.getWorkgroup().getLimit().compareTo(BigDecimal.ZERO) != 0) if (entity.getWorkgroup() != null && entity.getWorkgroup().getLimit() != null && entity.getWorkgroup().getLimit().compareTo(BigDecimal.ZERO) != 0)
{ {
BigDecimal total = null;//orderService.totalOrderedForWorkgroup(entity.getWorkgroup()); BigDecimal total = invoicingService.totalInvoicedForWorkgroup(entity.getWorkgroup());
if (total == null) if (total == null)
{ {

@ -3,7 +3,7 @@ package info.bukova.isspst.ui.dashboard;
import info.bukova.isspst.data.Role; import info.bukova.isspst.data.Role;
import info.bukova.isspst.data.User; import info.bukova.isspst.data.User;
import info.bukova.isspst.data.Workgroup; import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.services.orders.OrderService; import info.bukova.isspst.services.invoicing.InvoicingService;
import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.services.workgroups.WorkgroupService; import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.ui.DocumentViewModel; import info.bukova.isspst.ui.DocumentViewModel;
@ -24,7 +24,7 @@ public class DashBoardVM extends DocumentViewModel {
@WireVariable @WireVariable
private UserService userService; private UserService userService;
@WireVariable @WireVariable
private OrderService orderService; private InvoicingService invoicingService;
private User user; private User user;
private Map<Workgroup, List<Role>> groupRoles; private Map<Workgroup, List<Role>> groupRoles;
private Map<Workgroup, BigDecimal> workgroupSpent; private Map<Workgroup, BigDecimal> workgroupSpent;
@ -47,7 +47,7 @@ public class DashBoardVM extends DocumentViewModel {
for (Workgroup w : wg) { for (Workgroup w : wg) {
List<Role> r = workgroupService.getUserWorkgroupRoles(w, user); List<Role> r = workgroupService.getUserWorkgroupRoles(w, user);
groupRoles.put(w, r); groupRoles.put(w, r);
workgroupSpent.put(w, orderService.totalOrderedForWorkgroup(w)); workgroupSpent.put(w, invoicingService.totalInvoicedForWorkgroup(w));
} }
} }

@ -20,7 +20,7 @@ public class InvoicingForm extends FormViewModel<Invoicing> {
@Init(superclass = true) @Init(superclass = true)
public void init() { public void init() {
selectedIndex = -1;
} }
private void selectItem(InvoicingItem item) { private void selectItem(InvoicingItem item) {

Loading…
Cancel
Save