Announcement

Collapse
No announcement yet.

System report - Sales by Month showing wrong numbers

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • System report - Sales by Month showing wrong numbers

    Hello guys,

    I am currently facing an issue where one of our users is using the system report "Sales by Month" on the dashboard and it seems like it is showing wrong numbers. For example, for May he sees €5mil and when I use exactly the same report and add it to my dashboard it shows €1mil in May..

    Do you have any idea what could be causing this?

    Thanks a lot for the help!
    Attached Files

  • #2
    It is normal, this report is using withStrictAccessControl() which means it applies min access control to the current user. the current user would see the number of sales they have achieved based on the opportunities assigned to them. see the report here https://github.com/espocrm/espocrm/b...yMonth.php#L44
    Rabii
    Web Dev

    Comment


    • #3
      rabii hey man thanks a lot, is there any info about conditions for records displayed in this report? for example, close date, status "Closed won" etc.? I cannot see it in the script you sent me. I need to figure out why the colleague sees 5mil EUR in the May. Thanks a lot

      Comment


      • #4
        Yes in fact the report is build based on certain conditions. first thing is the date it is a report for the current fiscal year (starts from 01-01-2023 and ends at 31-12-2023) - the report fetch all opportunities that have a status (closed won) and then it gets the results of the closeDate and the amountConverted see the code below:

        PHP Code:
        $whereClause = [
            
        'stage' => $this->util->getWonStageList(),
        ];

        $whereClause[] = [
            
        'closeDate>=' => $from->getString(),
            
        'closeDate<' => $to->getString(),
        ];

        $queryBuilder
            
        ->select([
                [
        'MONTH:closeDate''month'],
                [
        'SUM:amountConverted''amount'],
            ])
            ->
        order('MONTH:closeDate')
            ->
        group('MONTH:closeDate')
            ->
        where($whereClause); 
        As you can see the query is built here with these conditions. Also notice that the report applied the controlAccess which means that every user will view the result of the opportunities assigned to them and also they need to have access to the amount field in the opportunity entity.

        Your colleague sees 5mil EUR because he is assigned opportunities that are closed won for current year which their amountConverted total value is 5mil EUR. are you the admin of the crm correct ? keep in mind even if you are admin still the report will apply the accessControl to fetch the data.
        Rabii
        Web Dev

        Comment


        • Jakub Grufik
          Jakub Grufik commented
          Editing a comment
          ah okay that makes sense, thanks a lot for the help mate! appreciate it

      • #5
        if you are the admin i suggest that you log into your colleague session and check what are the opportunities assigned to him to figure out what is happening.
        Rabii
        Web Dev

        Comment


        • #6
          hmm that is weird, I just made quick report where I am using same condition as the system report and I am getting different numbers, maybe it is caused by amountConverted, because I am able to use only Amount in the report not the converted one, I am going to check if the amountConverted is filled incorrectly somewhere..
          Attached Files

          Comment


          • rabii
            rabii commented
            Editing a comment
            use just assignedUser and select the correct assigneduser (when using assignedUser.userName starts with the query will be different and will fetch all assigned users that starts with Dav).

          • Jakub Grufik
            Jakub Grufik commented
            Editing a comment
            there is only one user with user.name starting with "david.kubacak"

        • #7
          rabii also when I filtered out opportunities in the system and checked ammounConverted it is not 5mil EUR not even close.. I dont know where the system report is getting those numbers
          Attached Files

          Comment


          • #8
            When I added stage Closed Won, it returned just two record with SUM: amountConverted 43kEUR...weird
            Attached Files

            Comment


            • rabii
              rabii commented
              Editing a comment
              but you have set closeDate to last month only

            • Jakub Grufik
              Jakub Grufik commented
              Editing a comment
              because the system report Sales by month shows wrong numbers in May, which is last month

          • #9
            what your base currency in the system ? do you use only one or multiple currencies ? if yes check out the conversion rate
            Rabii
            Web Dev

            Comment


            • Jakub Grufik
              Jakub Grufik commented
              Editing a comment
              we are using CZK and EUR, conversion rate is 0.04EUR = 1 CZK

          • #10
            i just noticed that the report maybe is wrong only for the label hence the other user use w different language. the chart is correct in both pic you showed there to make sure can you chnage the language of the other user to english and refresh to see if the misatek will be fixed ?
            Rabii
            Web Dev

            Comment


            • Jakub Grufik
              Jakub Grufik commented
              Editing a comment
              sure thing, on it

          • #11
            rabii nah the report still shows 5mil EUR in May even in English language (I tried refresh and also add report to the dashboard again after the change)
            Attached Files

            Comment


            • #12
              check the date filter of the dashlet ?
              Rabii
              Web Dev

              Comment


              • Jakub Grufik
                Jakub Grufik commented
                Editing a comment
                Current year, all good. Same numbers in May even when I changed it to Current quarter

            • #13
              that is weird - i can think of any other thing. create a report for david and get sum of all amount no filter
              Rabii
              Web Dev

              Comment


              • #14
                no filter, just assignedUser David
                Attached Files

                Comment


                • #15
                  You can see that there is only 80K in May 2023.

                  I have tried all these scenarios on my local dev and it works as expected. which version you are using ?
                  Rabii
                  Web Dev

                  Comment


                  • Jakub Grufik
                    Jakub Grufik commented
                    Editing a comment
                    Current version: 7.3.3
                    Advanced Pack 2.13.9
                    Reports, Workflows, BPM.


                    Google Integration 1.5.5
                    Google Calendar and Google Contacts integrations. Gmail secure authentication.
                Working...
                X