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

Public Member Functions

 DocumentSummaryGrid ()
 
void setDocument (Document document)
 
void updateSummary ()
 
void afterCompose ()
 
- Public Member Functions inherited from org.turro.zkoss.layout.GridLayout
 GridLayout ()
 
 GridLayout (int columns)
 
 GridLayout (String hflexs)
 
void setColumns (int columns)
 
void setColumns (String hflexs)
 
void setColCaptions (String captions)
 
void setColCaptions (String[] captions)
 
void clearRows ()
 
GridLayout addGroup (String title, boolean open)
 
GridLayout addRow ()
 
GridLayout insertBeforeRow (Row row)
 
GridLayout addCaption (String label)
 
GridLayout addValue (String value)
 
GridLayout addBoldValue (String value)
 
GridLayout addComponent (HtmlBasedComponent comp)
 
GridLayout addSpannedComponent (HtmlBasedComponent comp, int cols)
 
GridLayout addRowSpannedComponent (HtmlBasedComponent comp, int rows)
 
GridLayout addSpace ()
 
Row getCurrentRow ()
 
Rows getRows (boolean create)
 
Object getData ()
 
void setData (Object data)
 

Additional Inherited Members

- Protected Attributes inherited from org.turro.zkoss.layout.GridLayout
Row currentRow
 

Detailed Description

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

Definition at line 37 of file DocumentSummaryGrid.java.

Constructor & Destructor Documentation

◆ DocumentSummaryGrid()

org.turro.financials.document.DocumentSummaryGrid.DocumentSummaryGrid ( )

Definition at line 41 of file DocumentSummaryGrid.java.

41  {
42  }

Member Function Documentation

◆ afterCompose()

void org.turro.financials.document.DocumentSummaryGrid.afterCompose ( )

Definition at line 107 of file DocumentSummaryGrid.java.

107  {
108  Auxhead aux = new Auxhead();
109  appendChild(aux);
110  Auxheader auxh = new Auxheader(I_.get("Tax"));
111  auxh.setColspan(5);
112  auxh.setAlign("center");
113  aux.appendChild(auxh);
114  auxh = new Auxheader(I_.get("% Ret."));
115  auxh.setColspan(3);
116  auxh.setAlign("center");
117  aux.appendChild(auxh);
118  auxh = new Auxheader(document.getDocumentDefinition() != null ?
119  document.getDocumentDefinition().getName() : "");
120  auxh.setColspan(1);
121  auxh.setAlign("center");
122  aux.appendChild(auxh);
123  setColumns("right-1,right-3,right-3,right-3,right-3,right-1,right-3,right-3,right-3");
124  setColCaptions(new String[] {
125  I_.get("Type"),
126  I_.get("Subtotal"),
127  I_.get("Discount"),
128  I_.get("Taxable"),
129  I_.get("Tax amount"),
130  I_.get("Type"),
131  I_.get("Taxable"),
132  I_.get("Retained"),
133  I_.get("Total")
134  });
135  }
DocumentDefinition getDocumentDefinition()
Definition: Document.java:167
void setColCaptions(String captions)
Definition: GridLayout.java:94
Here is the call graph for this function:

◆ setDocument()

void org.turro.financials.document.DocumentSummaryGrid.setDocument ( Document  document)

Definition at line 44 of file DocumentSummaryGrid.java.

44  {
45  this.document = document;
46  updateSummary();
47  }
Here is the call graph for this function:

◆ updateSummary()

void org.turro.financials.document.DocumentSummaryGrid.updateSummary ( )

Definition at line 49 of file DocumentSummaryGrid.java.

49  {
50  clearRows();
51  DocumentAmounts da = new DocumentAmounts(document);
52  Iterator<AmountTaxable> iat = da.getTaxables().iterator();
53  Iterator<AmountRetained> iar = da.getRetentions().iterator();
54  boolean keepOn = true, totalDone = false;
55  boolean hasReq = da.hasReq();
56  String pattern = DecimalFormats.getStringFormat(da.getCurrency().getDefaultFractionDigits()),
57  patternPC = "#0.#";
58  while(keepOn) {
59  if(iat.hasNext()) {
60  AmountTaxable at = iat.next();
61  if(hasReq) {
63  DecimalFormats.format(at.getTax(), patternPC) + "% (" +
64  DecimalFormats.format(at.getReq(), patternPC) + "%)"
65  );
66  } else {
67  addBoldValue(DecimalFormats.format(at.getTax(), patternPC) + "%");
68  }
69  addValue(DecimalFormats.format(at.getAmount(), pattern));
70  addValue(DecimalFormats.format(at.getDiscount(), pattern));
71  addBoldValue(DecimalFormats.format(at.getTaxable(), pattern));
72  if(hasReq) {
74  DecimalFormats.format(at.getTaxRealAmount(), pattern) + "(" +
75  DecimalFormats.format(at.getReqAmount(), pattern) + ")"
76  );
77  } else {
78  addBoldValue(DecimalFormats.format(at.getTaxRealAmount(), pattern));
79  }
80  } else {
81  addSpace();
82  addSpace();
83  addSpace();
84  addSpace();
85  addSpace();
86  }
87  if(iar.hasNext()) {
88  AmountRetained ar = iar.next();
89  addBoldValue(DecimalFormats.format(ar.getRetention(), patternPC) + "%");
90  addValue(DecimalFormats.format(ar.getTaxable(), pattern));
91  addBoldValue(DecimalFormats.format(ar.getRetained(), pattern));
92  } else {
93  addSpace();
94  addSpace();
95  addSpace();
96  }
97  if(!totalDone) {
98  addBoldValue(DecimalFormats.format(da.getTotal(), pattern));
99  totalDone = true;
100  }
101  addRow();
102  keepOn = iat.hasNext() || iar.hasNext();
103  }
104  }
GridLayout addValue(String value)
GridLayout addBoldValue(String value)
Here is the call graph for this function:
Here is the caller graph for this function:

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