BrightSide Workbench Full Report + Source Code
All Classes Namespaces Files Functions Variables Pages
org.turro.erp.task.WorksheetReport Class Reference

Public Member Functions

void setWorkloads (WorkloadSet workloads)
 
void setSendToParticipants (boolean sendToParticipants)
 
void setOperator (HumanResource operator)
 
void print ()
 

Detailed Description

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

Definition at line 51 of file WorksheetReport.java.

Member Function Documentation

◆ print()

void org.turro.erp.task.WorksheetReport.print ( )

Definition at line 73 of file WorksheetReport.java.

73  {
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(
87  "labels",
88  ((Contact) operator.getContract().getIContractor().getContact()).getLocale(),
89  ElephantContext.getSiteLocales()));
90  //parameters.put("REPORT_LOCALE", );
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";
94  try {
95  if(sendToParticipants) {
96  Collection<IContact> cemails = operator.getContract().getIParticipantsEmail();
97  if(subOperator != null && subOperator.isWebUser()) {
98  cemails.add(subOperator);
99  }
100  String mailString = getMailString(operator.getContract().getIParticipantsEmail());
101  MailRecipients.selectRecipients(cemails, new Command() {
102  @Override
103  public Object execute(Context context) {
104  MailRecipients mr = (MailRecipients) context.get("component");
105  Collection<IContact> emails = mr.getRecipients();
106  if(emails != null) {
107  try {
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);
111  //Application.logZkoss(LogType.LOG_INFO, FinancialsPU.getObjectPath(document), "sent", mailString);
112  } catch (JRException ex) {
113  Logger.getLogger(WorksheetReport.class.getName()).log(Level.SEVERE, null, ex);
114  }
115  }
116  return null;
117  }
118  });
119  } else {
120  ReportPrint.print(Application.getString("lWorksheet"),
121  wss, parameters, file, "/WEB-INF/_reports/erp/worksheet/Worksheet.jasper",
122  ReportTypeEnum.PRINT_PDF.getType(), "Erp");
123  }
124  } catch (JRException ex) {
125  Logger.getLogger(DocumentReport.class.getName()).log(Level.SEVERE, null, ex);
126  }
127  }
128  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setOperator()

void org.turro.erp.task.WorksheetReport.setOperator ( HumanResource  operator)

Definition at line 66 of file WorksheetReport.java.

66  {
67  this.operator = operator;
68  if(operator != null) {
69  subOperator = operator.getOperator() == null ? null : operator.getOperator().getContract().getIContractor();
70  }
71  }
Here is the caller graph for this function:

◆ setSendToParticipants()

void org.turro.erp.task.WorksheetReport.setSendToParticipants ( boolean  sendToParticipants)

Definition at line 62 of file WorksheetReport.java.

62  {
63  this.sendToParticipants = sendToParticipants;
64  }
Here is the caller graph for this function:

◆ setWorkloads()

void org.turro.erp.task.WorksheetReport.setWorkloads ( WorkloadSet  workloads)

Definition at line 58 of file WorksheetReport.java.

58  {
59  this.workloads = workloads;
60  }
Here is the caller graph for this function:

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