feat: Add totals from all filtered records to invoices, treasury, and trial balance
Previously, totals were computed client-side from only the current page data, which gave incorrect results when paginating. Now the backend calculates totals across ALL filtered records and returns them in the API response. - Invoice: Add total_sold_all field for sum of all filtered invoice balances - Treasury: Add sold_precedent_all, total_incasari_all, total_plati_all, sold_final_all - Trial Balance: Add 6-column totals (debit/credit for each balance type) - Frontend stores and views updated to use backend totals 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -97,6 +97,35 @@
|
||||
</template>
|
||||
</Card>
|
||||
|
||||
<!-- Summary Totals - 2 rows (Debit/Credit) for visual balance verification -->
|
||||
<!-- Totaluri din TOATE înregistrările filtrate (nu doar pagina curentă) -->
|
||||
<div v-if="companyStore.selectedCompany && trialBalanceStore.hasData" class="totals-table-container">
|
||||
<table class="totals-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Sold Precedent</th>
|
||||
<th>Rulaj Lunar</th>
|
||||
<th>Sold Final</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="row-label">Debit</td>
|
||||
<td class="numeric">{{ formatCurrency(trialBalanceStore.totals.total_sold_precedent_debit) }}</td>
|
||||
<td class="numeric">{{ formatCurrency(trialBalanceStore.totals.total_rulaj_lunar_debit) }}</td>
|
||||
<td class="numeric">{{ formatCurrency(trialBalanceStore.totals.total_sold_final_debit) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row-label">Credit</td>
|
||||
<td class="numeric">{{ formatCurrency(trialBalanceStore.totals.total_sold_precedent_credit) }}</td>
|
||||
<td class="numeric">{{ formatCurrency(trialBalanceStore.totals.total_rulaj_lunar_credit) }}</td>
|
||||
<td class="numeric">{{ formatCurrency(trialBalanceStore.totals.total_sold_final_credit) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Trial Balance Table -->
|
||||
<Card v-if="companyStore.selectedCompany" class="table-card">
|
||||
<template #content>
|
||||
@@ -657,6 +686,49 @@ watch(
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* Totals Table for Trial Balance - 2 rows (Debit/Credit) */
|
||||
.totals-table-container {
|
||||
margin-bottom: var(--space-lg);
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.totals-table {
|
||||
border-collapse: collapse;
|
||||
font-size: 0.9rem;
|
||||
background: var(--surface-card);
|
||||
border-radius: var(--border-radius);
|
||||
overflow: hidden;
|
||||
box-shadow: var(--shadow-sm);
|
||||
}
|
||||
|
||||
.totals-table th,
|
||||
.totals-table td {
|
||||
padding: 0.5rem 1rem;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.totals-table th {
|
||||
background: var(--surface-100);
|
||||
font-weight: 600;
|
||||
color: var(--text-color-secondary);
|
||||
}
|
||||
|
||||
.totals-table .row-label {
|
||||
text-align: left;
|
||||
font-weight: 600;
|
||||
background: var(--surface-50);
|
||||
}
|
||||
|
||||
.totals-table .numeric {
|
||||
font-family: var(--font-mono, 'Roboto Mono', monospace);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.totals-table tbody tr:first-child td {
|
||||
border-bottom: 1px solid var(--surface-border);
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 768px) {
|
||||
.trial-balance {
|
||||
|
||||
Reference in New Issue
Block a user