Overview
Comment:Patch fourni dans ticket [e6a2c8e0d9] : utilisation de la somme des transactions plutôt que de leur nombre pour la taille du camembert
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 050e4d960ade08c18e9c403610978a8e9a7f43a7
User & Date: bohwaz on 2015-01-02 23:55:46
Other Links: manifest | tags
References
2015-01-02
23:56 Fixed ticket [e6a2c8e0d9]: Camemberts de recettes/dépenses par valeur plutot que par nombre de transactions plus 4 other changes artifact: a4b531654a user: bohwaz
Context
2015-01-03
00:00
version stable check-in: 6d12c73cd2 user: bohwaz tags: trunk, stable
2015-01-02
23:55
Patch fourni dans ticket [e6a2c8e0d9] : utilisation de la somme des transactions plutôt que de leur nombre pour la taille du camembert check-in: 050e4d960a user: bohwaz tags: trunk
23:40
PSR-0 progress: move countries list in KD2fw check-in: 82870b9ec8 user: bohwaz tags: trunk
Changes

Modified src/include/lib/Garradin/Compta/Stats.php from [13cd555739] to [4f574303f5].

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use \Garradin\UserException;

class Stats
{
	protected function _parRepartitionCategorie($type)
	{
		$db = DB::getInstance();
		return $db->simpleStatementFetch('SELECT COUNT(*) AS nb, id_categorie
			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);
	}

	public function repartitionRecettes()
	{
		return $this->_parRepartitionCategorie(Categories::RECETTES);
	}








|



|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use \Garradin\UserException;

class Stats
{
	protected function _parRepartitionCategorie($type)
	{
		$db = DB::getInstance();
		return $db->simpleStatementFetch('SELECT SUM(montant) AS somme, id_categorie
			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 somme DESC;', SQLITE3_ASSOC, $type);
	}

	public function repartitionRecettes()
	{
		return $this->_parRepartitionCategorie(Categories::RECETTES);
	}

Modified src/www/admin/compta/pie.php from [af72a48663] to [b09f4a0ec5].

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
	$max = count($colors);
	$i = 0;

	foreach ($data as $row)
	{
		if ($i++ >= $max)
		{
			$others += $row['nb'];
		}
		else
		{
			$cat = $categories[$row['id_categorie']];
			$pie->add(new \SVGPie_Data($row['nb'], substr($cat['intitule'], 0, 50), $colors[$i-1]));
		}
	}

	if ($others > 0)
	{
		$pie->add(new \KD2\SVGPie_Data($others, 'Autres', '#ccc'));
	}

	Static_Cache::store('pie_' . $graph, $pie->output());
}

header('Content-Type: image/svg+xml');
Static_Cache::display('pie_' . $graph);







|




|













35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
	$max = count($colors);
	$i = 0;

	foreach ($data as $row)
	{
		if ($i++ >= $max)
		{
			$others += $row['somme'];
		}
		else
		{
			$cat = $categories[$row['id_categorie']];
			$pie->add(new \KD2\SVGPie_Data($row['somme'], substr($cat['intitule'], 0, 50), $colors[$i-1]));
		}
	}

	if ($others > 0)
	{
		$pie->add(new \KD2\SVGPie_Data($others, 'Autres', '#ccc'));
	}

	Static_Cache::store('pie_' . $graph, $pie->output());
}

header('Content-Type: image/svg+xml');
Static_Cache::display('pie_' . $graph);