Calculation of data

Horse06Horse06 Member Posts: 496
edited 2006-09-13 in Navision Attain
Hi expert, I have a little trouble in one program. We added some persons (Sales Assistant) in the Salesperson/Purchaser table and added extra field Sales Assistant which we added in the Salesperson/Purchaser in the Sales Order form. We need to create a report and calculate how many sales sold by each salesperson and sales assisant. I can create a report separately(one for salesperson, one for sales assistant). My question is how I can put salesperson and sales assisant together in one report.
Check one selection( sales including salesperson and sales assistant) and calcualte the total sales order and amount.
Check another selection(Sales excluding Sales Assistant) and calculate the total and this need to deduct the sales from sales assistant.
The output is like this:
Salesperson XXX
Sales Order 12
Salesperson XXXX
Sales Order 15

Total Sales Order 27

I tried to program like this:
Create two sections: A) one for salesperson with sales Assisatant
B) One for salesperosn without sales Assistant


In A) Currreport.Showoutput((Salesperson Code='xx' )or (salesperson Code='yy'
In B) add something like A, but show different code.
The problem is if we want to retrieve the data for those without sales assistant, they are the same as the sales with assistant including the total sales order.
Expert how can we create one report for all functionality. Thanks!!!

Comments

  • KowaKowa Member Posts: 923
    If the sales assistant code is not available in the ledger entry, you can use the order document, provided it isn't deleted after invoicing.
    You can use the document no. of the value entry to find the sales invoice header. Here is a field "Order No.", by which you can find the Order. If you have checked "Only Sales without assistant", code
    If OnlySalesWithoutAssistant then 
      If SalesOrder."Sales Assistant" <> '' 
         then Currreport.skip;
    

    If the Orders are deleted after invoicing, create the "Sales Assistant" field in the posted documents tabe too using the same field ID ( Sales Invoice , Credit Memo etc.). This is advisable in any case to prevent these field ID's being used for other purposes ( this would result in posting errors or false field values)

    If the sales assistant code is copied to the ledger entries, it would enable to define new flowfields and flowfilterfields ( date , location etc.) in the Salesperson table which would calculate all values at once. In this case, Codeunits 22 and 80 have to be modified to copy the field values and at least one additional key with Sumindex for the Sales Amount is needed for the value entries.
    Kai Kowalewski
  • Horse06Horse06 Member Posts: 496
    Thanks! I am working on this right now. I have another question for you. In the dataitem, I group the salesperson. But I want to create another section in the report to group the sales assistant. I create a boolean and in the option tab, when the boolean variable is checked, I want to calculate the total by the sales assistant. How can I Code Group the sales Assistant? Thanks!
  • KowaKowa Member Posts: 923
    To create group totals , you need the CREATETOTALS Function ( or Property ) and the TOTALSCAUSEDBY Function in a group footer section of the report. The online help will tell you more about these functions.
    Kai Kowalewski
  • David_CoxDavid_Cox Member Posts: 509
    Kowa wrote:
    To create group totals , you need the CREATETOTALS Function ( or Property ) and the TOTALSCAUSEDBY Function in a group footer section of the report. The online help will tell you more about these functions.

    Just one more consideration is there needs to be a Key, with the fields in

    Field 1, Field 2,Field 3
    Each element of the key can create a group and a total

    Would give you grouping sections
    Report Header
    Field 1 group Header
    >>Field 2 group Header
    >>>>Field 3 group header
    >>>>>>>Detail Line
    >>>>Field 3 group Footer
    >>Field 2 group Footer
    Field 1 group Footer
    Report footer

    Use the wizard to create a grouped report and study the sections PreDataItem code

    Looking again at your original post, if I am right you have two fields on the sales header, Sales Person and Sales Assistant, if so you can just add a Key to the Sales Header for your Sales Assistant, and in your report create two dataItems
    one grouped by Sales Person where Sales Person <> '', and the other grouped by Sales Assistant where the Sales Assistant <> ''
    Analyst Developer with over 17 years Navision, Contract Status - Busy
    Mobile: +44(0)7854 842801
    Email: david.cox@adeptris.com
    Twitter: https://twitter.com/Adeptris
    Website: http://www.adeptris.com
Sign In or Register to comment.