Files
startup/inhalte/art_take.php

91 lines
2.5 KiB
PHP

<?php
if ("1" == $_POST['suche'])
{
if (("" == $_POST['name']) AND ("" == $_POST['Nr']))
{
$Abfrage = "";
}
else
{
$Abfrage = " WHERE (";
$i = 0;
if ("" != $_POST['name'])
{
$Abfrage .= " (" . PREFIX . "_Artikel.Bezeichnung LIKE \"%" . $_POST['name'] . "%\" OR " . PREFIX . "_Artikel.Feld1 LIKE \"%" . $_POST['name'] . "%\")";
$i = 1;
}
if ("" != $_POST['Nr'])
{
if (1 == $i)
{
$Abfrage .= " AND";
}
$Abfrage .= " ID = \"" . $_POST['Nr'] . "\"";
$i = 1;
}
$Abfrage .= ")";
}
}
$sql = "SELECT ID, Bezeichnung FROM " . PREFIX . "_Artikel " . $Abfrage . " ORDER BY ID ASC;";
$result = $db->query($sql);
echo "<fieldset>\n";
echo " <legend id=\"Artikel\">Artikel übernehmen</legend>\n";
echo " <form action=\"index.php?" . $_SERVER['QUERY_STRING'] . "#Artikel\" 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=\"Position\" value=\"" . $Max_Pos . "\" />\n";
echo " <span class=\"right\">\n";
echo " <input type=\"submit\" name=\"suche\" value=\"1\" title=\"Artikel suchen\" class=\"button_search\" />\n";
echo " </span>\n";
echo " <label>Artikelname</label>\n";
echo " <input type=\"text\" name=\"name\" />\n";
echo " <br style=\"clear: left;\" />\n";
echo " <label>Artikel Nr.</label>\n";
echo " <input type=\"text\" name=\"Nr\" />\n";
echo " <br />\n";
echo " <hr />\n";
if ("0" == $result->num_rows)
{
echo "<h2>Keine Datensätze \n";
}
elseif ("1" == $result->num_rows)
{
echo "<h2>" . $result->num_rows . " Datensatz \n";
}
else
{
echo "<h2>" . $result->num_rows . " Datensätze \n";
}
if (isset($_POST['suche']))
{
echo "gefunden";
}
else
{
echo "in der Datenbank";
}
echo "</h2>\n";
echo " <span class=\"right\">\n";
echo " <input type=\"submit\" name=\"art_take\" value=\"1\" title=\"Artikel in Positionen übernehmen\" class=\"button_ok\" />\n";
echo " </span>\n";
echo " <label>Artikel</label>\n";
echo " <select name=\"Art_ID\">\n";
while ($nt = $result->fetch_assoc())
{
while (strlen($nt['ID']) < $_SESSION['Firma']['Stellen'])
{
$nt['ID'] = "0" . $nt['ID'];
}
echo " <option value=\"" . $nt['ID'] . "\">" . $nt['ID'] . " - " . $nt['Bezeichnung'] . "</option>\n";
}
echo " </select>\n";
echo " <br style=\"clear: left;\" />\n";
echo " <label>Anzahl</label>\n";
echo " <input type=\"text\" name=\"Anzahl\" />\n";
echo " <br />\n";
echo " </form>\n";
echo "</fieldset>\n";
echo "<br />\n";