19 package org.turro.financials.business;
21 import java.util.Date;
22 import java.util.List;
23 import org.amic.util.date.CheckDate;
24 import org.turro.financials.entity.Contract;
25 import org.turro.financials.operating.ContractItemSet;
26 import org.zkoss.zk.ui.Component;
27 import org.zkoss.zk.ui.event.Event;
28 import org.zkoss.zk.ui.select.SelectorComposer;
29 import org.zkoss.zk.ui.select.annotation.Listen;
30 import org.zkoss.zk.ui.select.annotation.Wire;
31 import org.zkoss.zul.Chart;
32 import org.zkoss.zul.Datebox;
33 import org.zkoss.zul.Tab;
47 private Datebox fromDate;
50 private Datebox toDate;
52 @Wire(
"#tabSalesExpenses")
53 private Tab tabSalesExpenses;
56 private Tab tabStores;
58 @Wire(
"#tabParticipants")
59 private Tab tabParticipants;
61 @Wire(
"#tabSaleStores")
62 private Tab tabSaleStores;
64 @Wire(
"#tabExpenseStores")
65 private Tab tabExpenseStores;
67 @Wire(
"#tabProviders")
68 private Tab tabProviders;
70 @Wire(
"#tabCustomers")
71 private Tab tabCustomers;
73 @Wire(
"#salesExpenses")
74 private Chart salesExpenses;
79 @Wire(
"#participants")
80 private Chart participants;
83 private Chart saleStores;
85 @Wire(
"#expenseStores")
86 private Chart expenseStores;
89 private Chart providers;
92 private Chart customers;
94 @Listen(
"onSelect = #companyTree; onSelect = #tabSalesExpenses; "
95 +
"onSelect = #tabStores; onSelect = #tabParticipants; "
96 +
"onSelect = #tabSaleStores; onSelect = #tabExpenseStores; "
97 +
"onSelect = #tabCustomers; onSelect = #tabProviders")
105 Date now =
new Date();
106 fromDate.setValue(
new CheckDate(now).addMonths(-6).setDay(1).getDate());
107 toDate.setValue(
new CheckDate(now).setDay(31).getDate());
111 private void fillCurrentChart(List<Contract> contracts) {
115 items.
loadPeriod(fromDate.getValue(), toDate.getValue());
116 if(tabSalesExpenses.isSelected()) {
117 salesExpenses.setType(Chart.LINE);
118 salesExpenses.setEngine(
new CompanyChartEngine());
119 salesExpenses.setModel(
new CompanyModelWrapper(items).getSalesExpensesModel(contracts));
121 }
else if(tabStores.isSelected()) {
122 stores.setType(Chart.BAR);
123 stores.setThreeD(
true);
124 stores.setModel(
new CompanyModelWrapper(items).getStoresModel(contracts));
125 }
else if(tabParticipants.isSelected()) {
126 participants.setType(Chart.BAR);
127 participants.setThreeD(
true);
128 participants.setModel(
new CompanyModelWrapper(items).getParticipantsModel(contracts));
129 }
else if(tabSaleStores.isSelected()) {
130 saleStores.setType(Chart.BAR);
131 saleStores.setThreeD(
true);
132 saleStores.setModel(
new CompanyModelWrapper(items).getSaleStoresModel(contracts));
133 }
else if(tabExpenseStores.isSelected()) {
134 expenseStores.setType(Chart.BAR);
135 expenseStores.setThreeD(
true);
136 expenseStores.setModel(
new CompanyModelWrapper(items).getExpenseStoresModel(contracts));
137 }
else if(tabCustomers.isSelected()) {
138 customers.setType(Chart.BAR);
139 customers.setThreeD(
true);
140 customers.setModel(
new CompanyModelWrapper(items).getCustomersModel(contracts));
141 }
else if(tabProviders.isSelected()) {
142 providers.setType(Chart.BAR);
143 providers.setThreeD(
true);
144 providers.setModel(
new CompanyModelWrapper(items).getProvidersModel(contracts));
void onSelect(Event event)
List< Contract > getContracts()
void loadPeriod(Date start, Date end)