I get huge, absolutely unrealistic Realized Losses at the point when a Purchase Prepayment Invoice is either deducted or credited, but not always, just in two cases. Unfortunately I have not yet found how to reproduce it.
I am asking it because did anyone have the same problem and found what triggers it, how to reproduce it?
Nothing in KB or Hotfix list.
To me in CU444 RealizeGainsLosses the line GenJnlLine.Amount := -PurchLine."Prepmt. Amount Inv. (LCY)"; just "stinks". I checked it and it was totally redesigned in NAV2013... so I cannot use an idea from there.
I need to find out where this "Prepmt. Amount Inv. (LCY)" comes from, my bet was on the Receipt Line (we use Get Receipt Lines) but it doesn't. Any ideas? Has anyone found this one?
0
Comments
PurchLine = the original PO
CU90:
PurchLine."Prepmt. Amount Inv. (LCY)" := PurchLine."Prepmt. Amount Inv. (LCY)" - PurchLine."Prepmt Amt to Deduct";
PrepayRealizeGainLoss(PurchLine);
CU444:
GenJnlLine.Amount := -PurchLine."Prepmt. Amount Inv. (LCY)";
And this is booked as Realized Loss.
So if PurchLine."Prepmt Amt to Deduct" = 0 then PurchLine."Prepmt. Amount Inv. (LCY)" gets fully written off as Realized Loss which is exactly what happened here.
But why would it be 0?
Have I just found an unknown bug? But still no ways to reproduce it... if you can some how make the PurchLine."Prepmt. Amount Inv. (LCY)" equal the originally booked prepayment amount i.e. the code that does the deductions does not do anything, and you have the PO in a foreign currency then it happens.
But I was wrong when I assumed that the deduction that does not run (propery) is the PurchLine."Prepmt. Amount Inv. (LCY)" := PurchLine."Prepmt. Amount Inv. (LCY)" - PurchLine."Prepmt Amt to Deduct"; because that code does not run when you have a document in a foreign currency.
It's more like the
IF "Currency Code" <> '' THEN BEGIN
TempPrePayDeductLCYPurchLine := PurchLine;
IF TempPrePayDeductLCYPurchLine.FIND THEN
TempPurchLine."Prepmt. Amount Inv. (LCY)" := TempPurchLine."Prepmt. Amount Inv. (LCY)" -
TempPrePayDeductLCYPurchLine."Prepmt. Amount Inv. (LCY)";
?????? :-k :-k :-k
Hmmm...
Unfortunately I have no idea how to reproduce it even though it happened twice. Any ideas?