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.
...
IF ValueEntry.FINDSET(FALSE,FALSE) THEN BEGIN
CASE ValueEntry."Item Ledger Entry Type" OF
ValueEntry."Item Ledger Entry Type" :: Purchase: BEGIN
IF ValueEntry."Invoiced Quantity" > 0 THEN BEGIN
PurchInvLine.SETRANGE("Document No.",ValueEntry."Document No.");
PurchInvLine.SETRANGE(Type, PurchInvLine.Type::Item);
PurchInvLine.SETRANGE("No.",ValueEntry."Item No.");
IF PurchInvLine.FIND('-') THEN BEGIN
PurchInvHeader.GET(ValueEntry."Document No.");
REPEAT
TotalInvoicedQty := TotalInvoicedQty + PurchInvLine.Quantity;
IF PurchInvHeader."Currency Factor" <> 0 THEN
TotalAmt := TotalAmt + (PurchInvLine.Amount / PurchInvHeader."Currency Factor")
ELSE
TotalAmt := TotalAmt + PurchInvLine.Amount;
UNTIL PurchInvLine.NEXT = 0;
END ELSE BEGIN
PurchRcptLine.SETRANGE("Document No.",ValueEntry."Document No.");
PurchRcptLine.SETRANGE(Type, PurchRcptLine.Type::Item);
PurchRcptLine.SETRANGE("No.",ValueEntry."Item No.");
IF PurchRcptLine.FIND('-') THEN BEGIN
REPEAT
IF PurchRcptLine.Correction = TRUE THEN
CorrectionFound := TRUE;
DocItemSum += PurchRcptLine."Quantity Invoiced";
UNTIL PurchRcptLine.NEXT = 0;
IF (DocItemSum = 0) AND CorrectionFound THEN CurrReport.SKIP;
END;
END;
END ELSE BEGIN
PurchCrMemoLine.SETRANGE("Document No.",ValueEntry."Document No.");
PurchCrMemoLine.SETRANGE(Type, PurchInvLine.Type::Item);
PurchCrMemoLine.SETRANGE("No.",ValueEntry."Item No.");
IF PurchCrMemoLine.FIND('-') THEN BEGIN
PurchCrMemoHdr.GET(ValueEntry."Document No.");
REPEAT
TotalInvoicedQty := TotalInvoicedQty - PurchCrMemoLine.Quantity;
IF PurchCrMemoHdr."Currency Factor" <> 0 THEN
TotalAmt := TotalAmt - (PurchCrMemoLine.Amount / PurchCrMemoHdr."Currency Factor")
ELSE
TotalAmt := TotalAmt - PurchCrMemoLine.Amount;
UNTIL PurchCrMemoLine.NEXT = 0;
END ELSE BEGIN
PurchRcptLine.SETRANGE("Document No.",ValueEntry."Document No.");
PurchRcptLine.SETRANGE(Type, PurchRcptLine.Type::Item);
PurchRcptLine.SETRANGE("No.",ValueEntry."Item No.");
IF PurchRcptLine.FIND('-') THEN BEGIN
REPEAT
IF PurchRcptLine.Correction = TRUE THEN
CorrectionFound := TRUE;
DocItemSum += PurchRcptLine."Quantity Invoiced";
UNTIL PurchRcptLine.NEXT = 0;
IF (DocItemSum = 0) AND CorrectionFound THEN CurrReport.SKIP;
END;
END;
END;
END;
ValueEntry."Item Ledger Entry Type" :: Sale: BEGIN
IF ValueEntry."Invoiced Quantity" < 0 THEN BEGIN
SalesInvoiceLine.SETRANGE("Document No.",ValueEntry."Document No.");
SalesInvoiceLine.SETRANGE(Type, SalesInvoiceLine.Type::Item);
SalesInvoiceLine.SETRANGE("No.",ValueEntry."Item No.");
IF SalesInvoiceLine.FIND('-') THEN BEGIN
SalesInvoiceHeader.GET(ValueEntry."Document No.");
REPEAT
TotalInvoicedQty := TotalInvoicedQty - SalesInvoiceLine.Quantity;
IF SalesInvoiceHeader."Currency Factor" <> 0 THEN
TotalAmt := TotalAmt - (SalesInvoiceLine.Amount / SalesInvoiceHeader."Currency Factor")
ELSE
TotalAmt := TotalAmt - (SalesInvoiceLine.Amount);
UNTIL SalesInvoiceLine.NEXT = 0;
END ELSE BEGIN
SalesShipLine.SETRANGE("Document No.",ValueEntry."Document No.");
SalesShipLine.SETRANGE(Type, SalesShipLine.Type::Item);
SalesShipLine.SETRANGE("No.",ValueEntry."Item No.");
IF SalesShipLine.FIND('-') THEN BEGIN
REPEAT
IF SalesShipLine.Correction = TRUE THEN
CorrectionFound := TRUE;
DocItemSum += SalesShipLine."Quantity Invoiced";
UNTIL SalesShipLine.NEXT = 0;
IF (DocItemSum = 0) AND CorrectionFound THEN CurrReport.SKIP;
END;
END;
END ELSE BEGIN
SalesCrMemoLine.SETRANGE("Document No.",ValueEntry."Document No.");
SalesCrMemoLine.SETRANGE(Type,SalesCrMemoLine.Type::Item);
SalesCrMemoLine.SETRANGE("No.",ValueEntry."Item No.");
IF SalesCrMemoLine.FIND('-') THEN BEGIN
SalesCrMemoHeader.GET(ValueEntry."Document No.");
REPEAT
TotalInvoicedQty := TotalInvoicedQty + SalesCrMemoLine.Quantity;
IF SalesCrMemoHeader."Currency Factor" <>0 THEN
TotalAmt := TotalAmt + (SalesCrMemoLine.Amount / SalesCrMemoHeader."Currency Factor")
ELSE
TotalAmt := TotalAmt + SalesCrMemoLine.Amount;
UNTIL SalesCrMemoLine.NEXT = 0;
END ELSE BEGIN
SalesShipLine.SETRANGE("Document No.",ValueEntry."Document No.");
SalesShipLine.SETRANGE(Type, SalesShipLine.Type::Item);
SalesShipLine.SETRANGE("No.",ValueEntry."Item No.");
IF SalesShipLine.FIND('-') THEN BEGIN
...
...
IF ValueEntry.FINDSET(FALSE,FALSE) THEN BEGIN
CASE ValueEntry."Item Ledger Entry Type" OF
ValueEntry."Item Ledger Entry Type" :: Purchase: BEGIN
IF ValueEntry."Invoiced Quantity" > 0 THEN BEGIN
PurchInvLine.SETRANGE("Document No.",ValueEntry."Document No.");
PurchInvLine.SETRANGE(Type, PurchInvLine.Type::Item);
PurchInvLine.SETRANGE("No.",ValueEntry."Item No.");
// Add the following line.
PurchInvLine.SETRANGE("Line No.",ValueEntry."Document Line No.");
IF PurchInvLine.FIND('-') THEN BEGIN
PurchInvHeader.GET(ValueEntry."Document No.");
REPEAT
TotalInvoicedQty := TotalInvoicedQty + PurchInvLine.Quantity;
IF PurchInvHeader."Currency Factor" <> 0 THEN
TotalAmt := TotalAmt + (PurchInvLine.Amount / PurchInvHeader."Currency Factor")
ELSE
TotalAmt := TotalAmt + PurchInvLine.Amount;
UNTIL PurchInvLine.NEXT = 0;
END ELSE BEGIN
PurchRcptLine.SETRANGE("Document No.",ValueEntry."Document No.");
PurchRcptLine.SETRANGE(Type, PurchRcptLine.Type::Item);
PurchRcptLine.SETRANGE("No.",ValueEntry."Item No.");
// Add the following line.
PurchRcptLine.SETRANGE("Line No.",ValueEntry."Document Line No.");
IF PurchRcptLine.FIND('-') THEN BEGIN
REPEAT
IF PurchRcptLine.Correction = TRUE THEN
CorrectionFound := TRUE;
DocItemSum += PurchRcptLine."Quantity Invoiced";
UNTIL PurchRcptLine.NEXT = 0;
IF (DocItemSum = 0) AND CorrectionFound THEN CurrReport.SKIP;
END;
END;
END ELSE BEGIN
PurchCrMemoLine.SETRANGE("Document No.",ValueEntry."Document No.");
PurchCrMemoLine.SETRANGE(Type, PurchInvLine.Type::Item);
PurchCrMemoLine.SETRANGE("No.",ValueEntry."Item No.");
// Add the following line.
PurchCrMemoLine.SETRANGE("Line No.",ValueEntry."Document Line No.");
IF PurchCrMemoLine.FIND('-') THEN BEGIN
PurchCrMemoHdr.GET(ValueEntry."Document No.");
REPEAT
TotalInvoicedQty := TotalInvoicedQty - PurchCrMemoLine.Quantity;
IF PurchCrMemoHdr."Currency Factor" <> 0 THEN
TotalAmt := TotalAmt - (PurchCrMemoLine.Amount / PurchCrMemoHdr."Currency Factor")
ELSE
TotalAmt := TotalAmt - PurchCrMemoLine.Amount;
UNTIL PurchCrMemoLine.NEXT = 0;
END ELSE BEGIN
PurchRcptLine.SETRANGE("Document No.",ValueEntry."Document No.");
PurchRcptLine.SETRANGE(Type, PurchRcptLine.Type::Item);
PurchRcptLine.SETRANGE("No.",ValueEntry."Item No.");
// Add the following line.
PurchRcptLine.SETRANGE("Line No.",ValueEntry."Document Line No.");
IF PurchRcptLine.FIND('-') THEN BEGIN
REPEAT
IF PurchRcptLine.Correction = TRUE THEN
CorrectionFound := TRUE;
DocItemSum += PurchRcptLine."Quantity Invoiced";
UNTIL PurchRcptLine.NEXT = 0;
IF (DocItemSum = 0) AND CorrectionFound THEN CurrReport.SKIP;
END;
END;
END;
END;
ValueEntry."Item Ledger Entry Type" :: Sale: BEGIN
IF ValueEntry."Invoiced Quantity" < 0 THEN BEGIN
SalesInvoiceLine.SETRANGE("Document No.",ValueEntry."Document No.");
SalesInvoiceLine.SETRANGE(Type, SalesInvoiceLine.Type::Item);
SalesInvoiceLine.SETRANGE("No.",ValueEntry."Item No.");
// Add the following line.
SalesInvoiceLine.SETRANGE("Line No.",ValueEntry."Document Line No.");
IF SalesInvoiceLine.FIND('-') THEN BEGIN
SalesInvoiceHeader.GET(ValueEntry."Document No.");
REPEAT
TotalInvoicedQty := TotalInvoicedQty - SalesInvoiceLine.Quantity;
IF SalesInvoiceHeader."Currency Factor" <> 0 THEN
TotalAmt := TotalAmt - (SalesInvoiceLine.Amount / SalesInvoiceHeader."Currency Factor")
ELSE
TotalAmt := TotalAmt - (SalesInvoiceLine.Amount);
UNTIL SalesInvoiceLine.NEXT = 0;
END ELSE BEGIN
SalesShipLine.SETRANGE("Document No.",ValueEntry."Document No.");
SalesShipLine.SETRANGE(Type, SalesShipLine.Type::Item);
SalesShipLine.SETRANGE("No.",ValueEntry."Item No.");
// Add the following line.
SalesShipLine.SETRANGE("Line No.",ValueEntry."Document Line No.");
IF SalesShipLine.FIND('-') THEN BEGIN
REPEAT
IF SalesShipLine.Correction = TRUE THEN
CorrectionFound := TRUE;
DocItemSum += SalesShipLine."Quantity Invoiced";
UNTIL SalesShipLine.NEXT = 0;
IF (DocItemSum = 0) AND CorrectionFound THEN CurrReport.SKIP;
END;
END;
END ELSE BEGIN
SalesCrMemoLine.SETRANGE("Document No.",ValueEntry."Document No.");
SalesCrMemoLine.SETRANGE(Type,SalesCrMemoLine.Type::Item);
SalesCrMemoLine.SETRANGE("No.",ValueEntry."Item No.");
// Add the following line.
SalesCrMemoLine.SETRANGE("Line No.",ValueEntry."Document Line No.");
IF SalesCrMemoLine.FIND('-') THEN BEGIN
SalesCrMemoHeader.GET(ValueEntry."Document No.");
REPEAT
TotalInvoicedQty := TotalInvoicedQty + SalesCrMemoLine.Quantity;
IF SalesCrMemoHeader."Currency Factor" <>0 THEN
TotalAmt := TotalAmt + (SalesCrMemoLine.Amount / SalesCrMemoHeader."Currency Factor")
ELSE
TotalAmt := TotalAmt + SalesCrMemoLine.Amount;
UNTIL SalesCrMemoLine.NEXT = 0;
END ELSE BEGIN
SalesShipLine.SETRANGE("Document No.",ValueEntry."Document No.");
SalesShipLine.SETRANGE(Type, SalesShipLine.Type::Item);
SalesShipLine.SETRANGE("No.",ValueEntry."Item No.");
// Add the following line.
SalesShipLine.SETRANGE("Line No.",ValueEntry."Document Line No.");
IF SalesShipLine.FIND('-') THEN BEGIN
...