fix: Improve bank/cash register display and exports

- 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>
This commit is contained in:
2025-12-08 17:49:24 +02:00
parent 06066f1702
commit 3c0ab51f87
2 changed files with 70 additions and 24 deletions

View File

@@ -477,6 +477,13 @@ export const exportBankCashRegisterPDF = (data, header, filename) => {
.replace(/[ț]/gi, (m) => (m === m.toLowerCase() ? "t" : "T"));
};
// Truncate text helper (limit explicatia to 100 chars)
const truncateText = (text, maxLength = 100) => {
if (!text) return "";
if (text.length <= maxLength) return text;
return text.substring(0, maxLength) + "...";
};
// Group data by bank account (bancasa)
const groupedByBank = {};
const initialBalances = {};
@@ -696,7 +703,7 @@ export const exportBankCashRegisterPDF = (data, header, filename) => {
tableRows.push([
dateFormatted,
row.nract || "",
removeDiacritics(row.explicatia || row.nume || ""),
truncateText(removeDiacritics(row.explicatia || row.nume || ""), 100),
formatNumberForPDF(incasari),
formatNumberForPDF(plati),
formatNumberForPDF(row.sold),