====== 8. Reporting ====== CedarInsight generates PDF reports from your production data, automatically at run end, on a schedule, or on demand, and can send them by e-mail. Report management requires the **Admin** role and is found under //System → Reports//. E-mail dispatch requires configured SMTP settings ([[cedar-insight:manual:09-system-administration#e-mail_smtp_settings|chapter 9.4]]). Reports are generated in the system language ([[cedar-insight:manual:09-system-administration#system_configuration|chapter 9.1]]). ===== 8.1 Concepts ===== ^ Element ^ Purpose ^ | **Template** | A report definition: type, trigger, filters, recipients and an ordered list of sections | | **Block** | A reusable content element (HTML). Types: //Header//, //Footer//, //Section// | | **Common Layout** | The shared header/footer used by all templates unless overridden | A template is assembled from blocks; generated PDFs are archived per template. ===== 8.2 Report templates ===== {{.:pasted:20260725-225230.png}} //System → Reports → Templates// lists all templates with type, trigger, recipients, e-mail flag, active flag and last-sent time. From the list you can **Generate / Download PDF**, send a **test e-mail**, edit, duplicate, activate/deactivate or delete a template (deleting also removes its archived PDF files). Templates marked **system** are predefined and cannot be edited or deleted. There are two report types: * **Run Report:** covers a single production run. Generated at run end or on demand (you pick the run; defaults to the most recent completed run). * **Period Report:** covers a date range. Generated on schedule or on demand (you pick the range). ===== 8.3 Creating and editing a template (Report Builder) ===== {{.:pasted:20260725-230901.png}} **New Report** opens the Report Builder: * **General:** name, description, report type, active flag. * **Trigger:** * **Manual **(on demand only), * **Triggered at Run End:** generated automatically when a production run is stopped (run reports), or * **Scheduled (automatic):** for period reports, choose the report period (rolling window: daily / weekly 7 days / monthly 30 days / quarterly 90 days), the run-at time (HH:MM) and, for weekly/monthly schedules, the day of week / day of month. * **Filters (optional):** narrow the report to a specific product or program; all sections (OEE summary, charts, run table) then include only matching data. * **Recipients:** select users; enable Send Email to dispatch the PDF automatically. * Header & Footer: by default the shared Common Layout is used (). Enable Custom header/footer to override for this template only; you can load the common layout as a starting point. * **Sections:** pick a block from the library and Add it; reorder with Move up / Move down. Click a section to edit its title and HTML content directly in the built-in editor; Save as Block stores an edited section back to the library for reuse. * Generate Preview: renders the report with chosen parameters (run or date range) before saving. {{.:pasted:20260725-231156.png}} ===== 8.4 Blocks library ===== {{.:pasted:20260725-225811.png}} //System → Reports → Blocks// manages the reusable content elements. Each block has a name, description, type (//Header//, //Footer//, //Section//) and HTML content with Jinja2 template variables ([[cedar-insight:manual:08-reporting#template_variables|8.6]]). * **Predefined blocks** (OEE summary, run table, downtime table, charts, standard header/footer, …) are system-owned: they can be viewed and duplicated, but not edited or deleted. To customise one, duplicate it and edit the copy. * **Custom blocks** can be created, edited, previewed, duplicated and deleted freely. {{.:pasted:20260725-230117.png?550}} ===== 8.5 Common Layout ===== {{.:pasted:20260725-230237.png}} //System → Reports → Layout// defines the shared header and footer HTML used by all templates that do not override it. **Edit**, **Preview**, or **Reset to default**. A table of the available template variables is shown in the editor. Typical use: put your company logo and report title in the common header once; every report uses it automatically. ===== 8.6 Template variables ===== Block HTML is rendered with Jinja2. The most important context variables: ^ Variable ^ Content ^ | ''runs'' | List of the production runs in scope, with per-run OEE fields | | ''runs_by_product'' / ''runs_by_program'' | The same data grouped and aggregated per product / program | | ''oee_summary'' | Weighted OEE totals for the whole scope (availability, performance, quality, OEE, quantities) | | ''reasons'' | Downtime reasons with durations | | ''charts'' | Pre-rendered charts (embedded images) | | ''generated_at'' | Generation timestamp | | ''filter_*'' | The active filters (period, product, program) | | ''t'' | Translation dictionary: write ''{{ t.oee }}'', ''{{ t.availability }}'' etc. so one block renders correctly in any report language | The full, current variable list is displayed inside the Report Builder and the Layout editor (**Available Template Variables**). ===== 8.7 Generating, testing and dispatch ===== * **On demand:** //Templates// list → **Generate / Download PDF**; pick the run (run report) or date range and optional filters (period report). * **Test e-mail:** sends a generated report to a single address of your choice; use this to verify SMTP and layout before enabling automatic dispatch. * **Run end:** active run-end templates are offered for dispatch in the Run Complete dialog ([[cedar-insight:manual:05-live-operation#run-end_summary_and_bad_parts|chapter 5.2.4]]). * **Scheduled:** active scheduled templates are generated and e-mailed automatically at the configured time; //Last Sent// in the list shows the most recent dispatch.