diff --git a/wawi/bestellung.php b/wawi/bestellung.php index cb3db07d9..85d7fb01a 100644 --- a/wawi/bestellung.php +++ b/wawi/bestellung.php @@ -36,7 +36,7 @@ require_once '../include/wawi_kostenstelle.class.php'; require_once '../include/wawi_bestelldetails.class.php'; require_once '../include/wawi_aufteilung.class.php'; require_once '../include/wawi_bestellstatus.class.php'; -require_once '../include/wawi_tags.class.php'; +require_once '../include/tags.class.php'; $aktion =''; $test = 0; @@ -273,7 +273,10 @@ if(isset($_POST['deleteBtnStorno']) && isset($_POST['id'])) sortList: [[1,0]], widgets: ['zebra'] }); + + $('#aufteilung').toggle(); + $('#aufteilung_link').click(function() { $('#aufteilung').toggle(); return false; @@ -503,14 +506,14 @@ if($aktion == 'suche') echo ''.$firmenname."\n"; echo ''.$date->formatDatum($row->insertamum, 'd.m.Y')."\n"; echo ''.$freigegeben=($row->freigegeben=='t')?'ja':'nein'."\n"; - echo ''.number_format($brutto,2)."\n"; + echo ''.number_format($brutto, 2, ",",".")."\n"; echo ''.$row->titel."\n"; echo ''.$row->updateamum.' '.$row->updatevon ."\n"; echo "\n"; } echo "\n"; - echo "Summe:".number_format($gesamtpreis,2)." €\n"; + echo "Summe:".number_format($gesamtpreis,2, ",",".")." €\n"; } else echo $bestellung->errormsg; @@ -644,7 +647,7 @@ if($aktion == 'suche') $allStandorte = new standort(); $allStandorte->getStandorteWithTyp('Intern'); $status= new wawi_bestellstatus(); - $bestell_tag = new wawi_tags(); + $bestell_tag = new tags(); $studiengang = new studiengang(); $studiengang->getAll('typ, kurzbz', null); @@ -795,7 +798,7 @@ if($aktion == 'suche') echo "Preis/VE\n"; echo "USt\n"; echo "Brutto\n"; - echo "Tags"; + echo " "; echo "\n"; echo ""; $i= 1; @@ -829,6 +832,18 @@ if($aktion == 'suche') var anzahlRows='.$i.'; var uid = "'.$user.'"; + $("#tags_link").click(function() { + i=1; + while(i<=anzahlRows) + { + $("#detail_tag_"+i).toggle(); + i=i+1; + } + $("#tags_headline").toggle(); + $("#tags_link").toggle(); + return false; + }); + function deleteBtnBestellt(bestellung_id, user_uid) { $("#btn_bestellt").html(); @@ -972,7 +987,6 @@ if($aktion == 'suche') { echo""; } - foreach($aufteilung->result as $auf) { // wenn in aufteilung vorhanden @@ -982,11 +996,10 @@ if($aktion == 'suche') $vorhanden = true; } } - if($stud->aktiv || $vorhanden) { $summe += $anteil; - echo "".mb_strtoupper($stud->oe_kurzbz).": % \n"; + echo "".mb_strtoupper($stud->oe_kurzbz).": % \n"; $help++; $anteil = 0; } @@ -995,7 +1008,7 @@ if($aktion == 'suche') echo ""; echo "\n"; echo ' - + @@ -1046,10 +1059,13 @@ if($aktion == 'suche') // Update auf Bestellung $date = new datum(); + var_dump($_POST); + $bestellung_id = $_GET['bestellung']; $bestellung_detail_anz = $_POST['detail_anz']; $bestellung_new = new wawi_bestellung(); $bestellung_new->load($bestellung_id); + $aufteilung_anzahl = $_POST['anz_aufteilung']; $bestellung_new->new = false; $bestellung_new->besteller_uid=$user; @@ -1062,16 +1078,66 @@ if($aktion == 'suche') $bestellung_new->liefertermin = $date->formatDatum($_POST['liefertermin'], 'Y-m-d'); $bestellung_new->updateamum = date('Y-m-d H:i:s'); $bestellung_new->updatevon = $user; + $tags = explode(";", $_POST['tags']); + $help_tags = new tags(); + $help_tags->bestellung_id = $bestellung_id; + $help_tags->deleteBestellungTag($tags); + foreach ($tags as $bestelltags) + { + //echo $bestelltags."
"; + $tag_bestellung = new tags(); + $tag_bestellung->tag = trim($bestelltags); + $tag_bestellung->bestellung_id = $bestellung_id; + $tag_bestellung->insertvon = $user; + $tag_besetllung->insertamum = date('Y-m-d H:i:s'); + + if(!$tag_bestellung->TagExists()) + { + $tag_bestellung->saveTag(); + $tag_bestellung->saveBestellungTag(); + } + else + { + if(!$tag_bestellung->BestellungTagExists()) + $tag_bestellung->saveBestellungTag(); + } + } // 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(); + if($detail_id != '') { // Update - $bestell_detail = new wawi_bestelldetail(); + $tags_detail = explode(";", $_POST["detail_tag_$i"]); + + $help_detailtags = new tags(); + $help_detailtags->bestelldetail_id = $detail_id; + $help_detailtags->deleteBestelldetailTag($tags_detail); + + foreach ($tags_detail as $det) + { + $detail_tag = new tags(); + $detail_tag->tag = trim($det); + $detail_tag->bestelldetail_id = $detail_id; + $detail_tag->insertvon = $user; + $detail_tag->insertamum = date('Y-m-d H:i:s'); + + if(!$detail_tag->TagExists()) + { + $detail_tag->saveTag(); + $detail_tag->saveBestelldetailTag(); + } + else + { + if(!$detail_tag->BestelldetailTagExists()) + $detail_tag->saveBestelldetailTag(); + } + } $bestell_detail->load($detail_id); $bestell_detail->position = $_POST["pos_$i"]; @@ -1088,8 +1154,6 @@ if($aktion == 'suche') else { // Insert - $bestell_detail = new wawi_bestelldetail(); - $bestell_detail->bestellung_id = $_GET['bestellung']; $bestell_detail->position = $_POST["pos_$i"]; $bestell_detail->menge = $_POST["menge_$i"]; @@ -1110,6 +1174,35 @@ if($aktion == 'suche') echo $bestell_detail->errormsg; } } + + for($i=0; $i<$aufteilung_anzahl; $i++) + { + $aufteilung = new wawi_aufteilung(); + $aufteilung->bestellung_id = $bestellung_id; + $aufteilung->oe_kurzbz = $_POST['oe_kurzbz_'.$i]; + $aufteilung->anteil = $_POST['aufteilung_'.$i]; + + if($aufteilung->AufteilungExists()) + { + // Update + $aufteilung->updateamum = date('Y-m-d H:i:s'); + $aufteilung->updatevon = $user; + $aufteilung->new = false; + } + else + { + // Insert + $aufteilung->updateamum = date('Y-m-d H:i:s'); + $aufteilung->updatevon = $user; + $aufteilung->insertamum = date('Y-m-d H:i:s'); + $aufteilung->insertvon = $user; + $aufteilung->new = true; + } + + $aufteilung->saveAufteilung(); + + } + if($bestellung_new->save()) { @@ -1126,27 +1219,27 @@ if($aktion == 'suche') echo "\n"; echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; - /* $detail_tag = new wawi_tags(); + $detail_tag = new tags(); $detail_tag->GetTagsByBesteldetail($bestelldetail_id); - $help = $detail_tag->GetStringTags(); */ - echo ""; + $help = $detail_tag->GetStringTags(); + echo ""; - /* echo ' ';*/ + "; echo ""; echo "\n"; diff --git a/wawi/kostenstellenuebersicht.php b/wawi/kostenstellenuebersicht.php index 9c2174e11..1f8977624 100644 --- a/wawi/kostenstellenuebersicht.php +++ b/wawi/kostenstellenuebersicht.php @@ -305,6 +305,7 @@ if(isset($_GET['method'])) } else if ($_GET['method']=="allocate") { + // zu konto zuordnen if(!$rechte->isberechtigt('wawi/kostenstelle',null, 'su',$_GET['id'])) die('Sie haben keine Berechtigung zum Ändern der Kostenstelle'); @@ -507,6 +508,7 @@ if(isset($_GET['method'])) } else { + // alle anzeigen echo "

Kostenstelle - Übersicht

\n"; if(!$rechte->isberechtigt('wawi/kostenstelle',null, 's')) die('Sie haben keine Berechtigung zum Anzeigen der Kostenstellen'); @@ -538,7 +540,7 @@ else echo ''.$row->kostenstelle_nr."\n"; echo ''.$row->bezeichnung."\n"; echo ''.$row->kurzbz."\n"; - echo ''.$row->budget."\n"; + echo ''.number_format($row->budget, 2, ",",".")."\n"; echo ''.$row->oe_kurzbz."\n"; echo ''.$aktiv=($row->aktiv)?'ja':'nein'."\n"; echo "\n"; diff --git a/wawi/wawi_autocomplete.php b/wawi/wawi_autocomplete.php index 5b9cd07b9..bb02cb550 100644 --- a/wawi/wawi_autocomplete.php +++ b/wawi/wawi_autocomplete.php @@ -43,7 +43,7 @@ require_once('../include/betriebsmittelstatus.class.php'); require_once('../include/betriebsmittel_betriebsmittelstatus.class.php'); require_once ('../include/firma.class.php'); - require_once ('../include/wawi_tags.class.php'); + require_once ('../include/tags.class.php'); if (!$uid = get_uid()) die('Keine UID gefunden:'.$uid.' ! Zurück'); @@ -343,7 +343,7 @@ cellSeparator (default value: "|") if (is_null($bestell_id) || $tag_search=='') exit(); - $tags = new wawi_tags(); + $tags = new tags(); if (!$tags->getAll()) exit($tags->errormsg."\n"); @@ -360,9 +360,9 @@ cellSeparator (default value: "|") if (is_null($detail) || $tag_search=='') exit(); - $tags = new wawi_tags(); + $tags = new tags(); - if (!$tags->GetTagsByBesteldetail($detail)) + if (!$tags->getAll()) exit($tags->errormsg."\n"); for ($i=0;$iresult);$i++)