Übersicht\n";
echo "
offene Gutschriften
\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 "\n";
echo "\n";
echo "\n";
echo "\n";
echo "
\n";
if ("" != $nt['Firma']) {
echo "