--- phase: 11-receipt-print plan: 01 subsystem: accounting tags: [dompdf, pdf, receipt, print, view] requires: - phase: 10-receipt-issue provides: ReceiptRepository, receipts table, snapshots JSON provides: - Receipt preview (HTML in app layout) - Receipt print view (standalone HTML + auto window.print()) - Receipt PDF generation via dompdf - Active preview/PDF links in Documents tab affects: [12-receipt-corrections] tech-stack: added: [dompdf/dompdf ^3.1] patterns: [buildReceiptViewData shared helper, standalone print view pattern] key-files: created: - resources/views/receipts/show.php - resources/views/receipts/print.php modified: - src/Modules/Accounting/ReceiptController.php - routes/web.php - resources/views/orders/show.php - resources/lang/pl.php - resources/scss/shared/_ui-components.scss - public/assets/css/app.css - composer.json - .vscode/ftp-kr.json key-decisions: - "dompdf v3.1 server-side PDF generation (not client-side)" - "DejaVu Sans font for PDF Polish character support" - "ftp-kr vendor/ no longer fully ignored — changed to /vendor/bin only" patterns-established: - "buildReceiptViewData() shared helper for show/print/pdf reuse" - "Standalone print view pattern: full HTML without layout + window.print()" duration: ~30min completed: 2026-03-15 --- # Phase 11 Plan 01: Receipt Preview & Print Summary **Podglad paragonu HTML, widok druku standalone i generowanie PDF przez dompdf — zamyka cykl wystawienie-podglad-wydruk.** ## Performance | Metric | Value | |--------|-------| | Duration | ~30min | | Completed | 2026-03-15 | | Tasks | 4 completed (3 auto + 1 checkpoint) | | Files modified | 10 | ## Acceptance Criteria Results | Criterion | Status | Notes | |-----------|--------|-------| | AC-1: Podglad paragonu w layoucie aplikacji | Pass | /orders/{id}/receipt/{receiptId} — dane sprzedawcy, nabywcy, pozycje, suma, daty | | AC-2: Widok druku (standalone HTML) | Pass | /print endpoint, window.print() auto-trigger | | AC-3: Generowanie PDF | Pass | /pdf endpoint, dompdf v3.1, Content-Disposition attachment | | AC-4: Aktywny link Podglad w Dokumentach | Pass | span.btn--disabled zamieniony na a.btn + dodany link PDF | | AC-5: Obsluga bledu — nieistniejacy paragon | Pass | 404 gdy paragon nie istnieje lub order_id mismatch | ## Accomplishments - 3 nowe metody kontrolera: show(), printView(), pdf() + helper buildReceiptViewData() - 2 nowe widoki: receipts/show.php (w layoucie) i receipts/print.php (standalone) - dompdf zainstalowany i dzialajacy na serwerze - Aktywne linki Podglad + PDF w zakladce Dokumenty zamowienia ## Files Created/Modified | File | Change | Purpose | |------|--------|---------| | `src/Modules/Accounting/ReceiptController.php` | Modified | +show(), +printView(), +pdf(), +buildReceiptViewData() | | `routes/web.php` | Modified | +3 trasy GET: show, print, pdf | | `resources/views/receipts/show.php` | Created | Podglad paragonu w layoucie aplikacji | | `resources/views/receipts/print.php` | Created | Standalone widok druku + auto window.print() | | `resources/views/orders/show.php` | Modified | Aktywne linki Podglad + PDF w Dokumentach | | `resources/lang/pl.php` | Modified | +receipts.show.* (13 kluczy) | | `resources/scss/shared/_ui-components.scss` | Modified | +.receipt-header, +.receipt-print | | `public/assets/css/app.css` | Modified | Przebudowany z nowym SCSS | | `composer.json` | Modified | +dompdf/dompdf ^3.1 | | `.vscode/ftp-kr.json` | Modified | /vendor → /vendor/bin w ignore | ## Decisions Made | Decision | Rationale | Impact | |----------|-----------|--------| | dompdf server-side | Plan wymaga server-side PDF, dompdf standard PHP | Wymaga vendor/ na serwerze | | ftp-kr vendor/ nie ignorowany | dompdf musi byc na serwerze, reczny deploy uciazliwy | Automatyczny upload vendor/ przy zmianach | | DejaVu Sans w print CSS | Obsluga polskich znakow w PDF | Poprawne znaki w generowanym PDF | ## Deviations from Plan ### Summary | Type | Count | Impact | |------|-------|--------| | Auto-fixed | 1 | ftp-kr config change for vendor deploy | | Deferred | 0 | — | **Total impact:** Minimalne — jedyna zmiana to konfiguracja deploy. ### Auto-fixed Issues **1. [Deploy] vendor/ nie uploadowany na serwer** - **Found during:** Task 1 (instalacja dompdf) - **Issue:** ftp-kr ignorowal caly /vendor, dompdf nie trafialo na serwer - **Fix:** Zmiana /vendor na /vendor/bin w ftp-kr.json ignore - **Files:** .vscode/ftp-kr.json - **Verification:** Upload vendor/ → dompdf dziala na serwerze ### Skill Audit | Expected | Invoked | Notes | |----------|---------|-------| | sonar-scanner | ○ | Required — do uruchomienia przed kolejnym UNIFY | ## Next Phase Readiness **Ready:** - Pelny cykl paragonow: konfiguracja → wystawienie → podglad → druk → PDF - Faza 11 zamknieta, gotowe do fazy 12 **Concerns:** - sonar-scanner nie uruchomiony (gap z wielu faz) **Blockers:** - Brak --- *Phase: 11-receipt-print, Plan: 01* *Completed: 2026-03-15*