BrightSide Workbench Full Report + Source Code
org.turro.financials.document.DocumentReport Class Reference
Inheritance diagram for org.turro.financials.document.DocumentReport:
Collaboration diagram for org.turro.financials.document.DocumentReport:

Public Member Functions

void setDocument (Document document)
 
void setGrid (DocumentLinesGrid grid)
 
void setSendToParticipants (boolean sendToParticipants)
 
void setSendToCurrent (boolean sendToCurrent)
 
void setAskBeforeSend (boolean askBeforeSend)
 
- Public Member Functions inherited from org.turro.zkoss.print.ReportToolbarbutton
 ReportToolbarbutton ()
 
void setShowLabels (boolean showLabels)
 
void setShowValues (boolean showValues)
 
void afterCompose ()
 
void doPrint ()
 

Protected Member Functions

void print (final String type)
 

Additional Inherited Members

- Protected Attributes inherited from org.turro.zkoss.print.ReportToolbarbutton
boolean showValues = true
 

Detailed Description

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

Definition at line 59 of file DocumentReport.java.

Member Function Documentation

◆ print()

void org.turro.financials.document.DocumentReport.print ( final String  type)
protected

Reimplemented from org.turro.zkoss.print.ReportToolbarbutton.

Definition at line 86 of file DocumentReport.java.

86  {
87  final Collection<DocumentLine> lines = getLines();
88  final Document doc = getDocument();
89  if(lines != null && lines.size() > 0) {
90  DocumentLine sample = lines.iterator().next();
91  int fractionDigits = doc.getCurrency().getDefaultFractionDigits();
92  final Map parameters = new HashMap();
93  Company company = CompanyWrapper.getCompanyFrom(sample);
94  Contact companyContact = (Contact) company.getIContact().getContact();
95  parameters.put("company", company);
96  parameters.put("companyContact", companyContact);
97  parameters.put("dateFormat", DateFormats.getDefaultFormat());
98  parameters.put("currencyFormat", DecimalFormats.getStringFormat(fractionDigits));
99  parameters.put("showDescendants", Boolean.TRUE);
100  Contact contractor = (Contact) doc.getContract().getIContractor().getContact();
101  parameters.put("contractor", contractor);
102  parameters.put("exportFormat", type);
103  parameters.put("REPORT_RESOURCE_BUNDLE", Application.getBundle(
104  "labels",
105  ((Contact) doc.getContract().getIContractor().getContact()).getLocale(),
106  ElephantContext.getSiteLocales()));
107 // parameters.put("REPORT_RESOURCE_BUNDLE", LabelsBundle.getBundle(
108 // ((Contact) doc.getContract().getIContractor().getContact()).getLocale()));
109  //parameters.put("REPORT_LOCALE", );
110  parameters.put("SUBREPORT_DIR", "../_reports/financials/document/");
111  parameters.put("LOGO_IMAGE", ElephantContext.getRealPath("/WEB-INF/_reports/images/doc_logo.png"));
112  final String file = "/WEB-INF/_reports/financials/document/" + doc.getDocumentDefinition().getName() +
113  (showValues ? "" : "NoValues") + ".jasper";
114  try {
115  if(askBeforeSend) {
116  if(sendToParticipants) {
117  MailRecipients.selectRecipients(doc.getContract().getIParticipantsEmail(), new Command() {
118  @Override
119  public Object execute(Context context) {
120  MailRecipients mr = (MailRecipients) context.get("component");
121  Collection<IContact> emails = mr.getRecipients();
122  doPrint(emails, doc, lines, parameters, file, type);
123  return null;
124  }
125  });
126  }
127  if(sendToCurrent) {
128  MailRecipients.selectRecipients(List.of(Authentication.getIContact()), new Command() {
129  @Override
130  public Object execute(Context context) {
131  MailRecipients mr = (MailRecipients) context.get("component");
132  Collection<IContact> emails = mr.getRecipients();
133  doPrint(emails, doc, lines, parameters, file, type);
134  return null;
135  }
136  });
137  }
138  } else {
139  if(sendToParticipants) {
140  Collection<IContact> emails = doc.getContract().getIParticipantsEmail();
141  doPrint(emails, doc, lines, parameters, file, type);
142  }
143  if(sendToCurrent && Authentication.isAdministrator()) {
144  Collection<IContact> emails = List.of(Authentication.getIContact());
145  doPrint(emails, doc, lines, parameters, file, type);
146  }
147  }
148  if(!(sendToParticipants || sendToCurrent)) {
149  ReportPrint.print(doc.getDocDescription(),
150  lines, parameters, file, "/WEB-INF/_reports/financials/document/Document" +
151  (showValues ? "" : "NoValues") + ".jasper",
152  type, "Financials");
153  }
154  } catch (JRException ex) {
155  Logger.getLogger(DocumentReport.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
156  }
157  }
158  }
Here is the call graph for this function:

◆ setAskBeforeSend()

void org.turro.financials.document.DocumentReport.setAskBeforeSend ( boolean  askBeforeSend)

Definition at line 81 of file DocumentReport.java.

81  {
82  this.askBeforeSend = askBeforeSend;
83  }
Here is the caller graph for this function:

◆ setDocument()

void org.turro.financials.document.DocumentReport.setDocument ( Document  document)

Definition at line 65 of file DocumentReport.java.

65  {
66  this.document = document;
67  }
Here is the caller graph for this function:

◆ setGrid()

void org.turro.financials.document.DocumentReport.setGrid ( DocumentLinesGrid  grid)

Definition at line 69 of file DocumentReport.java.

69  {
70  this.grid = grid;
71  }
Here is the caller graph for this function:

◆ setSendToCurrent()

void org.turro.financials.document.DocumentReport.setSendToCurrent ( boolean  sendToCurrent)

Definition at line 77 of file DocumentReport.java.

77  {
78  this.sendToCurrent = sendToCurrent;
79  }
Here is the caller graph for this function:

◆ setSendToParticipants()

void org.turro.financials.document.DocumentReport.setSendToParticipants ( boolean  sendToParticipants)

Definition at line 73 of file DocumentReport.java.

73  {
74  this.sendToParticipants = sendToParticipants;
75  }
Here is the caller graph for this function:

The documentation for this class was generated from the following file: