Uploaded image for project: 'ASTPP Community'
  1. ASTPP Community
  2. ASTPPCOM-455

Dashboard call count and pie chart

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Done
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:

      Description

      Hello,

      I have picked up, what I think is an issue in 3.6 on the dashboard where the call count (Answered, failed) etc is counting the provider calls as well as customers / resellers. This gives an inaccurate count of calls and in a way it is a duplication. The provider and customers / reseller count should be separated.

      I have modified the code in /astpp/application/modules/dashboard/model/dashboard_model.php to exclude provider calls on the call count. See code below:

      function get_call_statistics($table, $parent_id, $start_date = '', $end_date = '', $group_flag = true) {
                      $this->db->select ( "count(uniqueid) as sum,
                                 count(CASE WHEN billseconds > 0 THEN 1 END) as answered,
                                 MAX(billseconds) AS mcd,
                                 SUM(billseconds) AS duration,
                                 count(CASE WHEN disposition NOT IN ('NORMAL_CLEARING','SUCCESS','NORMAL_CLEARING [16]') THEN 1 END) as failed,
                                 SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,
                                 sum(debit-cost) as profit,
                                 sum(debit) as debit,
                                 sum(cost) as cost,
                                 SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,
                                 DAY(callstart) as day", false );
                      $this->db->where ( 'callstart >=', $start_date . " 00:00:00" );
                      $this->db->where ( 'callstart <=', $end_date . " 23:59:59" );
                      $this->db->where ( 'reseller_id', $parent_id );
                      if ($table == cdrs)
                              $this->db->where ( 'type !=', "3" );
                      if ($group_flag)
                              $this->db->group_by ( "DAY(callstart)" );
                      $result = $this->db->get ( $table );
                      return $result;
              }
      

      I have added the following to exclude providers:

      if ($table == cdrs)
                              $this->db->where ( 'type !=', "3" );
      

      For the pie chart I add the same in the where clause but not sure how to use it in the parameters. I add AND type != '3' after the $where parameter in the SELECT query.

      function get_customer_maximum_callminutes($start_date, $end_date) {
                      $start_date = $start_date . " 00:00:00";
                      $end_date = $end_date . " 23:59:59";
                      $accountinfo = $this->session->userdata ( 'accountinfo' );
                      $parent_id = ($accountinfo ['type'] == 1) ? $accountinfo ['id'] : 0;
                      if ($this->session->userdata ( 'userlevel_logintype' ) != 0 && $this->session->userdata ( 'userlevel_logintype' ) != 3) {
                              $where = "reseller_id ='$parent_id'";
                      } else {
                              $where = "accountid ='$parent_id'";
                      }
                      $where = $where . " AND callstart >= '" . $start_date . "' AND  callstart <= '" . $end_date . "'";
                      $select_query = "(SELECT sum( billseconds ) AS billseconds,accountid FROM (cdrs) WHERE $where AND type != '3' group by accountid order$
                              union
                              (SELECT sum( billseconds ) AS billseconds,accountid FROM (reseller_cdrs) WHERE $where 
                              group by accountid order by sum(billseconds) desc limit 10 ) ORDER BY billseconds DESC LIMIT 10 ";
                      return $this->db->query ( $select_query );
              }
              function get_customer_maximum_callcount($start_date, $end_date) {
                      $start_date = $start_date . " 00:00:00";
                      $end_date = $end_date . " 23:59:59";
                      $accountinfo = $this->session->userdata ( 'accountinfo' );
                      $parent_id = ($accountinfo ['type'] == 1) ? $accountinfo ['id'] : 0;
                      if ($this->session->userdata ( 'userlevel_logintype' ) != 0 && $this->session->userdata ( 'userlevel_logintype' ) != 3) {
                              $where = "reseller_id ='$parent_id'";
                      } else {
                              $where = "accountid ='$parent_id'";
                      }
                      $where = $where . " AND callstart >= '" . $start_date . "' AND  callstart <= '" . $end_date . "'";
                      $select_query = "(SELECT count(uniqueid) as call_count, `accountid` FROM (`cdrs`) WHERE $where AND type != '3' GROUP BY `accountid` OR$
                UNION
                (SELECT count(uniqueid) as call_count,accountid FROM (reseller_cdrs) WHERE $where GROUP BY `accountid` ORDER BY `call_count` desc LIMIT 10)
                ORDER BY call_count desc limit 10";
                      return $this->db->query ( $select_query );
      

        Attachments

          Activity

            People

            Assignee:
            samir.doshi Samir Doshi
            Reporter:
            fozzygo4 fozzygo4
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: