18 package org.turro.financials.batchof;
20 import java.util.Collection;
21 import org.turro.elephant.util.DateFormats;
22 import org.turro.elephant.util.DecimalFormats;
23 import org.turro.financials.document.action.DocumentActionMenu;
24 import org.turro.financials.entity.BatchOf;
25 import org.turro.financials.entity.Document;
26 import org.turro.financials.menu.FinancialsMenu;
27 import org.turro.i18n.I_;
28 import org.turro.zkoss.grid.PagingGrid;
29 import org.zkoss.zk.ui.event.Event;
30 import org.zkoss.zk.ui.event.EventListener;
31 import org.zkoss.zk.ui.event.Events;
32 import org.zkoss.zk.ui.ext.AfterCompose;
33 import org.zkoss.zul.A;
34 import org.zkoss.zul.Column;
35 import org.zkoss.zul.Columns;
36 import org.zkoss.zul.Detail;
37 import org.zkoss.zul.Label;
38 import org.zkoss.zul.Row;
39 import org.zkoss.zul.Rows;
40 import org.zkoss.zul.Vbox;
50 private boolean batchMember =
false;
61 this.document = document;
71 getParent().appendChild(dam);
76 private void addRows() {
80 rows.getChildren().clear();
82 for(
final BatchOf batch : list) {
83 final Document doc = batch.getBatch();
85 rows.appendChild(row);
87 row.setSclass(
"draft");
89 addDetail(row, batch);
90 row.appendChild(
new Label(doc.
getId() +
""));
91 row.appendChild(
new Label(DateFormats.format(doc.
getReceiptDate(),
true)));
92 row.appendChild(
new Label(DateFormats.format(doc.
getDocumentDate(),
true)));
98 b.setImage(
"/_zul/images/batchof.png");
99 b.addEventListener(Events.ON_CLICK,
new EventListener() {
101 public void onEvent(Event event)
throws Exception {
102 FinancialsMenu.showBatchOf(batch.getId());
106 b.setAttribute(
"document", doc);
108 row.appendChild(
new Label(DecimalFormats.format(doc.
getTotalAmount(),
109 DecimalFormats.getStringFormat(doc.
getCurrency().getDefaultFractionDigits()))));
113 batchMember = list.size() > 0;
116 private void addColumns() {
122 Column col =
new Column(
"#",
null,
"40px");
123 cols.appendChild(col);
125 col =
new Column(I_.get(
"Receipt/Issue"),
null,
"120px");
126 cols.appendChild(col);
128 col =
new Column(I_.get(
"Date"),
null,
"90px");
129 cols.appendChild(col);
131 col =
new Column(I_.get(
"Number"),
null,
"180px");
132 cols.appendChild(col);
134 col =
new Column(I_.get(
"Batch of"));
135 cols.appendChild(col);
137 col =
new Column(I_.get(
"Amount"),
null,
"120px");
138 col.setAlign(
"right");
139 cols.appendChild(col);
142 private void addDetail(Row row, BatchOf batch) {
143 row.getChildren().clear();
144 Detail detail =
new Detail();
145 row.appendChild(detail);
146 Vbox vbox =
new Vbox();
147 vbox.setWidth(
"100%");
148 vbox.setStyle(
"padding:5px");
149 detail.appendChild(vbox);
150 BatchOfDetailGrid eg =
new BatchOfDetailGrid(batch, dam);
151 vbox.appendChild(eg);
152 detail.setOpen(
true);
void setDocument(Document document)
static Collection< BatchOf > getFrom(Document document)
String getFullDescription()
RegisterView getForcedView()
String getDocumentNumber()
DocumentDefinition getDocumentDefinition()
Columns getColumns(boolean create)
Rows getRows(boolean create)
void setRowCount(int rows)