Files
afup/htdocs/pages/administration/compta_balance.php
2020-04-21 15:15:42 +02:00

81 lines
2.2 KiB
PHP

<?php
// Impossible to access the file itself
use Afup\Site\Comptabilite\Comptabilite;
/** @var \AppBundle\Controller\LegacyController $this */
if (!defined('PAGE_LOADED_USING_INDEX')) {
trigger_error("Direct access forbidden.", E_USER_ERROR);
exit;
}
$action = verifierAction(array('lister', 'editer','raccourci','view'));
//$compte = verifierAction(array('espece','paypal','courant','livreta'));
//$tris_valides = array('Date', 'Evenement', 'catégorie', 'Description');
//$sens_valides = array('asc', 'desc');
$smarty->assign('action', $action);
if (isset($_GET['details']) && $_GET['details'])
$details=$_GET['details'];
else
$details ="";
$compta = new Comptabilite($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'];
$smarty->assign('compteurLigne',1);
if ($action == 'lister') {
$balance = $compta->obtenirBalance('',$periode_debut,$periode_fin);
$smarty->assign('balance', $balance);
$totalDepense = $compta->obtenirTotalBalance(1,$periode_debut,$periode_fin);
$smarty->assign('totalDepense', $totalDepense);
$totalRecette = $compta->obtenirTotalBalance(2,$periode_debut,$periode_fin);
$smarty->assign('totalRecette', $totalRecette);
$difMontant = $totalRecette - $totalDepense ;
$smarty->assign('difMontant', $difMontant);
if ($details!='')
{
$dataDetails = $compta->obtenirBalanceDetails($details,$periode_debut,$periode_fin);
$smarty->assign('dataDetails', $dataDetails);
$sousTotal = $compta->obtenirSousTotalBalance($details,$periode_debut,$periode_fin);
$smarty->assign('sousTotal', $sousTotal);
}
}
if ($action == 'view' && $details) {
$dataDetails = $compta->obtenirBalanceDetails($details,$periode_debut,$periode_fin);
$smarty->assign('dataDetails', $dataDetails);
$sousTotal = $compta->obtenirSousTotalBalance($details,$periode_debut,$periode_fin);
$smarty->assign('sousTotal', $sousTotal);
}
?>