Commit Graph

44 Commits

Author SHA1 Message Date
632c77d335 v2.5.1: Enhanced PDF layout with light gray section backgrounds
- Added light gray backgrounds to all section titles in detailed pages
- Enhanced visual hierarchy for better readability
- Improved professional appearance of PDF exports
- Updated module version to 2.5.1
2025-10-08 12:21:26 +02:00
f5f1169496 Version 2.5.0: Journal Configuration System
- Add complete journal configuration tab with account selection
- Add bank account configuration for VAT payments/receipts
- Add auto-create accounting toggle for submission
- Add configurable amount calculation method (round vs truncate)
- Add automatic database table creation and default values
- Fix configuration persistence and form handling
- Improve account loading with proper ordering
- Add comprehensive error handling and user feedback
- Update module version to 2.5.0
2025-10-08 11:48:33 +02:00
6178d9bdb7 Fix Update Configuration button translation and remove title
- Remove 'Actions' title from configuration page
- Add missing UpdateConfiguration translation to French and English
- Fix button text to display properly in both languages
- Clean up configuration page by removing unnecessary title
2025-10-07 20:17:35 +02:00
2d8dfc432e Change button text from 'CONFIGURER LES COMPTES PCG' to 'CONFIGURATION'
- Update French language file: ConfigurePCGAccounts = Configuration
- Update English language file: ConfigurePCGAccounts = Configuration
- Simplify button text for better user experience
- Maintain consistency across both languages
2025-10-07 20:07:31 +02:00
f7d27ae649 Add tabbed interface to configuration page
- Split configuration page into two tabs: PCG Mapping and Template Management
- Move CA-3 PDF template upload section to separate 'Template Management' tab
- Add JavaScript for tab switching functionality
- Add language strings for tab labels in French and English
- Improve user experience by organizing configuration options logically
- Maintain all existing functionality while improving navigation
2025-10-07 18:32:41 +02:00
ef40e60d6e Replace standard JavaScript confirm with Dolibarr-style modal for unvalidation
- Replaced onclick='return confirm()' with onclick='confirmUnvalidation()'
- Added confirmUnvalidation() JavaScript function with Dolibarr-style modal
- Added closeUnvalidationModal() and proceedUnvalidation() functions
- Modal has red warning styling to indicate destructive action
- Added UnvalidationConfirmationMessage and YesUnvalidate translations
- Modal includes escape key handler and proper styling
- Consistent with validation modal design and behavior
2025-10-06 17:56:47 +02:00
efa8f676fa Fix PDF document detection in declaration list
- Modified hasValidatedDocument() to check file system instead of database
- Added getValidatedPDFPath() method to get PDF file path
- Updated declaration list to show clickable PDF download links
- Added DownloadPDF translation in French and English
- PDF icons now link directly to downloadable PDF files
- Fixed issue where validated declarations didn't show PDF availability
2025-10-06 17:28:25 +02:00
a95e0782b6 Add unvalidate functionality for testing purposes
- Added unvalidateDeclaration() method to DeclarationTVA class
- Added unvalidate action handler in declarationtva_view.php
- Added red 'Unvalidate' button for validated declarations
- Added confirmation dialog for unvalidate action
- Added French and English language strings
- Allows reverting validated declarations back to draft status
- Useful for testing validation process multiple times
2025-10-06 17:10:49 +02:00
f07f6a7c28 Implement declaration validation with confirmation dialog
Features:
- Add validation confirmation dialog (non-JavaScript popup)
- Remove recalculate button after validation
- Generate and save detailed PDF to Dolibarr documents
- Add document icons in declaration list
- Add status icons (checkmark for validated, edit for draft)
- Create documents linking table
- Add validation language strings (FR/EN)

Technical:
- Enhanced validateDeclaration() method with user tracking
- saveValidatedPDF() method for document storage
- hasValidatedDocument() method for icon display
- Custom confirmation dialog with CSS styling
- Database migration for documents table
- Status-based UI changes
2025-10-06 17:03:47 +02:00
9255a39d42 Version 2.1.0: Enhanced PDF Export with Detailed Breakdown Pages
- Added comprehensive PDF export combining CA-3 form with detailed breakdown pages
- Implemented pdftk-based PDF merging that preserves form fields
- Added support for new CA-3 lines (25, 26, 27, TD, 28, 32) with conditional visibility
- Fixed multi-select configuration saving issues
- Enhanced error handling and debugging for PDF generation
- Added French status translation for detailed PDFs
- Optimized page breaks to reduce paper usage
- Improved form field preservation during PDF merging

Technical improvements:
- Better error handling with comprehensive logging
- Modular PDF generation with fallback options
- Fixed pdftk filename conflicts
- Enhanced debugging capabilities
- Status translation without external dependencies
2025-10-06 16:47:02 +02:00
0d27113489 🔄 Add Gitea-Based Template Auto-Update System
NEW FEATURES:
 Gitea API Integration for Template Management
 Automatic Template Update Checking
 Version Control and Manifest System
 One-Click Template Updates in Configuration
 Professional Template Management Workflow

TECHNICAL IMPLEMENTATION:
- Enhanced DeclarationTVA_PDF class with auto-update methods
- Template manifest system (templates/manifest.json)
- Gitea API integration for template downloads
- Update status display in configuration page
- Version comparison and automatic updates

TEMPLATE MANAGEMENT:
- Current version: 30 (10963*30)
- Gitea repository: https://git.covago.com/frank/DeclarationTVA
- Manifest URL: templates/manifest.json
- Auto-update on module activation
- Fallback to built-in template

MAINTENANCE WORKFLOW:
1. Tax authority updates form → Create fillable version (5 min)
2. Update manifest.json with new version (1 min)
3. Upload template to Gitea (2 min)
4. Users get automatic updates (0 min for maintainer)

This creates a professional, self-hosted template management system with minimal maintenance overhead!
2025-10-03 00:17:59 +02:00
3116445f60 📄 Add PDF Generation System for CA-3 Declarations
NEW FEATURES:
 PDF Generation Class (DeclarationTVA_PDF)
 Template Management System (Official + Custom)
 PDF Export Button in Declaration View
 Template Upload/Reset in Configuration
 Official CA-3 Template Support (10963*30)

TECHNICAL IMPLEMENTATION:
- core/class/declarationtva_pdf.class.php: Complete PDF generation system
- templates/declarationtva/: Template storage directory
- Template management in admin/setup_mvp.php
- PDF export action in declarationtva_view.php
- Bilingual support (French/English)

TEMPLATE SYSTEM:
- Built-in official template (10963*30)
- Custom template upload capability
- Template validation and version management
- Fallback to official template if custom not available

PDF FEATURES:
- Professional CA-3 layout with all sections
- Company information and declaration details
- Complete CA-3 line data with amounts
- Totals and calculations display
- Downloadable PDF files

This adds professional PDF export functionality to the CA-3 declaration system!
2025-10-03 00:05:03 +02:00
e78e6061a8 Split totals for BASE and VAT accounts in CA-3 line details
Fixed:
- Separated totals for BASE accounts vs VAT accounts
- Added subtotal rows for each account type
- Clear visual separation between base and VAT contributions
- Added 'Grand Total' row showing combined totals
- Added translations for subtotal labels

This eliminates confusion by showing:
- Subtotal for BASE accounts (sales amounts)
- Subtotal for VAT accounts (VAT amounts)
- Grand Total (combined total)

Users can now clearly see which accounts contribute to base vs VAT amounts.
2025-10-02 23:29:57 +02:00
84017f33ce Improve CA-3 line details display with proper account grouping
Fixed:
- Grouped BASE and VAT accounts separately for lines 08, 09, 9B
- Added clear section headers: 'Base Accounts (Sales)' and 'VAT Accounts'
- Improved visual organization of account breakdown
- Removed debugging code
- Added translations for new section headers

This ensures users can clearly see which accounts contribute to base amounts vs VAT amounts for the special lines.
2025-10-02 23:28:07 +02:00
f39a7f140a Implement inline dropdown panels for CA-3 line details
Features:
- Replaced separate page with inline dropdown panels
- Click any CA-3 line code to expand/collapse account details
- AJAX loading of account breakdown data
- Professional styling matching Dolibarr UI
- JavaScript toggle functionality with loading states
- Account details table with:
  * Account codes and labels
  * Base amounts, VAT amounts, total amounts
  * Mapping types and totals
  * Summary information
- Removed separate line details page
- Added comprehensive translations for dropdown interface

This provides seamless inline access to account breakdowns without page navigation.
2025-10-02 23:21:09 +02:00
b0934c55d4 Implement clickable CA-3 lines with detailed account breakdown
Features added:
- New getCA3LineDetails() method in DeclarationTVA class
- New declarationtva_line_details.php page for detailed view
- All CA-3 line codes are now clickable in declaration view
- Detailed breakdown shows:
  * Account codes and labels
  * Base amounts, VAT amounts, total amounts
  * Mapping types (A1, 08_BASE, 08_VAT, etc.)
  * Calculated totals vs account totals
- Added comprehensive translations for detailed view
- Navigation breadcrumbs and back buttons
- Professional styling with Dolibarr UI components

This provides complete transparency into which accounts contribute to each CA-3 line without touching the calculation logic.
2025-10-02 23:17:56 +02:00
e94d5e07de Update French column titles for lines 08, 09, 9B
Updated:
- BaseAmount: 'Montant HT' → 'Base hors taxe'
- VATAmount: 'Montant TVA' → 'Taxe due'
- More accurate French terminology for CA-3 form
- Professional tax terminology
2025-10-02 21:55:41 +02:00
ae7768dd7b Revert to 3-column layout with special base+VAT columns for 08, 09, 9B
Reverted:
- Main table back to 3 columns (Line, Description, Amount)
- Sections A, C, D use normal 3-column layout
- Only lines 08, 09, 9B have special 4-column layout (Line, Description, Base HT, VAT)
- Added special header 'Base HT et TVA par taux' for these lines
- Line 17 uses normal 3-column layout
- Added language translations for new header
2025-10-02 21:48:44 +02:00
337e82b30b Add Base and VAT amounts for fields 08, 09, 9B
Enhanced:
- Updated CA-3 line definitions for 08, 09, 9B to show both base and VAT
- Changed type from 'vat' to 'base_vat' for these fields
- Updated view table to show 5 columns: Line, Description, Base HT, VAT, Total
- Added language translations for new columns
- Fields 08, 09, 9B now display both base amounts and VAT amounts
- Enhanced debugging to show final amounts for each line
2025-10-02 21:44:30 +02:00
877a66057d Restore complete CA-3 table structure with sections
CA-3 Table Structure:
- Section A: Opérations imposables (A1, A2, A3, A4, A5)
- Section B: TVA due (08, 09, 9B, 17)
- Section C: TVA déductible (20, 21, 22)
- Section D: Résultat (25, 26, 28, 29)
- Proper section headers with bold formatting
- All 17 CA-3 lines as per configuration
- Real calculated amounts from database
- Bilingual section titles
2025-10-02 20:54:52 +02:00
213ab61bdd Restore complete declaration view layout with totals
Enhanced Declaration View:
- Restored all declaration fields (number, name, period, status, created date)
- Added totals section with VAT collected, deductible, net due, and credit
- Bold formatting for totals to highlight important amounts
- Added translations for all new fields
- Complete layout with all necessary information
2025-10-02 20:52:59 +02:00
14362712a1 Wire recalculate button to show real calculated amounts
Recalculate Button Integration:
- Replaced placeholder CA-3 data with real database queries
- getCA3Lines() now fetches actual calculated amounts
- Shows 'No CA-3 data' message when no calculations exist
- Displays real VAT amounts from database after recalculation
- Added translations for 'No CA-3 data' message

Now the recalculate button will:
1. Trigger calculation engine
2. Query accounting data
3. Display real calculated amounts
4. Show debugging info in error logs
2025-10-02 20:50:12 +02:00
56ed838601 Implement CA-3 calculation system and recalculate functionality
Calculation System:
- Added getAccountMappings() to retrieve PCG account mappings
- Added createCA3Line() to create CA-3 line records
- Added updateDeclarationTotals() to update declaration totals
- Added recalculateCA3Amounts() for recalculation functionality
- Enhanced getAccountAmounts() to query Dolibarr accounting entries

Recalculate Button:
- Added recalculate button to declaration view page
- Added action handling for recalculate functionality
- Added success/error messages for recalculation
- Added translations for recalculate functionality

The calculation system now:
- Queries actual accounting data from Dolibarr
- Creates detailed CA-3 line records
- Updates declaration totals automatically
- Allows manual recalculation of amounts
2025-10-02 20:42:29 +02:00
c3166b0dcc Add delete functionality for draft declarations
Delete Feature:
- Added deleteDeclaration() method to DeclarationTVA class
- Only allows deletion of draft declarations (safety check)
- Deletes CA-3 lines first, then declaration record
- Added delete button to main interface for draft declarations
- Added confirmation dialog before deletion
- Added success/error messages for delete operations
- Added translations in both English and French

Security:
- Only draft declarations can be deleted
- Confirmation dialog prevents accidental deletion
- Proper error handling and user feedback

The interface now shows a delete button for each draft declaration!
2025-10-02 20:00:31 +02:00
54d0ceaa03 Add CSRF protection to declaration creation form
Security Fixes:
- Added CSRF token field to form
- Added token validation in form processing
- Added proper error handling for missing dates
- Added ErrorMissingDates translation in both languages
- Form now properly validates CSRF tokens before processing

This fixes the 'Token not provided' error when submitting the form.
2025-10-02 18:14:58 +02:00
c61a964f14 Create declaration creation and view pages
New Pages Added:
- declarationtva_create.php: Complete declaration creation form
- declarationtva_view.php: Declaration details and CA-3 amounts display

Features Implemented:
- Period selection for new declarations
- Declaration naming with helpful examples
- Optional date range override
- Complete CA-3 form structure display
- Status-based action buttons (Validate/Submit)
- Proper error handling and success messages
- Full bilingual support (English/French)

Create Page Features:
- Period dropdown with date ranges
- Declaration name field with help text
- Optional date override
- Configuration reminder with link to setup

View Page Features:
- Complete declaration details
- CA-3 amounts table with all 16 lines
- Status-based actions
- Navigation back to main list

The module now has a complete declaration workflow!
2025-10-02 18:09:04 +02:00
0d17cfff53 Add comprehensive translations for main interface
Translation Updates:
- Added all missing translations for main interface elements
- Added translations for periods, declarations, and status messages
- Added success and error message translations
- Added French translations for all new keys
- Improved user experience with proper bilingual support

Main Interface Translations Added:
- DeclarationTVAMainInterface, DeclarationTVAPeriods, DeclarationTVADeclarations
- PeriodName, StartDate, EndDate, Status, Actions
- CreateDeclaration, DeclarationNumber, NetVATDue
- Validate, Submit, View buttons
- Status indicators (Draft, Validated, Submitted)
- Success/Error messages for all operations

The main interface is now fully translated in both English and French!
2025-10-02 18:03:20 +02:00
6053957353 Fix main interface configuration button
Main Interface Updates:
- Changed configuration button link from admin/setup.php to admin/setup_mvp.php
- Updated button text from 'ConfigureModule' to 'ConfigurePCGAccounts'
- Added new translation keys in both English and French
- Button now correctly points to our custom MVP setup page

This fixes the issue where the button was taking users to the standard
Dolibarr configuration page instead of our custom CA-3 setup interface.
2025-10-02 18:00:36 +02:00
67c01df597 Remove outdated multi-select help text
UI Cleanup:
- Removed 'Hold Ctrl/Cmd to select multiple accounts' help text
- This text is not relevant for Dolibarr's multiselectarray() method
- The native multi-select interface uses checkboxes and buttons
- No need for keyboard shortcuts with modern interface

The interface is now cleaner and more accurate!
2025-10-02 17:42:30 +02:00
c08e7df14c Fix form submission and add debugging
Form Submission Fixes:
- Process ALL CA-3 lines (including empty ones to clear mappings)
- Fixed SQL syntax in updateAccountMapping method
- Added proper error handling and success counting
- Added debug output to see what data is being received

Database Operations:
- Replaced ON DUPLICATE KEY UPDATE with proper check/update logic
- Better handling of existing vs new mappings
- Improved SQL query structure for reliability

Debug Features:
- Shows which lines have data and which are empty
- Displays form data being processed
- Helps identify where the issue occurs

The form should now properly save account mappings!
2025-10-02 17:28:22 +02:00
147361524c Fix CSRF protection error in configuration form
CSRF Protection Implementation:
- Added CSRF token to form with newToken() function
- Added token validation with checkToken() function
- Proper error handling for CSRF token validation
- Security compliance with Dolibarr standards

Form Security:
- Hidden token field in form submission
- Token validation before processing form data
- Error message display for invalid tokens
- Proper security workflow

Language Support:
- Added English error message for CSRF token error
- Added French error message for CSRF token error
- Complete bilingual support for security messages

The configuration form now properly handles CSRF protection and should work without security errors!
2025-10-02 17:21:34 +02:00
49174f610f Implement multi-select PCG account mapping using Dolibarr native style
Multi-Select Account Mapping:
- Replaced single account dropdown with multi-select field
- Users can now select multiple PCG accounts for each CA-3 line
- Uses Dolibarr native multi-select style with proper styling
- Supports Ctrl/Cmd key for multiple selection

Enhanced Configuration Interface:
- Multi-select dropdown for each CA-3 line
- Account selection from Dolibarr's chart of accounts
- Real-time account validation against existing accounts
- Better visual layout with proper sizing

Technical Updates:
- Updated config class to handle multiple account selections
- Added method to get account mappings grouped by CA-3 line
- Enhanced form submission to process array of account codes
- Improved current configuration display

Database Handling:
- Deactivate existing mappings before adding new ones
- Support for multiple accounts per CA-3 line
- Proper account code validation
- Clean data structure for multi-select support

User Experience:
- Native Dolibarr multi-select styling
- Helper text for multi-selection instructions
- Better account display with codes and labels
- Improved current configuration summary

Language Support:
- Added English translations for multi-select interface
- Added French translations for multi-select interface
- Complete bilingual support for new features

The configuration interface now supports multiple PCG account selection using Dolibarr's native multi-select style!
2025-10-02 17:13:44 +02:00
d32433c2b6 Add missing Sections C and D - Complete CA-3 Structure (Notice 4722)
Complete CA-3 Form Structure:
- Added Section C: Décompte de la TVA déductible (Deductible VAT Calculation)
- Added Section D: Résultat (Result)
- Now includes all 4 sections: A, B, C, D
- Total of 17 CA-3 lines covering complete form

Section C - Deductible VAT Calculation:
- Line 20: TVA déductible sur immobilisations (Deductible VAT on fixed assets)
- Line 21: TVA déductible sur autres biens et services (Deductible VAT on other goods and services)
- Line 22: TVA déductible sur importations (Deductible VAT on imports)

Section D - Result:
- Line 25: TVA brute due (Total VAT due)
- Line 26: TVA déductible totale (Total deductible VAT)
- Line 28: TVA nette à payer (Net VAT to pay)
- Line 29: Crédit de TVA à reporter ou remboursement (VAT credit to carry forward or refund)

Enhanced Configuration:
- Added section C and D headers with proper descriptions
- Added all 7 new CA-3 lines for sections C and D
- Updated PCG account mappings for all new lines
- Enhanced form layout to show all 4 sections

Language Support:
- Added English translations for sections C and D and all lines
- Added French translations for sections C and D and all lines
- Complete bilingual support for all 17 CA-3 lines

Documentation:
- Updated PLANNING.md with complete CA-3 structure
- Added sections C and D documentation with all lines
- Complete Notice 4722 compliance with all 4 sections

The module now includes the COMPLETE CA-3 structure with all 4 sections A, B, C, D!
2025-10-02 17:05:39 +02:00
c52d0d1d44 Add missing Section B - VAT Due Calculation (Notice 4722)
Complete CA-3 Structure Update:
- Added Section B: Décompte de la TVA due (VAT Due Calculation)
- Added 4 new CA-3 lines for VAT due calculations
- Updated all language files with new section and lines

Section B - VAT Due Calculation:
- Line 08: TVA due au taux de 20% (VAT due at 20% rate)
- Line 09: TVA due au taux de 10% (VAT due at 10% rate)
- Line 9B: TVA due aux taux réduits (VAT due at reduced rates 5,5% and 2,1%)
- Line 17: TVA due au titre des acquisitions intracommunautaires (VAT due on intra-EU acquisitions)

Enhanced Configuration:
- Added section B header with proper description
- Added all 4 VAT due calculation lines
- Updated PCG account mappings for VAT due lines
- Enhanced form layout to show both sections A and B

Language Support:
- Added English translations for Section B and all lines
- Added French translations for Section B and all lines
- Updated section headers in both languages

Documentation:
- Updated PLANNING.md with complete CA-3 structure
- Added Section B documentation with all lines
- Complete Notice 4722 compliance

The module now includes the complete CA-3 structure with both sections A and B!
2025-10-02 17:04:04 +02:00
1f0f4f927d Update CA-3 structure to Notice 4722 (3310-CA3-SD) - Latest Official Form
Major Structure Update:
- Updated to latest official CA-3 form structure (Notice 4722)
- Replaced old structure with new 5-line format (A1-A5)
- All changes based on official notice 4722

New CA-3 Lines (Notice 4722):
- A1: HT amount of all taxable operations that form normal sales
- A2: HT amount of special taxable operations not part of ordinary turnover
- A3: HT amount of services purchased from non-established providers (reverse charge)
- A4: HT amount of imports taxable in France (non-EU), excluding petroleum products
- A5: HT amount of taxable operations at exit from suspensive fiscal regime

Enhanced Configuration Interface:
- Added detailed descriptions for each line
- Added PCG account recommendations
- Added notice reference information
- Improved form layout with additional columns

Updated Files:
- core/class/declarationtva_config.class.php: New CA-3 line definitions
- admin/setup_mvp.php: Enhanced interface with descriptions and PCG accounts
- langs/en_US/declarationtva.lang: English translations for new structure
- langs/fr_FR/declarationtva.lang: French translations for new structure
- PLANNING.md: Updated documentation with new structure

Key Features:
- Official Notice 4722 compliance
- Detailed line descriptions and PCG account guidance
- Enhanced user interface with better information display
- Bilingual support for all new content

The module now uses the latest official CA-3 form structure!
2025-10-02 17:02:23 +02:00
d7bb9d23e8 Complete CA-3 configuration interface with all sections and headers
Configuration Interface Improvements:
- Added all missing CA-3 lines from planning document
- Implemented proper section headers (A, B, C, D)
- Added section descriptions for better understanding
- Organized lines by section for logical grouping

CA-3 Lines Added:
- A1, A2: Taxable operations base amounts
- B1-B4: VAT rate breakdowns (20%, 10%, 5.5%, 2.1%)
- 05, 06: Intra-EU operations (B2B)
- 17: VAT due on intra-EU acquisitions
- 20, 21: Deductible VAT (fixed assets, other)
- 22, 28, 29: Result calculations

Section Headers:
- A. Opérations imposables (Taxable Operations)
- B. TVA due (VAT Due)
- C. TVA déductible (Deductible VAT)
- D. Résultat (Result)

Enhanced Features:
- Section-based organization in configuration
- Type indicators (Base/VAT) for each line
- Improved visual layout with section headers
- Better grouping in current configuration display

Language Support:
- Added English translations for all new labels
- Added French translations for all new labels
- Consistent terminology across both languages

The configuration page now shows the complete CA-3 structure as defined in the planning document!
2025-10-02 16:36:12 +02:00
2a0c0b83b1 Add comprehensive multiple PCG account selection functionality
Multiple Account Selection Features:
- Multi-select dropdown for each CA-3 line from Dolibarr's chart of accounts
- Account search and filtering from llx_accounting_account table
- Real-time account validation against existing chart of accounts
- Account preview with current balances and details
- Account weighting and grouping for complex mappings
- Bulk operations for account management (add/remove multiple accounts)
- Account filtering by type (7xxxx, 4457xx, 4456xx, etc.)

Database Structure:
- New table: llx_declarationtva_account_mappings
- Stores multiple account mappings per CA-3 line
- Account code, label, VAT rate, type, weighting
- Active/inactive status and audit trail

Interface Features:
- Multi-select dropdown with search functionality
- Account preview showing current balances
- Account validation ensuring accounts exist and are active
- Bulk operations for efficient account management
- Account filtering by account type and characteristics

Enhanced Configuration:
- Each CA-3 line can map to multiple PCG accounts
- Account weighting for importance/priority
- Account grouping for complex business scenarios
- Real-time validation against Dolibarr's chart of accounts
- Account preview with current balances

Updated estimates: +27 hours for multiple account selection
Total project: 577+ hours with comprehensive account mapping
2025-10-02 16:06:41 +02:00
991d96f7be Add comprehensive advanced intelligence features for CA-3 VAT module
Advanced Analytics & Intelligence:
- VAT Forecasting: Predict future obligations using historical data
- Anomaly Detection: AI-powered detection of unusual VAT patterns
- Cash Flow Impact: Calculate VAT impact on cash flow projections
- VAT Optimization: Suggest strategies to minimize VAT payments
- Trend Analysis: Identify VAT trends and seasonal patterns
- Benchmarking: Compare performance against industry standards
- Risk Assessment: Flag potential compliance risks
- Predictive Alerts: Early warning system for VAT issues

Tax Authority Integration:
- Direct Submission: Submit CA-3 declarations directly to French tax authorities
- API Integration: Connect with French tax authority APIs
- Real-time Validation: Validate declarations against tax authority systems
- Electronic Signatures: Digital signature for declaration submission
- Receipt Management: Store and manage tax authority receipts
- Status Tracking: Track declaration status with tax authorities
- Amendment Handling: Process declaration amendments and corrections
- Payment Integration: Direct payment of VAT obligations

Advanced Reporting & Compliance:
- Multi-Period Analysis: Compare VAT across multiple periods
- VAT Reconciliation: Reconcile VAT with general ledger
- Audit Trail: Complete audit trail for tax authorities
- Compliance Dashboard: Real-time compliance status monitoring
- Regulatory Updates: Automatic updates for tax law changes
- Penalty Calculation: Calculate potential penalties for late submissions
- Deadline Management: Automated deadline tracking and reminders
- Document Generation: Auto-generate supporting documentation

Business Intelligence:
- VAT Analytics: Deep insights into VAT patterns and trends
- Cost Analysis: Analyze VAT impact on business costs
- Profitability Impact: Show how VAT affects product profitability
- Customer VAT Analysis: Analyze VAT by customer segments
- Supplier VAT Analysis: Analyze VAT by supplier categories
- Geographic Analysis: VAT analysis by geographic regions
- Product Analysis: VAT analysis by product categories
- Seasonal Analysis: Identify seasonal VAT patterns

Updated estimates: +106 hours for advanced intelligence features
Total project: 550+ hours with comprehensive business intelligence
2025-10-02 16:02:21 +02:00
1d18a82f19 Add Dolibarr workflow integration for automated VAT processing
Dolibarr Hook System Integration:
- Hook into invoice validation and accounting transfer events
- Automatic EU supplier detection and autoliquidation
- Custom fields for VAT processing (EU flag, transaction type)
- Batch processing for multiple invoices
- Workflow triggers for status changes

Available Hooks:
- supplier_invoice_validate: Auto-detect EU suppliers
- supplier_invoice_accountancy_transfer: Create VAT entries
- invoice_validate: Apply EU transaction rules
- invoice_accountancy_transfer: Generate accounting entries

Automation Workflow:
1. User creates EU supplier invoice
2. Hook triggers on validation
3. Auto-detect EU supplier
4. Create VAT due (4452xxx) and deductible (4456xx) entries
5. Entries ready for CA-3 calculations

Custom Fields:
- EU Supplier Flag
- VAT Treatment (autoliquidation vs normal)
- Transaction Type (B2B, B2C, special cases)
- OSS Threshold tracking
- DEB/DES requirement flags

Enhanced Features:
- Automatic VAT processing
- Reduced manual work for EU transactions
- Seamless integration with Dolibarr workflow
- Custom field management
- Batch processing capabilities

Updated estimates: +44 hours for workflow integration
Total project: 456+ hours with full Dolibarr integration
2025-10-02 15:59:41 +02:00
a08cc30293 Add comprehensive EU transaction handling for CA-3 VAT declarations
EU Transaction Scenarios:
1️⃣ Incoming EU Invoices (Purchases):
- Supplier invoices HT (no VAT)
- French autoliquidation: 4452xxx (VAT due) + 4456xx (VAT deductible)
- Net effect: zero if fully deductible
- CA-3 impact: Lines 17 (VAT due) + 20/21 (VAT deductible)

2️⃣ Outgoing EU Invoices (Sales):
- Case A (B2B): No French VAT, Lines 05/06 (base HT only)
- Case B (B2C): OSS threshold handling (€10,000)
- Case C (Special): Construction/energy reverse charge
- Invoice text requirements for EU transactions

3️⃣ DEB/DES Integration:
- Link CA-3 lines 05/06 with exchange declarations
- Cross-validation between CA-3 and DEB/DES
- Automatic data import and validation

Enhanced Features:
- EU transaction type detection and classification
- OSS threshold monitoring and alerts
- DEB/DES data integration and validation
- Special case handling (construction, energy)
- Comprehensive EU transaction workflow

Updated estimates: +64 hours for EU transaction handling
Total project: 414+ hours with full EU compliance
2025-10-02 15:55:13 +02:00
a48cfc18a8 Add official CA-3 form structure (n° 3310-CA3-SD) with precise line mappings
Official CA-3 Form Lines:
- Section A: Opérations imposables (A1, A2, B1-B4)
  - A1: Base HT of taxable operations
  - A2: Special operations (asset sales, self-deliveries)
  - B1-B4: Rate breakdowns (20%, 10%, 5.5%, 2.1%) with base + tax
- Section B: TVA due (Line 17)
  - Intra-EU acquisitions autoliquidation
- Section C: TVA déductible (Lines 20, 21)
  - Line 20: Capital goods VAT
  - Line 21: Operating expenses VAT
- Section D: Résultat (Lines 22, 28, 29)
  - Line 22: VAT credit to carry forward
  - Line 28: Net VAT to pay
  - Line 29: VAT credit amount

Enhanced Features:
- Detailed account breakdown for draft declarations
- Drill-down from form lines to individual transactions
- Separate handling of base amounts (HT) and VAT amounts
- Support for all French VAT rates
- Special operations handling (A2 line)
- Export detailed breakdown reports

Updated task estimates: +37 hours for form structure implementation
Added comprehensive bilingual support for all CA-3 form lines
2025-10-02 15:53:06 +02:00
e7d2d39cd6 Add comprehensive advanced features for CA-3 VAT declaration module
Core Advanced Features:
- Draft system with detailed account breakdowns
- Validation workflow with approval process
- Automatic journal entry generation (445510/445670)
- Complete audit trail and version history
- Multi-entity support for multiple companies

Analytics & Reporting:
- Period comparison tools with variance analysis
- Interactive dashboard with KPIs and trends
- Exception handling for unusual amounts
- Automated alerts and notifications

User Experience:
- Mobile-responsive design
- Document management with attachments
- Email notifications for deadlines
- Keyboard shortcuts and accessibility

Integration & APIs:
- External tax system integration
- Backup/restore functionality
- Webhook support for real-time updates
- API documentation for third-party access

Updated time estimates: 350+ hours total
Added Phase 7 (Advanced Features) with 80+ hours
Enhanced bilingual support for all new features
2025-10-02 15:47:58 +02:00
c240ef9769 Complete CA-3 structure with all three sections
- Add Section A: TVA collectée (Output VAT) - Boxes 01, 02, 03, 05, 08
- Add Section B: TVA déductible (Input VAT) - Boxes 20, 21, 22
- Add Section C: Résultat (Result) - Boxes 25, 26, 28, 29
- Update French translations with complete box descriptions
- Update English translations with full CA-3 structure
- Add PCG account mappings for all sections
- Update task list with complete calculation logic
- Include automatic totals and net calculations
- Add new task for complete CA-3 form structure implementation
2025-10-02 15:42:04 +02:00
1720dadd7a Add comprehensive project planning and task list
- Create PLANNING.md with detailed project architecture and phases
- Create TASK.md with 200+ hour development plan broken into 6 phases
- Add French language support (fr_FR/declarationtva.lang)
- Update English translations with CA3-specific terminology
- Define CA3 box structure and PCG account mappings
- Plan bilingual interface for French-speaking users
- Include database schema, testing, and documentation phases
2025-10-02 15:38:13 +02:00