BrightSide Workbench Full Report + Source Code
org.turro.financials.document.filter.DocumentFilterGrid Class Reference
Inheritance diagram for org.turro.financials.document.filter.DocumentFilterGrid:
Collaboration diagram for org.turro.financials.document.filter.DocumentFilterGrid:

Public Member Functions

 DocumentFilterGrid ()
 
String getIfNull (String field, String value)
 
String getSubtotal ()
 
String getRetained ()
 
String getDiscount ()
 
String getTaxable ()
 
String getTaxValue ()
 
String getAmount ()
 
- Public Member Functions inherited from org.turro.zkoss.filter.FilterGrid
 FilterGrid ()
 
FilterField addField (FilterField filterField)
 
FilterField addCurrentField (String label)
 
List< FilterFieldgetCurrentFields ()
 
void setCurrentFields (List< FilterField > currentFields)
 
List< FilterFieldgetFields ()
 
void setFields (List< FilterField > fields)
 
List< IFilterValuegetValues ()
 
boolean hasValues ()
 
void afterCompose ()
 

Additional Inherited Members

- Protected Member Functions inherited from org.turro.zkoss.filter.FilterGrid
boolean loadPreferences (String preference)
 
void savePreferences ()
 
- Protected Attributes inherited from org.turro.zkoss.filter.FilterGrid
List< FilterFieldfields = new ArrayList<>()
 
List< FilterFieldcurrentFields = new ArrayList<>()
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 35 of file DocumentFilterGrid.java.

Constructor & Destructor Documentation

◆ DocumentFilterGrid()

org.turro.financials.document.filter.DocumentFilterGrid.DocumentFilterGrid ( )

Definition at line 37 of file DocumentFilterGrid.java.

37  {
38  super();
39  addField(new FilterField("Number", "", FilterFieldOperator.FILTER_EQUAL) {
40  @Override
41  public void addConstraint(WhereClause wc) {
42  doAddConstraint(wc, "doc.documentNumber");
43  }
44  });
45  addField(new FilterField("Internal ID", 0L, FilterFieldOperator.FILTER_EQUAL) {
46  @Override
47  public void addConstraint(WhereClause wc) {
48  doAddConstraint(wc, "doc.id");
49  }
50  });
51  addField(new FilterField("Date", new java.util.Date(new java.util.Date().getTime() - (1L * 30L * 24L * 60L * 60L * 1000L))) {
52  @Override
53  public void addConstraint(WhereClause wc) {
54  doAddConstraint(wc, "doc.documentDate");
55  }
56  });
57  addField(new FilterField("Receipt/Issue", new java.util.Date(new java.util.Date().getTime() - (1L * 30L * 24L * 60L * 60L * 1000L))) {
58  @Override
59  public void addConstraint(WhereClause wc) {
60  doAddConstraint(wc, "doc.receiptDate");
61  }
62  });
63  addField(new FilterField("Contract") {
64  @Override
65  protected HtmlBasedComponent createEditor() {
66  return new ContractCombobox();
67  }
68  @Override
69  public void addConstraint(WhereClause wc) {
70  doAddConstraint(wc, "doc.contract");
71  }
72  });
73  addField(new FilterField("View") {
74  @Override
75  protected HtmlBasedComponent createEditor() {
76  ViewListbox vl = new ViewListbox();
77  vl.setMold("select");
78  vl.setAllowNull(true);
79  return vl;
80  }
81  @Override
82  public void addConstraint(WhereClause wc) {
83  doAddConstraint(wc, "ifnull(doc.forcedView, 0)");
84  }
85  });
86  addField(new FilterField("Contract model") {
87  @Override
88  protected HtmlBasedComponent createEditor() {
89  return new ContractDefinitionCombobox();
90  }
91  @Override
92  public void addConstraint(WhereClause wc) {
93  doAddConstraint(wc, "doc.contract.contractDefinition");
94  }
95  });
96  addField(new FilterField("Document model") {
97  @Override
98  protected HtmlBasedComponent createEditor() {
99  return new DocumentDefinitionCombobox();
100  }
101  @Override
102  public void addConstraint(WhereClause wc) {
103  doAddConstraint(wc, "doc.documentDefinition");
104  }
105  });
106  addField(new FilterField("Draft", true) {
107  @Override
108  public void addConstraint(WhereClause wc) {
109  doAddConstraint(wc, "doc.draft");
110  }
111  });
112  addField(new FilterField("Amount", 0.0) {
113  @Override
114  public void addConstraint(WhereClause wc) {
115  //doAddSubqueryConstraint(wc, "doc.documentLines", "price");
116  if(FilterFieldOperator.FILTER_EQUAL.equals(getOperator())) {
117  wc.addClause(getChain().getOpSQL() + " (" + getObjectValue() + " <= ");
118  wc.addClause("(");
119  wc.addClause("select sum("+ getAmount() +") + 0.05 from doc.documentLines as dl");
120  wc.addClause(")");
121  wc.addClause("and " + getObjectValue() + " >= ");
122  wc.addClause("(");
123  wc.addClause("select sum(" + getAmount() + ") - 0.05 from doc.documentLines as dl");
124  wc.addClause("))");
125  } else if(FilterFieldOperator.FILTER_BIG.equals(getOperator())) {
126  wc.addClause(getChain().getOpSQL() + " (" + getObjectValue() + " < ");
127  wc.addClause("(");
128  wc.addClause("select sum("+ getAmount() +") from doc.documentLines as dl");
129  wc.addClause("))");
130  } else if(FilterFieldOperator.FILTER_BIG_OR_EQUAL.equals(getOperator())) {
131  wc.addClause(getChain().getOpSQL() + " (" + getObjectValue() + " <= ");
132  wc.addClause("(");
133  wc.addClause("select sum("+ getAmount() +") from doc.documentLines as dl");
134  wc.addClause("))");
135  } else if(FilterFieldOperator.FILTER_LESS.equals(getOperator())) {
136  wc.addClause(getChain().getOpSQL() + " (" + getObjectValue() + " > ");
137  wc.addClause("(");
138  wc.addClause("select sum("+ getAmount() +") from doc.documentLines as dl");
139  wc.addClause("))");
140  } else if(FilterFieldOperator.FILTER_LESS_OR_EQUAL.equals(getOperator())) {
141  wc.addClause(getChain().getOpSQL() + " (" + getObjectValue() + " >= ");
142  wc.addClause("(");
143  wc.addClause("select sum("+ getAmount() +") from doc.documentLines as dl");
144  wc.addClause("))");
145  } else if(FilterFieldOperator.FILTER_NOT_EQUAL.equals(getOperator())) {
146  wc.addClause(getChain().getOpSQL() + " (" + getObjectValue() + " >= ");
147  wc.addClause("(");
148  wc.addClause("select sum("+ getAmount() +") from doc.documentLines as dl");
149  wc.addClause(")");
150  wc.addClause("and " + getObjectValue() + " <= ");
151  wc.addClause("(");
152  wc.addClause("select sum(" + getAmount() + ") from doc.documentLines as dl");
153  wc.addClause("))");
154  }
155  }
156  });
157  addField(new FilterField("Quantity", 0.0) {
158  @Override
159  public void addConstraint(WhereClause wc) {
160  doAddSubqueryConstraint(wc, "doc.documentLines", "quantity");
161  }
162  });
163  addField(new FilterField("Store") {
164  @Override
165  protected HtmlBasedComponent createEditor() {
166  return new ContractCombobox();
167  }
168  @Override
169  public void addConstraint(WhereClause wc) {
170  doAddSubqueryConstraint(wc, "doc.documentLines", "store");
171  }
172  });
173  addField(new FilterField("Concept", "") {
174  @Override
175  public void addConstraint(WhereClause wc) {
176  doAddSubqueryConstraint(wc, "doc.documentLines", "concept");
177  }
178  });
179  addField(new FilterField("Book") {
180  @Override
181  protected HtmlBasedComponent createEditor() {
182  BookListbox bl = new BookListbox();
183  bl.setMold("select");
184  bl.setAllowNull(true);
185  return bl;
186  }
187  @Override
188  public void addConstraint(WhereClause wc) {
189  doAddSubqueryConstraint(wc, new String[] {"doc.registers", "sqx.bookRegisters"}, "bookDefinition");
190  }
191  });
192  addField(new FilterField("Book entry", 0L) {
193  @Override
194  public void addConstraint(WhereClause wc) {
195  doAddSubqueryConstraint(wc, new String[] {"doc.registers", "sqx.bookRegisters"}, "bookOrder");
196  }
197  });
198  if(!loadPreferences(this.getClass().getName()+"_filter")) {
199  addCurrentField("Number");
200  }
201  }
FilterField addField(FilterField filterField)
Definition: FilterGrid.java:62
boolean loadPreferences(String preference)
FilterField addCurrentField(String label)
Definition: FilterGrid.java:67
Here is the call graph for this function:

Member Function Documentation

◆ getAmount()

String org.turro.financials.document.filter.DocumentFilterGrid.getAmount ( )

Definition at line 227 of file DocumentFilterGrid.java.

227  {
228  return "(" + getTaxable() + "* (1.0 + (dl.tax / 100))) - " + getRetained();
229  }

◆ getDiscount()

String org.turro.financials.document.filter.DocumentFilterGrid.getDiscount ( )

Definition at line 215 of file DocumentFilterGrid.java.

215  {
216  return "((" + getSubtotal() + " - dl.discountMoney) * (" + getIfNull("dl.discountPerCent", "0.0") + " / 100.0) + dl.discountMoney)";
217  }

◆ getIfNull()

String org.turro.financials.document.filter.DocumentFilterGrid.getIfNull ( String  field,
String  value 
)

Definition at line 203 of file DocumentFilterGrid.java.

203  {
204  return "case " + field + " when 0.0 then " + value + " else ifnull(" + field + "," + value + ") end";
205  }

◆ getRetained()

String org.turro.financials.document.filter.DocumentFilterGrid.getRetained ( )

Definition at line 211 of file DocumentFilterGrid.java.

211  {
212  return "((" + getSubtotal() + " - " + getDiscount() + ") * (" + getIfNull("dl.retention", "0.0") + " / 100.0))";
213  }

◆ getSubtotal()

String org.turro.financials.document.filter.DocumentFilterGrid.getSubtotal ( )

Definition at line 207 of file DocumentFilterGrid.java.

207  {
208  return "(" + getIfNull("dl.quantity", "1.0") + " * dl.price)";
209  }

◆ getTaxable()

String org.turro.financials.document.filter.DocumentFilterGrid.getTaxable ( )

Definition at line 219 of file DocumentFilterGrid.java.

219  {
220  return "(" + getSubtotal() + " - " + getDiscount() + ")";
221  }

◆ getTaxValue()

String org.turro.financials.document.filter.DocumentFilterGrid.getTaxValue ( )

Definition at line 223 of file DocumentFilterGrid.java.

223  {
224  return "(" + getAmount() + " + " + getRetained() + ") - " + getTaxable();
225  }

The documentation for this class was generated from the following file: