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.data.Invoicing;
import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.data.User;
import info.bukova.isspst.data.Workgroup;
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 foundCenter = Workgroup.isEqualByWorkgroupForFilter(item.getRequirement().getCentre(), condition.getRequirement().getCentre());
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());
return (foundNumser && foundReqDate && foundCenter && foundDescription && foundWorkgroup);
return (foundNumser && foundReqDate && foundCenter && foundDescription && foundWorkgroup && foundUser);
}
@Factory

@ -65,4 +65,12 @@ public class InvoicingServiceImpl extends AbstractOwnedService<Invoicing> implem
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 void addApprovedItems(Order order, boolean orderedChanged);
public void updateApprovedItems(Order order, boolean orderedChanged);
}

@ -180,9 +180,7 @@ public class OrderServiceImpl extends AbstractOwnedService<Order> implements
return sumTotal;
}
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_EDIT') or hasPermission(#entity, this.getUpdateEntityPermission())")
public void updateApprovedItems(Order order, boolean orderedChanged)
protected void setApprovedItems(Order order, boolean orderedChanged)
{
if (orderedChanged)
{
@ -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);
}
@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 BigDecimal calcSumTotalFromItems(List<RequirementItem> items);
public BigDecimal getInvoicedAmount(Requirement req);
}

@ -16,6 +16,7 @@ import java.util.Date;
import java.util.List;
import org.hibernate.Hibernate;
import org.hibernate.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
@ -240,4 +241,15 @@ public class RequirementServiceImpl extends RequirementBaseServiceImpl<Requireme
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()
{
return this.userService.getAll();
return this.userService.getUsersForCombo();
}
@Command

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

@ -297,6 +297,17 @@ public class OrderForm extends FormViewModel<Order>
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
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.ui.requirement.RequirementSubpage;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@ -64,4 +65,18 @@ public class ReqListMyAll extends RequirementSubpage<Requirement>
protected void beforeSelectViaUrl() {
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.ui.requirement.RequirementSubpage;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@ -64,4 +65,18 @@ public class ReqListMyCenters extends RequirementSubpage<Requirement>
protected void beforeSelectViaUrl() {
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.ui.requirement.RequirementSubpage;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@ -64,4 +65,18 @@ public class ReqListMyWorkgroups extends RequirementSubpage<Requirement>
protected void beforeSelectViaUrl() {
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
RequirementItemDescription=Poznámka
RequirementInvoicedAmount=Fakturovaná částka:
AgendaMyOrders=Aktuální
AgendaOrdersHistory=Ukončené
@ -362,8 +364,8 @@ WorkgroupFormCannotAddWorkgroup=Komisi nelze přidat
WorkgroupFormOrderLimit=Limit nákupů
WorkgroupIsInWorkgroup=Komisi nelze smazat, protože je členem některého střediska
Help=Příručka
GoogleDriveUrl=Odkaz na Google Drive
Help=Příručka
ModuleNotActive=Modul není aktivovaný

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

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

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

@ -121,6 +121,27 @@
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</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>

@ -32,6 +32,10 @@
<listhead menupopup="auto">
<listheader width="27" />
<listheader
hflex="6"
sort="czech(requirement.numser)"
label="${labels.InvoicingRequirementNumber}" />
<listheader
hflex="7"
sort="czech(code)"
label="${labels.RequirementItemCode}" />
@ -82,6 +86,21 @@
<auxhead visible="@load(vm.filter)">
<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-divtextbox">
<textbox
@ -268,6 +287,7 @@
<template name="model">
<listitem context="popupMenu">
<listcell />
<listcell label="@load(each.requirement.numser)"/>
<listcell label="@load(each.code)" />
<listcell label="@load(each.name)" />
<listcell label="@load(each.textItem)" />

@ -188,6 +188,14 @@
</template>
</listbox>
<div hflex="3">
<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>
</hbox>

@ -188,6 +188,14 @@
</template>
</listbox>
<div hflex="3">
<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>
</hbox>

@ -188,6 +188,14 @@
</template>
</listbox>
<div hflex="3">
<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>
</hbox>

Loading…
Cancel
Save