<h2>Preisliste</h2>
<h3>Preise für Wohnung Amelie (Dachwohnung, 65 qm für 2 Personen)</h3>
<table class="preise">
    <tr>
        <th>Zeitraum</th>
        <th>Buchungen<br/>&nbsp;<br/>3 - 4 Nächte<br/>&nbsp;<br/><small>(2 Pers./Nacht)</small></th>
        <th>Buchungen<br/>&nbsp;<br/>5 -6 Nächte<br/>&nbsp;<br/><small>(2 Pers./Nacht)</small></th>
        <th class="hs">Hauptsaison<br/>&nbsp;<br/>ab 7 Nächte<br/>&nbsp;<br/><small>(2 Pers./Nacht)</small></th>
        <th class="ns">Nebensaison<br/>&nbsp;<br/>ab 7 Nächte<br/>&nbsp;<br/><small>(2 Pers./Nacht)</small></th>
        <th class="aw">Weihnachten<br/>&nbsp;<br/>ab 14 Nächte<br/>&nbsp;<br/><small>(2 Pers./Nacht)</small></th>
    </tr>

    <?php
    $sql1 = "SELECT * FROM Preise WHERE ID = 2";
    $result1 = $db->query($sql1);
    $nt1 = $result1->fetch_assoc();
    $sql2 = "SELECT Von, Bis, Typ FROM Saison";
    $result2 = $db->query($sql2);
    while ($nt2 = $result2->fetch_assoc()) {
        $Von = date("d.m.y", strtotime($nt2['Von']));
        $Bis = date("d.m.y", strtotime($nt2['Bis']));
        echo "    <tr>\n";
        if ('Hauptsaison' == $nt2['Typ']) {
            echo "        <td class=\"hs\">$Von - $Bis</td>\n";
        }
        if ('Nebensaison' == $nt2['Typ']) {
            echo "        <td class=\"ns\">$Von - $Bis</td>\n";
        }
        if ('Weihnachten' == $nt2['Typ']) {
            echo "        <td class=\"aw\">$Von - $Bis</td>\n";
        }
        echo "        <td>" . number_format($nt1['Nacht3'], 2, ',', '.') . " €</td>\n";
        echo "        <td>" . number_format($nt1['Nacht5'], 2, ',', '.') . " €</td>\n";
        if ('Hauptsaison' == $nt2['Typ']) {
            echo "        <td class=\"hs\">" . number_format($nt1['Hauptsaison'], 2, ',', '.') . " €</td>\n";
            echo "        <td></td>\n";
            echo "        <td></td>\n";
        }
        if ('Nebensaison' == $nt2['Typ']) {
            echo "        <td></td>\n";
            echo "        <td class=\"ns\">" . number_format($nt1['Nebensaison'], 2, ',', '.') . " €</td>\n";
            echo "        <td></td>\n";
        }
        if ('Weihnachten' == $nt2['Typ']) {
            echo "        <td></td>\n";
            echo "        <td></td>\n";
            echo "        <td class=\"aw\">" . number_format($nt1['Weihnachten'], 2, ',', '.') . " €</td>\n";
        }
        echo "    </tr>\n";
    }

    $p1 = $nt1['Nacht3'] + 2 * $nt1['Kurbeitrag'];
    $p2 = $nt1['Nacht5'] + 2 * $nt1['Kurbeitrag'];
    $p3 = $nt1['Hauptsaison'] + 2 * $nt1['Kurbeitrag'];
    $p4 = $nt1['Nebensaison'] + 2 * $nt1['Kurbeitrag'];
    $p5 = $nt1['Weihnachten'] + 2 * $nt1['Kurbeitrag'];

    echo "    <tr>\n";
    echo "        <th>Preise inkl. Kurbeitrag</th>\n";
    echo "        <th>" . number_format($p1, 2, ',', '.') . " €</th>\n";
    echo "        <th>" . number_format($p2, 2, ',', '.') . " €</th>\n";
    echo "        <th>" . number_format($p3, 2, ',', '.') . " €</th>\n";
    echo "        <th>" . number_format($p4, 2, ',', '.') . " €</th>\n";
    echo "        <th>" . number_format($p5, 2, ',', '.') . " €</th>\n";
    echo "    </tr>\n";
    ?>
</table>
<?php
include "inhalte/kalender.php";
echo "<br style=\"clear:right;\" />";
include "inhalte/kal_def.php";
echo "<br class=\"clear\" />\n";
include "inhalte/preis_def.php";

?>
