From 1335537ba52fe83ef8bf23c596f6d1f06f6f6421 Mon Sep 17 00:00:00 2001 From: Karl Burkhart Date: Thu, 9 Dec 2010 15:04:53 +0000 Subject: [PATCH] --- wawi/bestellung.php | 60 ++++++++++++++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 17 deletions(-) diff --git a/wawi/bestellung.php b/wawi/bestellung.php index 85d7fb01a..9d1ab21e3 100644 --- a/wawi/bestellung.php +++ b/wawi/bestellung.php @@ -245,7 +245,12 @@ if(isset($_POST['deleteBtnStorno']) && isset($_POST['id'])) function formatItem(row) { return row[0] + "
" + row[1] + "
"; - } + } + function formatItemTag(row) + { + return row[0]; + } + function conf_del() { return confirm('Diese Bestellung wirklich löschen?'); @@ -500,7 +505,7 @@ if($aktion == 'suche') } //Zeilen der Tabelle ausgeben echo "\n"; - echo " bestellung_id\" title=\"Bearbeiten\"> bestellung_id\" onclick='return conf_del()' title='Löschen'> bestellung_id\" title=\"Neue Rechnung\"> "; + echo " bestellung_id\" title=\"Bestellung bearbeiten\"> bestellung_id\" onclick='return conf_del()' title='Bestellung löschen'> bestellung_id\" title=\"Neue Rechnung anlegen\"> bestellung_id\" title=\"Bestellung kopieren\"> "; echo ''.$row->bestell_nr."\n"; echo ''.$row->bestellung_id."\n"; echo ''.$firmenname."\n"; @@ -528,7 +533,7 @@ if($aktion == 'suche') die('Sie haben keine Berechtigung zum Anlegen von Bestellungen'); echo "

Neue Bestellung

"; - echo "
\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -597,7 +602,7 @@ if($aktion == 'suche') else { echo "Bestellung mit der ID ".$bestell_id." erfolgreich angelegt. "; - echo " Link drücken zum editieren der Bestellung"; + echo " Link drücken zum editieren der Bestellung"; } } } @@ -617,6 +622,17 @@ if($aktion == 'suche') { echo $bestellung->errormsg; } + } + else if($_GET['method']=='copy') + { + $bestellung_id = $_GET['id']; + $bestellung = new wawi_bestellung(); + if ($bestellung->copyBestellung($bestellung_id)) + { + echo $bestellung_id; + } + + } else if($_GET['method']=='update') { @@ -640,7 +656,18 @@ if($aktion == 'suche') $kostenstelle = new wawi_kostenstelle(); $kostenstelle->load($bestellung->kostenstelle_id); $aufteilung = new wawi_aufteilung(); - $aufteilung->getAufteilungFromKostenstelle($bestellung->kostenstelle_id); + + // Bei neuer Bestellung Default Aufteilung holen ansonsten von bestehender bestellung + if(isset($_GET['new'])) + { + $aufteilung->getAufteilungFromKostenstelle($bestellung->kostenstelle_id); + } + else + { + $aufteilung->getAufteilungFromBestellung($bestellung->bestellung_id); + } + + $firma = new firma(); $firma->load($bestellung->firma_id); $liefertermin = $date->formatDatum($bestellung->liefertermin, 'd.m.Y'); @@ -657,7 +684,7 @@ if($aktion == 'suche') echo "

Bearbeiten

"; echo "\n"; echo "

Bestellnummer: ".$bestellung->bestell_nr."

"; - + echo 'Bestellung kopieren'; //tabelle Bestelldetails echo "
Titel:
\n"; echo "\n"; @@ -762,6 +789,7 @@ if($aktion == 'suche') width:500, multiple: true, multipleSeparator: "; ", + formatItem:formatItemTag, extraParams:{"work":"tags", "bestell_id":"'.$bestellung->bestellung_id.'"} }); '; @@ -786,7 +814,7 @@ if($aktion == 'suche') echo "
\n"; echo "
"; - //tabelle Positonen + //tabelle Details echo "\n"; echo "\n"; echo "\n"; @@ -1057,9 +1085,8 @@ if($aktion == 'suche') else { // Update auf Bestellung - $date = new datum(); - - var_dump($_POST); + $date = new datum(); + //var_dump($_POST); $bestellung_id = $_GET['bestellung']; $bestellung_detail_anz = $_POST['detail_anz']; @@ -1085,7 +1112,6 @@ if($aktion == 'suche') foreach ($tags as $bestelltags) { - //echo $bestelltags."
"; $tag_bestellung = new tags(); $tag_bestellung->tag = trim($bestelltags); $tag_bestellung->bestellung_id = $bestellung_id; @@ -1106,13 +1132,15 @@ if($aktion == 'suche') // letzte leere zeile nicht speichern for($i = 1; $i < $bestellung_detail_anz; $i++) { - // gibt es ein bestelldetail schon $detail_id = $_POST["bestelldetailid_$i"]; $bestell_detail = new wawi_bestelldetail(); + // gibt es ein bestelldetail schon if($detail_id != '') { // Update + $bestell_detail->load($detail_id); + $tags_detail = explode(";", $_POST["detail_tag_$i"]); $help_detailtags = new tags(); @@ -1138,7 +1166,6 @@ if($aktion == 'suche') $detail_tag->saveBestelldetailTag(); } } - $bestell_detail->load($detail_id); $bestell_detail->position = $_POST["pos_$i"]; $bestell_detail->menge = $_POST["menge_$i"]; @@ -1169,6 +1196,7 @@ if($aktion == 'suche') $bestell_detail->updatevon = $user; $bestell_detail->new = true; } + if(!$bestell_detail->save()) { echo $bestell_detail->errormsg; @@ -1198,12 +1226,9 @@ if($aktion == 'suche') $aufteilung->insertvon = $user; $aufteilung->new = true; } - $aufteilung->saveAufteilung(); - } - if($bestellung_new->save()) { echo "erfolgreich gespeichert.

"; @@ -1243,4 +1268,5 @@ if($aktion == 'suche') echo ""; echo "\n"; - } \ No newline at end of file + } + \ No newline at end of file
Löschen