Files

90 lines
3.4 KiB
Markdown

# Business Report Templates
Quarto templates for Kimia Razi Persian (RTL) business reports.
One `.qmd` source renders to:
- **HTML** — RTL reading layout with the same title block as PDF (company, logo, report title)
- **PDF** — via WeasyPrint from the HTML, matching `typst-templates` page chrome (sidebar, header, title block, tables)
## Requirements
- [Quarto](https://quarto.org/) 1.7+
- [WeasyPrint](https://weasyprint.org/) (for PDF)
- Fonts in `assets/fonts/` (`IRNazanin`, `IRZar`, …)
Install WeasyPrint once in this repo:
```bash
uv venv .venv-pdf
uv pip install --python .venv-pdf/bin/python weasyprint
```
## Quick start
Always render from this project root so `_quarto.yml` applies (RTL CSS, filters, PDF post-render):
```bash
quarto render examples/travel-report.qmd
quarto render examples/product-test.qmd
quarto render examples/travel-expense.qmd
```
Outputs land in `_output/` (HTML + PDF). PDF is produced by `scripts/html-to-pdf.py` in `project.post-render`.
## Templates
Three named metadata templates (Typst-style explicit choice). Pick one via `metadata-files` in the `.qmd` frontmatter — that sets `report-type` and controls whether the travel meta block is injected. Document type is **not** inferred from `purpose`.
| Template | File | `report-type` | Example |
| --- | --- | --- | --- |
| Travel / mission | `templates/travel.yml` | `travel` | `examples/travel-report.qmd` |
| Product / raw-material test | `templates/product-test.yml` | `product-test` | `examples/product-test.qmd` |
| Travel / mission expense | `templates/travel-expense.yml` | `travel-expense` | `examples/travel-expense.qmd` |
### Start a new report
1. Copy the matching example `.qmd` (keep its `metadata-files` line pointing at `templates/travel.yml`, `templates/product-test.yml`, or `templates/travel-expense.yml`).
2. Fill frontmatter and body.
3. Render with `quarto render` from this repo root.
### Travel fields
Content for the PDF «اطلاعات کلی» block (only when using the travel template):
- `purpose` — هدف مأموریت
- `destinations` — مقصد (also used on the sidebar)
- `report-date` — تاریخ
### Product-test body
Put general info, samples, formula, and results in the body as Markdown tables. `destinations` is optional sidebar text. No `purpose` field is needed.
### Travel-expense body
Write a short formal letter in the body (addressee, greeting, mission meta, aligned expense list, notes, signature). `destinations` is sidebar text. No travel «اطلاعات کلی» block is injected.
## Project layout
```
_quarto.yml
styles/report.css # HTML screen theme
styles/print.css # PDF / print (typst-templates match)
filters/print-chrome.lua # title block + sidebar + travel meta
scripts/html-to-pdf.py # WeasyPrint post-render
assets/fonts/
assets/logo.png
templates/travel.yml
templates/product-test.yml
templates/travel-expense.yml
examples/travel-report.qmd
examples/product-test.qmd
examples/travel-expense.qmd
```
## Notes
- PDF layout targets `typst-templates` (`product_test_template.typ` / `travel-report-template.typ`): A4, RTL, rotated left sidebar with page `n / N`, running header on page 2+, content-sized tables with grey header row.
- HTML on screen shows the shared title block (logo + company | subtitle + report title); running header and sidebar stay `display: none` until print/PDF.
- Typst is not used for PDF generation.