add actions and shiat

This commit is contained in:
2021-06-17 12:27:30 +02:00
parent ff795bb1c0
commit 231c0a706e
5 changed files with 143 additions and 7 deletions
+34
View File
@@ -0,0 +1,34 @@
<?php
include '../head.php';
echo '<h1>Hinzufügen</h1>';
$id= $_GET['id'];
$dienst=$_POST['Produkt'];
$preis=$_POST['Preis'];
include '../connect.php';
$query="select Festpreiswert from dienstleistung where Dientleistungsnummer=?";
$stmt=$sql->prepare($query);
$stmt->bind_param("i",$dienst);
$stmt->execute();
$defaultPrice=$stmt->get_result()->fetch_assoc();
$query="INSERT INTO `umfasst` (`Einzelpreis`, `Auftragsnummer`, `Dienstleistungsnummer`) VALUES (?,?,?)";
$stmt=$sql->prepare($query);
if($preis==""){
$stmt->bind_param("iii",$defaultPrice["Festpreiswert"],$id,$dienst);
}else{
$stmt->bind_param("iii",$preis,$id,$dienst);
}
$stmt->execute();
echo $stmt->error;
echo "
<script>
goBack($id);
</script>
";
include '../tail.php';
+19
View File
@@ -0,0 +1,19 @@
<?php
include '../head.php';
echo '<h1>Auftrags Ansicht</h1>';
$id= $_GET['id'];
$dienst=$_GET['dienst'];
include '../connect.php';
$query="DELETE FROM umfasst WHERE Auftragsnummer=? AND Dienstleistungsnummer=?";
$stmt=$sql->prepare($query);
$stmt->bind_param("ii",$id,$dienst);
$stmt->execute();
echo "
<script>
goBack($id);
</script>
";
include '../tail.php';
?>
+34
View File
@@ -0,0 +1,34 @@
<?php
include '../head.php';
echo '<h1>Save Mitarbeiter Ref</h1>';
$id= $_GET['id'];
$mitar=$_POST['Mitarbeiter'];
include '../connect.php';
$query="select Festpreiswert from dienstleistung where Dientleistungsnummer=?";
$stmt=$sql->prepare($query);
$stmt->bind_param("i",$dienst);
$stmt->execute();
$defaultPrice=$stmt->get_result()->fetch_assoc();
$query="INSERT INTO `umfasst` (`Einzelpreis`, `Auftragsnummer`, `Dienstleistungsnummer`) VALUES (?,?,?)";
$stmt=$sql->prepare($query);
if($preis==""){
$stmt->bind_param("iii",$defaultPrice["Festpreiswert"],$id,$dienst);
}else{
$stmt->bind_param("iii",$preis,$id,$dienst);
}
$stmt->execute();
echo $stmt->error;
echo "
<script>
goBack($id);
</script>
";
include '../tail.php';
+5
View File
@@ -2,4 +2,9 @@
<head>
<title>PHP-Test</title>
</head>
<script>
function goBack(i) {
window.location.href='/view/auftrag.php?id='+i;
}
</script>
<body>
+51 -7
View File
@@ -2,6 +2,7 @@
include '../head.php';
echo '<h1>Auftrags Ansicht</h1>';
$id= $_GET['id'];
echo "<hr>";
echo "<h2>Auftrag $id</h2>";
include '../connect.php';
?>
@@ -29,7 +30,6 @@
$kid=$row["Kundenummer"];
$mitarbeiter=$row["Mitarbeiternummer"];
?>
<hr>
<fieldset>
<legend style="border: 1px black solid;margin-left: 1em; padding: 0.2em 0.8em ">Zeitpunkt</legend>
@@ -101,12 +101,14 @@
<fieldset>
<legend style="border: 1px black solid;margin-left: 1em; padding: 0.2em 0.8em ">Dienste</legend>
<fieldset>
<table >
<tr>
<th>NR.</th>
<th>Beschreibung</th>
<th>Katalog Preis</th>
<th>Auftrags Preis</th>
<th>Funktionen</th>
</tr>
<?php
@@ -126,23 +128,65 @@
$catPrice=$row[3];
$aufPrice=$row[4];
$total=$total+$aufPrice;
echo var_dump($row);
echo"
<td>$nr</td>
<td>$desc</td>
<td>$catPrice</td>
<td>$aufPrice</td>
<td>$catPrice €</td>
<td>$aufPrice €</td>
<td><a href=/action/remove-umfast.php?id=$id&dienst=$nr>Löschen</a>
</tr>";
}
?>
</table>
</fieldset>
<fieldset>
<legend style="border: 1px black solid;margin-left: 1em; padding: 0.2em 0.8em ">Summe</legend>
<?php
echo "Summe: $total €</br>";
?>
</fieldset>
<fieldset>
<legend style="border: 1px black solid;margin-left: 1em; padding: 0.2em 0.8em ">Dienste hinzufügen</legend>
<?php
$mit=$sql->query("select * from dienstleistung");
$lines=$mit->fetch_all();
echo "<form action='/action/add-dienstleistung.php?id=$id' method='post'>
<label for='product'>Produkt: </label>
<select name='Produkt' id='product'>";
foreach($lines as $rot){
$nr=$rot[2];
$name=$rot[1];
$preis=$rot[3];
echo "<option value='$nr'>$name ($preis €)</option>";
}
echo "
</select></br>
<label for='price'>Preis Überschreibung:</label>
<input type='number' id='price' name='Preis'> <br>
<input type='submit' value='Hinzufügen'>
</form>";
?>
</fieldset>
</fieldset>
<?php
include '../tail.php';
?>