Ajout : ./garradin
[garradin.git] / www / admin / compta / operations / voir.php
1 <?php
2 namespace Garradin;
3
4 require_once __DIR__ . '/../_inc.php';
5
6 $journal = new Compta_Journal;
7
8 $operation = $journal->get(utils::get('id'));
9
10 if (!$operation)
11 {
12 throw new UserException("L'opération demandée n'existe pas.");
13 }
14 $exercices = new Compta_Exercices;
15
16 $tpl->assign('operation', $operation);
17
18 foreach ($operation['fluxs'] as $key => &$flux)
19 {
20 $compte = $comptes->get($flux['compte']);
21 $flux['compte_libelle'] = $compte['libelle'];
22 $flux['montant_oppose'] = - $flux['montant'];
23 }
24 $tpl->assign('fluxs', $operation['fluxs']);
25
26 $tpl->assign('exercice', $exercices->get($operation['id_exercice']));
27
28 if ($operation['id_categorie'])
29 {
30 $cats = new Compta_Categories;
31
32 $categorie = $cats->get($operation['id_categorie']);
33 $tpl->assign('categorie', $categorie);
34
35 if ($categorie['type'] == Compta_Categories::RECETTES)
36 {
37 $tpl->assign('compte', $debit['libelle']);
38 }
39 else
40 {
41 $tpl->assign('compte', $credit['libelle']);
42 }
43
44 $tpl->assign('moyen_paiement', $cats->getMoyenPaiement($operation['moyen_paiement']));
45 }
46
47 if ($operation['id_auteur'])
48 {
49 $auteur = $membres->get($operation['id_auteur']);
50 $tpl->assign('nom_auteur', $auteur['identite']);
51 }
52
53 $tpl->display('admin/compta/operations/voir.tpl');
54
55 ?>