Artifacts Associated With Ticket e6a2c8e0d9b280b5

  1. Ticket change [90398bc3e0] (rid 3375) by ghostdog on 2014-11-21 17:13:49:

    1. foundin initialized to: "0.6.2"
    2. icomment:
      Les camemberts dans la vue comptabilité montre des pourcentages en nombre de transaction et pas en valeur de transaction (c'est à dire si vous avez 2 catégories de recettes une de 50€ et une de 150€: le camembert est coupé en deux parts égales).
      
      Le patch ci-dessous permet d'avoir des pourcentages par valeur.
      
      $ diff -u include/libs/svgplot/lib.svgpie.php.orig include/libs/svgplot/lib.svgpie.php
      --- include/libs/svgplot/lib.svgpie.php.orig    2014-11-21 16:12:54.841072386 +0100
      +++ include/libs/svgplot/lib.svgpie.php 2014-11-21 16:54:43.147069985 +0100
      @@ -64,15 +64,15 @@
      
                              foreach ($this->data as $row)
                              {
      -                               $sum += $row->data;
      +                               $sum += $row->somme;
                              }
      
                              foreach ($this->data as $row)
                              {
      -                               $row->angle = ceil(360 * $row->data / $sum);
      +                               $row->angle = ceil(360 * $row->somme / $sum);
      
      -                   $start_angle = $end_angle;
      -                   $end_angle = $start_angle + $row->angle;
      +                               $start_angle = $end_angle;
      +                               $end_angle = $start_angle + $row->angle;
      
                                      $x1 = $cx + $radius * cos(deg2rad($start_angle));
                                      $y1 = $cy + $radius * sin(deg2rad($start_angle));
      @@ -84,7 +84,7 @@
      
                                      $out .= "<path d=\"M{$cx},{$cy} L{$x1},{$y1} A{$radius},{$radius} 0 {$arc},1 {$x2},{$y2} Z\"
                                              fill=\"{$row->fill}\" stroke=\"white\" stroke-width=\"".($circle_size * 0.005)."\" stroke-linecap=\"round\"
      -                                       stroke-linejoin=\"round\" />";
      +                                       stroke-linejoin=\"round\" />" . PHP_EOL;
                              }
                      }
      
      @@ -132,12 +132,14 @@
              public $fill = 'blue';
              public $data = 0.0;
              public $label = null;
      +       public $somme = 0.0;
      
      -       public function __construct($data, $label = null, $fill = 'blue')
      +       public function __construct($data, $label = null, $fill = 'blue', $somme)
              {
                      $this->data = $data;
                      $this->fill = $fill;
                      $this->label = $label;
      +               $this->somme = $somme;
              }
       }
      
      
      $ diff -u include/class.compta_stats.php.orig include/class.compta_stats.php
      --- include/class.compta_stats.php.orig 2014-11-21 16:26:11.011071624 +0100
      +++ include/class.compta_stats.php      2014-11-21 16:32:23.436071268 +0100
      @@ -7,7 +7,7 @@
              protected function _parRepartitionCategorie($type)
              {
                      $db = DB::getInstance();
      -               return $db->simpleStatementFetch('SELECT COUNT(*) AS nb, id_categorie
      +               return $db->simpleStatementFetch('SELECT COUNT(*) AS nb, id_categorie, SUM(montant) AS somme
                              FROM compta_journal
                              WHERE id_categorie IN (SELECT id FROM compta_categories WHERE type = ?)
                              AND id_exercice = (SELECT id FROM compta_exercices WHERE cloture = 0)
      
      
      $ diff -u www/admin/compta/pie.php.orig www/admin/compta/pie.php
      --- www/admin/compta/pie.php.orig       2014-11-21 16:40:08.583070822 +0100
      +++ www/admin/compta/pie.php    2014-11-21 16:38:38.373070908 +0100
      @@ -33,6 +33,7 @@
              }
      
              $others = 0;
      +       $somme_others = 0;
              $colors = ['#c71', '#941', '#fa4', '#fd9', '#ffc', '#cc9'];
              $max = count($colors);
              $i = 0;
      @@ -42,17 +43,18 @@
                      if ($i++ >= $max)
                      {
                              $others += $row['nb'];
      +                       $somme_others += $row['somme'];
                      }
                      else
                      {
                              $cat = $categories[$row['id_categorie']];
      -                       $pie->add(new \SVGPie_Data($row['nb'], substr($cat['intitule'], 0, 50), $colors[$i-1]));
      +                       $pie->add(new \SVGPie_Data($row['nb'], substr($cat['intitule'], 0, 50), $colors[$i-1], $row['somme']));
                      }
              }
      
              if ($others > 0)
              {
      -               $pie->add(new \SVGPie_Data($others, 'Autres', '#ccc'));
      +               $pie->add(new \SVGPie_Data($others, 'Autres', '#ccc', $somme_others));
              }
      
              Static_Cache::store('pie_' . $graph, $pie->output());
      
    3. login: "ghostdog"
    4. mimetype: "text/x-fossil-plain"
    5. private_contact initialized to: "f49fb24b6279d8e333bc8f352600b84edcc7cdb6"
    6. severity initialized to: "Minor"
    7. status initialized to: "Open"
    8. title initialized to:
      Camemberts de recettes/dépenses par valeur plutot que par nombre de transactions
      
    9. type initialized to: "Feature_Request"
  2. Ticket change [ebaa77ec8a] (rid 3376) by ghostdog on 2014-11-21 17:26:31:

    1. icomment:
      Mise à jour du patch sur la requête SQL pour que les catégories soient retournées par ordre décroissant de valeur:
      
      $ diff -u include/class.compta_stats.php.orig include/class.compta_stats.php
      --- include/class.compta_stats.php.orig 2014-11-21 16:26:11.011071624 +0100
      +++ include/class.compta_stats.php      2014-11-21 17:14:47.917068832 +0100
      @@ -7,11 +7,11 @@
              protected function _parRepartitionCategorie($type)
              {
                      $db = DB::getInstance();
      -               return $db->simpleStatementFetch('SELECT COUNT(*) AS nb, id_categorie
      +               return $db->simpleStatementFetch('SELECT COUNT(*) AS nb, id_categorie, SUM(montant) AS somme
                              FROM compta_journal
                              WHERE id_categorie IN (SELECT id FROM compta_categories WHERE type = ?)
                              AND id_exercice = (SELECT id FROM compta_exercices WHERE cloture = 0)
      -                       GROUP BY id_categorie ORDER BY nb DESC;', SQLITE3_ASSOC, $type);
      +                       GROUP BY id_categorie ORDER BY somme DESC;', SQLITE3_ASSOC, $type);
              }
      
              public function repartitionRecettes()
      
    2. login: "ghostdog"
    3. mimetype: "text/x-fossil-plain"
    4. priority changed to: "Low"
    5. resolution changed to: "Open"
  3. Ticket change [a4b531654a] (rid 3512) by bohwaz on 2015-01-02 23:56:56:

    1. icomment:
      Patch inclus dans [050e4d960ade08c18e9c403610978a8e9a7f43a7]
      
    2. login: "bohwaz"
    3. mimetype: "text/x-fossil-plain"
    4. resolution changed to: "Fixed"
    5. status changed to: "Fixed"