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.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,
"doc.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,
"doc.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,
"doc.receiptDate");
57 addField(
new FilterField(
"Contract") {
59 protected HtmlBasedComponent createEditor() {
60 return new ContractCombobox();
63 public void addConstraint(WhereClause wc) {
64 doAddConstraint(wc,
"doc.contract");
67 addField(
new FilterField(
"Contact") {
69 protected HtmlBasedComponent createEditor() {
70 return new ContactCombobox();
73 protected Object getEditorValue() {
74 Contact c = ((ContactCombobox) editor).getContact();
75 return c ==
null ? null : c.getId();
78 public void addConstraint(WhereClause wc) {
79 doAddConstraint(wc,
"doc.contract.contractor");
82 addField(
new FilterField(
"View") {
84 protected HtmlBasedComponent createEditor() {
85 ViewListbox vl =
new ViewListbox();
87 vl.setAllowNull(
true);
91 public void addConstraint(WhereClause wc) {
92 doAddConstraint(wc,
"ifnull(doc.forcedView, 0)");
95 addField(
new FilterField(
"Draft",
true) {
97 public void addConstraint(WhereClause wc) {
98 doAddConstraint(wc,
"doc.draft");
101 addField(
new FilterField(
"Amount", 0.0) {
103 public void addConstraint(WhereClause wc) {
104 doAddSubqueryConstraint(wc,
"doc.documentLines",
"price");
107 addField(
new FilterField(
"Quantity", 0.0) {
109 public void addConstraint(WhereClause wc) {
110 doAddSubqueryConstraint(wc,
"doc.documentLines",
"quantity");
113 addField(
new FilterField(
"Store") {
115 protected HtmlBasedComponent createEditor() {
116 return new ContractCombobox();
119 public void addConstraint(WhereClause wc) {
120 doAddSubqueryConstraint(wc,
"doc.documentLines",
"store");
123 addField(
new FilterField(
"Concept",
"") {
125 public void addConstraint(WhereClause wc) {
126 doAddSubqueryConstraint(wc,
"doc.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[] {
"doc.registers",
"sqx.bookRegisters"},
"bookDefinition");
142 addField(
new FilterField(
"Book entry", 0L) {
144 public void addConstraint(WhereClause wc) {
145 doAddSubqueryConstraint(wc,
new String[] {
"doc.registers",
"sqx.bookRegisters"},
"bookOrder");
148 if(!loadPreferences(this.getClass().getName()+
"_filter")) {
FilterField addField(FilterField filterField)