Hi all,
I am on a report whereby I need to group Order No. from Sales Shipment Line and make a sum of 'Quantity'. My report is based on Sales Shipment Header and Sales Shipment Line.
Lets' say for this e.g:
Order No. Quantity
101001 2
101001 3
101001 1
101001 2
101001 2
101001 2 Then, sum=12.
I do not want to make use of GroupTotalFields because there are more customizations which are required.
I have placed the Qty field on the Footer of Sales Shipment Line.
Sales Shipment Line, Footer (9) - OnPreSection()
SalesShptLine.RESET;
SalesShptLine.SETRANGE(SalesShptLine."Order No.","Sales Shipment Line"."Order No.");
SalesShptLine.SETFILTER(SalesShptLine.Quantity,'>%1',0);
IF SalesShptLine.FINDSET THEN BEGIN
REPEAT
Qty:=Qty+SalesShptLine.Quantity;
UNTIL SalesShptLine.NEXT=0;
END;
SalesShptLine:record variable and Qty:decimal variable.
The Qty calculation is being displayed accordingly but it is being shown three times for this mentioned Order No. as mentioned above. There should not be grouping on Document No.
Please help me.
Thanks
Liizz
0
Comments
KCP Consultores
Hope this will help you.
if PrevOrderNo := "Sales Shipment Line"."Order No." then begin
Qty := 0;
CurrReport.Skip;
end;
SalesShptLine.RESET;
SalesShptLine.Setcurrentkey("Order No.");
SalesShptLine.SETRANGE(SalesShptLine."Order No.","Sales Shipment Line"."Order No.");
SalesShptLine.SETFILTER(SalesShptLine.Quantity,'>%1',0);
IF SalesShptLine.FINDSET THEN BEGIN
REPEAT
Qty:=Qty+SalesShptLine.Quantity;
PrevOrderNo := "Sales Shipment Line"."Order No.";
UNTIL SalesShptLine.NEXT=0;
END;,