Top Sales sorted by item and customer.
 
            
                
                    valkatamake                
                
                    Member Posts: 38                
            
                        
            
                    Hi i need a tip for this report
i have to show top sales for item grouped by customer something like this:
So far i have this
and
it count all sales for item .. and sales TO DIFERENT customers ..
                i have to show top sales for item grouped by customer something like this:
Item A Customer5 : 400 customer 2: 250 customer 3: 200 itemB customer2 : 500 customer 4: 340
So far i have this
Item - OnAfterGetRecord ()
Number1:=0;
ItemLedgerEntry.RESET;
ItemLedgerEntry.SETCURRENTKEY("Source Type","Source No.");
ItemLedgerEntry.SETRANGE("Entry Type",ItemLedgerEntry."Entry Type"::Sale);
ItemLedgerEntry.SETRANGE("Item No.",Item."No.");
IF ItemLedgerEntry.FIND('-') THEN
  REPEAT
   ItemLedgerEntry.SETRANGE("Source No.",ItemLedgerEntry."Source No.");
   Number:= Number +1;
   ItemLedgerEntry.FIND('+');
   ItemLedgerEntry.SETRANGE("Source No.");
  UNTIL ItemLedgerEntry.NEXT=0;
Number2:=0;
ItemLedgerEntry.RESET;
ItemLedgerEntry.SETCURRENTKEY("Source Type","Source No.");
ItemLedgerEntry.SETRANGE("Entry Type",ItemLedgerEntry."Entry Type"::Sale);
ItemLedgerEntry.SETRANGE("Item No.",Item."No.");
IF ItemLedgerEntry.FIND('-') THEN
  REPEAT
      number2:= number2 -ItemLedgerEntry.Quantity; // you know that sales in item ledger entry are negative numbers //
      ItemLedgerEntry.SETRANGE("Source No.");
  UNTIL ItemLedgerEntry.NEXT=0;
ItemAmount.INIT;
ItemAmount."Item No.":= Item."No.";
ItemAmount.Amount:= Number;
ItemAmount."Amount 2":=q1;
ItemAmount.INSERT;
and
Integer - OnPreDateItem()
ItemAmount.RESET;
ItemAmount.SETCURRENTKEY(Amount);
ItemAmount.ASCENDING(FALSE);
Integer - OnAfterGetRecord()
IF Number = 1 THEN ItemAmount.FIND('-')
ELSE ItemAmount.NEXT;
Item.GET(ItemAmount."Item No.");
it count all sales for item .. and sales TO DIFERENT customers ..
0                
            Comments
- 
            What is wrong with the standard Inventory - Customer Sales Report, 713?The art of teaching is clarity and the art of learning is to listen0
- 
            too much information in value entry mistakes are very possible in fact i found some
 just want quantity not amounts and other.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 323 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
