Announcement

Collapse
No announcement yet.

Leads by activity (reporting)

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

  • Leads by activity (reporting)

    I try to make a report similar to the demo report "leads by activity",

    Click image for larger version

Name:	
Views:	0
Size:	38.1 KB
ID:	26532

    in order to see who has not been contacted for 'a long time' (1 month) . I tried to edit the report on demo site to understand how to do it. however it does not show any editable parameters .. as shown by the following picture.

    Click image for larger version

Name:	
Views:	0
Size:	21.7 KB
ID:	26533
    Last edited by Patrick; 02-14-2017, 07:50 AM.

  • #2
    this is what i tried to reproduce a similar report, but no avail.

    Comment


    • #3
      The report also can be programmed. Leads by Last Activity report is defined in code. There are a path application/Espo/Modules/Advanced/Reports/LeadsByLastActivity.php , if you have Advanced Pack

      Comment


      • #4
        Hi Tanya,

        Thank you for your prompt reply.

        What are the recommended way of producing program-based report?

        Will a custom-programmed report be 'overwritten' with each upgrade of advanced pack?

        Thank you.

        Comment


        • #5
          This report could be overwritten only in case of bug founding. Other reports, you want to create in such way will be safe.

          If you want to create own internal report, you this one as example.
          You can set it only through database (you can create through UI, but it needs modifications in db).
          Look at this report (table report, id 001). The main columns are is_internal (set as 1), and internal_class_name.

          The main code is in application/Espo/Modules/Advanced/Services/Report.php

          Comment


          • #6
            Thank you Tanya, I'm looking into it.

            Comment


            • #7
              I am trying to create a custom report. I have added a record to reports table that has this data:
              '011', 'Commsion Payment', '0', 'CommisionPaymentReport', 'Grid', NULL, '["id","agent_first_name","agent_last_name", "first_name", "last_name","application_id", "policy_number","effective_date","year", "status","premium_fee","subsidy","monthly_paym ent" , "plan_name", "carrier_name","received_on", "paid_on", "commission", "agent_commission","commission_for","calc_comm issi on"]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '#6FA8D6', '', '', NULL, '1', 'Advanced:CommisionPayment', '2014-11-05 14:43:16', '2014-11-05 14:43:16', '', NULL, NULL, NULL, NULL, NULL, '0', '1', '1', '1'

              I have created a CommisionPayment.php and have added to application\Modules\Advance\CommissionPayment.php
              ***

              I am not able to get anything to display, but I also do not get any errors. Did I miss anything?
              Last edited by yuri; 04-10-2017, 08:04 AM.

              Comment


              • #8
                Is there any error in server log (not data/logs)? I think something must be there. What is return by server (F12 > Network tab, run report to see response).

                Comment


                • #9
                  This is what I get
                  Uncaught TypeError: Cannot read property 'indexOf' of undefined
                  at ReportHelper.formatGroup (eval at _execute (http://dev.crm.clragroup.us/client/e...69099:16:26553), <anonymous>:41:20)
                  at n.eval (eval at _execute (http://dev.crm.clragroup.us/client/e...69099:16:26553), <anonymous>:53:127)
                  at Array.forEach (native)
                  at n.afterRender (eval at _execute (http://dev.crm.clragroup.us/client/e...69099:16:26553), <anonymous>:51:37)
                  at n._afterRender (http://dev.crm.clragroup.us/client/e...69099:16:10601)
                  at n.<anonymous> (http://dev.crm.clragroup.us/client/e...69099:16:10295)
                  at n.<anonymous> (http://dev.crm.clragroup.us/client/e...69099:16:14243)
                  at Bull.Templator.<anonymous> (http://dev.crm.clragroup.us/client/e...69099:16:21317)
                  at http://dev.crm.clragroup.us/client/e...69099:16:26702
                  at Array.forEach (native)
                  espo.min.js?r=1486112069099:2



                  if (~gr.indexOf('MONTH:')) {
                  return moment(value + '-01').format('MMM YYYY');
                  } else if (~gr.indexOf('DAY:')) {
                  return moment(value).format('MMM DD');
                  }


                  What I am not sure is what is return format for a List report?


                  $result = array( 'type' => 'List', 'groupBy' => $groupBy, 'columns' => $columns, 'columnsData'=> $columnsData, 'sums' => $sums, 'groupNameMap' => $groupNameMap, 'columnNameMap' => $columnNameMap, 'depth' => 1, 'grouping' => $grouping, 'reportData' => $reportData, 'entityType' => 'CommisionPaymentReport', ); return $result; here is my data:
                  $sth = $pdo->prepare($sql); $sth->execute(); $data = $sth->fetchAll(); foreach ($data as $row) { $id = $row["id"]; $resultData['id']= array( 'id' => $row['id'], 'agent_first_name' => $row['agent_first_name'], 'agent_last_name' => $row['agent_last_name'], 'first_name' => $row['first_name'], 'last_name' => $row['last_name'], 'application_id' => $row['application_id'], 'policy_number' => $row['policy_number'], 'effective_date' => $row['effective_date'], 'year' => $row['year'], 'status' => $row['status'], 'premium_fee' => $row['premium_fee'], 'subsidy' => $row['subsidy'], 'monthly_payment' => $row['monthly_payment'], 'plan_name' => $row['plan_name'], 'carrier_name' => $row['carrier_name'], 'received_on' => $row['received_on'], 'paid_on' => $row['paid_on'], 'commission' => $row['commission'], 'agent_commission' => $row['agent_commission'], 'commission_for' => $row['commission_for'], 'calc_commission' => $row['calc_commission'] ); } return $resultData;

                  Comment


                  • #10
                    You can try to create similar report through UI and then replicate return format in your custom report.

                    Comment


                    • #11
                      Thats how I got this far, for a list report which items are needed to be passed in?

                      Comment


                      • #12
                        What am trying to do is have the report be created from SQL statement, because you do not support the reporting on multiple objects. I am not sure if the data been passed back is in the correct format. I am not sure if am passing all the necessary parameters.

                        Comment


                        • #13
                          1st question, is this the right format or do I just pass back the $data variable?
                          foreach ($data as $row) { $id = $row["id"]; $resultData['id']= array( 'id' => $row['id'], 'agent_first_name' => $row['agent_first_name'], 'agent_last_name' => $row['agent_last_name'], 'first_name' => $row['first_name'], 'last_name' => $row['last_name'], 'application_id' => $row['application_id'], 'policy_number' => $row['policy_number'], 'effective_date' => $row['effective_date'], 'year' => $row['year'], 'status' => $row['status'], 'premium_fee' => $row['premium_fee'], 'subsidy' => $row['subsidy'], 'monthly_payment' => $row['monthly_payment'], 'plan_name' => $row['plan_name'], 'carrier_name' => $row['carrier_name'], 'received_on' => $row['received_on'], 'paid_on' => $row['paid_on'], 'commission' => $row['commission'], 'agent_commission' => $row['agent_commission'], 'commission_for' => $row['commission_for'], 'calc_commission' => $row['calc_commission'] ); } return $resultData; 2nd question, is this the right format to be passed back by the run method?
                          $result = array( 'type' => 'List', 'groupBy' => $groupBy, 'columns' => $columns, 'columnsData'=> $columnsData, 'sums' => $sums, 'groupNameMap' => $groupNameMap, 'columnNameMap' => $columnNameMap, 'depth' => 1, 'grouping' => $grouping, 'reportData' => $reportData, 'entityType' => 'CommisionPaymentReport', ); return $result; Thank you for your help

                          Comment


                          • #14
                            Originally posted by cfernandez View Post
                            I am trying to create a custom report. I have added a record to reports table that has this data:

                            I have created a CommisionPayment.php and have added to application\Modules\Advance\CommissionPayment.php
                            application/Espo/Modules/Advanced/Reports/CommissionPayment.php - path of your report
                            CommisionPaymentReport - did you create this entity? If I remember well, 4-th column is target entity name

                            Comment


                            • #15
                              Yes, I created the entity and it has the same structure as the query which I am using.

                              Comment

                              Working...
                              X