fix: frontend VAT preview — extract VAT from inclusive amount, not add on top
This commit is contained in:
@@ -783,7 +783,7 @@ export default function ReceivedInvoices({ statsMonth, statsYear, uploadOpen, se
|
||||
{uploadMeta[idx]?.amount && (
|
||||
<div style={{ fontSize: '0.75rem', color: 'var(--text-tertiary)', marginTop: '-0.25rem', marginBottom: '0.5rem' }}>
|
||||
DPH: {formatCurrency(
|
||||
parseFloat(uploadMeta[idx].amount || '0') * parseFloat(uploadMeta[idx].vat_rate || '21') / 100,
|
||||
(() => { const a = parseFloat(uploadMeta[idx].amount || '0'); const r = parseFloat(uploadMeta[idx].vat_rate || '21'); return r > 0 ? Math.round((a - a / (1 + r / 100)) * 100) / 100 : 0; })(),
|
||||
uploadMeta[idx].currency || 'CZK'
|
||||
)}
|
||||
</div>
|
||||
@@ -911,7 +911,7 @@ export default function ReceivedInvoices({ statsMonth, statsYear, uploadOpen, se
|
||||
{editInvoice.amount && (
|
||||
<div style={{ fontSize: '0.75rem', color: 'var(--text-tertiary)', marginBottom: '0.75rem' }}>
|
||||
DPH: {formatCurrency(
|
||||
parseFloat(editInvoice.amount || '0') * parseFloat(editInvoice.vat_rate || '21') / 100,
|
||||
(() => { const a = parseFloat(editInvoice.amount || '0'); const r = parseFloat(editInvoice.vat_rate || '21'); return r > 0 ? Math.round((a - a / (1 + r / 100)) * 100) / 100 : 0; })(),
|
||||
editInvoice.currency || 'CZK'
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user