X-Git-Url: https://git.cyclocoop.org/?p=garradin.git;a=blobdiff_plain;f=www%2Fadmin%2Fcompta%2Foperations%2Findex.php;h=e225b102c82e9f3b5fb81f7712183f4953421aae;hp=e257d684923ea747b51445f5a2e0746500ac93b2;hb=f7ee0ae730f47bfef173c394fa4db71a22dece61;hpb=1ab3343a95ed3ef4958d91dfbf49372dce8a092e;ds=sidebyside diff --git a/www/admin/compta/operations/index.php b/www/admin/compta/operations/index.php index e257d68..e225b10 100644 --- a/www/admin/compta/operations/index.php +++ b/www/admin/compta/operations/index.php @@ -32,7 +32,6 @@ $journal = new Compta_Journal; $list = $journal->getListForCategory($type === Compta_Categories::AUTRES ? null : $type, $cat ? $cat['id'] : null); $tpl->assign('categorie', $cat); -$tpl->assign('journal', $list); $tpl->assign('type', $type); if ($type !== Compta_Categories::AUTRES) @@ -41,14 +40,19 @@ if ($type !== Compta_Categories::AUTRES) } $total = 0.0; - -foreach ($list as $row) +foreach ($list as &$row) { - $total += (float) $row['montant']; + $db = DB::getInstance(); + $row['montant'] = + $db->simpleQuerySingle(' + SELECT sum(CASE WHEN montant > 0 THEN montant ELSE 0 END) + FROM compta_flux + WHERE compta_flux.id_journal = ?', false, $row['id']); + $total += round((float) $row['montant'], 2); } - +$tpl->assign('journal', $list); $tpl->assign('total', $total); $tpl->display('admin/compta/operations/index.tpl'); -?> \ No newline at end of file +?>