Help with Report - accessing same table as the report for YTD total.

I have a daily Vendor report printing this is the quantity we received from the Vendor with prompt for the user to enter the date off the Purch.Line Receipt table 121. This report works fine - prints a quantity total for each Vendor. My boss wants me to add a YTD column to the report next to the Daily total. I added code but it only picks the last record for that Vendor from the Purch.Line Receipt table 121.

In my Cal/Globals I have the Purch.Line Receipt table 121 under a temp table.

Is there anyway to access the same table your in and get the records for that Vendor??

When I print the report my YTD quantity total for the Vendor is exactly the quantity from the last record for that Vendor even though I’m looping thru.

Attached is my code.

Any help would be appreciated.


This code is under the Purch. Rcpt. Line - Group Footer section.


recTempPurchRcptLine.SETRANGE(“Buy-from Vendor No.”,gsParentItemNo2);

IF recTempPurchRcptLine.FINDSET THEN
IF (recTempPurchRcptLine.“Posting Date” > 010110D) AND // looking for all records for 2010.
(recTempPurchRcptLine.Type = Type::Item) THEN // only picking Item records
gsYTDqty:=gsYTDqty + Quantity;

UNTIL recTempPurchRcptLine.NEXT = 0;

I tried the record.RESET and it worked fine but only selected the first Vendor it came to even though I wasn’t filtering on that Vendor.

Stopped after printing the first Vendor it came to.

The YTD total was correct though.

I found my error. I was using the Quantity from the “Purch. Rcpt. Line” instead of recTempPurch.RcptLine.Quantity.

My bad,