Filtr v agendě Fakturace požadavků.

closes #164
Verze_1.0
Josef Rokos 10 years ago
parent 9175a7911f
commit 6ccd2a91a3

@ -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) {
getDataBean().getItems().remove(item);
selectItem(null);
calculate();
}
@Command

@ -1,7 +1,12 @@
package info.bukova.isspst.ui.main.invoicing;
import java.util.List;
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.workgroups.WorkgroupService;
import info.bukova.isspst.ui.ListViewModel;
import org.zkoss.bind.annotation.Init;
@ -11,13 +16,15 @@ public class InvoicingList extends ListViewModel<Invoicing> {
@WireVariable
private InvoicingService invoicingService;
@WireVariable
private WorkgroupService workgroupService;
@Init(superclass = true)
public void initInvoicing() {
service = invoicingService;
dataClass = Invoicing.class;
formZul = "invoicingForm.zul";
//dataFilter = new BuildingFilter(getFilterTemplate());
dataFilter = new InvoicingFilter(getFilterTemplate());
}
@Override
@ -30,4 +37,12 @@ public class InvoicingList extends ListViewModel<Invoicing> {
return false;
}
public List<Workgroup> getCentres() {
return workgroupService.getCentres();
}
public List<Workgroup> getWorkgroups() {
return workgroupService.getWorkgroups();
}
}

@ -113,7 +113,8 @@
<textbox
width="150px"
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>
</row>
</rows>

@ -20,7 +20,16 @@
label="${labels.InvoicingRequirementNumber}"
width="130px" />
<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=""/>
<listheader
label="${labels.InvoicingRequirementPrice}"
@ -31,14 +40,15 @@
align="right"
width="130px" />
</listhead>
<!-- auxhead
sclass="category-center"
visible="@load(vm.filter)">
<auxhead
sclass="category-center"
visible="@load(vm.filter)">
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vm.filterTemplate.name)"
value="@bind(vm.filterTemplate.requirement.numser)"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox" />
@ -48,11 +58,64 @@
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<datebox
value="@bind(vm.filterTemplate.requirement.reqDate)"
format="${labels.DateFormat}"
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">
<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.description)"
value="@bind(vm.filterTemplate.requirement.description)"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox" />
@ -62,13 +125,46 @@
</div>
</div>
</auxheader>
</auxhead-->
<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">
<listitem>
<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.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>
</template>
</listbox>

Loading…
Cancel
Save