Datenstand V1.0

This commit is contained in:
2016-07-05 20:38:34 +00:00
parent 5a75f609e5
commit 5ea463a308
1027 changed files with 141480 additions and 0 deletions

84
inhalte/oposten_mahn2.php Normal file
View File

@@ -0,0 +1,84 @@
<?php
$test = explode("_", $_POST['ID']);
$ID = $test['1'];
$Jahr = $test['0'];
if (!isset($_POST['ok'])) {
$sql = "SELECT *, DATE_FORMAT(Datum, '%d.%m.%Y') AS Datum, DATE_ADD(Datum, INTERVAL Z_BIS DAY) AS Abfrage FROM ".PREFIX."_Mahnungen WHERE (Jahr = \"".$Jahr."\" AND ID = \"".$ID."\");";
$result = $db->query($sql);
$nt = $result->fetch_assoc();
$sql = "SELECT * FROM ".PREFIX."_Mahnungen WHERE (Referenz_Jahr = \"".$nt['Referenz_Jahr']."\" AND Referenz_ID =\"".$nt['Referenz_ID']."\" AND Nr = \"2\");";
$result = $db->query($sql);
if ($ntt = $result->fetch_assoc()) {
while (strlen($ntt['ID']) < $_SESSION['Firma']['Stellen']) {
$ntt['ID'] = "0".$ntt['ID'];
}
echo "<h2>Zu diesem Vorgang existiert bereits eine 2. Mahnung mit der Nummer: <i>".$ntt['Jahr']."_".$ntt['ID']."</i></h2>";
return(0);
}
echo "<p>Soll eine weitere Mahnung erstellt werden:</p>\n";
$Heute = date('Y-m-d');
if ($Heute < $nt['Abfrage']) {
echo "<h2>Achtung die Frist für den Ausgleich des offenen Betrags wurde noch nicht überschritten!</h2>\n";
echo "<p>Soll die Mahnung dennoch erstellt werden?</p>\n";
}
$sql = "SELECT Firma, Vorname, Nachname FROM ".PREFIX."_Kontakte WHERE ID = \"".$nt['Kontakt_ID']."\";";
$resultk = $db->query($sql);
$ntk = $resultk->fetch_assoc();
while (strlen($nt['ID']) < $_SESSION['Firma']['Stellen']) {
$nt['ID'] = "0".$nt['ID'];
}
echo "<label>Mahnung-Nr</label>\n";
echo "<label>".$nt['Jahr']."_".$nt['ID']."</label>\n";
echo "<br class=\"fix\" />\n";
echo "<label>vom</label>\n";
echo "<label>".$nt['Datum']."</label>\n";
echo "<br class=\"fix\" />\n";
echo "<label>Kunde</label>\n";
echo "<label class=\"data\">";
if ("" != $ntk['Firma']) {
echo $ntk['Firma'].",";
} else {
echo $ntk['Vorname'];
}
echo " ".$ntk['Nachname'];
echo "</label>\n";
echo "<br class=\"fix\" />\n";
echo "<form action=\"index.php?".$_SERVER['QUERY_STRING']."\" method=\"post\" />\n";
echo " <input type=\"hidden\" name=\"table\" value=\"".$Typ."\" />\n";
echo " <input type=\"hidden\" name=\"Jahr\" value=\"".$nt['Referenz_Jahr']."\" />\n";
echo " <input type=\"hidden\" name=\"ID\" value=\"".$nt['Referenz_ID']."\" />\n";
echo " <input type=\"hidden\" name=\"Admin_ID\" value=\"".$nt['Admin_ID']."\" />\n";
echo " <input type=\"hidden\" name=\"Kontakt_ID\" value=\"".$nt['Kontakt_ID']."\" />\n";
echo " <input type=\"hidden\" name=\"formaction\" value=\"mahn2\" />\n";
echo " <label>Zahlbar bis</label>\n";
echo " <input type=\"text\" name=\"Z_Bis\" value=\"".$_SESSION['Firma']['Z_Bis']."\" />\n";
echo " <img src=\"img/small_info.png\" title=\"Tage ab Datum der Erstellung.\" alt=\"Tage ab Datum der Erstellung.\" />\n";
echo " <br />\n";
echo " <input type=\"submit\" class=\"button_ok\" name=\"ok\" value=\"1\" title=\"Übernehmen\" />\n";
echo "</form>\n";
echo "<br class=\"fix\" />\n";
} else {
$sql = 'INSERT INTO '.PREFIX.'_Mahnungen (Jahr, ID, Nr, Kontakt_ID, Admin_ID, Referenz_Jahr, Referenz_ID, Datum) VALUES (YEAR(CURDATE()), NULL, "2", "'.$_POST['Kontakt_ID'].'", "'.$_POST['Admin_ID'].'", "'.$_POST['Jahr'].'", "'.$_POST['ID'].'", CURDATE())';
$stmt = $db->prepare($sql);
if (!$stmt) {
die ('Datensatz konnte nicht angelegt werden: '.$db->error);
}
if (!$stmt->execute()) {
die ('Datensatz konnte nicht angelegt werden: '.$stmt->error);
}
$sql = 'SELECT last_insert_id() AS last';
$result = $db->query($sql);
$nt = $result->fetch_assoc();
$ID = $nt['last'];
echo "<fieldset>\n";
echo " <legend>Mahnung wurde erstellt</legend>\n";
echo " <form action=\"index.php?".$_SERVER['QUERY_STRING']."\" method=\"post\">\n";
echo " <input type=\"hidden\" name=\"mahnung\" value=\"2\" />\n";
echo " <input type=\"hidden\" name=\"ID\" value=\"".date("y").",".$ID."\" />\n";
echo " <input type=\"submit\" class=\"button_view\" name=\"formaction\" value=\"view\" title=\"Mahnung anzeigen\" />\n";
echo " </form>\n";
echo "</fieldset>\n";
}
?>