Files
startup/inhalte/eur_gadd.php

48 lines
2.4 KiB
PHP

<?php
echo "<h1>Übersicht</h1>\n";
echo "<h2>offene Gutschriften</h2>\n";
$sql = "SELECT " . PREFIX . "_Gutschriften.Jahr, " . PREFIX . "_Gutschriften.ID, " . PREFIX . "_Gutschriften.Rechnung_ID, " . PREFIX . "_Kontakte.Firma, " . PREFIX . "_Kontakte.Vorname, " . PREFIX . "_Kontakte.Nachname, " . PREFIX . "_Gutschriften.Preis, DATE_FORMAT(" . PREFIX . "_Gutschriften.Datum, '%d.%m.%Y') AS Datum FROM " . PREFIX . "_Gutschriften LEFT JOIN " . PREFIX . "_Kontakte ON " . PREFIX . "_Gutschriften.Kontakt_ID = " . PREFIX . "_Kontakte.ID WHERE (Bezahlt = \"0\"" . $Frage . ") ORDER BY " . PREFIX . "_Gutschriften.Jahr ASC, " . PREFIX . "_Gutschriften.ID ASC;";
$result = $db->query($sql);
$sql = "SELECT SUM(Preis) AS Preis FROM " . PREFIX . "_Gutschriften WHERE (Bezahlt =\"0\"" . $Frage . ") GROUP BY Bezahlt;";
$res_sum = $db->query($sql);
$ntsum = $res_sum->fetch_assoc();
while ($nt = $result->fetch_assoc())
{
while (strlen($nt['ID']) < $_SESSION['Firma']['Stellen'])
{
$nt['ID'] = "0" . $nt['ID'];
}
echo "<b><label class=\"data\">Gutschrift-Nr.: " . $nt['Jahr'] . "_" . $nt['ID'] . "</label>\n";
echo "<label class=\"short\">Betrag</label>\n";
echo "<label class=\"short\">Datum</label>\n";
echo "<label class=\"data\">Bezahlt am</label></b>\n";
echo "<br class=\"fix\" />\n";
if ("" != $nt['Firma'])
{
echo "<label class=\"data\">" . $nt['Firma'] . ", ";
}
else
{
echo "<label class=\"data\">" . $nt['Vorname'] . " ";
}
echo $nt['Nachname'] . "</label>";
echo "<label class=\"short\">" . number_format($nt['Preis'] * 1.19, '2', ',', '.') . " €</label>\n";
echo "<label class=\"short\">" . $nt['Datum'] . "</label>";
echo " <form action=\"index.php?" . $_SERVER['QUERY_STRING'] . "\" method=\"post\" >\n";
echo " <input type=\"hidden\" name=\"ID\" value=\"" . $nt['ID'] . "\" />\n";
echo " <input type=\"hidden\" name=\"Jahr\" value=\"" . $nt['Jahr'] . "\" />\n";
echo " <input class=\"short\" type=\"text\" name=\"Bezahlt_am\" />\n";
echo " <img style=\"float: left;\"src=\"img/small_info.png\" alt=\"TT.MM.JJJJ\" title=\"Datum der Form: <TT.MM.JJJJ>\" />\n";
echo " <input type=\"submit\" class=\"button_small_ok\" name=\"formaction\" value=\"gsave\" title=\"Übernehmen\" />\n";
echo " </form>\n";
echo "<br />\n";
echo "<hr class=\"fix\" />\n";
}
echo "<h2>Gesamt " . $Typ . ": " . number_format($ntsum['Preis'] * 1.19, '2', ',', '.') . " €</h2>\n";
echo "<br class=\"fix\" />\n";