...
OnValidate=BEGIN
MessageIfSalesLinesExist(FIELDCAPTION("Customer Price Group"));
END;
CaptionML=ENU=Customer Price Group }
// Delete the following lines.
{ 35 ; ;Prices Including VAT;Boolean ;OnValidate=VAR
SalesLine@1000 : Record 37;
Currency@1001 : Record 4;
JobPostLine@1003 : Codeunit 1001;
RecalculatePrice@1002 : Boolean;
BEGIN
TESTFIELD(Status,Status::Open);
IF "Prices Including VAT" <> xRec."Prices Including VAT" THEN BEGIN
SalesLine.SETRANGE("Document Type","Document Type");
SalesLine.SETRANGE("Document No.","No.");
SalesLine.SETFILTER("Job Contract Entry No.",' <>%1',0);
IF SalesLine.FIND('-') THEN BEGIN
SalesLine.TESTFIELD("Job No.",'');
SalesLine.TESTFIELD("Job Contract Entry No.",0);
END;
SalesLine.RESET;
SalesLine.SETRANGE("Document Type","Document Type");
SalesLine.SETRANGE("Document No.","No.");
SalesLine.SETFILTER("Unit Price",' <>%1',0);
SalesLine.SETFILTER("VAT %",' <>%1',0);
IF SalesLine.FINDFIRST THEN BEGIN
RecalculatePrice :=
CONFIRM(
STRSUBSTNO(
Text024 +
Text026,
FIELDCAPTION("Prices Including VAT"),SalesLine.FIELDCAPTION("Unit Price")),
TRUE);
SalesLine.SetSalesHeader(Rec);
IF "Currency Code" = '' THEN
Currency.InitRoundingPrecision
ELSE
Currency.GET("Currency Code");
SalesLine.LOCKTABLE;
LOCKTABLE;
SalesLine.FINDSET;
REPEAT
SalesLine.TESTFIELD("Quantity Invoiced",0);
SalesLine.TESTFIELD("Prepmt. Amt. Inv.",0);
IF NOT RecalculatePrice THEN BEGIN
SalesLine."VAT Difference" := 0;
SalesLine.InitOutstandingAmount;
END ELSE
IF "Prices Including VAT" THEN BEGIN
SalesLine."Unit Price" :=
ROUND(
SalesLine."Unit Price" * (1 + (SalesLine."VAT %" / 100)),
Currency."Unit-Amount Rounding Precision");
IF SalesLine.Quantity <> 0 THEN BEGIN
SalesLine."Line Discount Amount" :=
ROUND(
SalesLine.Quantity * SalesLine."Unit Price" * SalesLine."Line Discount %" / 100,
Currency."Amount Rounding Precision");
SalesLine.VALIDATE("Inv. Discount Amount",
ROUND(
SalesLine."Inv. Discount Amount" * (1 + (SalesLine."VAT %" / 100)),
Currency."Amount Rounding Precision"));
END;
END ELSE BEGIN
SalesLine."Unit Price" :=
ROUND(
SalesLine."Unit Price" / (1 + (SalesLine."VAT %" / 100)),
Currency."Unit-Amount Rounding Precision");
IF SalesLine.Quantity <> 0 THEN BEGIN
SalesLine."Line Discount Amount" :=
ROUND(
SalesLine.Quantity * SalesLine."Unit Price" * SalesLine."Line Discount %" / 100,
Currency."Amount Rounding Precision");
SalesLine.VALIDATE("Inv. Discount Amount",
ROUND(
SalesLine."Inv. Discount Amount" / (1 + (SalesLine."VAT %" / 100)),
Currency."Amount Rounding Precision"));
END;
END;
SalesLine.MODIFY;
UNTIL SalesLine.NEXT = 0;
END;
END;
// End of the deleted lines.
END;
CaptionML=ENU=Prices Including VAT }
{ 37 ; ;Invoice Disc. Code ;Code20 ;OnValidate=BEGIN
TESTFIELD(Status,Status::Open);
...
...
OnValidate=BEGIN
MessageIfSalesLinesExist(FIELDCAPTION("Customer Price Group"));
END;
CaptionML=ENU=Customer Price Group }
// Add the following lines.
{ 35 ; ;Prices Including VAT;Boolean ;OnValidate=BEGIN
TESTFIELD(Status,Status::Open);
IF "Prices Including VAT" <> xRec."Prices Including VAT" THEN
UpdtPriceInclVAT;
// End of the added lines.
END;
CaptionML=ENU=Prices Including VAT }
{ 37 ; ;Invoice Disc. Code ;Code20 ;OnValidate=BEGIN
TESTFIELD(Status,Status::Open);
...