feat: Enhance invoice management with PDF optimization and date fixes

Optimize PDF export layout with compact columns and more space for partner names.
Add accounting period display to invoices matching Trial Balance format. Fix date
filtering to use local timezone instead of UTC. Update invoice ordering to
chronological sequence (DATAACT, NRACT, NUME).

**Backend changes:**
- Add accounting period query from calendar table
- Add currency (valuta) and cont filter support
- Change invoice ordering to chronological (DATAACT ASC, NRACT ASC, NUME)
- Add accounting_period field to InvoiceListResponse model

**Frontend changes:**
- Optimize PDF column widths (37% for partner names, compact numeric columns)
- Add custom column width support in exportUtils
- Fix date conversion from UTC to local timezone (prevents day shift)
- Add accounting period display in PDF exports
- Enhance E2E test coverage

**Cleanup:**
- Remove obsolete Trial Balance feature documentation

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-20 15:29:24 +02:00
parent a45dfa826d
commit 8eed1566a3
11 changed files with 750 additions and 1051 deletions

View File

@@ -137,22 +137,34 @@ export const exportToPDF = (data, columns, filename, header) => {
// Total usable width: pageWidth - marginLeft - marginRight
const totalWidth = pageWidth - marginLeft - marginRight; // ~281mm for A4 landscape
// Define width allocation (proportional)
// Cont: 7%, Denumire: 33%, Number columns (6x): 10% each = 100%
const widthAllocations = {
0: totalWidth * 0.07, // Cont: ~20mm
1: totalWidth * 0.33, // Denumire: ~93mm
2: totalWidth * 0.10, // Sold Prec D: ~28mm
3: totalWidth * 0.10, // Sold Prec C: ~28mm
4: totalWidth * 0.10, // Rulaj D: ~28mm
5: totalWidth * 0.10, // Rulaj C: ~28mm
6: totalWidth * 0.10, // Sold Final D: ~28mm
7: totalWidth * 0.10, // Sold Final C: ~28mm
};
// Define width allocation (proportional) - support custom widths from columns
const widthAllocations = {};
columns.forEach((col, index) => {
// Use custom width if provided, otherwise auto
if (col.width && typeof col.width === 'number') {
widthAllocations[index] = totalWidth * col.width;
} else if (col.width === 'auto') {
widthAllocations[index] = 'auto';
} else {
// Default width allocation for Trial Balance (8 columns)
const defaultWidths = {
0: totalWidth * 0.07, // Cont: ~20mm
1: totalWidth * 0.33, // Denumire: ~93mm
2: totalWidth * 0.10, // Sold Prec D: ~28mm
3: totalWidth * 0.10, // Sold Prec C: ~28mm
4: totalWidth * 0.10, // Rulaj D: ~28mm
5: totalWidth * 0.10, // Rulaj C: ~28mm
6: totalWidth * 0.10, // Sold Final D: ~28mm
7: totalWidth * 0.10, // Sold Final C: ~28mm
};
widthAllocations[index] = defaultWidths[index] || 'auto';
}
});
columns.forEach((col, index) => {
columnStyles[index] = {
cellWidth: widthAllocations[index] || 'auto'
cellWidth: widthAllocations[index]
};
// Set alignment based on type