Example #1
0
 function test_importerFichierBanque()
 {
     $compta = new AFUP_Compta($this->bdd);
     $this->assertFalse($compta->extraireComptaDepuisCSVBanque(null));
     $this->assertFalse($compta->extraireComptaDepuisCSVBanque(array()));
     $fichierBanque = file(dirname(__FILE__) . "/data/banque.csv");
     $this->assertTrue($compta->extraireComptaDepuisCSVBanque($fichierBanque));
     $toutCompta = $compta->obtenirTous();
     $this->assertEqual(4, count($toutCompta));
     $this->assertEqual('2011-11-09', $toutCompta[0]['date_ecriture']);
     $this->assertEqual(3, $toutCompta[0]['idmode_regl']);
     $this->assertEqual(2, $toutCompta[1]['idmode_regl']);
     $this->assertEqual(4, $toutCompta[2]['idmode_regl']);
     $this->assertEqual(4, $toutCompta[3]['idmode_regl']);
     $this->assertEqual(180, $toutCompta[0]['montant']);
     $this->assertEqual(0.65, $toutCompta[1]['montant']);
     $this->assertEqual(0.65, $toutCompta[2]['montant']);
     $this->assertEqual(0.65, $toutCompta[3]['montant']);
 }
Example #2
0
<?php

// Impossible to access the file itself
if (!defined('PAGE_LOADED_USING_INDEX')) {
    trigger_error("Direct access forbidden.", E_USER_ERROR);
    exit;
}
$action = verifierAction(array('lister', 'editer'));
$smarty->assign('action', $action);
require_once dirname(__FILE__) . '/../../../sources/Afup/AFUP_Compta.php';
$compta = new AFUP_Compta($bdd);
if ($action == 'lister') {
    $listEvenement = $compta->obtenirListEvenements('liste');
    $smarty->assign('listEvenement', $listEvenement);
    if (!isset($_GET['idevnt']) || intval($_GET['idevnt']) == 0) {
        $idevnt = 8;
    } else {
        $idevnt = $_GET['idevnt'];
    }
    $smarty->assign('idevnt', $idevnt);
    $debit = $compta->obtenirSyntheseEvenement(1, $idevnt);
    $smarty->assign('debit', $debit);
    $credit = $compta->obtenirSyntheseEvenement(2, $idevnt);
    $smarty->assign('credit', $credit);
    $totalDepense = $compta->obtenirTotalSyntheseEvenement(1, $idevnt);
    $smarty->assign('totalDepense', $totalDepense);
    $totalRecette = $compta->obtenirTotalSyntheseEvenement(2, $idevnt);
    $smarty->assign('totalRecette', $totalRecette);
    $difMontant = $totalRecette - $totalDepense;
    $smarty->assign('difMontant', $difMontant);
}
Example #3
0
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 = "";
}
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'];
$smarty->assign('compteurLigne', 1);
if ($action == 'lister') {
    $balance = $compta->obtenirBalance('', $periode_debut, $periode_fin);
    $smarty->assign('balance', $balance);
Example #4
0
<?php

// Impossible to access the file itself
if (!defined('PAGE_LOADED_USING_INDEX')) {
    trigger_error("Direct access forbidden.", E_USER_ERROR);
    exit;
}
$action = verifierAction(array('lister', 'ajouter', 'modifier'));
$smarty->assign('action', $action);
require_once dirname(__FILE__) . '/../../../sources/Afup/AFUP_Compta.php';
$compta = new AFUP_Compta($bdd);
if ($action == 'lister') {
    $data = $compta->obtenirListCategories(true);
    $smarty->assign('data', $data);
} elseif ($action == 'ajouter' || $action == 'modifier') {
    $formulaire =& instancierFormulaire();
    if ($action == 'modifier') {
        $champsRecup = $compta->obtenirListCategories('', $_GET['id']);
        $champs['categorie'] = $champsRecup['categorie'];
        $formulaire->setDefaults($champs);
        $formulaire->addElement('hidden', 'id', $_GET['id']);
    }
    // partie saisie
    $formulaire->addElement('header', '', '');
    $formulaire->addElement('text', 'categorie', 'Categorie', array('size' => 30, 'maxlength' => 40));
    // boutons
    $formulaire->addElement('header', 'boutons', '');
    $formulaire->addElement('submit', 'soumettre', ucfirst($action));
    if ($formulaire->validate()) {
        $valeur = $formulaire->exportValues();
        if ($action == 'ajouter') {
Example #5
0
<?php

$action = verifierAction(array('lister', 'ajouter', 'modifier'));
$smarty->assign('action', $action);
require_once dirname(__FILE__) . '/../../../sources/Afup/AFUP_Compta.php';
$compta = new AFUP_Compta($bdd);
if ($action == 'lister') {
    $data = $compta->obtenirListReglements(true);
    $smarty->assign('data', $data);
} elseif ($action == 'ajouter' || $action == 'modifier') {
    $formulaire =& instancierFormulaire();
    if ($action == 'modifier') {
        $champsRecup = $compta->obtenirListReglements('', $_GET['id']);
        $champs['reglement'] = $champsRecup['reglement'];
        $formulaire->setDefaults($champs);
        $formulaire->addElement('hidden', 'id', $_GET['id']);
    }
    // partie saisie
    $formulaire->addElement('header', '', '');
    $formulaire->addElement('text', 'reglement', 'Nom Reglement', array('size' => 30, 'maxlength' => 40));
    // boutons
    $formulaire->addElement('header', 'boutons', '');
    $formulaire->addElement('submit', 'soumettre', ucfirst($action));
    if ($formulaire->validate()) {
        $valeur = $formulaire->exportValues();
        if ($action == 'ajouter') {
            $ok = $compta->ajouterConfig('compta_reglement', 'reglement', $valeur['reglement']);
        } else {
            $ok = $compta->modifierConfig('compta_reglement', $valeur['id'], 'reglement', $valeur['reglement']);
        }
        if ($ok) {
Example #6
0
// Impossible to access the file itself
if (!defined('PAGE_LOADED_USING_INDEX')) {
    trigger_error("Direct access forbidden.", E_USER_ERROR);
    exit;
}
$action = verifierAction(array('lister', 'editer', 'view', 'bilanpdf'));
$smarty->assign('action', $action);
//$compte=$_GET['compte'];
if (isset($_GET['details']) && $_GET['details']) {
    $details = $_GET['details'];
} else {
    $details = "";
}
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') {
    $debit = $compta->obtenirBilan(1, $periode_debut, $periode_fin);
    $smarty->assign('debit', $debit);
    $credit = $compta->obtenirBilan(2, $periode_debut, $periode_fin);
Example #7
0
<?php

$action = verifierAction(array('lister', 'debit', 'credit', 'ajouter', 'modifier', 'supprimer', 'importer', 'ventiler'));
//$tris_valides = array('Date', 'Evenement', 'catégorie', 'Description');
//$sens_valides = array('asc', 'desc');
$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') {
Example #8
0
<?php

// Impossible to access the file itself
if (!defined('PAGE_LOADED_USING_INDEX')) {
    trigger_error("Direct access forbidden.", E_USER_ERROR);
    exit;
}
$action = verifierAction(array('lister', 'exporter', 'download_attachments'));
$smarty->assign('action', $action);
if (isset($_GET['compte']) && $_GET['compte']) {
    $compte = $_GET['compte'];
} else {
    $compte = 1;
}
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);
if ($action == 'lister') {
    $periode_debut = $listPeriode[$id_periode - 1]['date_debut'];
    $periode_fin = $listPeriode[$id_periode - 1]['date_fin'];
    $smarty->assign('compteurLigne', 1);
    $journal = $compta->obtenirJournalBanque($compte, $periode_debut, $periode_fin);
    $smarty->assign('journal', $journal);
Example #9
0
<?php

$action = verifierAction(array('lister', 'ajouter', 'modifier'));
//$tris_valides = array('Date', 'Evenement', 'catégorie', 'Description');
//$sens_valides = array('asc', 'desc');
$smarty->assign('action', $action);
require_once dirname(__FILE__) . '/../../../sources/Afup/AFUP_Compta.php';
$compta = new AFUP_Compta($bdd);
if ($action == 'lister') {
    $data = $compta->obtenirListOperations(true);
    $smarty->assign('data', $data);
} elseif ($action == 'ajouter' || $action == 'modifier') {
    $formulaire =& instancierFormulaire();
    if ($action == 'modifier') {
        $champsRecup = $compta->obtenirListOperations('', $_GET['id']);
        $champs['operation'] = $champsRecup['operation'];
        $formulaire->setDefaults($champs);
        $formulaire->addElement('hidden', 'id', $_GET['id']);
    }
    // partie saisie
    $formulaire->addElement('header', '', '');
    $formulaire->addElement('text', 'operation', 'Operation', array('size' => 30, 'maxlength' => 40));
    // boutons
    $formulaire->addElement('header', 'boutons', '');
    $formulaire->addElement('submit', 'soumettre', ucfirst($action));
    if ($formulaire->validate()) {
        $valeur = $formulaire->exportValues();
        if ($action == 'ajouter') {
            $ok = $compta->ajouterConfig('compta_operation', 'operation', $valeur['operation']);
        } else {
            $ok = $compta->modifierConfig('compta_operation', $valeur['id'], 'operation', $valeur['operation']);
Example #10
0
<?php

// Impossible to access the file itself
if (!defined('PAGE_LOADED_USING_INDEX')) {
    trigger_error("Direct access forbidden.", E_USER_ERROR);
    exit;
}
// Actions
$defaultAction = 'search';
$action = verifierAction([$defaultAction, 'results']);
// Some smarty vars
$smarty->assign('action', $action);
$smarty->assign('page', $_GET['page']);
// Compta
require_once dirname(__FILE__) . '/../../../sources/Afup/AFUP_Compta.php';
$compta = new AFUP_Compta($bdd);
// Switch on action name
switch ($action) {
    // Search form
    case "search":
    default:
        // nothing to do
        break;
        // Results
    // Results
    case 'results':
        // No search param?
        if (!isset($_GET['q']) || !($q = trim($_GET['q']))) {
            $smarty->assign('action', $defaultAction);
            continue;
        }