19 package org.turro.financials.product;
21 import java.util.Collection;
22 import java.util.Date;
23 import org.amic.util.date.CheckDate;
24 import org.turro.elephant.util.DecimalFormats;
25 import org.turro.financials.entity.Contract;
26 import org.turro.i18n.I_;
27 import org.turro.zkoss.grid.PagingGrid;
28 import org.turro.zkoss.label.LabelExtended;
29 import org.turro.zkoss.label.LabelTypes;
30 import org.zkoss.zk.ui.ext.AfterCompose;
31 import org.zkoss.zul.*;
40 private Date from, to;
56 this.product = product;
58 from =
new CheckDate(to).addMonths(-1).getDate();
78 getRows(
true).getChildren().clear();
88 private void initiate() {
90 Collection<Movement> movs = product.
getMovements(from, to, store);
92 double quantity = 0.0d, amount = 0.0d;
97 if(mov.getContract() ==
null) {
98 row.appendChild(
new Label(
I_.
get(mov.getConcept())));
99 row.appendChild(
new Space());
100 row.appendChild(
new Space());
101 row.appendChild(
new LabelExtended().setDouble(mov.getQuantity()));
102 row.appendChild(
new Space());
103 row.appendChild(
new Space());
104 row.appendChild(
new LabelExtended().setDouble(mov.getAmount()));
105 quantity += mov.getQuantity();
106 amount += mov.getAmount();
108 row.appendChild(
new Label(mov.getContract().getFullDescription()));
109 row.appendChild(
new LabelExtended().setDate(mov.getDate()));
110 row.appendChild(
new LabelExtended().setDouble(mov.getCoefficient()));
111 row.appendChild(
new LabelExtended().setDouble(mov.getQuantity()));
112 row.appendChild(
new Label(mov.getConcept()));
113 row.appendChild(
new LabelExtended().setDouble(mov.getPrice()));
114 row.appendChild(
new LabelExtended().setDouble(mov.getAmount()));
115 quantity += mov.getQuantity();
116 amount += mov.getAmount();
121 foot.getChildren().clear();
122 Footer footer =
new Footer(
"");
124 foot.appendChild(footer);
125 footer =
new Footer();
126 footer.setAlign(
"right");
127 footer.appendChild(LabelTypes.getCaptionLabel(DecimalFormats.format(quantity,
"#,##0.000")));
128 foot.appendChild(footer);
129 footer =
new Footer(
"");
130 foot.appendChild(footer);
131 footer =
new Footer(
"");
132 foot.appendChild(footer);
133 footer =
new Footer();
134 footer.setAlign(
"right");
135 footer.appendChild(LabelTypes.getCaptionLabel(DecimalFormats.format(amount,
"#,##0.00")));
136 foot.appendChild(footer);
141 private void addColumns() {
144 Column col =
new Column(I_.get(
"Description"));
146 cols.appendChild(col);
148 col =
new Column(I_.get(
"Date"));
149 col.setWidth(
"120px");
150 cols.appendChild(col);
153 col.setWidth(
"30px");
154 cols.appendChild(col);
156 col =
new Column(I_.get(
"Quantity"));
157 col.setWidth(
"120px");
158 col.setAlign(
"right");
159 cols.appendChild(col);
161 col =
new Column(I_.get(
"Concept"));
163 cols.appendChild(col);
165 col =
new Column(I_.get(
"Price"));
166 col.setWidth(
"120px");
167 col.setAlign(
"right");
168 cols.appendChild(col);
170 col =
new Column(I_.get(
"Amount"));
171 col.setWidth(
"120px");
172 col.setAlign(
"right");
173 cols.appendChild(col);
void setStore(Contract store)
void setIProduct(IProduct product)
static String get(String msg)
Columns getColumns(boolean create)
Rows getRows(boolean create)
void setRowCount(int rows)
Collection< Movement > getMovements()