<?
session_register("kopf", "head_id") ;
session_start() ;
include ("db_open.php") ;
mysql_select_db("kasse") or die ("Datenbank konnte nicht ausgewählt werden");
if ($reset) {
$name = "" ;
$adresse = "";
$kopf = "" ;
$head_id = "" ;
}
if ($del_1) {
$sql = "delete from head where id = $del_1";
mysql_query($sql);
}
if (($name) and (!$kopf)) {
$eintrag = "INSERT INTO head (name, adresse, ort, datum, total, mwst) values ('$name', '$adresse', '$ort', '$datum', '$total', '$mwst')";
$eintragen = mysql_query($eintrag);
$head_id = mysql_insert_id() ;
$kopf = "OK" ;
}
if ($del_2) {
$sql = "delete from pos where id = $del_2";
mysql_query($sql);
}
if ($bezeichnung) {
$betrag = $preis * $menge ;
$eintrag = "INSERT INTO pos (head_id, menge, bezeichnung, preis, betrag) values ('$head_id', '$menge', '$bezeichnung', '$preis', '$betrag')";
$eintragen = mysql_query($eintrag);
}
if ($id_1) {
$head_id = $id_1 ;
$result = mysql_query("select * from head where id=$head_id") or die ("DB - Lesefehler (ID, HEAD_ID)");
$row = mysql_fetch_array ($result) ;
include ("kopf_read.php") ;
$kopf = "OK" ;
}
?>
<html>
<head>
<meta http-equiv="Content-Language" content="de-ch">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Kasse <? echo $kopf ?></title>
</head>
<body bgcolor="#008080">
<link rel="stylesheet" href="style.css" type="text/css">
<img src="img/csi_klein.jpg" alt="" border="0">
<form action="index.php" method="post">
<TABLE>
<tr>
<td>Name:</td>
<td><input type="text" style="font-family: Tahoma; font-size: 12px; border-style: solid; border-width: 1px" size="20" maxlength="50" name="name" value="<? echo $name ?>"></td>
<td>Nummer:</td>
<td><? echo $head_id ?></td>
</tr>
<tr>
<td>Adresse:</td>
<td><input type="text" style="font-family: Tahoma; font-size: 12px; border-style: solid; border-width: 1px" size="20" maxlength="50" name="adresse" value="<? echo $adresse ?>"></td>
<td>Datum:</td>
<td><input type="text" style="font-family: Tahoma; font-size: 12px; border-style: solid; border-width: 1px" size="20" maxlength="50" name="datum" value="<? echo $datum ?>"></td>
</tr>
<tr>
<td>Ort:</td>
<td><input type="text" style="font-family: Tahoma; font-size: 12px; border-style: solid; border-width: 1px" size="20" maxlength="50" name="ort" value="<? echo $ort ?>"></td>
<td>Total:</td>
<td><input type="text" style="font-family: Tahoma; font-size: 12px; border-style: solid; border-width: 1px" size="20" maxlength="50" name="total" value="<? echo $total ?>"></td>
</tr>
<tr>
<td colspan="4" bgcolor="#ffffff" width="100%"></td>
</tr>
</TABLE>
<TABLE>
<tr>
<td>Artikel: </td>
<td><textarea style="font-family: Tahoma; font-size: 12px; border-style: solid; border-width: 1px" cols="60" rows="2" name="bezeichnung"></textarea></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Preis: </td>
<td><input type="Text" style="font-family: Tahoma; font-size: 12px; border-style: solid; border-width: 1px" size="6" maxlength="7" name="preis"></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Anzahl: </td>
<td><input type="Text" style="font-family: Tahoma; font-size: 12px; border-style: solid; border-width: 1px" size="6" maxlength="2" name="menge"></td>
<td></td>
<td></td>
</tr>
<tr>
<td align="center" colspan="6"><input type="submit" style="font-family: Tahoma; font-size: 12px; border-style: solid; border-width: 1px" value="OK">
<a href="index.php?reset=1">Reset</a>
<a target="_blank" href="beleg.php?id=<? echo $id ?>">Beleg</a></td>
</tr>
</table>
<table>
<tr>
<td width="20"></td>
<td width="150"></td>
<td width="100"></td>
<td width="100"></td>
<td width="100"></td>
<td width="20"></td>
<td width="20"></td>
</tr>
<tr><td colspan="7" height="1" width="100%" bgcolor="#ffffff"></td></tr>
<?
if ($kopf) {
$result = mysql_query("select * from pos where head_id=$head_id") or die ("DB - Lesefehler (POS)");
while ($row = mysql_fetch_array ($result)) {
$id = $row['id'] ;
$menge = $row['menge'] ;
$bezeichnung = $row['bezeichnung'] ;
$preis = $row['preis'] ;
$betrag = $row['betrag'] ;
$mwst = $row['mwst'] ;
?>
<tr>
<td align="left"><? echo $bezeichnung ?></td>
<td align="right"><? echo $preis ?></td>
<td align="right"><? echo $menge ?></td>
<td align="right"><? echo $betrag ?></td>
<td align="right"><? echo $total ?></td>
<td align="right"><? echo $mwst ?></td>
<td bgcolor="#ff0000" align="center"><a href="index.php?del_2=<? echo $id ?>"><font color="#FFFFFF">Del</font></a></td>
</tr>
<tr><td colspan="6" height="1" width="100%" bgcolor="#ffffff"></td></tr>
<?
}
} else {
$result = mysql_query("select * from head") or die ("DB - Lesefehler (HEAD)");
while ($row = mysql_fetch_array ($result)) {
include ("kopf_read.php") ;
?>
<tr>
<a href="index.php?id_1=<? echo $id ?>">
<td align="center"><? echo $id ?></td>
<td><? echo $name ?></td>
<td><? echo $adresse ?></td>
<td><? echo $ort ?></td>
<td><? echo $datum ?></td>
<td align="right"><? echo $total ?></td>
</a>
<td bgcolor="#ff0000" align="center"><a href="index.php?del_1=<? echo $id ?>"><font color="#FFFFFF">Del</font></a></td>
</tr>
<tr><td colspan="7" height="1" width="100%" bgcolor="#ffffff"></td></tr>
<?
}
}
?>
</TABLE>
</form>
</body>
</html>