You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2013-02-05 12:34:46

LRC
Member
Registered: 2013-01-14
Posts: 6

Graphique mreporting

Bonjour à tous!

Je suis actuellement en stage et ma mission est la suivante:

Permettre à mon tuteur d'afficher un graphique avec mreporting, des tickets clos et des tickets ouverts par jour et selon le groupe sélectionné dans la liste déroulante ainsi que la date de début et de fin.

J'aimerais que la la courbe des tickets ouverts représente les status new, assign, plan, waiting, et que la courbe des tickets clos représentent les status solved et closed.
Pour le moment voici ce que j'ai pu faire mais je suis encore loin du compte:


function reportHgbarTicketNumberByServiceTest() {
           global $DB;
      
      $delay = 30;
      $this->sql_date = PluginMreportingMisc::getSQLDate("glpi_tickets.date",$delay);
      
        echo "<form name='form' method='post'>";
        echo "<table class='tab_cadre' width='5'>";
        echo "<tr class='tab_bg_1'><td width='35'>".$LANG['reports'][35]."</td>";
        echo "<td>";
        Dropdown::show('Group', array(
         'value' => isset($_REQUEST['groups_id'])?$_REQUEST['groups_id']:0,
         'entity' => $_SESSION["glpiactive_entity"]
         ));
         
        
        echo "</td><td class='center' width='35'>";
        echo "<input type='submit' value=\"".$LANG['reports'][15]."\" class='submit'>";
        echo "</td></tr>";
        echo "</table></form>";
      if (!isset($_REQUEST['groups_id'])) {
         echo "<center><b>Selectionner un groupe ci dessus</b></center>";
         return false;
      }
      
      $datas = array();
      
      foreach($this->filters as $class=>$filter) {
         $datas['labels2'][$class] = $filter['label'];
         $query = "
            SELECT COUNT(*)
            FROM glpi_tickets
            WHERE id NOT IN (
               SELECT tickets_id
               FROM glpi_groups_tickets
               WHERE glpi_groups_tickets.type = 1
            )
            AND glpi_tickets.entities_id IN (".$this->where_entities.")
            AND ".$this->sql_date."
            
            AND status IN('".implode("', '", array_keys($filter['status']))."')
         ";
         $result = $DB->query($query);
         $datas['datas'][$LANG['common'][49]][$class] = $DB->result($result, 0, 0);
         $query = "
            SELECT
                DATE_FORMAT(date, '%y%m%d') as month,
                DATE_FORMAT(date, '%d%b%y') as month_l,
                COUNT(glpi_tickets.id) as count
            FROM glpi_tickets, glpi_groups_tickets, glpi_groups
            WHERE glpi_tickets.id = glpi_groups_tickets.tickets_id
            AND glpi_tickets.entities_id IN (".$this->where_entities.")
            AND glpi_groups_tickets.groups_id = glpi_groups.id
            AND glpi_groups_tickets.type = 1
            AND glpi_tickets.is_deleted = '0'
            AND ".$this->sql_date."            
            AND glpi_tickets.status IN('".implode("', '", array_keys($filter['status']))."')
            GROUP BY month,
            ORDER BY month ";
            
         $result = $DB->query($query);
         while ($data = $DB->fetch_assoc($res)) {
         $status =Ticket::getStatus($data['status']);
         $datas['labels2'][$data['month_l']] = $data['month_l'];
         $datas['datas'][$status][$data['month_l']] = $data['nb'];
        }
      }
      return $datas;
   }

Sa fait maintenant pas mal de temps que je coince, si quelqu'un pouvait m'aider s'il vous plait, je lui en serais très reconnaissant smile

Offline

Board footer

Powered by FluxBB