Commit Graph

3 Commits

Author SHA1 Message Date
8e076af166 Optimize slow SQL queries + Fix duplicate invoices bug
Performance optimizations (views → base tables):
- SUMAR_EXECUTIV: 6 UNION ALL → 1 CTE (130s → 0.4s)
- SUMAR_EXECUTIV_YOY: 2 CTEs → 1 scan with CASE (129s → 0.4s)
- CLIENTI_SUB_MEDIE: 2 duplicate CTEs → 1 base CTE (131s → 0.2s)
- VANZARI_LUNARE: view → base table swap (130s → 0.4s)
- INDICATORI_AGREGATI_VENITURI_YOY: 2 CTEs → 1 scan (129s → 0.2s)

Bug fix (duplicate invoices in vireg_parteneri):
- AGING_CREANTE, FACTURI_RESTANTE, AGING_DATORII,
  FACTURI_RESTANTE_FURNIZORI now filter by last closed
  calendar period to avoid showing same invoice multiple times

Total query time reduced from ~31 min to ~22 min.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-11 16:29:07 +02:00
9e9ddec014 Implement Dashboard consolidation + Performance logging
Features:
- Add unified "Dashboard Complet" sheet (Excel) with all 9 sections
- Add unified "Dashboard Complet" page (PDF) with key metrics
- Fix VALOARE_ANTERIOARA NULL bug (use sumar_executiv_yoy directly)
- Add PerformanceLogger class for timing analysis
- Remove redundant consolidated sheets (keep only Dashboard Complet)

Bug fixes:
- Fix Excel formula error (=== interpreted as formula, changed to >>>)
- Fix args.output → args.output_dir in perf.summary()

Performance analysis:
- Add PERFORMANCE_ANALYSIS.md with detailed breakdown
- SQL queries take 94% of runtime (31 min), Excel/PDF only 1%
- Identified slow queries for optimization

Documentation:
- Update CLAUDE.md with new structure
- Add context handover for query optimization task

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-11 13:33:02 +02:00
0b732f7a7a Initial commit: Data Intelligence Report Generator
- Oracle ERP ROA integration with sales analytics and margin analysis
- Excel multi-sheet reports with conditional formatting
- PDF executive summaries with charts via ReportLab
- Optimized SQL queries (no cartesian products)
- Docker support for cross-platform deployment
- Configurable alert thresholds for business intelligence

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 15:41:56 +02:00