Commit Graph

4 Commits

Author SHA1 Message Date
38d8f9c6d2 Add FORMULA column to financial indicator queries
Added detailed calculation formulas with accounting references for managers
to understand and verify financial indicators:

- INDICATORI_GENERALI (6 formulas): grad indatorare, autonomie financiara,
  rata datoriilor, marja neta, ROA, rotatia activelor
- INDICATORI_LICHIDITATE (4 formulas): lichiditate curenta, quick ratio,
  cash ratio, fond de rulment
- CICLU_CONVERSIE_CASH (4 formulas): DIO, DSO, DPO, CCC
- DSO_DPO (2 formulas): DSO, DPO with detailed sources

Each formula includes:
- Mathematical calculation (e.g., "Datorii / Capital Propriu")
- Account references (e.g., "cont 16x,40x,42x,44x,46x / cont 10x,11x,12x,117")
- Data sources for verification (e.g., "jurnal vanzari vjv2025")

Also fixed ORA-32039 error by renaming CTE 'vanzari' to 'vanzari_calc'
to avoid conflict with table name.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-12 16:19:53 +02:00
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