Merge branch 'Verze_1.0'

Conflicts:
	src/main/webapp/WEB-INF/locales/zk-label.properties
	src/main/webapp/app/mainMenu.zul
Verze_2.0
František Přibyl 10 years ago
commit 277ea0f993

@ -4,6 +4,7 @@ import info.bukova.isspst.DateTimeUtils;
import info.bukova.isspst.StringUtils; import info.bukova.isspst.StringUtils;
import info.bukova.isspst.data.Invoicing; import info.bukova.isspst.data.Invoicing;
import info.bukova.isspst.data.Requirement; import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.data.User;
import info.bukova.isspst.data.Workgroup; import info.bukova.isspst.data.Workgroup;
import org.hamcrest.Description; import org.hamcrest.Description;
@ -48,8 +49,9 @@ public class InvoicingFilter implements Filter<Invoicing>
boolean foundReqDate = DateTimeUtils.isEqualByDateForFilter(item.getRequirement().getReqDate(), condition.getRequirement().getReqDate()); boolean foundReqDate = DateTimeUtils.isEqualByDateForFilter(item.getRequirement().getReqDate(), condition.getRequirement().getReqDate());
boolean foundCenter = Workgroup.isEqualByWorkgroupForFilter(item.getRequirement().getCentre(), condition.getRequirement().getCentre()); boolean foundCenter = Workgroup.isEqualByWorkgroupForFilter(item.getRequirement().getCentre(), condition.getRequirement().getCentre());
boolean foundWorkgroup = Workgroup.isEqualByWorkgroupForFilter(item.getRequirement().getWorkgroup(), condition.getRequirement().getWorkgroup()); boolean foundWorkgroup = Workgroup.isEqualByWorkgroupForFilter(item.getRequirement().getWorkgroup(), condition.getRequirement().getWorkgroup());
boolean foundUser = User.isEqualByUserForFilter(item.getRequirement().getOwnedBy(), condition.getRequirement().getOwnedBy());
boolean foundDescription = StringUtils.isEqualForFilter(item.getRequirement().getDescription(), condition.getRequirement().getDescription()); boolean foundDescription = StringUtils.isEqualForFilter(item.getRequirement().getDescription(), condition.getRequirement().getDescription());
return (foundNumser && foundReqDate && foundCenter && foundDescription && foundWorkgroup); return (foundNumser && foundReqDate && foundCenter && foundDescription && foundWorkgroup && foundUser);
} }
@Factory @Factory

@ -64,5 +64,13 @@ public class InvoicingServiceImpl extends AbstractOwnedService<Invoicing> implem
Query q = dao.getQuery("select inv from Invoicing as inv join fetch inv.requirement rq join fetch rq.ownedBy order by rq.numser"); Query q = dao.getQuery("select inv from Invoicing as inv join fetch inv.requirement rq join fetch rq.ownedBy order by rq.numser");
return q.list(); return q.list();
} }
@Transactional
@LazyLoader("form")
public void loadOwnedBy(Invoicing invoice) {
Invoicing inv = getById(invoice.getId());
Hibernate.initialize(inv.getRequirement().getOwnedBy());
invoice.getRequirement().setOwnedBy(inv.getRequirement().getOwnedBy());
}
} }

@ -22,5 +22,7 @@ public interface OrderService extends Service<Order> {
public BigDecimal calcSumTotalFromItems(List<OrderItem> items); public BigDecimal calcSumTotalFromItems(List<OrderItem> items);
public void addApprovedItems(Order order, boolean orderedChanged);
public void updateApprovedItems(Order order, boolean orderedChanged); public void updateApprovedItems(Order order, boolean orderedChanged);
} }

@ -180,16 +180,14 @@ public class OrderServiceImpl extends AbstractOwnedService<Order> implements
return sumTotal; return sumTotal;
} }
@Transactional protected void setApprovedItems(Order order, boolean orderedChanged)
@PreAuthorize("hasPermission(this, 'PERM_EDIT') or hasPermission(#entity, this.getUpdateEntityPermission())")
public void updateApprovedItems(Order order, boolean orderedChanged)
{ {
if (orderedChanged) if (orderedChanged)
{ {
for (OrderItem item : order.getItems()) for (OrderItem item : order.getItems())
{ {
RequirementItem rItem = item.getReqItem(); RequirementItem rItem = item.getReqItem();
if (rItem != null) if (rItem != null)
{ {
rItem.setOrderNum(order.isOrdered() ? order.getNumser() : null); rItem.setOrderNum(order.isOrdered() ? order.getNumser() : null);
@ -197,7 +195,41 @@ public class OrderServiceImpl extends AbstractOwnedService<Order> implements
} }
} }
} }
}
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_ADD')")
public void addApprovedItems(Order order, boolean orderedChanged)
{
this.add(order);
this.setApprovedItems(order, orderedChanged);
}
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_EDIT') or hasPermission(#entity, this.getUpdateEntityPermission())")
public void updateApprovedItems(Order order, boolean orderedChanged)
{
this.setApprovedItems(order, orderedChanged);
super.update(order); super.update(order);
} }
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_DELETE') or hasPermission(#entity, this.getDeleteEntityPermission())")
public void delete(Order order) {
for (OrderItem item : order.getItems())
{
RequirementItem rItem = item.getReqItem();
if (rItem != null)
{
rItem.setOrderNum(null);
requirementItemDao.modify(rItem);
}
}
super.delete(order);
}
} }

@ -26,4 +26,6 @@ public interface RequirementService extends RequirementBaseService<Requirement>
public RequirementItem calcItemValuesFromItemTotal(RequirementItem item); public RequirementItem calcItemValuesFromItemTotal(RequirementItem item);
public BigDecimal calcSumTotalFromItems(List<RequirementItem> items); public BigDecimal calcSumTotalFromItems(List<RequirementItem> items);
public BigDecimal getInvoicedAmount(Requirement req);
} }

@ -16,6 +16,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import org.hibernate.Hibernate; import org.hibernate.Hibernate;
import org.hibernate.Query;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -240,4 +241,15 @@ public class RequirementServiceImpl extends RequirementBaseServiceImpl<Requireme
invoicingService.add(inv); invoicingService.add(inv);
} }
} }
@Override
@Transactional
public BigDecimal getInvoicedAmount(Requirement req) {
Query query = dao.getQuery("select invoice from Invoicing invoice join invoice.requirement rq where rq.id = :reqId");
query.setParameter("reqId", req.getId());
Invoicing inv = (Invoicing) query.uniqueResult();
return inv != null ? inv.getTotalInvoiced() : null;
}
} }

@ -85,7 +85,7 @@ public class ApprovedList extends ListViewModel<JoinedItem>
public List<User> getUsers() public List<User> getUsers()
{ {
return this.userService.getAll(); return this.userService.getUsersForCombo();
} }
@Command @Command

@ -3,9 +3,11 @@ package info.bukova.isspst.ui.main.invoicing;
import java.util.List; import java.util.List;
import info.bukova.isspst.data.Invoicing; import info.bukova.isspst.data.Invoicing;
import info.bukova.isspst.data.User;
import info.bukova.isspst.data.Workgroup; import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.filters.InvoicingFilter; import info.bukova.isspst.filters.InvoicingFilter;
import info.bukova.isspst.services.invoicing.InvoicingService; import info.bukova.isspst.services.invoicing.InvoicingService;
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.ListViewModel; import info.bukova.isspst.ui.ListViewModel;
@ -18,6 +20,8 @@ public class InvoicingList extends ListViewModel<Invoicing> {
private InvoicingService invoicingService; private InvoicingService invoicingService;
@WireVariable @WireVariable
private WorkgroupService workgroupService; private WorkgroupService workgroupService;
@WireVariable
private UserService userService;
@Init(superclass = true) @Init(superclass = true)
public void initInvoicing() { public void initInvoicing() {
@ -45,4 +49,8 @@ public class InvoicingList extends ListViewModel<Invoicing> {
return workgroupService.getWorkgroups(); return workgroupService.getWorkgroups();
} }
public List<User> getUsers() {
return userService.getUsersForCombo();
}
} }

@ -297,6 +297,17 @@ public class OrderForm extends FormViewModel<Order>
this.calcAndUpdateFormTotalPrice(form); this.calcAndUpdateFormTotalPrice(form);
} }
@Override
protected void doAdd()
{
// Zjisti, zda se změnil příznak objednávky (objednáno/neobjednáno)
boolean orderedChanged = (this.recordBeforeEdit.isOrdered() != this.getDataBean().isOrdered());
// Aktualizovat příznak schválených položek, aby se nemohli vložit do
// jiných objednávek
orderService.addApprovedItems(this.getDataBean(), orderedChanged);
BindUtils.postGlobalCommand(null, null, "reload", null);
}
@Override @Override
protected void doSave() protected void doSave()
{ {

@ -7,6 +7,7 @@ import info.bukova.isspst.services.requirement.RequirementService;
import info.bukova.isspst.services.workgroups.WorkgroupService; import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.ui.requirement.RequirementSubpage; import info.bukova.isspst.ui.requirement.RequirementSubpage;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -64,4 +65,18 @@ public class ReqListMyAll extends RequirementSubpage<Requirement>
protected void beforeSelectViaUrl() { protected void beforeSelectViaUrl() {
BindUtils.postGlobalCommand(null, null, "selectAll", null); BindUtils.postGlobalCommand(null, null, "selectAll", null);
} }
public BigDecimal getInvoicedAmount() {
if (getDataBean() != null) {
return requirementService.getInvoicedAmount(getDataBean());
} else {
return null;
}
}
@Override
@NotifyChange({ "dataBean", "ableToDelete", "canApprove", "invoicedAmount" })
public void setDataBean(Requirement data) {
super.setDataBean(data);
}
} }

@ -7,6 +7,7 @@ import info.bukova.isspst.services.requirement.RequirementService;
import info.bukova.isspst.services.workgroups.WorkgroupService; import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.ui.requirement.RequirementSubpage; import info.bukova.isspst.ui.requirement.RequirementSubpage;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -64,4 +65,18 @@ public class ReqListMyCenters extends RequirementSubpage<Requirement>
protected void beforeSelectViaUrl() { protected void beforeSelectViaUrl() {
BindUtils.postGlobalCommand(null, null, "selectCentre", null); BindUtils.postGlobalCommand(null, null, "selectCentre", null);
} }
public BigDecimal getInvoicedAmount() {
if (getDataBean() != null) {
return requirementService.getInvoicedAmount(getDataBean());
} else {
return null;
}
}
@Override
@NotifyChange({ "dataBean", "ableToDelete", "canApprove", "invoicedAmount" })
public void setDataBean(Requirement data) {
super.setDataBean(data);
}
} }

@ -7,6 +7,7 @@ import info.bukova.isspst.services.requirement.RequirementService;
import info.bukova.isspst.services.workgroups.WorkgroupService; import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.ui.requirement.RequirementSubpage; import info.bukova.isspst.ui.requirement.RequirementSubpage;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -64,4 +65,18 @@ public class ReqListMyWorkgroups extends RequirementSubpage<Requirement>
protected void beforeSelectViaUrl() { protected void beforeSelectViaUrl() {
BindUtils.postGlobalCommand(null, null, "selectWorkgroup", null); BindUtils.postGlobalCommand(null, null, "selectWorkgroup", null);
} }
public BigDecimal getInvoicedAmount() {
if (getDataBean() != null) {
return requirementService.getInvoicedAmount(getDataBean());
} else {
return null;
}
}
@Override
@NotifyChange({ "dataBean", "ableToDelete", "canApprove", "invoicedAmount" })
public void setDataBean(Requirement data) {
super.setDataBean(data);
}
} }

@ -40,6 +40,8 @@ RequirementItemUnitPrice=Jedn. cena
RequirementItemTotal=Celkem RequirementItemTotal=Celkem
RequirementItemDescription=Poznámka RequirementItemDescription=Poznámka
RequirementInvoicedAmount=Fakturovaná částka:
AgendaMyOrders=Aktuální AgendaMyOrders=Aktuální
AgendaOrdersHistory=Ukončené AgendaOrdersHistory=Ukončené
@ -362,8 +364,8 @@ WorkgroupFormCannotAddWorkgroup=Komisi nelze přidat
WorkgroupFormOrderLimit=Limit nákupů WorkgroupFormOrderLimit=Limit nákupů
WorkgroupIsInWorkgroup=Komisi nelze smazat, protože je členem některého střediska WorkgroupIsInWorkgroup=Komisi nelze smazat, protože je členem některého střediska
Help=Příručka
GoogleDriveUrl=Odkaz na Google Drive GoogleDriveUrl=Odkaz na Google Drive
Help=Příručka
ModuleNotActive=Modul není aktivovaný ModuleNotActive=Modul není aktivovaný

@ -192,6 +192,10 @@
<location>/error.zul</location> <location>/error.zul</location>
</error-page> </error-page>
<session-config>
<session-timeout>480</session-timeout>
</session-config>
<welcome-file-list> <welcome-file-list>
<welcome-file>index.zul</welcome-file> <welcome-file>index.zul</welcome-file>
<welcome-file>index.zhtml</welcome-file> <welcome-file>index.zhtml</welcome-file>

@ -135,6 +135,9 @@
href="/j_spring_security_logout" /> href="/j_spring_security_logout" />
</menupopup> </menupopup>
</menu> </menu>
<menuitem label="${labels.Help}" target="blank"
href="https://drive.google.com/folderview?id=0B2inqAvr2t-TODg4ZWZoSThYbGM&amp;usp=sharing_eid"
tooltiptext="${labels.GoogleDriveUrl}" />
<menuseparator /> <menuseparator />
<menuitem <menuitem
image="/img/search.png" image="/img/search.png"

@ -51,6 +51,6 @@
<div id="mainData"> <div id="mainData">
<u:include src="${gridZul}" /> <u:include src="${gridZul}" />
</div> </div>
<div id="footer"> Verze 1.0 </div> <div id="footer"> Verze 1.3 </div>
</div> </div>
</html> </html>

@ -123,6 +123,27 @@
</div> </div>
</div> </div>
</auxheader> </auxheader>
<auxheader>
<div zclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<combobox
ctrlKeys="${labels.HandleComboKeyFilter}"
onCtrlKey="@command('handleComboKeyFilter', ctrl=self, keyEvent=event)"
onChange="@command('doFilter')"
width="100%"
selectedItem="@bind(vm.filterTemplate.requirement.ownedBy)"
model="@load(vm.users)"
readonly="true">
<template name="model">
<comboitem label="@load(each.fullName)" />
</template>
</combobox>
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader> <auxheader>
<div sclass="find-grid-cell"> <div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox"> <div sclass="find-grid-divtextbox">

@ -32,6 +32,10 @@
<listhead menupopup="auto"> <listhead menupopup="auto">
<listheader width="27" /> <listheader width="27" />
<listheader <listheader
hflex="6"
sort="czech(requirement.numser)"
label="${labels.InvoicingRequirementNumber}" />
<listheader
hflex="7" hflex="7"
sort="czech(code)" sort="czech(code)"
label="${labels.RequirementItemCode}" /> label="${labels.RequirementItemCode}" />
@ -82,6 +86,21 @@
<auxhead visible="@load(vm.filter)"> <auxhead visible="@load(vm.filter)">
<auxheader /> <auxheader />
<auxheader> <auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vm.filterTemplate.requirement.numser)"
instant="true"
onChange="@command('doFilter')"
maxlength="@load(vm.lengthText)"
sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell"> <div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox"> <div sclass="find-grid-divtextbox">
<textbox <textbox
@ -268,6 +287,7 @@
<template name="model"> <template name="model">
<listitem context="popupMenu"> <listitem context="popupMenu">
<listcell /> <listcell />
<listcell label="@load(each.requirement.numser)"/>
<listcell label="@load(each.code)" /> <listcell label="@load(each.code)" />
<listcell label="@load(each.name)" /> <listcell label="@load(each.name)" />
<listcell label="@load(each.textItem)" /> <listcell label="@load(each.textItem)" />

@ -188,6 +188,14 @@
</template> </template>
</listbox> </listbox>
<div hflex="3"> <div hflex="3">
<include src="/main/approveStatus.zul" /> <vbox>
<include src="/main/approveStatus.zul" />
<hbox visible="@load(not empty vm.invoicedAmount)">
<label value="${labels.RequirementInvoicedAmount}"/>
<label value="@load(vm.invoicedAmount) @converter(vm.bigDecimalConverter)"/>
</hbox>
</vbox>
</div> </div>
</hbox> </hbox>

@ -188,6 +188,14 @@
</template> </template>
</listbox> </listbox>
<div hflex="3"> <div hflex="3">
<include src="/main/approveStatus.zul" /> <vbox>
<include src="/main/approveStatus.zul" />
<hbox visible="@load(not empty vm.invoicedAmount)">
<label value="${labels.RequirementInvoicedAmount}"/>
<label value="@load(vm.invoicedAmount) @converter(vm.bigDecimalConverter)"/>
</hbox>
</vbox>
</div> </div>
</hbox> </hbox>

@ -188,6 +188,14 @@
</template> </template>
</listbox> </listbox>
<div hflex="3"> <div hflex="3">
<include src="/main/approveStatus.zul" /> <vbox>
<include src="/main/approveStatus.zul" />
<hbox visible="@load(not empty vm.invoicedAmount)">
<label value="${labels.RequirementInvoicedAmount}"/>
<label value="@load(vm.invoicedAmount) @converter(vm.bigDecimalConverter)"/>
</hbox>
</vbox>
</div> </div>
</hbox> </hbox>

Loading…
Cancel
Save