$smarty->assign('action', $action); require_once dirname(__FILE__) . '/../../../sources/Afup/AFUP_Compta.php'; $compta = new AFUP_Compta($bdd); if (isset($_GET['id_periode']) && $_GET['id_periode']) { $id_periode = $_GET['id_periode']; } else { $id_periode = ""; } $id_periode = $compta->obtenirPeriodeEnCours($id_periode); $smarty->assign('id_periode', $id_periode); $listPeriode = $compta->obtenirListPeriode(); $smarty->assign('listPeriode', $listPeriode); $periode_debut = $listPeriode[$id_periode - 1]['date_debut']; $periode_fin = $listPeriode[$id_periode - 1]['date_fin']; if ($action == 'lister') { $journal = $compta->obtenirJournal('', $periode_debut, $periode_fin); $smarty->assign('journal', $journal); } elseif ($action == 'debit') { $journal = $compta->obtenirJournal(1, $periode_debut, $periode_fin); $smarty->assign('journal', $journal); } elseif ($action == 'credit') { $journal = $compta->obtenirJournal(2, $periode_debut, $periode_fin); $smarty->assign('journal', $journal); } elseif ($action == 'ajouter' || $action == 'modifier') { $formulaire =& instancierFormulaire(); if ($action == 'modifier') { $champsRecup = $compta->obtenir($_GET['id']); $champs['idcompte'] = $champsRecup['idcompte']; $champs['date_saisie'] = $champsRecup['date_ecriture']; $champs['idoperation'] = $champsRecup['idoperation']; $champs['idcategorie'] = $champsRecup['idcategorie'];