19 package org.turro.financials.model.document;
22 import java.io.OutputStream;
23 import java.util.Collection;
24 import java.util.HashMap;
26 import javax.servlet.http.HttpServletResponse;
27 import org.turro.contacts.Contact;
28 import org.turro.elephant.context.Application;
29 import org.turro.elephant.context.ElephantContext;
30 import org.turro.elephant.util.DateFormats;
31 import org.turro.elephant.util.DecimalFormats;
32 import org.turro.financials.entity.Company;
33 import org.turro.financials.entity.Document;
34 import org.turro.financials.entity.DocumentLine;
35 import org.turro.financials.model.business.CompanyWrapper;
36 import org.turro.pdf.GeneratePDF;
44 private Collection<DocumentLine> lines;
46 private Map parameters;
50 if(lines !=
null && lines.size() > 0) {
51 prepareValues(doc, showValues);
58 if(lines !=
null && lines.size() > 0) {
59 prepareValues(doc, showValues);
64 private void prepareValues(
Document doc,
boolean showValues) {
66 int fractionDigits = doc.
getCurrency().getDefaultFractionDigits();
67 parameters =
new HashMap();
70 parameters.put(
"company", company);
71 parameters.put(
"companyContact", companyContact);
74 parameters.put(
"showDescendants", Boolean.TRUE);
76 parameters.put(
"contractor", contractor);
77 parameters.put(
"exportFormat",
"pdf");
82 parameters.put(
"SUBREPORT_DIR",
"../_reports/financials/document/");
85 (showValues ?
"" :
"NoValues") +
".jasper";
87 file =
"/WEB-INF/_reports/financials/document/Document" +
88 (showValues ?
"" :
"NoValues") +
".jasper";
static ResourceBundle getBundle(String bundle, Locale locale, String configured)
static String getRealPath(String path)
static String getSiteLocales()
IContact getIContractor()
Set< DocumentLine > getDocumentLines()
DocumentDefinition getDocumentDefinition()
static Company getCompanyFrom(DocumentLine line)
void outputDocument(Document doc, boolean showValues, HttpServletResponse response)
void outputDocument(Document doc, boolean showValues, OutputStream out)
static void exportToStream(OutputStream out, String jasperFile, Collection collection, Map parameters)
static void writeAsResponse(HttpServletResponse response, String jasperFile, Collection collection, Map parameters)