fix(supplier-invoices): flag foreign 0 % lines with reverse charge switched off (#1255)
* fix(supplier-invoices): flag foreign 0 % lines with reverse charge switched off A foreign supplier charging no Swedish VAT is normally omvand skattskyldighet. With the reverse-charge switch off, createSupplierInvoiceRegistrationEntry emits neither the 26x4 output leg nor the 44xx/45xx basis lines, so ruta 20-24, 30-32 and 48 all stay empty and the momsdeklaration takes a shape Skatteverket rejects. For a fully deductible purchase the net moms att betala is unchanged, which is exactly why this goes unnoticed. The form already auto-ticks reverse charge for eu_business but not for non_eu_business, so that path slips through silently. Adds a pure helper plus a non-blocking banner cloned from the existing rc_account_warning block. Deliberately silent for swedish_business, where 0 % is a genuine exemption that belongs in no ruta at all, and phrased as a question rather than an assertion: a non-EU goods purchase cleared at customs is legitimately 0 % without reverse charge, and pushing that user into ticking the switch would manufacture a new wrong verifikat. Does not add the exempt/import/other picker the issue proposes: supplier_invoices.vat_treatment is metadata that no booking or ruta mapping reads, and the codebase cannot book import VAT at all, so an import option would imply ruta 50/60 were handled when they are not. Refs #1042 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(supplier-invoices): name the local-VAT case in the foreign 0 % hint Review flagged that the most common foreign document a Swedish small company sees is an invoice carrying the supplier's OWN local VAT, booked at 0 % Swedish VAT with reverse charge correctly off. The banner fires there, and the previous copy only offered "momsfri av annat skal, till exempel en varuimport" as the way out, which does not describe that invoice at all: it is not VAT-free, it carries foreign VAT. Names both legitimate cases explicitly and says 0 % is correct in them, so the hint cannot read as an instruction to tick reverse charge on a purchase where that would produce a wrong verifikat. Title also narrowed to "utan svensk moms" for the same reason. Refs #1042 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
ece6eca922
commit
10a7d961f3
@@ -35,6 +35,7 @@ import {
|
||||
LEGAL_VAT_RATES,
|
||||
findIllegalVatRateRow,
|
||||
findReverseChargeAccountWarningRows,
|
||||
findUnflaggedForeignZeroVatRows,
|
||||
} from '@/lib/vat/supplier-invoice-line-checks'
|
||||
import { ArrowLeft, Plus, Trash2, ChevronDown, Loader2, Lock, AlertCircle, AlertTriangle, MessageCircle, Link2, CalendarClock, Tags, Paperclip } from 'lucide-react'
|
||||
import type { Supplier, BASAccount, VatTreatment, EntityType, InvoiceExtractionResult, FiscalPeriod } from '@/types'
|
||||
@@ -456,6 +457,18 @@ export default function NewSupplierInvoiceForm({
|
||||
? findReverseChargeAccountWarningRows(watchedItems ?? [])
|
||||
: []
|
||||
|
||||
// Advisory nudge (#1042): a foreign supplier charging no Swedish VAT is
|
||||
// normally omvand skattskyldighet. With the switch off no 26x4 leg and no
|
||||
// 44xx/45xx basis is booked, so ruta 20-24, 30-32 and 48 stay empty. Silent
|
||||
// for Swedish suppliers, where 0 % is a genuine exemption. Never blocks:
|
||||
// a non-EU goods purchase cleared at customs is legitimately 0 % without
|
||||
// reverse charge, and forcing the switch there would book a wrong verifikat.
|
||||
const foreignZeroVatRows = findUnflaggedForeignZeroVatRows(
|
||||
watchedItems ?? [],
|
||||
watchedReverseCharge,
|
||||
suppliers.find((s) => s.id === watchedSupplierId)?.supplier_type,
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
fetchSuppliers()
|
||||
fetchAccounts()
|
||||
@@ -1805,6 +1818,24 @@ export default function NewSupplierInvoiceForm({
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Non-blocking omvand-skattskyldighet hint for foreign suppliers
|
||||
invoiced at 0 % VAT (#1042). Mutually exclusive with the banner
|
||||
above: that one needs the switch on, this one needs it off. */}
|
||||
{foreignZeroVatRows.length > 0 && (
|
||||
<div
|
||||
role="status"
|
||||
className="mb-4 flex items-start gap-2 rounded-lg border border-warning/30 bg-warning/10 p-3"
|
||||
>
|
||||
<AlertTriangle className="h-4 w-4 text-warning-foreground mt-0.5 shrink-0" />
|
||||
<p className="text-sm text-warning-foreground">
|
||||
{t('foreign_zero_vat_warning', {
|
||||
count: foreignZeroVatRows.length,
|
||||
rows: foreignZeroVatRows.map((i) => i + 1).join(', '),
|
||||
})}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Desktop table */}
|
||||
<div className="hidden sm:block">
|
||||
<table className="w-full text-sm">
|
||||
|
||||
Reference in New Issue
Block a user