/** * @name insert($pReservation) * @param ReservationVO * @return integer * @desc Ajoute une réservation */ private function insert($pReservation) { // Calcul du total $lTotal = 0; foreach ($pReservation->getDetailReservation() as $lProduit) { $lTotal += $lProduit->getMontant(); } // L'operation $lOperation = new OperationDetailVO(); $lOperation->setIdCompte($pReservation->getId()->getIdCompte()); $lOperation->setMontant($lTotal); $lOperation->setLibelle("Marché N°" . $pReservation->getId()->getIdCommande()); $lOperation->setTypePaiement(0); $lOperation->setType(0); $lChampComplementaire = array(); // Id Marché $lOperationChampComplementaire = new OperationChampComplementaireVO(); $lOperationChampComplementaire->setChcpId(1); $lOperationChampComplementaire->setValeur($pReservation->getId()->getIdCommande()); array_push($lChampComplementaire, $lOperationChampComplementaire); $lOperation->setChampComplementaire($lChampComplementaire); // // $lOperation->setIdCommande($pReservation->getId()->getIdCommande()); $lListeIdDetailCommande = array(); foreach ($pReservation->getDetailReservation() as $lProduit) { array_push($lListeIdDetailCommande, $lProduit->getIdDetailCommande()); } $lDetailMarche = DetailMarcheViewManager::selectByIdDetailCommande($lListeIdDetailCommande); $lOperationService = new OperationService(); $lIdOperation = $lOperationService->set($lOperation); // Ajout detail operation $lStockService = new StockService(); $lDetailOperationService = new DetailOperationService(); foreach ($pReservation->getDetailReservation() as $lProduit) { // Ajout du stock $lStock = new StockVO(); $lStock->setQuantite($lProduit->getQuantite()); $lStock->setType(0); $lStock->setIdCompte($pReservation->getId()->getIdCompte()); $lStock->setIdDetailCommande($lProduit->getIdDetailCommande()); $lStock->setIdOperation($lIdOperation); $lStock->setIdNomProduit($lDetailMarche[$lProduit->getIdDetailCommande()]->getProIdNomProduit()); $lStock->setUnite($lDetailMarche[$lProduit->getIdDetailCommande()]->getProUniteMesure()); $lStockService->set($lStock); // Ajout du détail de l'operation $lDetailOperation = new DetailOperationVO(); $lDetailOperation->setIdOperation($lIdOperation); $lDetailOperation->setIdCompte($pReservation->getId()->getIdCompte()); $lDetailOperation->setMontant($lProduit->getMontant()); $lDetailOperation->setLibelle("Marché N°" . $pReservation->getId()->getIdCommande()); $lDetailOperation->setTypePaiement(0); $lDetailOperation->setIdDetailCommande($lProduit->getIdDetailCommande()); $lDetailOperation->setIdNomProduit($lDetailMarche[$lProduit->getIdDetailCommande()]->getProIdNomProduit()); $lDetailOperationService->set($lDetailOperation); } return $lIdOperation; }
/** * @name remplirOperationDetailEntete($pId, $pIdCompte, $pMontant, $pLibelle, $pDate, $pTypePaiement, $pType, $pDateMaj, $pIdLogin, $pTppId, $pTppType, $pTppChampComplementaire, $pTppVisible) * @param int(11) * @param int(11) * @param decimal(10,2) * @param varchar(100) * @param datetime * @param int(11) * @param int(11) * @param datetime * @param int(11) * @param int(11) * @param varchar(100) * @param tinyint(4) * @param tinyint(1) * @return OperationVO * @desc Retourne une OperationDetailVO remplie */ private static function remplirOperationDetailEntete($pId, $pIdCompte, $pMontant, $pLibelle, $pDate, $pTypePaiement, $pType, $pDateMaj, $pIdLogin, $pTppId, $pTppType, $pTppChampComplementaire, $pTppVisible) { $lOperation = new OperationDetailVO(); $lOperation->setId($pId); $lOperation->setIdCompte($pIdCompte); $lOperation->setMontant($pMontant); $lOperation->setLibelle($pLibelle); $lOperation->setDate($pDate); $lOperation->setTypePaiement($pTypePaiement); $lOperation->setType($pType); $lOperation->setDateMaj($pDateMaj); $lOperation->setIdLogin($pIdLogin); $lOperation->setTppId($pTppId); $lOperation->setTppType($pTppType); $lOperation->setTppChampComplementaire($pTppChampComplementaire); $lOperation->setTppVisible($pTppVisible); return $lOperation; }