Major OCR infrastructure improvements:
- Add persistent SQLite-based job queue for OCR tasks
- Implement worker pool with process isolation and auto-restart
- Add OCR engine selector dropdown (Tesseract/PaddleOCR) in upload zone
- Optimize Tesseract preprocessing based on benchmark results (8x faster)
- Add recognize_cif_optimized() with multi-strategy CIF extraction
- Add Romanian CIF checksum validation
- Increase Telegram long polling timeout from 10s to 30s
Squashed commits:
- feat(ocr): Implement persistent worker pool with SQLite job queue
- feat(ocr): Add OCR engine selector dropdown to upload zone
- perf(telegram): Increase long polling timeout from 10s to 30s
- perf(ocr): Optimize Tesseract preprocessing based on benchmark results
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
OCR Service improvements:
- Single worker ThreadPoolExecutor to prevent parallel OCR memory accumulation
- Semaphore to ensure only one OCR operation at a time
- Explicit numpy array cleanup after each OCR step
- Forced garbage collection after every OCR request
- Memory threshold check (2500MB) with pre-processing GC
- Memory usage logging before/after processing
Backend auto-restart:
- Add run-with-restart.sh wrapper script for uvicorn
- Auto-restart on crash (OOM, etc.) with max 10 restarts
- Reset restart counter if process runs >60s (stable)
- Graceful exit on SIGINT/SIGTERM
- Update start-prod.sh and start-test.sh to use wrapper
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Use CSS Grid with fixed columns (140px/120px/200px) to prevent TOTAL/CARD/MOD PLATA overlap
- Move MOD PLATA to end of row to avoid overlapping other fields
- Add borderless dropdown styling matching AutoComplete look
- Remove showClear (X button) from MOD PLATA dropdown
- Align dropdown height (44px) with text inputs for consistent vertical alignment
- Add non-scoped CSS for PrimeVue dropdown overrides (per CSS rules)
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Changed from flexbox to CSS Grid layout for precise column control:
- grid-template-columns: 150px 200px auto (TOTAL, MOD PLATA, CARD)
- column-gap: 3rem ensures clear separation
- Fixed widths prevent any possibility of overlap
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Replace separate [Trezorerie Casa] and [Trezorerie Banca] buttons
with single unified [Trezorerie] button in main menu
- Add format_treasury_combined_response() formatter showing:
- Grand total (Sold Trezorerie)
- Casa section with total + all accounts
- Banca section with total + all accounts
- Compact menu layout: Row 2 [Sold Companie][Trezorerie],
Row 3 [Sold Clienti][Sold Furnizori], Row 4 [Evolutie Incasari]
- Use Romanian number format (period as thousands separator)
Also includes:
- Oracle pool: Support both SERVICE_NAME and SID connections
(ORACLE_SERVICE_NAME takes priority over ORACLE_SID)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Consolidate 3 separate applications (reports-app, data-entry-app, telegram-bot) into a unified
architecture with single backend and frontend:
Backend Changes:
- Unified FastAPI backend at backend/ with modular structure
- Modules: reports, data_entry, telegram in backend/modules/
- Centralized config.py and main.py with all routers registered
- Single worker mode (--workers 1) for Telegram bot compatibility
- Shared Oracle connection pool and JWT authentication
- Unified requirements.txt and environment configuration
Frontend Changes:
- Single Vue.js SPA with module-based routing
- Unified frontend at src/ with modules in src/modules/{reports,data-entry}/
- Shared components and stores in src/shared/
- Error boundaries for module isolation
- Dual API proxy in Vite for module communication
Infrastructure:
- New unified startup scripts: start-prod.sh, start-test.sh, start-backend.sh
- Environment templates: .env.dev.example, .env.test.example, .env.prod.example
- Updated deployment scripts for Windows IIS
- Simplified SSH tunnel management
Documentation:
- Comprehensive CLAUDE.md with architecture overview
- Module-specific docs in docs/{data-entry,telegram}/
- Architecture decision records in docs/ARCHITECTURE-DECISIONS.md
- Deployment guides consolidated in deployment/windows/docs/
This migration reduces complexity, improves maintainability, and enables easier
deployment while maintaining all existing functionality.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Transformare arhitecturală de la 3 backend-uri separate la monolith ULTRATHIN:
- 1 singur proces FastAPI (port 8000) în loc de 3 (8001, 8003, 8002)
- Telegram bot integrat în același proces (nu separat)
- Structură modulară păstrată: backend/modules/{reports,data-entry,telegram}/
- Log-uri unificate cu prefixe de modul
- Deploy Windows simplificat: 1 serviciu NSSM în loc de 3
- Startup paralel: Oracle pool + PaddleOCR
- Curățenie cod: eliminare duplicări, cod mort
- URL-uri API păstrate: /api/reports/*, /api/data-entry/*, /api/telegram/*
Estimare: 21-31 ore (3-4 zile)
Fișiere afectate: ~70 (10 critice)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Consolidate Reports and Data Entry apps into a single Vue.js SPA with:
Architecture:
- Module-based structure with lazy-loaded routes (@reports, @data-entry)
- Error boundaries per module to prevent cascade failures
- Dual API proxy in Vite for microservices (reports:8001, data-entry:8003)
- Pinia store factories for shared auth, company, and period stores
- Vite path aliases for clear module boundaries (@shared, @reports, @data-entry)
Service Management:
- Granular service control scripts (backend-reports.sh, backend-data-entry.sh, bot.sh, frontend.sh)
- 87% faster frontend restart: 7s vs 53s full restart
- 38% faster full startup: 33s vs 53s via parallel backend initialization
- Enhanced start-dev.sh with proper service timeouts (OCR: 30s, Vite: 15s, Bot: 10s)
- status.sh for comprehensive health checks
Features:
- Auto-select first company on login with period auto-load
- Hamburger menu with feature toggle support
- JWT token auto-injection via axios interceptors
- Unified header with company/period selectors
- IIS web.config for production deployment with multi-API routing
UX Improvements:
- Vue watchers for reactive company/period loading
- Lazy store initialization with graceful error handling
- Period persistence per user+company in localStorage
- Feature flags for optional modules
Deployment:
- Single IIS site serves unified frontend with API proxy rules
- Maintains separate backend processes for microservices
- Windows line ending fixes (.env CRLF → LF conversion)
Stats: 112 files changed, 38,342 insertions(+), 2,342 deletions(-)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Modified all specification files to reference the project root directory (.)
instead of creating a new unified-app/ subdirectory:
- spec.md: Updated project structure and all file paths
- SUMMARY.md: Updated critical files paths and documentation references
- critical-files.md: Updated all source/destination paths for migration
- MIGRATION_CHECKLIST.md: Updated directory creation and file paths
All implementation files will now be created directly in /mnt/e/proiecte/roa2web/
instead of /mnt/e/proiecte/roa2web/unified-app/
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add dedupe option for vue, vue-router, pinia, primevue in both Vite configs
to prevent duplicate module issues when using shared components
- Add optimizeDeps and commonjsOptions for better shared module handling
- Fix CompanySelector and PeriodSelector header variants to support both
light headers (using CSS variables) and gradient headers (white text)
- Make hamburger button always display:flex for consistent mobile layout
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Data Entry App:
- Fix shared path finding for both dev and production environments
- Add base URL support for IIS subdirectory deployment (/data-entry/)
- Use import.meta.env.BASE_URL in router for correct path handling
- Add email-validator and python-jose dependencies
Deployment Scripts:
- Enhance Build-ROA2WEB.ps1 with improved build process
- Update ROA2WEB-Console.ps1 with Data Entry support
- Improve Publish-And-Deploy.ps1 deployment workflow
- Update deploy-config.json with new settings
Gitignore:
- Add more build cache patterns to ignore
- Add temp frontend build directories
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add OCR installation instructions for Windows (Poppler, Tesseract, PaddleOCR)
- Add troubleshooting section for common OCR errors on Windows
- Fix web.config.data-entry to use existingResponse="Auto" instead of "Replace"
This allows FastAPI JSON error responses to pass through IIS unchanged
- Update system requirements to recommend 16GB RAM for OCR workloads
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Make payment methods (CARD/NUMERAR) editable InputNumber fields
- Remove RON currency display from TOTAL, TVA, and payment fields
- Allow editing REJECTED receipts (to fix OCR errors before resubmit)
- Add "Editeaza" button for REJECTED receipts in view mode
- Fix null amount validation by converting to 0 before API call
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove /approval route and ReceiptApprovalView.vue
- Add checkbox selection column to receipts DataTable
- Add bulk actions bar with "Validează selectate" button
- Add visual indicator (underline) for active status filter
- Update CLAUDE.md with test environment instructions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add top action buttons in all modes (view/edit/create) aligned to the right
- Merge ReceiptDetailView into ReceiptCreateView for unified receipt handling
- Fix attachment download using blob URLs with auth headers
- Add download button in both view and edit modes for attachments
- Fix TVA InputNumber type mismatch by parsing amounts as floats
- Add fetchAttachmentBlob and downloadAttachment methods to receiptsStore
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Restructure OCRPreview with 5 sections matching Romanian receipt format:
FURNIZOR, DOCUMENT, TOTAL, PLATA, TVA
- Add collapse button to OCRPreview header with minimize functionality
- Restructure form with matching compact sections for side-by-side comparison
- Add "din OCR" indicator when payment mode is auto-set from OCR
- Remove auto-collapse behavior - OCRPreview stays visible after applying data
- Add prominent TOTAL box styling with gradient background
- Compact form layout with fields on same row where logical
- Add TVA section to form with editable breakdown
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Backend:
- Add payment_methods and payment_mode fields to Receipt model
- Add payment method extraction (CARD/NUMERAR) with auto-suggestion logic
- Improve OCR service with TVA validation and reverse calculation
- Fix nomenclature service supplier limit (was 50, now unlimited)
- Add OCR fields migrations (ocr_raw_text, ocr_confidence, payment_mode)
Frontend:
- Fix AutoComplete to properly display supplier name after OCR
- Add payment methods display in OCR preview with suggested payment mode
- Improve ReceiptCreateView form handling and OCR data application
Database migrations:
- 20251215_add_ocr_fields_to_receipt.py
- 20251215_remove_partner_id.py
- 20251216_add_payment_mode.py
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add safety padding (50px) around images before preprocessing to protect
edge content during deskew rotation
- Fix _deskew() to expand canvas during rotation instead of using fixed
canvas size with BORDER_REPLICATE (which lost edge content)
- Add fallback payment method patterns for truncated text detection
(RD→CARD, ARD→CARD, MERAR→NUMERAR)
This fixes the issue where text near left edge was being cut off,
causing "CARD" to appear as "RD", "SUBTOTAL" as "UBTOTAL", etc.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Integrate shared JWT authentication into data-entry-app:
- Add Oracle pool initialization for auth service
- Add AuthenticationMiddleware to protect API routes
- Update all receipt endpoints to use CurrentUser from JWT
- Add shared auth router (/api/auth/login, /api/auth/refresh)
Add nomenclature synchronization feature:
- Create SQLite models for synced suppliers, local suppliers, and cash registers
- Add nomenclature router with sync triggers and CRUD endpoints
- Add sync service for Oracle → SQLite nomenclature data
- Update nomenclature_service to use synced SQLite data with fallbacks
Create shared frontend components:
- Add shared/frontend/ with LoginView.vue, auth store factory, login.css
- Integrate shared login and auth into data-entry-app frontend
- Add axios-based API service with token refresh interceptor
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add adaptive 3-step OCR pipeline with early exit when all 5 fields found
- Add pattern for "C. I. F." with spaces (OCR artifact from PaddleOCR)
- Add pattern for YYYY. MM. DD date format with spaces (OMV/Petrom receipts)
- Add pattern for "OTAL TAXE" with T cut off and reversed amount position
- Make TVA rate pattern more flexible (code letter optional, handle "-21%")
- Replace logger.info with print(flush=True) for better debugging visibility
- Improve OCRPreview.vue to show extraction progress and raw OCR text
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add TvaEntry schema supporting multiple TVA rates (A, B, C, D codes)
- Update OCR extractor to extract multiple TVA entries from receipts
- Support both old (19%, 9%, 5%) and new Romanian rates (21%, 11% from Aug 2025)
- Add tva_breakdown, tva_total, items_count, vendor_address to Receipt model
- Update OCRPreview.vue to display TVA entries with rate badges
- Add "Detalii Suplimentare" section in ReceiptCreateView with editable TVA table
- Add TVA breakdown display in ReceiptDetailView
- Create database migration for new TVA columns
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implement Tesseract-based OCR to automatically extract vendor name,
date, total amount, and VAT from uploaded receipt images/PDFs,
reducing manual data entry and improving accuracy.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add application-specific instructions section
- Reference data-entry-app/CLAUDE.md for data entry work
- Update architecture diagram with both apps
- Add starting services commands for both apps
- Add data-entry documentation to Documentation Index
- Clarify when to use which instructions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add manifest.json, meta tags and app icons to enable:
- Add to Home Screen on iOS/Android
- Standalone mode (no browser UI)
- Custom app icon (ROA) and theme color
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add manifest.json and meta tags to enable:
- Add to Home Screen on iOS/Android
- Standalone mode (no browser UI)
- Custom app icon and theme color
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Fix main content margin-top in App.vue to account for fixed header
(was hidden behind 56px header bar)
- Add mobile page header styles in mobile.css for proper title visibility
- Increase mobile totals font size to match table font (0.875rem base)
- Change Dashboard title to just "Dashboard" without subtitle
(period selector now shows the current accounting period)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add mobile card layout for Invoices, Treasury, and Trial Balance views
- Implement two-row mobile toolbar with icon-only action buttons
- Add uniform totals grid across all views with compact number formatting
- Move profile menu to hamburger menu on mobile devices
- Fix company selector and period selector truncation on mobile
- Add mobile-specific CSS with responsive breakpoints
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Features:
- Trial balance totals on single line with shared CSS
- Renamed "Sold Prec" to "Sume Prec" (correct terminology)
- PDF export with class totals (TOTAL CLASA 1-7) and grand total
- Updated CLAUDE.md with shared CSS guidelines
- Change totals display to single horizontal line using shared CSS
- Rename column headers from "Sold Prec" to "Sume Prec" (correct terminology)
- Add class totals (TOTAL CLASA 1-7) and grand total to PDF export
- Style class totals with light gray background, grand total with darker gray
- Update CLAUDE.md with rule to use shared CSS instead of creating new styles
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
The totals PL/SQL block was generating invalid SQL with duplicate WHERE clauses
when bank/cash filters were applied (e.g., "WHERE bank_account=X WHERE dataact IS NULL").
Now properly uses AND when where_clause exists, WHERE otherwise.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Previously, totals were computed client-side from only the current page data,
which gave incorrect results when paginating. Now the backend calculates totals
across ALL filtered records and returns them in the API response.
- Invoice: Add total_sold_all field for sum of all filtered invoice balances
- Treasury: Add sold_precedent_all, total_incasari_all, total_plati_all, sold_final_all
- Trial Balance: Add 6-column totals (debit/credit for each balance type)
- Frontend stores and views updated to use backend totals
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add PeriodSelectorMini component for global period selection
- Add accountingPeriod store for shared period state
- Add calendar service/router/model for available periods API
- Update Dashboard, Invoices, Trial Balance, Bank/Cash Register views
to respect selected period
- Fix Trial Balance navigation sync bug (period now syncs on mount)
- Update backend services to accept luna/an parameters
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Truncate explicatia field to 100 characters in table, Excel, and PDF exports
- Fix summary stats to separate opening balance from transactions:
- Show Sold Precedent (from rows with null date)
- Show Încasări and Plăți (only from actual transactions)
- Show Sold Final (calculated correctly)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Move menuOpen state from DashboardHeader to App.vue for proper state management
- Pass menuOpen as prop to DashboardHeader component
- Translate hamburger menu labels to Romanian (Navigation, Invoices, Bank & Cash, System, Cache Statistics)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Move DataTable striped rows and hover styling to global primevue-overrides.css
- Add .summary-stats-inline pattern to shared stats.css
- Refactor BankCashRegisterView.vue: CSS reduced from ~210 to 45 lines (78%)
- Refactor TrialBalanceView.vue: CSS reduced from ~100 to 42 lines (58%)
- Remove :deep() violations by using global DataTable overrides
- Update templates to use shared classes (.table-empty, .loading-state, .form-actions)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add bancasa as third sorting criterion (date, number, bank name)
- Sort null-date rows (previous balances) alphabetically by bank name
- Sort bank names alphabetically in PDF export
- Improve window function for cumulative balance calculation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>