147 lines
4.8 KiB
PHP
147 lines
4.8 KiB
PHP
<?php
|
|
if ("1" == $_POST['art_take'])
|
|
{
|
|
include __DIR__ . "/art_save.php";
|
|
}
|
|
if ("1" == $_POST['pos_save'])
|
|
{
|
|
include __DIR__ . "/pos_save.php";
|
|
}
|
|
if ("1" == $_POST['art_pos_save'])
|
|
{
|
|
include __DIR__ . "/pos_save.php";
|
|
include __DIR__ . "/art_pos_save.php";
|
|
}
|
|
if ("1" == $_POST['pos_change'])
|
|
{
|
|
include __DIR__ . "/pos_change.php";
|
|
}
|
|
if ("1" == $_POST['art_pos_change'])
|
|
{
|
|
include __DIR__ . "/pos_change.php";
|
|
include __DIR__ . "/art_pos_save.php";
|
|
}
|
|
if ("1" == $_POST['pos_delete'])
|
|
{
|
|
include __DIR__ . "/pos_delete.php";
|
|
}
|
|
|
|
if (isset($_POST['Datum']))
|
|
{
|
|
$nt = explode(".", $_POST['Datum']);
|
|
$Datum = $nt['2'] . "-" . $nt['1'] . "-" . $nt['0'];
|
|
if (3 != sizeof($nt))
|
|
{
|
|
echo "<h1>Bitte überprüfen Sie das Datumsformat bei der Eingabe!</h1>\n";
|
|
echo "<h2>Das korrekte Datumsformat ist z.B.: \"25.7.2009\"!</h2>\n";
|
|
}
|
|
else
|
|
{
|
|
if (4 != strlen($nt['2']))
|
|
{
|
|
echo "<h1>Bitte überprüfen Sie das Datumsformat bei der Eingabe!</h1>\n";
|
|
echo "<h2>Die Eingabe der Jahreszahl muss 4-stellig erfolgen!</h2>\n";
|
|
}
|
|
else
|
|
{
|
|
if (checkdate($nt['1'], $nt['0'], $nt['2']))
|
|
{
|
|
$temp = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if ("settings" == $_POST['action'])
|
|
{
|
|
if ($temp)
|
|
{
|
|
if (!isset($_POST['KfZ_ID'])) { $_POST['KfZ_ID'] = null; }
|
|
$sql = 'UPDATE ' . PREFIX . '_Reminder SET
|
|
Kontakt_ID = "' . $_POST['Kontakt_ID'] . '",
|
|
Admin_ID = "' . $_POST['Admin_ID'] . '",
|
|
KfZ_ID = "' . $_POST['KfZ_ID'] . '",
|
|
Preis = "' . $_POST['Preis'] . '",
|
|
MwSt = "' . $_POST['MwSt'] . '",
|
|
Rabatt = "' . $_POST['Rabatt'] . '",
|
|
Skonto = "' . $_POST['Skonto'] . '",
|
|
Datum = "' . $Datum . '"
|
|
WHERE
|
|
(Jahr = "' . $Jahr . '"
|
|
AND
|
|
ID = "' . $ID . '");';
|
|
$stmt = $db->prepare($sql);
|
|
if (!$stmt)
|
|
{
|
|
die ('Datensatz konnte nicht gespeichert werden: ' . $db->error);
|
|
}
|
|
if (!$stmt->execute())
|
|
{
|
|
die ('Datensatz konnte nicht gespeichert werden: ' . $stmt->error);
|
|
}
|
|
}
|
|
}
|
|
|
|
$Max_Pos = 0;
|
|
$sql = "SELECT *, DATE_FORMAT(Datum, '%d.%m.%Y') AS Datum FROM " . PREFIX . "_Reminder WHERE (Jahr = \"" . $Jahr . "\" AND ID = \"" . $ID . "\");";
|
|
$result = $db->query($sql);
|
|
$nt = $result->fetch_assoc();
|
|
$sqlp = "SELECT * FROM " . PREFIX . "_Reminder_Pos WHERE (Jahr = \"" . $Jahr . "\" AND Reminder_ID =\"" . $ID . "\") ORDER BY Position ASC;";
|
|
$resultp = $db->query($sqlp);
|
|
$sqls = "SELECT SUM(Preis * Anzahl) AS Summe FROM " . PREFIX . "_Reminder_Pos WHERE (Jahr = \"" . $Jahr . "\" AND Reminder_ID = \"" . $ID . "\") GROUP BY Reminder_ID;";
|
|
$results = $db->query($sqls);
|
|
$nts = $results->fetch_assoc();
|
|
|
|
$sqlkn = "SELECT * FROM " . PREFIX . "_Kontakte ORDER BY Nachname ASC, Firma ASC";
|
|
$resultkn = $db->query($sqlkn);
|
|
$sqlan = "SELECT ID, Vorname, Nachname FROM Admin WHERE Firma_ID = \"" . PREFIX . "\" ORDER BY ID ASC";
|
|
$resultan = $db->query($sqlan);
|
|
|
|
$Text = $nt['Text'];
|
|
|
|
include __DIR__ . "/settings.php";
|
|
|
|
include __DIR__ . "/positions.php";
|
|
|
|
echo " <tr>\n";
|
|
echo " <td style=\"border: none;\"> </td>\n";
|
|
echo " <td style=\"border: none;\"> </td>\n";
|
|
echo " <td colspan=\"2\">Gesamtpreis zzgl. " . $nt['MwSt'] . "% gesetzlicher MwSt.</td>\n";
|
|
echo " <td>" . number_format(($nts['Summe']), '2', ',', '.') . " €</td>\n";
|
|
echo " </tr>\n";
|
|
$Summe = $nts['Summe'];
|
|
if (0 != $nt['Rabatt'])
|
|
{
|
|
echo " <tr>\n";
|
|
echo " <td style=\"border: none;\"> </td>\n";
|
|
echo " <td style=\"border: none;\"> </td>\n";
|
|
echo " <td colspan=\"2\">- " . number_format($nt['Rabatt'], '2', ',', '.') . "% Rabatt auf " . number_format($nt['Preis'], '2', ',', '.') . " €</td>\n";
|
|
$Rabatt = $nts['Summe'] * $nt['Rabatt'] / 100;
|
|
$Summe = $nts['Summe'] * (1 - $nt['Rabatt'] / 100);
|
|
echo " <td>" . number_format($Rabatt, '2', ',', '.') . " €</td>\n";
|
|
echo " </tr>\n";
|
|
}
|
|
echo " <tr>\n";
|
|
echo " <td style=\"border: none;\"> </td>\n";
|
|
echo " <td style=\"border: none;\"> </td>\n";
|
|
echo " <td colspan=\"2\">+ " . $nt['MwSt'] . "% gesetzliche MwSt.</td>\n";
|
|
echo " <td>" . number_format(($Summe * $nt['MwSt'] / 100), '2', ',', '.') . " €</td>\n";
|
|
echo " </tr>\n";
|
|
echo " <tr>\n";
|
|
echo " <td style=\"border: none;\"> </td>\n";
|
|
echo " <td style=\"border: none;\"> </td>\n";
|
|
echo " <td colspan=\"2\"><b>Gesamtpreis inkl. " . $nt['MwSt'] . "% gesetzlicher MwSt.</b></td>\n";
|
|
echo " <td><b>" . number_format(($Summe * (1 + $nt['MwSt'] / 100)), '2', ',', '.') . " €</b></td>\n";
|
|
echo " </tr>\n";
|
|
echo "</table>\n";
|
|
echo "<br />\n";
|
|
if (0 != $nt['Skonto'])
|
|
{
|
|
$Skonto = date("d.m.Y", strtotime("+" . $_SESSION['Firma']['S_Bis'] . " day", strtotime($nt['Datum'])));
|
|
echo "<p>Bei Bezahlung bis zum " . $Skonto . " erhalten Sie " . number_format($nt['Skonto'], '2', ',', '.') . "% Skonto! Dies entspricht einem Betrag von " . number_format($Summe * (1 + $nt['MwSt'] / 100) * ($nt['Skonto'] / 100), '2', ',', '.') . " €.</p>\n";
|
|
}
|
|
echo "</fieldset>\n";
|
|
|
|
include __DIR__ . "/art_take.php";
|
|
|
|
$nt['Preis'] = $nts['Summe']; |