Hi guy´s
I need to count saleslines for each salesperson, but this code gives wrong result. If I count salesheader result is correct, so I think it´s the REPEAT that make my head hurt :-)
Hopefully a frindly NAV guru could help me out ?
Here is my code (NAV 5.0)
rSalesHeader.RESET;
rSalesLine.RESET;
salesFilter := "Salesperson/Purchaser".Code;
rSalesHeader.SETRANGE(rSalesHeader."Document Type",rSalesHeader."Document Type"::Order);
rSalesHeader.SETFILTER(rSalesHeader."Order Date",datefilter);
rSalesHeader.SETRANGE(rSalesHeader."Salesperson Code",salesFilter);
IF rSalesHeader.FINDSET THEN
REPEAT
rSalesLine.SETRANGE(rSalesLine."Document No.",rSalesHeader."No.");
rSalesLine.SETRANGE(rSalesLine.Type,rSalesLine.Type::Item);
rSalesLine.SETRANGE(rSalesLine."Quantity Shipped",0);
ok := rSalesLine.GET;
CountLines += rSalesLine.COUNT;
UNTIL rSalesHeader.NEXT = 0;
OrderLinesQty := CountLines;
0
Answers
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
Follow my blog at http://x-dynamics.blogspot.com
CountLines := 0;
OrderLinesQty := 0;
//Lars