18 package org.turro.financials.portfolio;
20 import org.turro.elephant.util.DecimalFormats;
21 import org.turro.financials.entity.Contract;
22 import org.turro.financials.entity.MajorAccount;
23 import org.turro.financials.model.contract.PortfolioStatus;
24 import org.turro.financials.model.contract.PortfolioStatusSet;
25 import org.turro.i18n.I_;
26 import org.turro.zkoss.grid.GroupExtended;
27 import org.turro.zkoss.grid.PagingGrid;
28 import org.zkoss.zul.Column;
29 import org.zkoss.zul.Columns;
30 import org.zkoss.zul.Group;
31 import org.zkoss.zul.Groupfoot;
32 import org.zkoss.zul.Label;
33 import org.zkoss.zul.Row;
34 import org.zkoss.zul.Rows;
47 private void addColumns() {
52 Column col =
new Column(
I_.
get(
"Contract"),
null,
"80%");
53 cols.appendChild(col);
55 col =
new Column(
I_.
get(
"Balance"),
null,
"150px");
56 col.setAlign(
"right");
57 cols.appendChild(col);
59 col =
new Column(
I_.
get(
"Debit/Credit effects"),
null,
"150px");
60 col.setAlign(
"right");
61 cols.appendChild(col);
64 private Double balance, effects;
65 private int groupsCount;
67 private void addRows() {
68 Contract.checkNames();
70 PortfolioStatusSet pss =
new PortfolioStatusSet();
76 balance = effects = 0.0;
79 for(PortfolioStatus ps : pss) {
82 row.appendChild(
new PortfolioStatusDetailRow(ps));
83 row.appendChild(
new Label(ps.getContract().getName()));
84 row.appendChild(
new Label(DecimalFormats.format(ps.getBalance())));
85 row.appendChild(
new Label(DecimalFormats.format(ps.getEffects())));
86 rows.appendChild(row);
87 balance += ps.getBalance() ==
null ? 0 : ps.getBalance();
88 effects += ps.getEffects() ==
null ? 0 : ps.getEffects();
95 private String lastMajor;
97 private void checkGrouping(PortfolioStatus ps) {
98 if(!ps.getMajor().equals(lastMajor)) {
100 Group g =
new GroupExtended(ps.getMajorString());
103 lastMajor = ps.getMajor();
108 private void addGroupFoot() {
109 if(lastMajor !=
null) {
110 Groupfoot gf =
new Groupfoot();
111 gf.appendChild(
new Label());
112 gf.appendChild(
new Label(MajorAccount.getMajor(lastMajor).getDescription()));
113 gf.appendChild(
new Label(DecimalFormats.format(balance)));
114 gf.appendChild(
new Label(DecimalFormats.format(effects)));
116 balance = effects = 0.0;
static String get(String msg)
Columns getColumns(boolean create)
Rows getRows(boolean create)
void setRowCount(int rows)