Ajout du support des écritures ventilées.
[garradin.git] / www / admin / compta / exercices / journal.php
1 <?php
2 namespace Garradin;
3
4 require_once __DIR__ . '/../_inc.php';
5
6 $exercices = new Compta_Exercices;
7
8 $exercice = $exercices->get((int)utils::get('id'));
9
10 if (!$exercice)
11 {
12 throw new UserException('Exercice inconnu.');
13 }
14
15 $liste_comptes = $comptes->getListAll();
16
17 function get_nom_compte($compte)
18 {
19 if (is_null($compte))
20 return '';
21
22 global $liste_comptes;
23 return $liste_comptes[$compte];
24 }
25
26 $tpl->register_modifier('get_nom_compte', 'Garradin\get_nom_compte');
27 $journal = $exercices->getJournal($exercice['id']);
28 $id = -1;
29 foreach ($journal as &$ligne)
30 {
31 if ($ligne['id'] == $id)
32 {
33 unset($ligne['date']);
34 unset($ligne['libelle']);
35 }
36 else
37 {
38 $id = $ligne['id'];
39 }
40 }
41 $tpl->assign('journal', $journal);
42
43 $tpl->assign('cloture', $exercice['cloture'] ? $exercice['fin'] : time());
44 $tpl->assign('exercice', $exercice);
45
46 $tpl->display('admin/compta/exercices/journal.tpl');
47
48 ?>