Este artigo aplica-se ao Microsoft Dynamics NAV para a região de idioma da Europa de Leste (EE).
Sintomas
Suponha que aplica a correção 2672643 na versão da Europa de Leste do Microsoft Dynamics NAV 2009 R2. Publica uma carta antecipada para uma encomenda de venda que contém pré-pagamentos. Nesta situação, quando envia e fatura o pedido de venda, recebe a seguinte mensagem de erro:
Nota
Qty. to Ship não pode ser superior a 0,9. em Sales Line Document Type='Order',Document No.='Number',Line No.='Number'.
Por conseguinte, não pode publicar a encomenda de vendas.
Para obter mais informações sobre a correção 2672643, clique no seguinte número de artigo para ver o artigo na Base de Dados de Conhecimento Microsoft:
2672643 mensagem de erro "Existem Montantes de Pré-pagamento não publicados na Encomenda [número]" quando publica o envio parcial de uma encomenda de venda na versão da Europa Oriental do Microsoft Dynamics NAV 2009 R2
Resolução
Informações de correção
Uma correção suportada está agora disponível na Microsoft. No entanto, destina-se apenas a corrigir o problema descrito neste artigo. Aplique-o apenas a sistemas com este problema específico. Esta correção pode receber testes adicionais. Por conseguinte, se não for gravemente afetado por este problema, recomendamos que aguarde pelo próximo service pack do Microsoft Dynamics NAV 2009 ou pela próxima versão do Microsoft Dynamics NAV que contém esta correção.
Nota Em casos especiais, os custos normalmente incorridos para chamadas de suporte poderão ser cancelados se um Profissional de Suporte Técnico para o Microsoft Dynamics e produtos relacionados determinar que uma atualização específica irá resolver o problema. Os custos de suporte habituais serão aplicados a questões e problemas de suporte adicionais que não se qualificam para a atualização específica em questão.
Informações de instalação
A Microsoft fornece exemplos de programação apenas para ilustração, sem garantia expressa ou implícita. Isto inclui, mas não se limita às garantias implícitas de comercialização ou adequação a um fim específico. Este artigo parte do princípio de que está familiarizado com a linguagem de programação que está a ser demonstrada e com as ferramentas utilizadas para criar e depurar procedimentos. Os engenheiros de suporte da Microsoft podem ajudar a explicar a funcionalidade de um determinado procedimento. No entanto, não modificarão estes exemplos para fornecer funcionalidades adicionais ou construir procedimentos para cumprir os seus requisitos específicos.
Nota Antes de instalar esta correção, verifique se todos os utilizadores cliente do Microsoft Dynamics NAV têm sessão iniciada no sistema. Isto inclui serviços do Microsoft Dynamics NAV Application Server (NAS). Deve ser o único utilizador cliente com sessão iniciada quando implementa esta correção.
Para implementar esta correção, tem de ter uma licença de programador.
Recomendamos que a conta de utilizador na janela Inícios de Sessão do Windows ou na janela Inícios de Sessão da Base de Dados seja atribuída ao ID da função "SUPER". Se não for possível atribuir à conta de utilizador o ID de função "SUPER", tem de verificar se a conta de utilizador tem as seguintes permissões:
- A permissão Modificar para o objeto que irá alterar.
- A permissão Executar para o objeto ID de Objeto de Sistema 5210 e para o objeto ID de Objeto do Sistema 9015.
Nota Não tem de ter direitos sobre os arquivos de dados, a menos que tenha de efetuar a reparação de dados.
Alterações de código
Nota Teste sempre as correções de código num ambiente controlado antes de aplicar as correções aos seus computadores de produção.
Para resolver este problema, siga estes passos:
Altere o código no acionador Prepmt Amt para Deduzir – OnValidate na tabela "Linha de Vendas" (37) da seguinte forma:
Código existente... "Prepmt Amt to Deduct", STRSUBSTNO(Text045,"Prepmt. Amt. Inv." - "Prepmt Amt Deducted")); IF "Qty. to Invoice" = Quantity - "Quantity Invoiced" THEN // Delete the following line. TESTFIELD("Prepmt Amt to Deduct","Prepmt. Amt. Inv." - "Prepmt Amt Deducted"); ...Código de substituição
... "Prepmt Amt to Deduct", STRSUBSTNO(Text045,"Prepmt. Amt. Inv." - "Prepmt Amt Deducted")); IF "Qty. to Invoice" = Quantity - "Quantity Invoiced" THEN // Add the following lines. TESTFIELD("Prepmt Amt to Deduct","Prepmt. Amt. Inv." - "Prepmt Amt Deducted"); GetSalesHeader; IF SalesHeader."Prepayment Type" = SalesHeader."Prepayment Type"::Advance THEN BEGIN VATPostingSetup.GET("VAT Bus. Posting Group","VAT Prod. Posting Group"); VATPostingSetup.TESTFIELD("Adv. Invoice Correction Type",VATPostingSetup."Adv. Invoice Correction Type"::Percentage); END; // End of the added lines. ...Altere o código na função CalcPrepaymentToDeduct na tabela "Linha de Vendas" (37) da seguinte forma:
Elimine as seguintes variáveis locais:
PrepmtPct: Decimal; AbsoluteAdvCorrection : Boolean;Altere o código da seguinte forma:
Código existente... IF (Quantity - "Quantity Invoiced") <> 0 THEN BEGIN GetSalesHeader; IF SalesHeader."Prepayment Type" = SalesHeader."Prepayment Type"::Advance THEN BEGIN VATPostingSetup.GET("VAT Bus. Posting Group","VAT Prod. Posting Group"); // Delete the following lines. AbsoluteAdvCorrection := VATPostingSetup."Adv. Invoice Correction Type" = VATPostingSetup."Adv. Invoice Correction Type"::Absolute; IF AbsoluteAdvCorrection THEN BEGIN PrepmtPct := "Prepayment %"; "Prepayment %" := 100; END; END; IF SalesHeader."Prices Including VAT" THEN "Prepmt Amt to Deduct" := ROUND( ROUND( ROUND( ROUND("Unit Price" * "Qty. to Invoice",Currency."Amount Rounding Precision") * (1 - ("Line Discount %" / 100)),Currency."Amount Rounding Precision") * ("Prepayment %" / 100) / (1 + ("VAT %" / 100)),Currency."Amount Rounding Precision") * (1 + ("VAT %" / 100)),Currency."Amount Rounding Precision") ELSE "Prepmt Amt to Deduct" := ROUND( ROUND( ROUND("Unit Price" * "Qty. to Invoice",Currency."Amount Rounding Precision") * (1 - ("Line Discount %" / 100)),Currency."Amount Rounding Precision") * "Prepayment %" / 100 ,Currency."Amount Rounding Precision"); IF AbsoluteAdvCorrection THEN BEGIN "Prepayment %" := PrepmtPct; IF "Prepmt Amt to Deduct" > ("Prepmt. Amt. Inv." - "Prepmt Amt Deducted") THEN "Prepmt Amt to Deduct" := "Prepmt. Amt. Inv." - "Prepmt Amt Deducted"; END; END ELSE "Prepmt Amt to Deduct" := 0 // End of the deleted lines. ...Código de substituição
... IF (Quantity - "Quantity Invoiced") <> 0 THEN BEGIN GetSalesHeader; IF SalesHeader."Prepayment Type" = SalesHeader."Prepayment Type"::Advance THEN BEGIN VATPostingSetup.GET("VAT Bus. Posting Group","VAT Prod. Posting Group"); // Add the following lines. CASE VATPostingSetup."Adv. Invoice Correction Type" OF VATPostingSetup."Adv. Invoice Correction Type"::Percentage: "Prepmt Amt to Deduct" := ROUND("Qty. to Invoice" / (Quantity - "Quantity Invoiced") * ("Prepmt. Amt. Inv." - "Prepmt Amt Deducted"),Currency."Amount Rounding Precision"); VATPostingSetup."Adv. Invoice Correction Type"::Absolute: BEGIN "Prepmt Amt to Deduct" := PrepmtAmtToDeduct(SalesHeader."Prices Including VAT",100); IF "Prepmt Amt to Deduct" > ("Prepmt. Amt. Inv." - "Prepmt Amt Deducted") THEN "Prepmt Amt to Deduct" := "Prepmt. Amt. Inv." - "Prepmt Amt Deducted"; END; VATPostingSetup."Adv. Invoice Correction Type"::"Fully Invoiced": IF "Qty. to Invoice" = Quantity - "Quantity Invoiced" THEN "Prepmt Amt to Deduct" := "Prepmt. Amt. Inv." - "Prepmt Amt Deducted" ELSE "Prepmt Amt to Deduct" := 0; END; END ELSE "Prepmt Amt to Deduct" := PrepmtAmtToDeduct(SalesHeader."Prices Including VAT","Prepayment %"); END ELSE "Prepmt Amt to Deduct" := 0 // End of the added lines. ...
Crie uma nova função PrepmtAmtToDeduct na tabela "Linha de Vendas" (37) da seguinte forma:
PROCEDURE PrepmtAmtToDeduct@1470002(PricesIncludingVAT@1470000 : Boolean;PrepaymentPct@1470001 : Decimal) : Decimal; VAR VATPct@1470002 : Decimal; BEGIN IF PricesIncludingVAT THEN VATPct := "VAT %" ELSE VATPct := 0; EXIT( ROUND( ROUND( ROUND( ROUND("Unit Price" * "Qty. to Invoice",Currency."Amount Rounding Precision") * (1 - ("Line Discount %" / 100)),Currency."Amount Rounding Precision") * (PrepaymentPct / 100) / (1 + (VATPct / 100)),Currency."Amount Rounding Precision") * (1 + (VATPct / 100)),Currency."Amount Rounding Precision")); END;Altere o código no acionador Prepmt Amt para Deduzido – OnValidate na tabela "Linha de Compra" (39) da seguinte forma:
Código existente... FIELDERROR( "Prepmt Amt to Deduct", STRSUBSTNO(Text039,"Prepmt. Amt. Inv." - "Prepmt Amt Deducted")); IF "Qty. to Invoice" = Quantity - "Quantity Invoiced" THEN // Delete the following line. TESTFIELD("Prepmt Amt to Deduct","Prepmt. Amt. Inv." - "Prepmt Amt Deducted"); ...Código de substituição
... FIELDERROR( "Prepmt Amt to Deduct", STRSUBSTNO(Text039,"Prepmt. Amt. Inv." - "Prepmt Amt Deducted")); IF "Qty. to Invoice" = Quantity - "Quantity Invoiced" THEN // Add the following lines. TESTFIELD("Prepmt Amt to Deduct","Prepmt. Amt. Inv." - "Prepmt Amt Deducted"); GetPurchHeader; IF PurchHeader."Prepayment Type" = PurchHeader."Prepayment Type"::Advance THEN BEGIN VATPostingSetup.GET("VAT Bus. Posting Group","VAT Prod. Posting Group"); VATPostingSetup.TESTFIELD("Adv. Invoice Correction Type",VATPostingSetup."Adv. Invoice Correction Type"::Percentage); END; // End of the added lines. ...Altere o código na função CalcPrepaymentToDeduct na tabela "Linha de Compra" (39). Para fazê-lo, siga estes passos:
Elimine as seguintes variáveis locais:
PrepmtPct@ : Decimal; AbsoluteAdvCorrection@ : Boolean;Altere o código da seguinte forma:
Código existente... IF (Quantity - "Quantity Invoiced") <> 0 THEN BEGIN GetPurchHeader; IF PurchHeader."Prepayment Type" = PurchHeader."Prepayment Type"::Advance THEN BEGIN VATPostingSetup.GET("VAT Bus. Posting Group","VAT Prod. Posting Group"); // Delete the following lines. AbsoluteAdvCorrection := VATPostingSetup."Adv. Invoice Correction Type" = VATPostingSetup."Adv. Invoice Correction Type"::Absolute; IF AbsoluteAdvCorrection THEN BEGIN PrepmtPct := "Prepayment %"; "Prepayment %" := 100; END; END; IF PurchHeader."Prices Including VAT" THEN "Prepmt Amt to Deduct" := ROUND( ROUND( ROUND( ROUND("Direct Unit Cost" * "Qty. to Invoice",Currency."Amount Rounding Precision") * (1 - ("Line Discount %" / 100)),Currency."Amount Rounding Precision") * ("Prepayment %" / 100) / (1 + ("VAT %" / 100)),Currency."Amount Rounding Precision") * (1 + ("VAT %" / 100)),Currency."Amount Rounding Precision") ELSE "Prepmt Amt to Deduct" := ROUND( ROUND( ROUND("Direct Unit Cost" * "Qty. to Invoice",Currency."Amount Rounding Precision") * (1 - ("Line Discount %" / 100)),Currency."Amount Rounding Precision") * "Prepayment %" / 100,Currency."Amount Rounding Precision"); IF AbsoluteAdvCorrection THEN BEGIN "Prepayment %" := PrepmtPct; IF "Prepmt Amt to Deduct" > ("Prepmt. Amt. Inv." - "Prepmt Amt Deducted") THEN "Prepmt Amt to Deduct" := "Prepmt. Amt. Inv." - "Prepmt Amt Deducted"; END; END ELSE "Prepmt Amt to Deduct" := 0 // End of the deleted lines. ...Código de substituição
... IF (Quantity - "Quantity Invoiced") <> 0 THEN BEGIN GetPurchHeader; IF PurchHeader."Prepayment Type" = PurchHeader."Prepayment Type"::Advance THEN BEGIN VATPostingSetup.GET("VAT Bus. Posting Group","VAT Prod. Posting Group"); // Add the following lines. CASE VATPostingSetup."Adv. Invoice Correction Type" OF VATPostingSetup."Adv. Invoice Correction Type"::Percentage: "Prepmt Amt to Deduct" := ROUND("Qty. to Invoice" / (Quantity - "Quantity Invoiced") * ("Prepmt. Amt. Inv." - "Prepmt Amt Deducted"),Currency."Amount Rounding Precision"); VATPostingSetup."Adv. Invoice Correction Type"::Absolute: BEGIN "Prepmt Amt to Deduct" := PrepmtAmtToDeduct(PurchHeader."Prices Including VAT",100); IF "Prepmt Amt to Deduct" > ("Prepmt. Amt. Inv." - "Prepmt Amt Deducted") THEN "Prepmt Amt to Deduct" := "Prepmt. Amt. Inv." - "Prepmt Amt Deducted"; END; VATPostingSetup."Adv. Invoice Correction Type"::"Fully Invoiced": IF "Qty. to Invoice" = Quantity - "Quantity Invoiced" THEN "Prepmt Amt to Deduct" := "Prepmt. Amt. Inv." - "Prepmt Amt Deducted" ELSE "Prepmt Amt to Deduct" := 0; END; END ELSE "Prepmt Amt to Deduct" := PrepmtAmtToDeduct(PurchHeader."Prices Including VAT","Prepayment %"); END ELSE "Prepmt Amt to Deduct" := 0 // End of the added lines. ...
Crie uma nova função PrepmtAmtToDeduct na tabela "Linha de Compra" (39), da seguinte forma:
PROCEDURE PrepmtAmtToDeduct@1470002(PricesIncludingVAT@1470000 : Boolean;PrepaymentPct@1470001 : Decimal) : Decimal; VAR VATPct@1470002 : Decimal; BEGIN IF PricesIncludingVAT THEN VATPct := "VAT %" ELSE VATPct := 0; EXIT( ROUND( ROUND( ROUND( ROUND("Direct Unit Cost" * "Qty. to Invoice",Currency."Amount Rounding Precision") * (1 - ("Line Discount %" / 100)),Currency."Amount Rounding Precision") * (PrepaymentPct / 100) / (1 + (VATPct / 100)),Currency."Amount Rounding Precision") * (1 + (VATPct / 100)),Currency."Amount Rounding Precision")); END;Altere o código no acionador OnRun na codeunit "Sales-Post" (80) da seguinte forma:
Código existente... ItemJnlRollRndg := FALSE; LineCount := LineCount + 1; Window.UPDATE(2,LineCount); IF Invoice AND (NOT GLSetup."Allow VAT Date Change in Lines") THEN SalesLine."VAT Date" := "VAT Date"; IF SalesLine.Type = SalesLine.Type::"Charge (Item)" THEN BEGIN SalesLine.TESTFIELD(Amount); SalesLine.TESTFIELD("Job No.",''); SalesLine.TESTFIELD("Job Contract Entry No.",0); END; ...Código de substituição
... ItemJnlRollRndg := FALSE; LineCount := LineCount + 1; Window.UPDATE(2,LineCount); IF Invoice AND (NOT GLSetup."Allow VAT Date Change in Lines") THEN SalesLine."VAT Date" := "VAT Date"; // Add the following lines. IF Invoice THEN IF SalesHeader."Prepayment Type" = SalesHeader."Prepayment Type"::Advance THEN TestPrepmtAmount; // End of the added lines. IF SalesLine.Type = SalesLine.Type::"Charge (Item)" THEN BEGIN SalesLine.TESTFIELD(Amount); SalesLine.TESTFIELD("Job No.",''); SalesLine.TESTFIELD("Job Contract Entry No.",0); END; ...Crie uma nova função TestPrepmtAmount na codeunit "Sales-Post" (80) da seguinte forma:
PROCEDURE TestPrepmtAmount@1470003(); VAR AllowedQtyToShip@1470000 : Decimal; SalesAdvLetterHeader@1470001 : Record 26585; BEGIN WITH SalesLine DO BEGIN IF ("Prepmt. Line Amount" = 0) OR (Quantity = 0) THEN EXIT; SalesAdvLetterHeader.SETRANGE("Order No.","Document No."); IF NOT SalesAdvLetterHeader.ISEMPTY THEN BEGIN AllowedQtyToShip := ROUND( ("Line Amount" - "Prepmt. Line Amount" + "Prepmt. Amt. Inv.") / "Line Amount" * Quantity - "Quantity Invoiced",0.00001); IF "Qty. to Ship" > AllowedQtyToShip THEN FIELDERROR("Qty. to Ship",STRSUBSTNO(Text047,AllowedQtyToShip)); END; END; END;Altere o código no acionador OnRun na codeunit "Purch.-Post" (90) da seguinte forma:
Código existente... IF GUIALLOWED THEN Window.UPDATE(2,LineCount); IF Invoice AND (NOT GLSetup."Allow VAT Date Change in Lines") THEN PurchLine."VAT Date" := "VAT Date"; IF Invoice THEN TestPrepmtAmount; IF PurchLine.Type = PurchLine.Type::"Charge (Item)" THEN BEGIN PurchLine.TESTFIELD(Amount); PurchLine.TESTFIELD("Job No.",''); END; ...Código de substituição
... IF GUIALLOWED THEN Window.UPDATE(2,LineCount); IF Invoice AND (NOT GLSetup."Allow VAT Date Change in Lines") THEN PurchLine."VAT Date" := "VAT Date"; IF Invoice THEN // Add the following line. IF PurchHeader."Prepayment Type" = PurchHeader."Prepayment Type"::Advance THEN TestPrepmtAmount; IF PurchLine.Type = PurchLine.Type::"Charge (Item)" THEN BEGIN PurchLine.TESTFIELD(Amount); PurchLine.TESTFIELD("Job No.",''); END; ...Elimine a função TestPrepmtAmount e crie-a novamente na codeunit "Sales-Post" (80) da seguinte forma:
LOCAL PROCEDURE TestPrepmtAmount@55(); VAR AllowedQtyToReceive@1470000 : Decimal; PurchAdvLetterHeader@147001 : Record 26587; BEGIN WITH PurchLine DO BEGIN IF ("Prepmt. Line Amount" = 0) OR (Quantity = 0) THEN EXIT; PurchAdvLetterHeader.SETRANGE("Order No.","Document No."); IF NOT PurchAdvLetterHeader.ISEMPTY THEN BEGIN AllowedQtyToReceive := ROUND( ("Line Amount" - "Prepmt. Line Amount" + "Prepmt. Amt. Inv.") / "Line Amount" * Quantity - "Quantity Invoiced",0.00001); IF "Qty. to Receive" > AllowedQtyToReceive THEN FIELDERROR("Qty. to Receive",STRSUBSTNO(Text047,AllowedQtyToReceive)); END; END; END;Altere o código na função TestSalesPrepayment na codeunit "Approvals Management" (439) da seguinte forma:
Código existente... SalesLines.SETRANGE("Document Type",SalesHeader."Document Type"); SalesLines.SETRANGE("Document No.",SalesHeader."No."); SalesLines.SETFILTER("Prepmt. Line Amount",'<>%1',0); IF SalesLines.FIND('-') THEN BEGIN REPEAT ...Código de substituição
... // Add the following lines. IF SalesHeader."Prepayment Type" = SalesHeader."Prepayment Type"::Advance THEN EXIT(IsNotInvoicedSalesAdvLetter(SalesHeader."No.")); // End of the added lines. SalesLines.SETRANGE("Document Type",SalesHeader."Document Type"); SalesLines.SETRANGE("Document No.",SalesHeader."No."); SalesLines.SETFILTER("Prepmt. Line Amount",'<>%1',0); IF SalesLines.FIND('-') THEN BEGIN REPEAT ...Altere o código na função TestPurchasePrepayment na codeunit "Approvals Management" (439) da seguinte forma:
Código existente... PurchaseLines.SETRANGE("Document Type",PurchaseHeader."Document Type"); PurchaseLines.SETRANGE("Document No.",PurchaseHeader."No."); PurchaseLines.SETFILTER("Prepmt. Line Amount",'<>%1',0); IF PurchaseLines.FIND('-') THEN BEGIN REPEAT ...Código de substituição
... // Add the following lines. IF PurchaseHeader."Prepayment Type" = PurchaseHeader."Prepayment Type"::Advance THEN EXIT(IsNotInvoicedPurchAdvLetter(PurchaseHeader."No.")); // End of the added lines. PurchaseLines.SETRANGE("Document Type",PurchaseHeader."Document Type"); PurchaseLines.SETRANGE("Document No.",PurchaseHeader."No."); PurchaseLines.SETFILTER("Prepmt. Line Amount",'<>%1',0); IF PurchaseLines.FIND('-') THEN BEGIN REPEAT ...Crie uma nova função local IsNotInvoicedSalesAdvLetter na codeunit "Approvals Management" (439) da seguinte forma:
LOCAL PROCEDURE IsNotInvoicedSalesAdvLetter@38(SalesOrderNo@1170000000 : Code[30]) : Boolean; VAR SalesAdvLetterHeader@1001 : Record 26585; SalesAdvLetterLine@1002 : Record 26586; BEGIN WITH SalesAdvLetterHeader DO BEGIN SETRANGE("Order No.",SalesOrderNo); IF FIND('-') THEN REPEAT SalesAdvLetterLine.SETRANGE("Letter No.","No."); IF SalesAdvLetterLine.FIND('-') THEN REPEAT IF SalesAdvLetterLine."Amount Including VAT" <> SalesAdvLetterLine."Amount Invoiced" THEN EXIT(TRUE); UNTIL SalesAdvLetterLine.NEXT = 0; UNTIL NEXT = 0; END; END;Crie uma nova função local IsNotInvoicedPurchAdvLetter na codeunit "Approvals Management" (439) da seguinte forma:
LOCAL PROCEDURE IsNotInvoicedPurchAdvLetter@39(PurchOrderNo@1170000000 : Code[30]) : Boolean; VAR PurchAdvLetterHeader@1001 : Record 26587; PurchAdvLetterLine@1002 : Record 26588; BEGIN WITH PurchAdvLetterHeader DO BEGIN SETRANGE("Order No.",PurchOrderNo); IF FIND('-') THEN REPEAT PurchAdvLetterLine.SETRANGE("Letter No.","No."); IF PurchAdvLetterLine.FIND('-') THEN REPEAT IF PurchAdvLetterLine."Amount Including VAT" <> PurchAdvLetterLine."Amount Invoiced" THEN EXIT(TRUE); UNTIL PurchAdvLetterLine.NEXT = 0; UNTIL NEXT = 0; END; END;
Pré-requisitos
Tem de ter a versão da Europa de Leste do Microsoft Dynamics NAV 2009 R2 instalada para aplicar esta correção.
Informações de remoção
Não é possível remover esta correção.
Estado
A Microsoft confirmou que se trata de um problema nos produtos Microsoft listados na secção "Aplica-se a".
Nota Este é um artigo "PUBLICAÇÃO RÁPIDA" criado diretamente a partir da organização de suporte da Microsoft. As informações aqui contidas são fornecidas tal como estão em resposta a problemas emergentes. Como resultado da velocidade de disponibilização, os materiais podem incluir erros tipográficos e podem ser revistos em qualquer altura sem aviso prévio. Veja Termos de Utilização para outras considerações.