コード例 #1
0
<?php

if (!$gjennomIndex) {
    die("Access denied.");
}
?>

<h2>Ordre</h2>

<?php 
$db = new sql();
$resultat = $db->query("SELECT OrdreNr FROM webprosjekt_ordre ORDER BY OrdreDato DESC;");
if (!$resultat) {
    die("<p>Feil - kunne ikke koble til databasen (006)</p>");
}
$db->close();
$ordrenummer;
while ($rad = $resultat->fetch_assoc()) {
    $ordrenummer[] = $rad['OrdreNr'];
}
if (count($ordrenummer) == 0) {
    echo "<p>Du har ingen eksisterengde ordre.</p>";
} else {
    echo "<table><tr><th>Ordrenummer</th><th>Kunde</th><th>Ordredato</th><th>Ordrebeløp</th></tr>";
    foreach ($ordrenummer as $value) {
        $ordre = new Ordre($value);
        echo "<tr><td><a href='index.php?side=admin_ordreoversikt&amp;o=" . $ordre->getOrdreNr() . "'>" . $ordre->getOrdreNr() . "</td>\n                <td>" . $ordre->getKundenavn() . "</td><td>" . $ordre->getOrdreDato() . "</td><td>" . number_format($ordre->getOrdretotal() + $ordre->getFraktsum(), 2, ',', '.') . "</td></tr>";
    }
    echo "</table>";
}
コード例 #2
0
<?php

if (!$gjennomIndex) {
    die("Access denied.");
}
$ordrenr = $_REQUEST['o'];
$ordre = new Ordre($ordrenr);
echo "<h2>Oversikt over ordrenummer " . $ordre->getOrdreNr() . "</h2>";
echo "<p>Ordrenr: " . $ordre->getOrdreNr() . "<br/>\n      Ordredato: " . $ordre->getOrdreDato() . "</p>";
echo "<p><strong>Faktura/leveringsadresse:</strong><br/>" . $kunde->getNavn() . "<br/>" . $kunde->getAdresse() . "<br/>" . $kunde->getPostnr() . " " . $kunde->getPoststed() . "</p>";
$ordrelinjer = $ordre->getOrdrelinjer();
if (count($ordrelinjer) == 0) {
    die("<p>Ingen varer registrert på ordre</p>");
}
?>
<table>
    <tr><th>Varenummer</th><th>Varenavn</th><th>Enhetspris</th><th>Antall</th><th>MVA</th><th>Totalpris</th></tr>
<?php 
foreach ($ordrelinjer as $ordrelinje) {
    echo "<tr><td>" . $ordrelinje[0] . "</td><td>" . $ordrelinje[1] . "</td><td>" . number_format($ordrelinje[2], 2, ',', '.') . "</td><td>" . $ordrelinje[3] . "</td><td>25&#37;</td><td>" . number_format($ordrelinje[4], 2, ',', '.') . "</td></tr>";
}
echo "<tr><td colspan=\"4\"></td><td><strong>Sum varer:</strong></td><td>" . number_format($ordre->getOrdretotal(), 2, ',', '.') . "</td></tr>";
echo "<tr><td colspan=\"4\"></td><td><strong>Frakt:</strong></td><td>" . number_format($ordre->getFraktsum(), 2, ',', '.') . "</td></tr>";
echo "<tr><td colspan=\"4\"></td><td><strong>Herav MVA (25&#37;):</strong></td><td>" . number_format(($ordre->getOrdretotal() + $ordre->getFraktsum()) * 0.2, 2, ',', '.') . "</td></tr>";
echo "<tr><td colspan=\"4\"></td><td><strong>TOTALT:</strong></td><td>" . number_format($ordre->getOrdretotal() + 120, 2, ',', '.') . "</td></tr>";
?>
</table>
<p><a href="index.php?side=minkonto&amp;kontoside=ordre">Tilbake til mine ordre</a></p>
コード例 #3
0
}
$ordrenr = $_REQUEST['o'];
$ordre = new Ordre($ordrenr);
$db = new sql();
$knr = $ordre->getKNr();
$resultat = $db->query("SELECT * FROM webprosjekt_kunde WHERE KNr = '{$knr}';");
if (!$resultat) {
    die("<p>Feil - kunne ikke koble til databasen (007)</p>");
}
if ($db->affected_rows == 0) {
    die("<p>Feil - finner ikke kunde i databasen (008)</p>");
}
$db->close();
$k = $resultat->fetch_assoc();
echo "<h2>Oversikt over ordrenummer " . $ordre->getOrdreNr() . "</h2>";
echo "<p>Ordrenr: " . $ordre->getOrdreNr() . "<br/>\n      Ordredato: " . $ordre->getOrdreDato() . "<br/>\n      Kundenr: " . $k['KNr'] . "</p>";
echo "<p><strong>Faktura/leveringsadresse:</strong><br/>" . $k['Fornavn'] . " " . $k['Etternavn'] . "<br/>" . $k['Adresse'] . "<br/>" . $k['PostNr'] . " " . sjekkPostnr($k['PostNr']) . "</p>";
$ordrelinjer = $ordre->getOrdrelinjer();
if (count($ordrelinjer) == 0) {
    die("<p>Ingen varer registrert på ordre</p>");
}
?>
<table>
    <tr><th>Varenummer</th><th>Varenavn</th><th>Enhetspris</th><th>Antall</th><th>MVA</th><th>Totalpris</th></tr>
<?php 
foreach ($ordrelinjer as $ordrelinje) {
    echo "<tr><td>" . $ordrelinje[0] . "</td><td>" . $ordrelinje[1] . "</td><td>" . number_format($ordrelinje[2], 2, ',', '.') . "</td><td>" . $ordrelinje[3] . "</td><td>25&#37;</td><td>" . number_format($ordrelinje[4], 2, ',', '.') . "</td></tr>";
}
echo "<tr><td colspan=\"4\"></td><td><strong>Sum varer:</strong></td><td>" . number_format($ordre->getOrdretotal(), 2, ',', '.') . "</td></tr>";
echo "<tr><td colspan=\"4\"></td><td><strong>Frakt:</strong></td><td>" . number_format($ordre->getFraktsum(), 2, ',', '.') . "</td></tr>";
echo "<tr><td colspan=\"4\"></td><td><strong>Herav MVA (25&#37;):</strong></td><td>" . number_format(($ordre->getOrdretotal() + $ordre->getFraktsum()) * 0.2, 2, ',', '.') . "</td></tr>";