18 package org.turro.financials.portfolio.filter;
20 import org.turro.contacts.Contact;
21 import org.turro.contacts.util.ContactCombobox;
22 import org.turro.elephant.db.WhereClause;
23 import org.turro.financials.book.BookListbox;
24 import org.turro.financials.contract.ContractCombobox;
25 import org.turro.financials.contract.ContractDefinitionCombobox;
26 import org.turro.financials.document.DocumentDefinitionCombobox;
27 import org.turro.financials.portfolio.RelationMode;
28 import org.turro.financials.view.ViewListbox;
29 import org.turro.zkoss.filter.FilterField;
30 import org.turro.zkoss.filter.FilterFieldOperator;
31 import org.turro.zkoss.filter.FilterGrid;
32 import org.zkoss.zk.ui.HtmlBasedComponent;
44 protected HtmlBasedComponent createEditor() {
51 doAddConstraint(wc,
"dw.descendant");
53 doAddConstraint(wc,
"dw.ancestor");
59 public void addConstraint(WhereClause wc) {
60 doAddConstraint(wc,
"doc.documentNumber");
63 addField(
new FilterField(
"Date",
new java.util.Date(
new java.util.Date().getTime() - (1L * 30L * 24L * 60L * 60L * 1000L))) {
65 public void addConstraint(WhereClause wc) {
66 doAddConstraint(wc,
"doc.documentDate");
69 addField(
new FilterField(
"Receipt/Issue",
new java.util.Date(
new java.util.Date().getTime() - (1L * 30L * 24L * 60L * 60L * 1000L))) {
71 public void addConstraint(WhereClause wc) {
72 doAddConstraint(wc,
"doc.receiptDate");
75 addField(
new FilterField(
"Contract") {
77 protected HtmlBasedComponent createEditor() {
78 return new ContractCombobox();
81 public void addConstraint(WhereClause wc) {
82 doAddConstraint(wc,
"doc.contract");
85 addField(
new FilterField(
"Contact") {
87 protected HtmlBasedComponent createEditor() {
88 return new ContactCombobox();
91 protected Object getEditorValue() {
92 Contact c = ((ContactCombobox) editor).getContact();
93 return c ==
null ? null : c.getId();
96 public void addConstraint(WhereClause wc) {
97 doAddConstraint(wc,
"doc.contract.contractor");
100 addField(
new FilterField(
"View") {
102 protected HtmlBasedComponent createEditor() {
103 ViewListbox vl =
new ViewListbox();
104 vl.setMold(
"select");
105 vl.setAllowNull(
true);
109 public void addConstraint(WhereClause wc) {
110 doAddConstraint(wc,
"ifnull(doc.forcedView, 0)");
113 addField(
new FilterField(
"Contract model") {
115 protected HtmlBasedComponent createEditor() {
116 return new ContractDefinitionCombobox();
119 public void addConstraint(WhereClause wc) {
120 doAddConstraint(wc,
"doc.contract.contractDefinition");
123 addField(
new FilterField(
"Draft",
true) {
125 public void addConstraint(WhereClause wc) {
126 doAddConstraint(wc,
"doc.draft");
129 addField(
new FilterField(
"Amount", 0.0) {
131 public void addConstraint(WhereClause wc) {
132 doAddSubqueryConstraint(wc,
"doc.documentLines",
"price");
135 addField(
new FilterField(
"Quantity", 0.0) {
137 public void addConstraint(WhereClause wc) {
138 doAddSubqueryConstraint(wc,
"doc.documentLines",
"quantity");
141 addField(
new FilterField(
"Store") {
143 protected HtmlBasedComponent createEditor() {
144 return new ContractCombobox();
147 public void addConstraint(WhereClause wc) {
148 doAddSubqueryConstraint(wc,
"doc.documentLines",
"store");
151 addField(
new FilterField(
"Concept",
"") {
153 public void addConstraint(WhereClause wc) {
154 doAddSubqueryConstraint(wc,
"doc.documentLines",
"concept");
157 addField(
new FilterField(
"Book") {
159 protected HtmlBasedComponent createEditor() {
160 BookListbox bl =
new BookListbox();
161 bl.setMold(
"select");
162 bl.setAllowNull(
true);
166 public void addConstraint(WhereClause wc) {
167 doAddSubqueryConstraint(wc,
new String[] {
"doc.registers",
"sqx.bookRegisters"},
"bookDefinition");
170 addField(
new FilterField(
"Book entry", 0L) {
172 public void addConstraint(WhereClause wc) {
173 doAddSubqueryConstraint(wc,
new String[] {
"doc.registers",
"sqx.bookRegisters"},
"bookOrder");
176 if(!loadPreferences(this.getClass().getName()+
"_filter")) {
177 addCurrentField(
"Document model");
Map< String, Object > getAttributes()
FilterField addField(FilterField filterField)