Iva ad esigibilità differita

Ho un problema sull’iva ad esigibilità differita.

Ho attivato il flag specifico nel setup di contabilità generale.

Ho creato nel setup Registrazione iva una riga con il campo [Ripart. IVA ad esig. diff.] settato a “Percentuale” e ho valorizzato per la stessa riga i campi dei conti [Conto IVA vendite] e [Conto IVA ven. ad esig. diff.].

Emetto una fattura di vendita per un cliente con l’iva sopra indicata.

Nella tab.12142 la fattura genera una riga con i campi [Imponibile ad esig. diff.] e [Imposta ad esig. diff.] valorizzati correttamente.

Quando però registro il pagamento non accade nulla. Nessun giroconto tra il conto iva indetr. e iva vendite. Nessun movimento iva viene generato dal pagamento, etc.

PERCHE???

Semplice: perché è un bug.

Ho mandato la correzione a Microsoft due settimane fa: Codeunit 12, funzione CustUnrealVAT

Codice originale:

VATPostingSetup.“Unrealized VAT Type”::Percentage:
BEGIN
IF (TotalPayments >= 0) AND
(CustLedgEntry2.“Document Type” = CustLedgEntry2.“Document Type”::Invoice) THEN EXIT;
IF (CustLedgEntry2.“Document Type” = CustLedgEntry2.“Document Type”::“Credit Memo”) THEN
IF (-TotalPayments + (VATEntry2.“Remaining Unrealized Amount” + VATEntry2.“Remaining Unrealized Base”)) <= 0 THEN
VATPart := 1
ELSE
IF (-TotalPayments + (VATEntry2.“Remaining Unrealized Amount” + VATEntry2.“Remaining Unrealized Base”)) >= 0 THEN
VATPart := 1
ELSE
VATPart := TotalPayments / (VATEntry2.“Remaining Unrealized Amount” + VATEntry2.“Remaining Unrealized Base”);
END;

Codice corretto:

VATPostingSetup.“Unrealized VAT Type”::Percentage:
BEGIN
IF (TotalPayments >= 0) AND
(CustLedgEntry2.“Document Type” = CustLedgEntry2.“Document Type”::Invoice)
THEN
EXIT;
IF CustLedgEntry2.“Document Type” = CustLedgEntry2.“Document Type”::“Credit Memo” THEN BEGIN // Correzione - Aggiunto BEGIN
IF (-TotalPayments + (VATEntry2.“Remaining Unrealized Amount” + VATEntry2.“Remaining Unrealized Base”)) <= 0 THEN
VATPart := 1;
END ELSE // Correzione - Aggiunto END
IF (-TotalPayments + (VATEntry2.“Remaining Unrealized Amount” + VATEntry2.“Remaining Unrealized Base”)) >= 0 THEN
VATPart := 1
ELSE
VATPart := TotalPayments / (VATEntry2.“Remaining Unrealized Amount” + VATEntry2.“Remaining Unrealized Base”);
END;

In pratica mancava un Begin, quindi il codice andava in palla per via delle troppe ELSE

Ciao
Marco

la correzione suggerita da Marco è ora diventata un KNOWLEDGE BASE Article della Microsoft del 2009-04-07:

https://mbs.microsoft.com/knowledgebase/KBDisplay.aspx?WTNTZSMNWUKNTMMYSZRRNOTTUKOOSTLLQLYNSTTLUZOQQULQZLKPQQYOQTUKMWVZ