18 package org.turro.financials.document;
20 import java.util.Collection;
21 import java.util.List;
22 import org.turro.elephant.db.WhereClause;
23 import org.turro.financials.db.FinancialsPU;
24 import org.turro.financials.entity.Document;
25 import org.turro.jpa.Dao;
26 import org.turro.plugin.filter.IFilterValue;
27 import org.turro.zkoss.grid.GroupExtended;
28 import org.zkoss.zul.Grid;
29 import org.zkoss.zul.Group;
37 private String mainOrderField;
39 private long lastId = 0;
44 public Collection
getDocuments(List<IFilterValue> values,
boolean onlyIds) {
48 return dao.getResultList(wc);
52 if(
"doc.contract.id".equals(mainOrderField)) {
57 grid.getRows().appendChild(group);
59 }
else if(
"doc.documentDefinition.id".equals(mainOrderField)) {
64 grid.getRows().appendChild(group);
69 private WhereClause createCriteria(List<IFilterValue> values,
boolean onlyIds) {
70 mainOrderField =
"doc.contract.id";
73 wc.
addClause(
"select doc.id from Document as doc");
75 wc.
addClause(
"select doc from Document as doc");
78 for(IFilterValue v : values) {
79 if(v.hasValue() &&
"Contract".equals(v.getLabel())) {
80 mainOrderField =
"doc.documentDefinition.id";
84 wc.
addClause(
"order by " + mainOrderField +
", doc.documentDate, doc.documentNumber");
void addClause(String clause)
Collection getDocuments(List< IFilterValue > values, boolean onlyIds)
void checkGroup(Grid grid, Document doc, boolean open)
String getFullDescription()
DocumentDefinition getDocumentDefinition()