18 package org.turro.financials.document;
20 import java.util.Collection;
21 import java.util.HashSet;
22 import java.util.List;
23 import org.turro.string.Strings;
24 import org.turro.elephant.util.DateFormats;
25 import org.turro.elephant.util.DecimalFormats;
26 import org.turro.financials.document.action.DocumentActionMenu;
27 import org.turro.financials.entity.Document;
28 import org.turro.financials.entity.DocumentLine;
29 import org.turro.i18n.I_;
30 import org.turro.zkoss.input.CollectionListbox;
31 import org.zkoss.zul.*;
39 private boolean showContract =
false,
40 showTotalAmount =
false,
57 this.showConcepts = showConcepts;
65 this.showContract = showContract;
73 this.showStores = showStores;
77 return showTotalAmount;
81 this.showTotalAmount = showTotalAmount;
86 if(v ==
null)
return null;
88 String storesStr =
"";
90 HashSet<String>
set =
new HashSet<String>();
92 if(dl.getStore() !=
null) {
93 set.add(dl.getStore().getPartialDescription());
97 storesStr += SUBITEM_SEPARATOR + s;
101 String conceptsStr =
"";
103 HashSet<String>
set =
new HashSet<String>();
105 if(!Strings.isBlank(dl.getConcept())) {
106 set.add(dl.getConcept());
109 for(String s :
set) {
110 conceptsStr += SUBITEM_SEPARATOR + s;
125 getParent().appendChild(dam);
127 super.afterCompose();
128 if(showTotalAmount) {
135 super.populateList();
136 for(Listitem li : (List<Listitem>) getItems()) {
138 li.setAttribute(
"document", li.getValue());
142 private void addHeaders() {
143 if(getListhead() !=
null)
return;
144 Listhead lh =
new Listhead();
146 lh.appendChild(
new Listheader(
I_.
get(
"Document"),
null,
"40%"));
147 lh.appendChild(
new Listheader(
I_.
get(
"Date"),
null,
"20%"));
148 lh.appendChild(
new Listheader(
I_.
get(
"Number"),
null,
"20%"));
149 lh.appendChild(
new Listheader(
I_.
get(
"Amount"),
null,
"20%"));
153 private void addFooters() {
154 Listfoot lh = getListfoot();
160 lh.appendChild(
new Listfooter());
161 lh.appendChild(
new Listfooter());
162 lh.appendChild(
new Listfooter());
163 lh.appendChild(
new Listfooter(DecimalFormats.format(getTotal())));
166 private double getTotal() {
170 total += d.getTotalAmount();
String convertToString(Document v)
void setShowConcepts(boolean showConcepts)
boolean isShowTotalAmount()
void setShowStores(boolean showStores)
DocumentListbox(Collection< Document > collection)
void setShowContract(boolean showContract)
void setShowTotalAmount(boolean showTotalAmount)
String getFullDescription()
String getDocumentNumber()
Set< DocumentLine > getDocumentLines()
DocumentDefinition getDocumentDefinition()
static String get(String msg)