74 if(workloads !=
null && !workloads.isEmpty()) {
75 final WorksheetSet wss =
new WorksheetSet(workloads);
76 final Map parameters =
new HashMap();
77 Company company = CompanyWrapper.getDefaultCompany();
78 Contact companyContact = (Contact) company.getIContact().getContact();
79 parameters.put(
"company", company);
80 parameters.put(
"companyContact", companyContact);
81 parameters.put(
"dateFormat", DateFormats.getDefaultFormat());
82 parameters.put(
"currencyFormat", DecimalFormats.getStringFormat(2));
83 parameters.put(
"operator",
operator);
84 parameters.put(
"subOperator", subOperator);
85 parameters.put(
"exportFormat", ReportTypeEnum.PRINT_PDF.getType());
86 parameters.put(
"REPORT_RESOURCE_BUNDLE", Application.getApplication().getLabels().getBundle(
88 ((Contact)
operator.getContract().getIContractor().getContact()).getLocale(),
89 ElephantContext.getSiteLocales()));
91 parameters.put(
"SUBREPORT_DIR",
"../_reports/erp/worksheet/");
92 parameters.put(
"LOGO_IMAGE", ElephantContext.getRealPath(
"/WEB-INF/_reports/images/doc_logo.png"));
93 final String file =
"/WEB-INF/_reports/erp/worksheet/Worksheet_" + Strings.toFile(
operator.getName()) +
".jasper";
95 if(sendToParticipants) {
96 Collection<IContact> cemails =
operator.getContract().getIParticipantsEmail();
97 if(subOperator !=
null && subOperator.
isWebUser()) {
98 cemails.add(subOperator);
100 String mailString = getMailString(
operator.getContract().getIParticipantsEmail());
101 MailRecipients.selectRecipients(cemails,
new Command() {
103 public Object execute(Context context) {
104 MailRecipients mr = (MailRecipients) context.get(
"component");
105 Collection<IContact> emails = mr.getRecipients();
108 ReportPrint.send(Application.getString(
"lWorksheet"),
109 wss, parameters, file,
"/WEB-INF/_reports/erp/worksheet/Worksheet.jasper",
110 ReportTypeEnum.PRINT_PDF.getType(),
"Erp", emails,
null,
null,
null);
112 }
catch (JRException ex) {
113 Logger.getLogger(WorksheetReport.class.getName()).log(Level.SEVERE,
null, ex);
120 ReportPrint.print(Application.getString(
"lWorksheet"),
121 wss, parameters, file,
"/WEB-INF/_reports/erp/worksheet/Worksheet.jasper",
122 ReportTypeEnum.PRINT_PDF.getType(),
"Erp");
124 }
catch (JRException ex) {
125 Logger.getLogger(DocumentReport.class.getName()).log(Level.SEVERE,
null, ex);