@@ -0,0 +1,74 @@
|
|||||||
|
package info.bukova.isspst.filters;
|
||||||
|
|
||||||
|
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.Workgroup;
|
||||||
|
|
||||||
|
import org.hamcrest.Description;
|
||||||
|
import org.hamcrest.Factory;
|
||||||
|
import org.hamcrest.Matcher;
|
||||||
|
import org.hamcrest.TypeSafeMatcher;
|
||||||
|
|
||||||
|
public class InvoicingFilter implements Filter<Invoicing>
|
||||||
|
{
|
||||||
|
|
||||||
|
private Invoicing condition;
|
||||||
|
|
||||||
|
public InvoicingFilter(Invoicing cond)
|
||||||
|
{
|
||||||
|
this.condition = cond;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class InvoicingMatcher extends TypeSafeMatcher<Invoicing>
|
||||||
|
{
|
||||||
|
|
||||||
|
private Invoicing condition;
|
||||||
|
|
||||||
|
public InvoicingMatcher(Invoicing cond)
|
||||||
|
{
|
||||||
|
this.condition = cond;
|
||||||
|
|
||||||
|
if (condition.getRequirement() == null) {
|
||||||
|
condition.setRequirement(new Requirement());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void describeTo(Description desc)
|
||||||
|
{
|
||||||
|
desc.appendText("Invoicing matches");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean matchesSafely(Invoicing item)
|
||||||
|
{
|
||||||
|
boolean foundNumser = StringUtils.isEqualForFilter(item.getRequirement().getNumser(), condition.getRequirement().getNumser());
|
||||||
|
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 foundDescription = StringUtils.isEqualForFilter(item.getRequirement().getDescription(), condition.getRequirement().getDescription());
|
||||||
|
return (foundNumser && foundReqDate && foundCenter && foundDescription && foundWorkgroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Factory
|
||||||
|
public static Matcher<Invoicing> matchBuilding(Invoicing building)
|
||||||
|
{
|
||||||
|
return new InvoicingMatcher(building);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public InvoicingMatcher matcher()
|
||||||
|
{
|
||||||
|
return new InvoicingMatcher(condition);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String queryString()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -46,6 +46,7 @@ public class InvoicingForm extends FormViewModel<Invoicing> {
|
|||||||
public void removeItem(@BindingParam("item") InvoicingItem item) {
|
public void removeItem(@BindingParam("item") InvoicingItem item) {
|
||||||
getDataBean().getItems().remove(item);
|
getDataBean().getItems().remove(item);
|
||||||
selectItem(null);
|
selectItem(null);
|
||||||
|
calculate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
package info.bukova.isspst.ui.main.invoicing;
|
package info.bukova.isspst.ui.main.invoicing;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import info.bukova.isspst.data.Invoicing;
|
import info.bukova.isspst.data.Invoicing;
|
||||||
|
import info.bukova.isspst.data.Workgroup;
|
||||||
|
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.workgroups.WorkgroupService;
|
||||||
import info.bukova.isspst.ui.ListViewModel;
|
import info.bukova.isspst.ui.ListViewModel;
|
||||||
|
|
||||||
import org.zkoss.bind.annotation.Init;
|
import org.zkoss.bind.annotation.Init;
|
||||||
@@ -11,13 +16,15 @@ public class InvoicingList extends ListViewModel<Invoicing> {
|
|||||||
|
|
||||||
@WireVariable
|
@WireVariable
|
||||||
private InvoicingService invoicingService;
|
private InvoicingService invoicingService;
|
||||||
|
@WireVariable
|
||||||
|
private WorkgroupService workgroupService;
|
||||||
|
|
||||||
@Init(superclass = true)
|
@Init(superclass = true)
|
||||||
public void initInvoicing() {
|
public void initInvoicing() {
|
||||||
service = invoicingService;
|
service = invoicingService;
|
||||||
dataClass = Invoicing.class;
|
dataClass = Invoicing.class;
|
||||||
formZul = "invoicingForm.zul";
|
formZul = "invoicingForm.zul";
|
||||||
//dataFilter = new BuildingFilter(getFilterTemplate());
|
dataFilter = new InvoicingFilter(getFilterTemplate());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -30,4 +37,12 @@ public class InvoicingList extends ListViewModel<Invoicing> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Workgroup> getCentres() {
|
||||||
|
return workgroupService.getCentres();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Workgroup> getWorkgroups() {
|
||||||
|
return workgroupService.getWorkgroups();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,8 @@
|
|||||||
<textbox
|
<textbox
|
||||||
width="150px"
|
width="150px"
|
||||||
value="@bind(vm.dataBean.totalInvoiced) @converter(vm.standardBigDecimalConverter)"
|
value="@bind(vm.dataBean.totalInvoiced) @converter(vm.standardBigDecimalConverter)"
|
||||||
readonly="true"/>
|
readonly="true"
|
||||||
|
style="@load(vm.dataBean.totalInvoiced gt vm.dataBean.requirement.sumTotal ? ' color: red;' : '' )"/>
|
||||||
</cell>
|
</cell>
|
||||||
</row>
|
</row>
|
||||||
</rows>
|
</rows>
|
||||||
|
|||||||
@@ -20,7 +20,16 @@
|
|||||||
label="${labels.InvoicingRequirementNumber}"
|
label="${labels.InvoicingRequirementNumber}"
|
||||||
width="130px" />
|
width="130px" />
|
||||||
<listheader
|
<listheader
|
||||||
label="Popis"
|
label="${labels.RequirementsGridReqDate}"
|
||||||
|
width="150px"/>
|
||||||
|
<listheader
|
||||||
|
label="${labels.RequirementsGridCenter}"
|
||||||
|
width="180px"/>
|
||||||
|
<listheader
|
||||||
|
label="${labels.RequirementsGridWorkgroup}"
|
||||||
|
width="180px"/>
|
||||||
|
<listheader
|
||||||
|
label="${labels.InvoicingDescription}"
|
||||||
width=""/>
|
width=""/>
|
||||||
<listheader
|
<listheader
|
||||||
label="${labels.InvoicingRequirementPrice}"
|
label="${labels.InvoicingRequirementPrice}"
|
||||||
@@ -31,14 +40,15 @@
|
|||||||
align="right"
|
align="right"
|
||||||
width="130px" />
|
width="130px" />
|
||||||
</listhead>
|
</listhead>
|
||||||
<!-- auxhead
|
<auxhead
|
||||||
sclass="category-center"
|
sclass="category-center"
|
||||||
visible="@load(vm.filter)">
|
visible="@load(vm.filter)">
|
||||||
|
|
||||||
<auxheader>
|
<auxheader>
|
||||||
<div sclass="find-grid-cell">
|
<div sclass="find-grid-cell">
|
||||||
<div sclass="find-grid-divtextbox">
|
<div sclass="find-grid-divtextbox">
|
||||||
<textbox
|
<textbox
|
||||||
value="@bind(vm.filterTemplate.name)"
|
value="@bind(vm.filterTemplate.requirement.numser)"
|
||||||
instant="true"
|
instant="true"
|
||||||
onChange="@command('doFilter')"
|
onChange="@command('doFilter')"
|
||||||
sclass="find-grid-textbox" />
|
sclass="find-grid-textbox" />
|
||||||
@@ -51,8 +61,9 @@
|
|||||||
<auxheader>
|
<auxheader>
|
||||||
<div sclass="find-grid-cell">
|
<div sclass="find-grid-cell">
|
||||||
<div sclass="find-grid-divtextbox">
|
<div sclass="find-grid-divtextbox">
|
||||||
<textbox
|
<datebox
|
||||||
value="@bind(vm.filterTemplate.description)"
|
value="@bind(vm.filterTemplate.requirement.reqDate)"
|
||||||
|
format="${labels.DateFormat}"
|
||||||
instant="true"
|
instant="true"
|
||||||
onChange="@command('doFilter')"
|
onChange="@command('doFilter')"
|
||||||
sclass="find-grid-textbox" />
|
sclass="find-grid-textbox" />
|
||||||
@@ -62,13 +73,98 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</auxheader>
|
</auxheader>
|
||||||
</auxhead-->
|
<auxheader>
|
||||||
|
<div sclass="find-grid-cell">
|
||||||
|
<combobox
|
||||||
|
ctrlKeys="${labels.HandleComboKeyFilter}"
|
||||||
|
onCtrlKey="@command('handleComboKeyFilter', ctrl=self, keyEvent=event)"
|
||||||
|
onChange="@command('doFilter')"
|
||||||
|
model="@load(vm.centres)"
|
||||||
|
readonly="true"
|
||||||
|
width="100%"
|
||||||
|
selectedItem="@bind(vm.filterTemplate.requirement.centre)">
|
||||||
|
<template name="model">
|
||||||
|
<comboitem label="@load(each.fullName)" />
|
||||||
|
</template>
|
||||||
|
</combobox>
|
||||||
|
<div sclass="find-grid-img">
|
||||||
|
<image src="/img/funnel.png" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</auxheader>
|
||||||
|
<auxheader>
|
||||||
|
<div sclass="find-grid-cell">
|
||||||
|
<combobox
|
||||||
|
ctrlKeys="${labels.HandleComboKeyFilter}"
|
||||||
|
onCtrlKey="@command('handleComboKeyFilter', ctrl=self, keyEvent=event)"
|
||||||
|
onChange="@command('doFilter')"
|
||||||
|
model="@load(vm.workgroups)"
|
||||||
|
readonly="true"
|
||||||
|
width="100%"
|
||||||
|
selectedItem="@bind(vm.filterTemplate.requirement.workgroup)">
|
||||||
|
<template name="model">
|
||||||
|
<comboitem label="@load(each.fullName)" />
|
||||||
|
</template>
|
||||||
|
</combobox>
|
||||||
|
<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
|
||||||
|
value="@bind(vm.filterTemplate.requirement.description)"
|
||||||
|
instant="true"
|
||||||
|
onChange="@command('doFilter')"
|
||||||
|
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
|
||||||
|
value="@bind(vm.filterTemplate.requirement.sumTotal) @converter(vm.standardBigDecimalConverter)"
|
||||||
|
instant="true"
|
||||||
|
onChange="@command('doFilter')"
|
||||||
|
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
|
||||||
|
value="@bind(vm.filterTemplate.totalInvoiced) @converter(vm.standardBigDecimalConverter)"
|
||||||
|
instant="true"
|
||||||
|
onChange="@command('doFilter')"
|
||||||
|
sclass="find-grid-textbox" />
|
||||||
|
</div>
|
||||||
|
<div sclass="find-grid-img">
|
||||||
|
<image src="/img/funnel.png" />
|
||||||
|
</div>
|
||||||
|
</div-->
|
||||||
|
</auxheader>
|
||||||
|
|
||||||
|
</auxhead>
|
||||||
<template name="model">
|
<template name="model">
|
||||||
<listitem>
|
<listitem>
|
||||||
<listcell label="@load(each.requirement.numser)" />
|
<listcell label="@load(each.requirement.numser)" />
|
||||||
|
<listcell label="@load(each.requirement.reqDate) @converter('formatedDate', format=labels.DateFormat)" />
|
||||||
|
<listcell label="@load(each.requirement.centre)" />
|
||||||
|
<listcell label="@load(each.requirement.workgroup)" />
|
||||||
<listcell label="@load(each.requirement.description)" />
|
<listcell label="@load(each.requirement.description)" />
|
||||||
<listcell label="@load(each.requirement.sumTotal) @converter(vm.standardBigDecimalConverter)" />
|
<listcell label="@load(each.requirement.sumTotal) @converter(vm.standardBigDecimalConverter)" />
|
||||||
<listcell label="@load(each.totalInvoiced) @converter(vm.standardBigDecimalConverter)" />
|
<listcell label="@load(each.totalInvoiced) @converter(vm.standardBigDecimalConverter)"
|
||||||
|
style="@load(vm.dataBean.totalInvoiced gt vm.dataBean.requirement.sumTotal ? ' color: red;' : '' )" />
|
||||||
</listitem>
|
</listitem>
|
||||||
</template>
|
</template>
|
||||||
</listbox>
|
</listbox>
|
||||||
|
|||||||
Reference in New Issue
Block a user