BrightSide Workbench Full Report + Source Code
org.turro.financials.menu.FinancialsSheets Class Reference

Public Member Functions

void exportSheet (Page page)
 

Detailed Description

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

Definition at line 45 of file FinancialsSheets.java.

Member Function Documentation

◆ exportSheet()

void org.turro.financials.menu.FinancialsSheets.exportSheet ( Page  page)

Definition at line 47 of file FinancialsSheets.java.

47  {
48  File dir = new File(ElephantContext.getRealPath("/WEB-INF/_reports/financials/sheets"));
49  InputField iDate = new InputField("Date", new Date(), null, 0);
50  InputField iFile = new InputField("Sheet", dir, "*.xls", 0);
51  ViewListbox vl = new ViewListbox();
52  vl.setMold("select");
53  vl.setAllowNull(true);
54  InputField iView = new InputField("View", vl, ViewWrapper.getFormalView());
55  InputDialog.getInput(
56  page, I_.get("Report sheets"),
57  new InputField[] {iDate, iFile, iView},
58  new Command() {
59  @Override
60  public Object execute(Context context) {
61  File file = null;
62  Date date = null;
63  RegisterView view = null;
64  InputField[] fields = (InputField[]) context.get("fields");
65  if(fields.length > 0) {
66  for(InputField f : fields) {
67  if("Date".equals(f.getLabel())) {
68  date = (Date) f.getValue();
69  } else if("Sheet".equals(f.getLabel())) {
70  file = (File) f.getValue();
71  } else if("View".equals(f.getLabel())) {
72  view = (RegisterView) f.getValue();
73  }
74  }
75  try {
76  //File file = new File(Application.getApplication().getRealPath("/WEB-INF/_reports/financials/sheets/ComptesAnuals.xls"));
77  ReportSheet rs = new ReportSheet(file, date, view);
78  Filedownload.save(rs.getExcel(), new MimetypesFileTypeMap().getContentType(file.getName()), file.getName());
79  } catch (IOException | BiffException | WriteException ex) {
80  Logger.getLogger(FinancialsSheets.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
81  }
82  }
83  return null;
84  }
85  });
86  }
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: