e225b102c82e9f3b5fb81f7712183f4953421aae
4 require_once __DIR__
. '/../_inc.php';
6 $cats = new Compta_Categories
;
11 $cat = $cats->get(utils
::get('cat'));
15 throw new UserException("La catégorie demandée n'existe pas.");
22 if (isset($_GET['autres']))
23 $type = Compta_Categories
::AUTRES
;
24 elseif (isset($_GET['depenses']))
25 $type = Compta_Categories
::DEPENSES
;
27 $type = Compta_Categories
::RECETTES
;
30 $journal = new Compta_Journal
;
32 $list = $journal->getListForCategory($type === Compta_Categories
::AUTRES ?
null : $type, $cat ?
$cat['id'] : null);
34 $tpl->assign('categorie', $cat);
35 $tpl->assign('type', $type);
37 if ($type !== Compta_Categories
::AUTRES
)
39 $tpl->assign('liste_cats', $cats->getList($type));
43 foreach ($list as &$row)
45 $db = DB
::getInstance();
47 $db->simpleQuerySingle('
48 SELECT sum(CASE WHEN montant > 0 THEN montant ELSE 0 END)
50 WHERE compta_flux.id_journal = ?', false, $row['id']);
51 $total +
= round((float) $row['montant'], 2);
53 $tpl->assign('journal', $list);
54 $tpl->assign('total', $total);
56 $tpl->display('admin/compta/operations/index.tpl');