예제 #1
0
 public function recup_facture_lignes($monidfact)
 {
     $requete = $this->_db->prepare('select * from facture_ligne where idfact=:idfact and idutil=:idutil');
     $requete->execute(array(':idfact' => $monidfact, ':idutil' => $_SESSION['id']));
     $results = $requete->fetchAll();
     $tabobject = array();
     /** Si pas de resultat alors faux */
     if (empty($results)) {
         return false;
     } else {
         /** Sinon parcours et stocke tout les lignes de factures */
         foreach ($results as $result) {
             $mafacturelignes = new FactureLignes();
             $mafacturelignes->setIdfact($result['idfact'])->setIdutil($result['idutil'])->setIdart($result['idart'])->setQuantiteart($result['quantiteart'])->setPointsart($result['pointsart'])->setTotalignes($result['totalignes'])->setNomart($result['nomart']);
             array_push($tabobject, $mafacturelignes);
             // Push l'objet $article dans le tableau $tabobject
         }
         return $tabobject;
     }
 }
예제 #2
0
require_once '../class/Panier.php';
require_once '../manager/FactureManager.php';
require_once '../manager/PanierManager.php';
session_start();
$date = date("Y/m/d");
$mafacture = new Facture();
$mafacture->setIdutil($_SESSION['id'])->setDate($date)->setValider('N');
$mafacturemanager = new FactureManager($bdd);
$mafacturemanager->insertion_facture($mafacture);
$factures = $mafacturemanager->recup_facture();
foreach ($factures as $facture) {
    $idfact = $facture->getId();
    $idutil = $facture->getIdutil();
    $datefact = $facture->getDate();
    $valider = $facture->getValider();
}
$monpanier = new Panier();
$monpaniermanager = new PanierManager($bdd);
$monpaniers = $monpaniermanager->retour_panier();
foreach ($monpaniers as $panier) {
    $mafacturelignes = new FactureLignes();
    $mafacturelignes->setIdfact($idfact);
    $mafacturelignes->setIdutil($idutil);
    $mafacturelignes->setIdart($panier->getIdart());
    $mafacturelignes->setQuantiteart($panier->getQuantiteart());
    $mafacturelignes->setPointsart($panier->getPointsart());
    $mafacturelignes->setTotalignes($panier->getQuantiteart() * $panier->getPointsart());
    $mafacturelignes->setNomart($panier->getNomart());
    $mafacturemanager->insertion_facture_lignes($mafacturelignes);
}
header('Location:../main/facture.php');