Files
startup/inhalte/positions.php

149 lines
9.8 KiB
PHP

<?php
while (strlen($nt['ID']) < $_SESSION['Firma']['Stellen'])
{
$nt['ID'] = "0" . $nt['ID'];
}
echo "<fieldset>\n";
echo " <legend id=\"Position\">" . $type . ": Positionen</legend>\n";
echo " <p style=\"float: left;\">" . $type . "-Nr.: " . $nt['Jahr'] . "_" . $nt['ID'] . "</p>\n";
echo " <p class=\"right\">Datum: " . $nt['Datum'] . "</p>\n";
echo " <br class=\"fix\" />\n";
echo " <table>\n";
echo " <colgroup>\n";
echo " <col span=\"2\" width=\"5%\" />\n";
echo " <col width=\"60%\" />\n";
echo " <col span=\"3\" width=\"10%\" />\n";
echo " </colgroup>\n";
echo " <tr>\n";
echo " <th>Pos.</th>\n";
echo " <th>Anz.</th>\n";
echo " <th>Artikel</th>\n";
echo " <th>E-Preis</th>\n";
echo " <th>Gesamtpreis</th>\n";
echo " <th>&nbsp;</th>\n";
echo " </tr>\n";
while ($ntp = $resultp->fetch_assoc())
{
if ($ntp['Position'] > $Max_Pos)
{
$Max_Pos = $ntp['Position'];
}
if (("edit" == $_POST['action']) AND ($ntp['ID'] == $_POST['POS_ID']))
{
echo " <tr>\n";
echo " <form action=\"index.php?" . $_SERVER['QUERY_STRING'] . "#Position\" method=\"post\" />\n";
echo " <input type=\"hidden\" name=\"formaction\" value=\"edit\" />\n";
echo " <input type=\"hidden\" name=\"ID\" value=\"" . $Jahr . "_" . $ID . "\" />\n";
echo " <input type=\"hidden\" name=\"POS_ID\" value=\"" . $ntp['ID'] . "\" />\n";
echo " <td><input class=\"number\" onkeyup=\"if ( window.event.keyCode == '188' || window.event.keyCode == '190' || window.event.keyCode == '110' ) { this.value = this.value.replace(',' , '').replace('.' , ''); }\" type=\"text\" name=\"Position\" value=\"" . $ntp['Position'] . "\" /></td>\n";
echo " <td><input class=\"number\" onkeyup=\"if ( window.event.keyCode == '188' || window.event.keyCode == '110' ) { this.value = this.value.replace(',' , '.'); }\" type=\"text\" name=\"Anzahl\" value=\"" . $ntp['Anzahl'] . "\" /></td>\n";
echo " <td><input class=\"verylong\" type=\"text\" name=\"Bezeichnung\" value=\"" . $ntp['Bezeichnung'] . "\" /><br class=\"fix\" />\n";
if (("" != $_SESSION['Firma']['Feld1_Name']) AND (preg_match("/" . $_GET['section'] . ",/", $_SESSION['Firma']['Feld1'])))
{
echo "<p class=\"Feld1\"><textarea style=\"float:none;\" name=\"Feld1\">" . stripslashes($ntp['Feld1']) . "</textarea></p>\n";
}
if (("" != $_SESSION['Firma']['Feld2_Name']) AND (preg_match("/" . $_GET['section'] . ",/", $_SESSION['Firma']['Feld2'])))
{
echo "<p class=\"Feld\">" . $_SESSION['Firma']['Feld2_Name'] . ": <br /><input class=\"verylong\" type=\"text\" name=\"Feld2\" value=\"" . stripslashes($ntp['Feld2']) . "\" /></p>\n";
}
if (("" != $_SESSION['Firma']['Feld3_Name']) AND (preg_match("/" . $_GET['section'] . ",/", $_SESSION['Firma']['Feld3'])))
{
echo "<p class=\"Feld\">" . $_SESSION['Firma']['Feld3_Name'] . ": <br /><input class=\"verylong\" type=\"text\" name=\"Feld3\" value=\"" . stripslashes($ntp['Feld3']) . "\" /></p>\n";
}
if (("" != $_SESSION['Firma']['Feld4_Name']) AND (preg_match("/" . $_GET['section'] . ",/", $_SESSION['Firma']['Feld4'])))
{
echo "<p class=\"Feld\">" . $_SESSION['Firma']['Feld4_Name'] . ": <br /><input class=\"verylong\" type=\"text\" name=\"Feld4\" value=\"" . stripslashes($ntp['Feld4']) . "\" /></p>\n";
}
if (("" != $_SESSION['Firma']['Feld5_Name']) AND (preg_match("/" . $_GET['section'] . ",/", $_SESSION['Firma']['Feld5'])))
{
echo "<p class=\"Feld\">" . $_SESSION['Firma']['Feld5_Name'] . ": <br /><input class=\"verylong\" type=\"text\" name=\"Feld5\" value=\"" . stripslashes($ntp['Feld5']) . "\" /></p>\n";
}
echo "</td>\n";
echo " <td><input class=\"money\" onkeyup=\"if ( window.event.keyCode == '188' || window.event.keyCode == '110' ) { this.value = this.value.replace(',' , '.'); }\" type=\"text\" name=\"Preis\" value=\"" . $ntp['Preis'] . "\" /></td>\n";
echo " <td>" . $ntp['Preis'] * $ntp['Anzahl'] . "</td>\n";
echo " <td>\n";
echo " <input type=\"submit\" class=\"button_small_ok\" name=\"pos_change\" value=\"1\" title=\"Änderungen speichern\" />\n";
echo " <input type=\"submit\" class=\"button_small_save\" name=\"art_pos_change\" value=\"1\" title=\"Änderungen speichern und Artikel in Datenbank speichern\" />\n";
echo " <input type=\"submit\" class=\"button_small_stop\" name=\"Nix_machen\" value=\"1\" title=\"Änderungen abbrechen\" />\n";
echo " </td>\n";
echo " </form>\n";
echo " </tr>\n";
}
else
{
echo " <tr>\n";
echo " <td>" . $ntp['Position'] . "</td>\n";
echo " <td>" . $ntp['Anzahl'] . "</td>\n";
echo " <td>" . nl2br($ntp['Bezeichnung']);
if (("" != $_SESSION['Firma']['Feld1_Name']) AND (preg_match("/" . $_GET['section'] . ",/", $_SESSION['Firma']['Feld1'])))
{
echo "<p class=\"Feld1\">" . nl2br(stripslashes($ntp['Feld1'])) . "</p>\n";
}
if (("" != $_SESSION['Firma']['Feld2_Name']) AND (preg_match("/" . $_GET['section'] . ",/", $_SESSION['Firma']['Feld2'])))
{
echo "<p class=\"Feld\">" . $_SESSION['Firma']['Feld2_Name'] . ": " . stripslashes($ntp['Feld2']) . "</p>\n";
}
if (("" != $_SESSION['Firma']['Feld3_Name']) AND (preg_match("/" . $_GET['section'] . ",/", $_SESSION['Firma']['Feld3'])))
{
echo "<p class=\"Feld\">" . $_SESSION['Firma']['Feld3_Name'] . ": " . stripslashes($ntp['Feld3']) . "</p>\n";
}
if (("" != $_SESSION['Firma']['Feld4_Name']) AND (preg_match("/" . $_GET['section'] . ",/", $_SESSION['Firma']['Feld4'])))
{
echo "<p class=\"Feld\">" . $_SESSION['Firma']['Feld4_Name'] . ": " . stripslashes($ntp['Feld4']) . "</p>\n";
}
if (("" != $_SESSION['Firma']['Feld5_Name']) AND (preg_match("/" . $_GET['section'] . ",/", $_SESSION['Firma']['Feld5'])))
{
echo "<p class=\"Feld\">" . $_SESSION['Firma']['Feld5_Name'] . ": " . stripslashes($ntp['Feld5']) . "</p>\n";
}
echo "</td>\n";
echo " <td>" . $ntp['Preis'] . " &euro;</td>\n";
echo " <td>" . number_format($ntp['Preis'] * $ntp['Anzahl'], '2', ',', '.') . " €</td>\n";
echo " <td>\n";
echo " <form action=\"index.php?" . $_SERVER['QUERY_STRING'] . "#Position\" method=\"post\" />\n";
echo " <input type=\"hidden\" name=\"formaction\" value=\"edit\" />\n";
echo " <input type=\"hidden\" name=\"ID\" value=\"" . $Jahr . "_" . $ID . "\" />\n";
echo " <input type=\"hidden\" name=\"POS_ID\" value=\"" . $ntp['ID'] . "\" />\n";
echo " <input type=\"submit\" class=\"button_small_edit\" name=\"action\" value=\"edit\" title=\"Position bearbeiten\" />\n";
echo " <input type=\"submit\" class=\"button_small_del\" name=\"pos_delete\" value=\"1\" title=\"Position löschen\" />\n";
echo " </form>\n";
echo " </td>\n";
echo " </tr>\n";
}
}
++$Max_Pos;
echo " <tr>\n";
echo " <form action=\"index.php?" . $_SERVER['QUERY_STRING'] . "\" method=\"post\" />\n";
echo " <input type=\"hidden\" name=\"formaction\" value=\"edit\" />\n";
echo " <input type=\"hidden\" name=\"ID\" value=\"" . $Jahr . "_" . $ID . "\" />\n";
echo " <td><input type=\"hidden\" name=\"Position\" value=\"" . $Max_Pos . "\" /></td>\n";
echo " <td><input class=\"number\" type=\"text\" name=\"Anzahl\" value=\"1\" onfocus=\"if(this.value == this.defaultValue) this.value = '';\" onblur = \"if(!this.value) this.value = this.defaultValue;\"/></td>\n";
echo " <td><input class=\"verylong\" type=\"text\" name=\"Bezeichnung\" value=\"Bezeichnung\" onfocus=\"if(this.value == this.defaultValue) this.value = '';\" onblur = \"if(!this.value) this.value = this.defaultValue;\"/><br class=\"fix\" />\n";
if (("" != $_SESSION['Firma']['Feld1_Name']) AND (preg_match("/" . $_GET['section'] . ",/", $_SESSION['Firma']['Feld1'])))
{
echo "<p class=\"Feld1\"><textarea name=\"Feld1\" onfocus=\"if(this.value == this.defaultValue) this.value = '';\" >" . $_SESSION['Firma']['Feld1_Name'] . "</textarea></p>\n";
}
if (("" != $_SESSION['Firma']['Feld2_Name']) AND (preg_match("/" . $_GET['section'] . ",/", $_SESSION['Firma']['Feld2'])))
{
echo "<p class=\"Feld\"><input class=\"verylong\" type=\"text\" name=\"Feld2\" value=\"" . $_SESSION['Firma']['Feld2_Name'] . "\" onfocus=\"if(this.value == this.defaultValue) this.value = '';\" onblur = \"if(!this.value) this.value = this.defaultValue;\"/></p>\n";
}
if (("" != $_SESSION['Firma']['Feld3_Name']) AND (preg_match("/" . $_GET['section'] . ",/", $_SESSION['Firma']['Feld3'])))
{
echo "<p class=\"Feld\"><input class=\"verylong\" type=\"text\" name=\"Feld3\" value=\"" . $_SESSION['Firma']['Feld3_Name'] . "\" onfocus=\"if(this.value == this.defaultValue) this.value = '';\" onblur = \"if(!this.value) this.value = this.defaultValue;\"/></p>\n";
}
if (("" != $_SESSION['Firma']['Feld4_Name']) AND (preg_match("/" . $_GET['section'] . ",/", $_SESSION['Firma']['Feld4'])))
{
echo "<p class=\"Feld\"><input class=\"verylong\" type=\"text\" name=\"Feld4\" value=\"" . $_SESSION['Firma']['Feld4_Name'] . "\" onfocus=\"if(this.value == this.defaultValue) this.value = '';\" onblur = \"if(!this.value) this.value = this.defaultValue;\"/></p>\n";
}
if (("" != $_SESSION['Firma']['Feld5_Name']) AND (preg_match("/" . $_GET['section'] . ",/", $_SESSION['Firma']['Feld5'])))
{
echo "<p class=\"Feld\"><input class=\"verylong\" type=\"text\" name=\"Feld5\" value=\"" . $_SESSION['Firma']['Feld5_Name'] . "\" onfocus=\"if(this.value == this.defaultValue) this.value = '';\" onblur = \"if(!this.value) this.value = this.defaultValue;\"/></p>\n";
}
echo "</td>\n";
echo " <td><input class=\"money\" type=\"text\" name=\"Preis\" value=\"1.00\" onfocus=\"if(this.value == this.defaultValue) this.value = '';\" onblur = \"if(!this.value) this.value = this.defaultValue;\"/></td>\n";
echo " <td>&nbsp;</td>\n";
echo " <td><input type=\"submit\" class=\"button_small_ok\" name=\"pos_save\" value=\"1\" title=\"Position übernehmen\" />\n";
echo " <input type=\"submit\" class=\"button_small_save\" name=\"art_pos_save\" value=\"1\" title=\"Position übernehmen und Artikel in Datenbank speichern\" /></td>\n";
echo " </form>\n";
echo " </tr>\n";