Totalling fields on integer dataitems

rvilelarvilela Member Posts: 10
Hi!
I am changing the purchase order report to group lines for the same item number, and show only one line per item (totalling the qty and line amount fields). I am new in developping in NAV, so I was able to sort the lines and the totals with the precious help you all gave here in other posts in the fórum.
So I have only one problem left... On the line that sums, either it sums the qty or the amount, can't sum them both! Apparently it only sums the one I put first on the code.

I have 2 decimal variables: FooterTotal and FooterTotalQ
I created a variable (PurchLine2), record for Purchase line table

I added this code to the OnAfterGetRecord (RoundLoop dataitem):


IF ShowFooter THEN

FooterTotalQ := 0;
FooterTotal := 0;

FooterTotalQ += PurchLine.Quantity;
FooterTotal += PurchLine.Amount;

ShowFooter := TRUE;

PurchLine2.COPY(PurchLine);
PurchLine2.GET(PurchLine."Document Type",PurchLine."Document No.",PurchLine."Line No.");
IF PurchLine.Type = PurchLine.Type::Item THEN
IF PurchLine2.NEXT <> 0 THEN
ShowFooter := (PurchLine2."No." <> PurchLine."No.");


Can you help me understand why the amount field doesn't sum?

Thanks a lot!
Rita

Answers

Sign In or Register to comment.