19 package org.turro.financials.report;
21 import java.io.IOException;
22 import java.util.Date;
23 import java.util.logging.Level;
24 import java.util.logging.Logger;
25 import org.amic.util.date.CheckDate;
26 import org.amic.util.file.FileUtil;
27 import org.turro.elephant.context.ElephantContext;
28 import org.turro.zkoss.grid.NumericColumn;
29 import org.turro.zkoss.grid.PagingGrid;
30 import org.turro.zkoss.label.LabelExtended;
31 import org.zkoss.zk.ui.Component;
32 import org.zkoss.zk.ui.Executions;
33 import org.zkoss.zk.ui.select.SelectorComposer;
34 import org.zkoss.zk.ui.select.annotation.Listen;
35 import org.zkoss.zk.ui.select.annotation.Wire;
36 import org.zkoss.zul.Column;
37 import org.zkoss.zul.Datebox;
38 import org.zkoss.zul.Row;
39 import org.zkoss.zul.Textbox;
40 import org.zkoss.zul.Toolbarbutton;
50 @Wire(
"#from") Datebox from;
51 @Wire(
"#to") Datebox to;
53 @Wire(
"#execute") Toolbarbutton execute;
54 @Wire(
"#text") Textbox text;
56 @Listen(
"onClick = #execute")
64 @Listen(
"onClick = #save")
69 }
catch (IOException ex) {
78 super.doAfterCompose(comp);
79 to.setValue(
new Date());
80 from.setValue(
new CheckDate(to.getValue()).addMonths(-1).getDate());
81 body = (
ReportBody) Executions.getCurrent().getAttribute(
"body");
82 execute.setDisabled(body ==
null);
88 private void updateGrid() {
89 body.
fill(from.getValue(), to.getValue());
95 reportgrid.
getColumns(
true).appendChild(
new Column(
""));
102 for(ReportRow row : body.
getRows()) {
103 Row grow =
new Row();
104 grow.appendChild(
new LabelExtended().setString(row.getName()).setCSS(
"font-weight:bold;"));
106 for(ReportColumn column : body.
getColumns()) {
107 grow.appendChild(
new LabelExtended().setCSS(
"font-weight:bold;")
108 .setFormat(
"#,##0.00").setDouble(body.
getSum(row, column, row.getGroup())));
111 for(ReportColumn column : body.
getColumns()) {
112 grow.appendChild(
new LabelExtended().setFormat(
"#,##0.00")
113 .setDouble(body.
getValue(row, column)));
116 reportgrid.
getRows(
true).appendChild(grow);
static String logMsg(String msg)
static String getEncoding()
static void setContent(File file, String value)
static String getContent(File file)
Double getValue(ReportRow row, ReportColumn column)
void fill(Date start, Date end)
TreeSet< ReportRow > getRows()
static ReportBody load(File file)
TreeSet< ReportColumn > getColumns()
Double getSum(ReportRow row, ReportColumn column, String group)
void doAfterCompose(Component comp)
Columns getColumns(boolean create)
Rows getRows(boolean create)