To implement this hotfix, you must have a developer license.
You do not have to have rights to the data stores unless you have to perform data repair.
...
PROCEDURE InsertServLedgerEntry@6(VAR NextEntryNo@1002 : Integer;VAR ServHeader@1006 : Record 5900;VAR TempServLine@1000 : Record 5902;VAR ServItemLine@1003 : Record 5901;Qty@1001 : Decimal;DocNo@1005 : Code[20]) : Integer;
VAR
ServItem@1007 : Record 5940;
// Delete the following line.
LineAmount@1004 : Decimal;
BEGIN
ServLedgEntry.LOCKTABLE;
WITH TempServLine DO BEGIN
ServLedgEntry.INIT;
...
...
PROCEDURE InsertServLedgerEntry@6(VAR NextEntryNo@1002 : Integer;VAR ServHeader@1006 : Record 5900;VAR TempServLine@1000 : Record 5902;VAR ServItemLine@1003 : Record 5901;Qty@1001 : Decimal;DocNo@1005 : Code[20]) : Integer;
VAR
ServItem@1007 : Record 5940;
// Add the following lines.
ServLedgEntry2@1110 : Record 5907;
ServLedgEntry3@1008 : Record 5907;
LineAmount@1004 : Decimal;
OpenEntryCount@1009 : Integer;
i@1010 : Integer;
TotalUnitPrice@1011 : Decimal;
TotalAmount@1012 : Decimal;
TotalAmountLCY@1014 : Decimal;
TotalDisc@1013 : Decimal;
// End of the lines.
BEGIN
ServLedgEntry.LOCKTABLE;
WITH TempServLine DO BEGIN
ServLedgEntry.INIT;
...
...
END;
ServLedgEntry.Amount := AmountToFCY(ServHeader,ServLedgEntry."Amount (LCY)");
END;
IF TempServLine."Qty. to Consume" <> 0 THEN
ServLedgEntry."Discount Amount" := 0;
ServLedgEntry.INSERT;
...
...
END;
ServLedgEntry.Amount := AmountToFCY(ServHeader,ServLedgEntry."Amount (LCY)");
END;
// Add the following lines.
IF "Document Type" = "Document Type"::Invoice THEN BEGIN
i := 1;
IF "Appl.-to Service Entry" <> 0 THEN BEGIN
ServLedgEntry2.GET("Appl.-to Service Entry");
ServLedgEntry3.SETRANGE("Service Contract No.",ServLedgEntry2."Service Contract No.");
ServLedgEntry3.SETRANGE("Document No.",ServLedgEntry2."Document No.");
ServLedgEntry3.SETRANGE("Entry Type",ServLedgEntry3."Entry Type"::Sale);
ServLedgEntry3.SETRANGE("Moved from Prepaid Acc.",FALSE);
IF ServLedgEntry3.FINDSET THEN
OpenEntryCount := ServLedgEntry3.COUNT;
IF OpenEntryCount <> 0 THEN
REPEAT
IF -(ServLedgEntry3."Unit Price") <> ServLedgEntry."Unit Price" THEN BEGIN
ServLedgEntry3."Unit Price" := -ROUND(ServLedgEntry."Unit Price" / OpenEntryCount);
ServLedgEntry3."Amount (LCY)" := -ROUND(ServLedgEntry."Amount (LCY)" / OpenEntryCount);
ServLedgEntry3."Discount Amount" := -ROUND(ServLedgEntry."Discount Amount" / OpenEntryCount);
ServLedgEntry3.Amount := -ROUND(ServLedgEntry.Amount / OpenEntryCount);
ServLedgEntry3.MODIFY;
END;
i += 1;
TotalUnitPrice += ServLedgEntry3."Unit Price";
TotalAmountLCY += ServLedgEntry3."Amount (LCY)";
TotalAmount += ServLedgEntry3.Amount;
TotalDisc += ServLedgEntry3."Discount Amount";
IF i = OpenEntryCount THEN BEGIN
IF TotalUnitPrice <> ServLedgEntry."Unit Price" THEN
ServLedgEntry3."Unit Price" := ServLedgEntry3."Unit Price" + (ServLedgEntry."Unit Price" - TotalUnitPrice);
IF TotalAmountLCY <> ServLedgEntry."Amount (LCY)" THEN
ServLedgEntry3."Amount (LCY)" := ServLedgEntry3."Amount (LCY)" + (ServLedgEntry."Amount (LCY)" - TotalAmountLCY);
IF TotalAmount <> ServLedgEntry.Amount THEN
ServLedgEntry3.Amount := ServLedgEntry3.Amount + (ServLedgEntry.Amount - TotalAmount);
IF TotalDisc <> ServLedgEntry."Discount Amount" THEN
ServLedgEntry3."Discount Amount" := ServLedgEntry3."Discount Amount" +
(ServLedgEntry."Discount Amount" - TotalDisc);
END;
UNTIL ServLedgEntry3.NEXT = 0;
END;
END;
// End of the lines.
IF TempServLine."Qty. to Consume" <> 0 THEN
ServLedgEntry."Discount Amount" := 0;
ServLedgEntry.INSERT;
...