...
LOCAL PROCEDURE GetPrepaymentCurrFactors@1470049(SalesOrderNo@1470000 : Code[20];VAR CurrFactor@1360001 : Decimal;VAR VATCurrFactor@1360002 : Decimal);
VAR
LetterHeader@1470001 : Record 26585;
CustLedgEntry@1470002 : Record 21;
AdvanceLink@1470003 : Record 26590;
BEGIN
CurrFactor := 0;
VATCurrFactor := 0;
WITH AdvanceLink DO BEGIN
LetterHeader.SETRANGE("Order No.",SalesOrderNo);
IF LetterHeader.FINDLAST THEN BEGIN
SETCURRENTKEY("Document No.","Line No.","Entry Type");
SETRANGE("Entry Type","Entry Type"::"Link To Letter");
SETRANGE("Document No.",LetterHeader."No.");
IF FINDLAST THEN
IF CustLedgEntry.GET("CV Ledger Entry No.") THEN
IF CustLedgEntry."Currency Code" <> '' THEN BEGIN
CurrFactor := CustLedgEntry."Original Currency Factor";
VATCurrFactor := CustLedgEntry."VAT Currency Factor";
END;
END;
END;
END;
LOCAL PROCEDURE SetVATClause@1470058(SalesInvHeader@1470001 : Record 112;SalesInvLine@1470002 : Record 113);
BEGIN
WITH VATClauseBuffer DO
IF GET(SalesInvLine."VAT Bus. Posting Group",SalesInvLine."VAT Prod. Posting Group") THEN BEGIN
"VAT Base" +=
CurrExchRate.ExchangeAmtFCYToLCY(SalesInvHeader."Posting Date",
SalesInvHeader."Currency Code",
PrepmtInvBuffer.Amount,
SalesInvHeader."Currency Factor");
"VAT Amount" +=
(CurrExchRate.ExchangeAmtFCYToLCY(SalesInvHeader."Posting Date",
SalesInvHeader."Currency Code",
PrepmtInvBuffer."Amount Incl. VAT",
SalesInvHeader."Currency Factor") -
CurrExchRate.ExchangeAmtFCYToLCY(SalesInvHeader."Posting Date",
SalesInvHeader."Currency Code",
SalesInvLine.Amount,
SalesInvHeader."Currency Factor"));
MODIFY;
END ELSE BEGIN
"VAT Bus. Posting Group" := SalesInvLine."VAT Bus. Posting Group";
"VAT Prod. Posting Group" := SalesInvLine."VAT Prod. Posting Group";
"VAT Base" :=
CurrExchRate.ExchangeAmtFCYToLCY(SalesInvHeader."Posting Date",
SalesInvHeader."Currency Code",
PrepmtInvBuffer.Amount,
SalesInvHeader."Currency Factor");
"VAT Amount" :=
CurrExchRate.ExchangeAmtFCYToLCY(SalesInvHeader."Posting Date",
SalesInvHeader."Currency Code",
PrepmtInvBuffer."Amount Incl. VAT",
SalesInvHeader."Currency Factor") -
"VAT Base";
INSERT;
END;
END;
LOCAL PROCEDURE FinalizeVATClause@1470064(SalesInvHeader@1470002 : Record 112;SalesInvLine@1470003 : Record 113);
VAR
TransferExtText@1470000 : Codeunit 378;
VATClauseSetup@1470001 : Record 26512;
BEGIN
IF VATClauseBuffer.FINDSET THEN
REPEAT
VATClauseSetup.SETRANGE("VAT Bus. Posting Group",VATClauseBuffer."VAT Bus. Posting Group");
VATClauseSetup.SETRANGE("VAT Prod. Posting Group",VATClauseBuffer."VAT Prod. Posting Group");
IF VATClauseSetup.FINDSET THEN
REPEAT
VATClauseSetup.TESTFIELD("Standard Text Code");
TransferExtText.VATCheckIfAnyExtText(SalesInvHeader,VATClauseSetup."Standard Text Code");
TransferExtText.InsertVATExtText(SalesInvLine,VATClauseBuffer);
UNTIL VATClauseSetup.NEXT = 0;
UNTIL VATClauseBuffer.NEXT = 0;
END;
...