18 package org.turro.financials.batchof.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.view.ViewListbox;
26 import org.turro.zkoss.filter.FilterField;
27 import org.turro.zkoss.filter.FilterFieldOperator;
28 import org.turro.zkoss.filter.FilterGrid;
29 import org.zkoss.zk.ui.HtmlBasedComponent;
41 public void addConstraint(WhereClause wc) {
42 doAddConstraint(wc,
"batch.batch.documentNumber");
45 addField(
new FilterField(
"Date",
new java.util.Date(
new java.util.Date().getTime() - (1L * 30L * 24L * 60L * 60L * 1000L))) {
47 public void addConstraint(WhereClause wc) {
48 doAddConstraint(wc,
"batch.batch.documentDate");
51 addField(
new FilterField(
"Receipt/Issue",
new java.util.Date(
new java.util.Date().getTime() - (1L * 30L * 24L * 60L * 60L * 1000L))) {
53 public void addConstraint(WhereClause wc) {
54 doAddConstraint(wc,
"batch.batch.receiptDate");
57 addField(
new FilterField(
"Internal ID", 0L, FilterFieldOperator.FILTER_EQUAL) {
59 public void addConstraint(WhereClause wc) {
60 doAddConstraint(wc,
"batch.id");
63 addField(
new FilterField(
"Contract") {
65 protected HtmlBasedComponent createEditor() {
66 return new ContractCombobox();
69 public void addConstraint(WhereClause wc) {
70 doAddConstraint(wc,
"batch.batch.contract");
73 addField(
new FilterField(
"Contact") {
75 protected HtmlBasedComponent createEditor() {
76 return new ContactCombobox();
79 protected Object getEditorValue() {
80 Contact c = ((ContactCombobox) editor).getContact();
81 return c ==
null ? null : c.getId();
84 public void addConstraint(WhereClause wc) {
85 doAddConstraint(wc,
"batch.batch.contract.contractor");
88 addField(
new FilterField(
"View") {
90 protected HtmlBasedComponent createEditor() {
91 ViewListbox vl =
new ViewListbox();
93 vl.setAllowNull(
true);
97 public void addConstraint(WhereClause wc) {
98 doAddConstraint(wc,
"ifnull(batch.batch.forcedView, 0)");
101 addField(
new FilterField(
"Amount", 0.0) {
103 public void addConstraint(WhereClause wc) {
104 doAddSubqueryConstraint(wc,
"bacth.bacth.documentLines",
"price");
107 addField(
new FilterField(
"Quantity", 0.0) {
109 public void addConstraint(WhereClause wc) {
110 doAddSubqueryConstraint(wc,
"bacth.bacth.documentLines",
"quantity");
113 addField(
new FilterField(
"Store") {
115 protected HtmlBasedComponent createEditor() {
116 return new ContractCombobox();
119 public void addConstraint(WhereClause wc) {
120 doAddSubqueryConstraint(wc,
"bacth.bacth.documentLines",
"store");
123 addField(
new FilterField(
"Concept",
"") {
125 public void addConstraint(WhereClause wc) {
126 doAddSubqueryConstraint(wc,
"bacth.bacth.documentLines",
"concept");
129 addField(
new FilterField(
"Book") {
131 protected HtmlBasedComponent createEditor() {
132 BookListbox bl =
new BookListbox();
133 bl.setMold(
"select");
134 bl.setAllowNull(
true);
138 public void addConstraint(WhereClause wc) {
139 doAddSubqueryConstraint(wc,
new String[] {
"bacth.bacth.registers",
"sqx.bookRegisters"},
"bookDefinition");
142 addField(
new FilterField(
"Book entry", 0L) {
144 public void addConstraint(WhereClause wc) {
145 doAddSubqueryConstraint(wc,
new String[] {
"bacth.bacth.registers",
"sqx.bookRegisters"},
"bookOrder");
148 if(!loadPreferences(this.getClass().getName()+
"_filter")) {
149 addCurrentField(
"Number");
FilterField addField(FilterField filterField)