public static function totaalBestelling($arrBestelRegel) { /* return totaalprijs van de bestelling */ $Prijs = 0; foreach ($arrBestelRegel as $regel) { $product = productService::getProductFromId($regel->productID); $Prijs += $product->prijs * $regel->aantal; } return $Prijs; }
public function bestellingDoorvoeren($arrBestelRegel, $datum, $prijs, $KlantID) { // Voert een bestelling door naar DB $albestelddiedag = bestellingService::alBesteldDieDag($datum, $KlantID); if (!$albestelddiedag) { $BestelID = BestellingDAO::createBestelling($KlantID, $datum, $arrBestelRegel, $prijs); foreach ($arrBestelRegel as $regel) { $Aantal = $regel->aantal; if ($Aantal) { $ProductID = $regel->productID; $product = productService::getProductFromId($ProductID); $productPrijs = $product->prijs; $Prijs = $Aantal * $productPrijs; BestelRegelDAO::createBestelRegel($BestelID, $ProductID, $Aantal, $Prijs); $Aantal = 0; } } unset($_SESSION['bestelregelarray']); return TRUE; } if ($albestelddiedag) { return FALSE; } }
$klantnaam = $klant->Naam . " " . $klant->VNaam; if ($nextdatum == "") { print $datum . "<hr/>"; } else { if ($nextdatum != $dbDatum) { print "<hr/>" . $datum . "<hr/>"; } } print "<div class='innercontainer txtL'> "; print "<dl><dt>Bestelling voor " . $klantnaam . " op " . $datum . "</dt>"; $totPrijs = $bestelling->Prijs; $arrBestelRegel = bestelRegelService::getBestelRegelsFromId($BestelID); foreach ($arrBestelRegel as $regel) { $productID = $regel->productID; $aantal = $regel->aantal; $product = productService::getProductFromId($productID); $productPrijs = $product->prijs; $prijs = $aantal * $productPrijs; if ($aantal) { print "<dd>" . $aantal . " x " . $product->product . " <strong>€ " . $productPrijs . "</strong> = € " . $prijs . "</dd>"; } } print "<dt>Totaalprijs = € " . $totPrijs . "</dt>"; print "</dl><a href='?page=overzicht&verwijder=" . $BestelID . "'>bestelling verwijderen</a>"; print "</div>"; $nextdatum = $dbDatum; } if (!$arrBestellingen) { print "<dt>Geen bestellingen geplaatst.</dt>"; } ?>
$product = productService::getProductFromId($productID); $productPrijs = $product->prijs; $prijs = $aantal * $productPrijs; if ($aantal) { print "<dd><a href='?page=wijzigen&winkelkar=wijzigen&product=" . $productID . "'>" . $aantal . " x " . $product->product . " <strong>€ " . $productPrijs . "</strong></a> = € " . $prijs . " <a href='?page=wijzigen&winkelkar=wijzigen&product=" . $productID . "&aantal=0'> Haal dit uit winkelmand</a></dd>"; } $totprijs += $prijs; } print "<dt>Totaalprijs = € " . $totprijs . "</dt>"; ?> </dl> </div> </div> <?php if (isset($_GET['product']) && !isset($_GET['aantal'])) { $IDproduct = productService::getProductFromId($_GET['product']); ?> <div class="wrapper clearfix"> <div class="txtC"> <h1>Hoeveel <?php print $IDproduct->categorie; ?> had u er dan gewenst?</h1> <form action="index.php" method="get"> <input type="hidden" name="page" value="wijzigen"> <input type="hidden" name="winkelkar" value="wijzigen"> <input type="hidden" name="product" value="<?php print $IDproduct->id; ?> "> <input type="text" name="aantal" value="" style="width: 30px;" autofocus=""><?php