fix(invoices): show sub-cent Rundung in the editor totals preview
The live totals panel in the quote/invoice editor (LineItemsTable) summed the per-line rounded totals and showed that as Total — so with crm_invoice_round_total on, a 4 × (2.5h @ 32.25) invoice previewed CHF 322.52 while the saved invoice + PDF correctly show 322.50 with a Rundung row. The preview now mirrors the backend. - LineItemsTable gains a `roundTotal` prop. When set, it computes the clean net (full-precision sum rounded once — same rule as backend utils/invoiceRounding.cleanNetMinor, including the migration-119 priced sub-item override), shows a "Rundung" row for the drift, and folds it into the VAT base + Total. Off ⇒ unchanged (no row). - Bill + Quote editors pass roundTotal from appSettings.crm_invoice_round_total. - i18n: crm.lineItems.rounding (de "Rundung", en "Rounding"). The saved-invoice detail view already shows the stored clean total, so no change there.
This commit is contained in:
@@ -675,7 +675,8 @@ export const BillEditorPage: React.FC = () => {
|
||||
<Card>
|
||||
<h3 className="font-semibold mb-2">{t('bills.section.lineItems', 'Line items')}</h3>
|
||||
<LineItemsTable items={lineItems} currency={currency} showDiscount={false}
|
||||
vatRate={vatRate / 100} shippingAmount={shipping} onChange={setLineItems} />
|
||||
vatRate={vatRate / 100} shippingAmount={shipping}
|
||||
roundTotal={appSettings?.crm_invoice_round_total === true} onChange={setLineItems} />
|
||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-3 mt-4">
|
||||
<VatRateSelect
|
||||
label={t('bills.field.vatRate', 'VAT rate %') as string}
|
||||
|
||||
@@ -621,6 +621,7 @@ export const QuoteEditorPage: React.FC = () => {
|
||||
showDiscount={true}
|
||||
vatRate={form.vatRate / 100}
|
||||
shippingAmount={form.shippingAmount}
|
||||
roundTotal={appSettings?.crm_invoice_round_total === true}
|
||||
presets={liPresets?.presets || []}
|
||||
onChange={(items) => setForm((f) => ({ ...f, lineItems: items }))}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user