Monthly Sales Report Location wise

varunkgvarunkg Member Posts: 8
I need a report with matrix

Location AAA BBB CCC
AGD 139,9 0 0
AGR 0 0 0
AHM 0 0 0
ALL 0 0 0
AMB 0 0 0
BBSR 0 0 0

AAA,BBB,CCC (Sales Person Code)
I use Location Table and Sales person table as record variable and SER as a code field with Array(Dim=5)
I am storing data in a field Value(Dim=5)
But i an not able to get the data when i put the following code
////
SIH.RESET;
SIH.SETRANGE(SIH."Posting Date",SDATE,EDATE);
SIH.SETFILTER(SIH."Sles Person Code",SER);
SIH.SETFILTER(SIH."Location Code",Code);
IF SIH.FINDFIRST THEN BEGIN
REPEAT
SIL.RESET;
SIL.SETRANGE(SIL."Document No.",SIH."No.");
IF SIL.FIND('-') THEN BEGIN
REPEAT
VALUE += SIL."Line Amount" ;
UNTIL
SIL.NEXT=0;
END;
UNTIL
SIH.NEXT=0;
END;

SIH= Sales Inv Header
SIl = Sales iNv Line
////


But when i write code for each sales person its working like where is the mistake
///??
////
SIH.RESET;
SIH.SETRANGE(SIH."Posting Date",SDATE,EDATE);
SIH.SETFILTER(SIH."Sles Person Code",SER[1]);
SIH.SETFILTER(SIH."Location Code",Code);
IF SIH.FINDFIRST THEN BEGIN
REPEAT
SIL.RESET;
SIL.SETRANGE(SIL."Document No.",SIH."No.");
IF SIL.FIND('-') THEN BEGIN
REPEAT
VALUE[1] += SIL."Line Amount" ;
UNTIL
SIL.NEXT=0;
END;
UNTIL
SIH.NEXT=0;
END;

//?? Then for 2,3,4 etc

Please let me know what is wrong with code.


Thanks
VARUN GUPTA

Comments

  • JDVyskaJDVyska Member Posts: 179
    Question: Any chance it can be an RTC report? Some of the Matrix options for that make this much simpler.


    Separately, you're using Value without any noticeable iteration of i, so i never changes?
    JEREMY VYSKA
    CEO, Spare Brained Ideas, Göteborg, Sweden
    New (April 2021) Getting Started with Microsoft Dynamics 365 Business Central Book Available: "Your First 20 Hours with Business Central"
Sign In or Register to comment.