示例#1
0
 <thead>
     <tr>
         <th style="width:10%;">Actions</th>
         <th style="width:10%;">DateOpe</th>
         <th style="width:10%;">DateVal</th>
         <th style="width:20%;">Libelle</th>
         <th style="width:10%;">Reference</th>
         <th style="width:15%;">Débit</th>
         <th style="width:15%;">Crédit</th>
         <th style="width:10%;">Projet</th>
     </tr>
 </thead>
 <tbody>
     <?php
     foreach($releveBancaires as $releve){
         $numeroCompte = $compteBancaireManager->getCompteBancaireById($releve->idCompteBancaire())->numero();
     ?>
     <tr class="odd gradeX">
         <td>
             <?php
             if ( $_SESSION['userMerlaTrav']->profil() == "admin" ) {
             ?>
                 <a href="#update<?= $releve->id() ?>" data-toggle="modal" data-id="<?= $releve->id() ?>" class="btn mini green"><i class="icon-refresh"></i></a>
                 <a href="#delete<?= $releve->id() ?>" data-toggle="modal" data-id="<?= $releve->id() ?>" class="btn mini red"><i class="icon-remove"></i></a>
             <?php  
                 //In this section we will process credit and debit element.
                 //The debit element will be added for fournisseur component
                 //The credit element will be added for client component
                 if ( $releve->debit() > 0 ) {
             ?>
                     <a title="Opérations Fournisseurs" href="#processFournisseur<?= $releve->id() ?>" data-toggle="modal" data-id="<?= $releve->id() ?>" class="btn mini blue"><i class="icon-cogs"></i></a>
            //add history data to db
            $historyManager = new HistoryManager($pdo);
            $societeManager = new SocieteManager($pdo);
            $societe = $societeManager->getSocieteById($idSociete);
            $createdBy = $_SESSION['userMerlaTrav']->login();
            $created = date('Y-m-d h:i:s');
            $history = new History(array('action' => "Modification", 'target' => "Table des comptes bancaires", 'description' => "Modification du compte bancaire - ID : " . $idCompte . " - Numéro : " . $numeroCompte . " - Société : " . $societe->raisonSociale(), 'created' => $created, 'createdBy' => $createdBy));
            //add it to db
            $historyManager->add($history);
        } else {
            $actionMessage = "Erreur Modification Compte Bancaire : Vous devez remplir le champ 'Numero compte'.";
        }
    } else {
        if ($action == "delete") {
            $idCompte = htmlentities($_POST['idCompte']);
            $compte = $compteBancaireManager->getCompteBancaireById($idCompte);
            $compteBancaireManager->delete($idCompte);
            $actionMessage = "Opération Valide : Compte Bancaire supprimé avec succès.";
            //add history data to db
            $historyManager = new HistoryManager($pdo);
            $societeManager = new SocieteManager($pdo);
            $societe = $societeManager->getSocieteById($idSociete);
            $createdBy = $_SESSION['userMerlaTrav']->login();
            $created = date('Y-m-d h:i:s');
            $history = new History(array('action' => "Suppression", 'target' => "Table des comptes bancaires", 'description' => "Suppression du compte bancaire - ID : " . $idCompte . " - Numéro : " . $compte->numero() . " - Société : " . $societe->raisonSociale(), 'created' => $created, 'createdBy' => $createdBy));
            //add it to db
            $historyManager->add($history);
        }
    }
}
$_SESSION['bien-action-message'] = $actionMessage;