18 package org.turro.financials.treasury.settlement;
20 import java.util.Date;
21 import org.turro.elephant.util.DecimalFormats;
22 import org.turro.financials.entity.Contract;
23 import org.turro.i18n.I_;
24 import org.turro.zkoss.grid.GroupExtended;
25 import org.turro.zkoss.label.MultilineLabel;
26 import org.turro.zkoss.layout.GridLayout;
27 import org.zkoss.zk.ui.event.Event;
28 import org.zkoss.zk.ui.event.EventListener;
29 import org.zkoss.zk.ui.event.Events;
30 import org.zkoss.zul.Checkbox;
31 import org.zkoss.zul.Groupfoot;
32 import org.zkoss.zul.Label;
33 import org.zkoss.zul.Space;
42 private Label debtorLabel, creditorLabel;
45 super(
"min,1,right-min,min");
55 Date prevSettDate =
set !=
null ?
set.getSettlementDate() :
null;
58 set.setSettlementDate(prevSettDate);
63 set.setSettlementDate(date);
67 set.generateRegister(store);
70 private void compose() {
71 getRows(
true).getChildren().clear();
73 double subtotal = 0.0, total = 0.0;
74 boolean addToGrid =
false;
83 Groupfoot gf =
new Groupfoot();
84 gf.appendChild(
new Space());
85 gf.appendChild(
new Label(I_.get(
"Debtor")));
86 debtorLabel =
new Label();
87 gf.appendChild(debtorLabel);
88 gf.appendChild(
new Space());
91 GroupExtended ge =
new GroupExtended(I_.get(
"Creditor"));
102 final Checkbox process =
new Checkbox();
104 process.addEventListener(Events.ON_CHECK,
new EventListener() {
106 public void onEvent(Event event)
throws Exception {
115 if(!
getRows().getChildren().isEmpty()) {
116 Groupfoot gf =
new Groupfoot();
117 gf.setStyle(
"padding:5px;");
118 gf.appendChild(
new Space());
119 gf.appendChild(
new MultilineLabel(I_.get(
"Creditor") +
"\n\n" + I_.get(
"Total")));
120 creditorLabel =
new MultilineLabel();
121 gf.appendChild(creditorLabel);
122 gf.appendChild(
new Space());
128 private void updateAmmounts() {
129 double debtor =
set.getDebtorTotal(),
130 creditor =
set.getCreditorTotal();
131 if(debtorLabel !=
null) {
132 debtorLabel.setValue(DecimalFormats.format(debtor));
134 if(creditorLabel !=
null) {
135 creditorLabel.setValue(DecimalFormats.format(creditor) +
"\n\n" + DecimalFormats.format(creditor - debtor));
void setChecked(boolean checked)
void setSettlementDate(Date date)
void doRegister(Contract store)
static String get(String msg)
void setColCaptions(String captions)
GridLayout addComponent(HtmlBasedComponent comp)
Rows getRows(boolean create)
GridLayout addCaption(String label)