The code snippet below is from Codeunit 99002504. The problem with the original is that the Unit Price from the Credit Decision or the original Invoice was overwritten by the Unit Price from the Item Card. The fix given here prevents that from happening. cheers, Matt.
//<Begin ModID> ****** </Begin ModID>
//<CompanyName> Kelar Corporation - Burlington </CompanyName>
//<Author> Matt Benvenuti </Author>
//<InstallDate> 2001-09-13 </InstallDate>
// commented out Unit Price because Validate overwrites value anyway
// SalesLine."Unit Price" := ReturnLine."Inv. Unit Price" * ReturnLine."Qty. Per. Ret. UOM";
//<End ModID> ****** </End ModID>
SalesLine.VALIDATE("Unit of Measure",ReturnLine.UOM);
SalesLine.VALIDATE("Unit of Measure Code",ReturnLine.UOM);
IF SalesInvoiceLine.GET(ReturnLine."Inv. No.",
ReturnLine."Inv. Line No.") THEN BEGIN
SalesLine."Tax Group Code" := SalesInvoiceLine."Tax Group Code";
SalesLine."Department Code" := SalesInvoiceLine."Department Code";
SalesLine."Project Code" := SalesInvoiceLine."Project Code";
END;
SalesLine.VALIDATE(Quantity,ReturnLine."Qty. Ret. To-Date");
//<Begin ModID> ****** </Begin ModID>
//<CompanyName> Kelar Corporation - Burlington </CompanyName>
//<Author> Matt Benvenuti </Author>
//<InstallDate> 2001-09-13 </InstallDate>
// overwrite Unit Price with the ReturnLine value
SalesLine."Unit Price" := ReturnLine."Inv. Unit Price" * ReturnLine."Qty. Per. Ret. UOM";
//<End ModID> ****** </End ModID>