Files
startup/inhalte/oposten_edit.php

67 lines
3.0 KiB
PHP

<?php
$test = explode("_", $_POST['ID']);
$ID = $test['1'];
$Jahr = $test['0'];
$sql = "SELECT *, DATE_FORMAT(Datum, '%d.%m.%Y') AS Datum FROM " . PREFIX . "_Mahnungen WHERE (Jahr = \"" . $Jahr . "\" AND ID = \"" . $ID . "\");";
$result = $db->query($sql);
$nt = $result->fetch_assoc();
$sql = "SELECT * FROM " . PREFIX . "_Kontakte WHERE ID = \"" . $nt['Kontakt_ID'] . "\";";
$result = $db->query($sql);
$ntk = $result->fetch_assoc();
$sql = "SELECT *, DATE_FORMAT(Datum, '%d.%m.%Y') AS Datum FROM " . PREFIX . "_Rechnungen WHERE (Jahr = \"" . $nt['Referenz_Jahr'] . "\" AND ID = \"" . $nt['Referenz_ID'] . "\");";
$result = $db->query($sql);
$ntr = $result->fetch_assoc();
$sql = "SELECT * FROM Admin WHERE Firma_ID = \"" . PREFIX . "\";";
$result = $db->query($sql);
while (strlen($nt['ID']) < $_SESSION['Firma']['Stellen'])
{
$nt['ID'] = "0" . $nt['ID'];
}
while (strlen($nt['Referenz_ID']) < $_SESSION['Firma']['Stellen'])
{
$nt['Referenz_ID'] = "0" . $nt['Referenz_ID'];
}
echo "<fieldset>";
echo " <legend>MahnungNr: " . $nt['Jahr'] . "_" . $nt['ID'] . " vom " . $nt['Datum'] . "</legend>\n";
echo " <label>zu Rechnung</label>\n";
echo " <label class=\"data\">" . $nt['Referenz_Jahr'] . "_" . $nt['Referenz_ID'] . " vom " . $ntr['Datum'] . "</label>\n";
echo " <br class=\"fix\" />\n";
echo " <label>Rechnungsbetrag zzgl. MwSt.</label>\n";
echo " <label class=\"data\">" . number_format($ntr['Preis'], '2', ',', '.') . " €</label>\n";
echo " <br class=\"fix\" />\n";
echo " <label>Kunde</label>\n";
echo " <label class=\"data\">" . $ntk['Nachname'] . ", " . $ntk['Vorname'] . "</label>\n";
echo " <br class=\"fix\" />\n";
echo " <label>Firma</label>\n";
echo " <label class=\"data\">" . $ntk['Firma'] . "</label>\n";
echo " <br class=\"fix\" />\n";
echo " <form action=\"index.php?" . $_SERVER['QUERY_STRING'] . "\" method=\"post\">\n";
echo " <input type=\"hidden\" name=\"Jahr\" value=\"" . $Jahr . "\" />\n";
echo " <input type=\"hidden\" name=\"ID\" value=\"" . $ID . "\" />\n";
echo " <input type=\"hidden\" name=\"mahnung\" value=\"" . $nt['Nr'] . "\" />\n";
echo " <label>Ansprechpartner</label>\n";
echo " <select name=\"Admin_ID\">\n";
while ($nta = $result->fetch_assoc())
{
echo " <option value=\"" . $nta['ID'] . "\"";
if ($nta['ID'] == $nt['Admin_ID'])
{
echo " selected=\"selected\"";
}
echo ">" . $nta['Nachname'] . ", " . $nta['Vorname'] . "</option>\n";
}
echo " </select>\n";
echo " <br class=\"fix\" />\n";
echo " <label>Zahlbar bis</label>\n";
echo " <input type=\"text\" name=\"Z_Bis\" value=\"" . $nt['Z_Bis'] . "\" />\n";
echo " <img src=\"img/small_info.png\" alt=\"Anzahl Tage ab der Erstellung\" title=\"Anzahl Tage ab der Erstellung\" />\n";
echo " <br class=\"fix\" />\n";
echo " <input type=\"submit\" class=\"button_save\" name=\"formaction\" value=\"mahn_save\" title=\"Einstellungen speichern\" />\n";
echo " <input type=\"submit\" class=\"button_stop\" name=\"formaction\" value=\"stop\" title=\"Abbrechen\" />\n";
echo " </form>\n";
echo "</fieldset>\n";