From 6a22ae49abd62fa6ef50ba948c57ca9473269197 Mon Sep 17 00:00:00 2001 From: Karl Burkhart Date: Mon, 22 Nov 2010 16:27:41 +0000 Subject: [PATCH] --- wawi/bestellung.php | 252 ++++++++++++++++++++++++------- wawi/kostenstellenuebersicht.php | 1 + 2 files changed, 196 insertions(+), 57 deletions(-) diff --git a/wawi/bestellung.php b/wawi/bestellung.php index f2feae1ae..3b057974a 100644 --- a/wawi/bestellung.php +++ b/wawi/bestellung.php @@ -20,15 +20,40 @@ * Karl Burkhart . */ -require_once '../config/wawi.config.inc.php'; require_once('auth.php'); +require_once '../config/wawi.config.inc.php'; require_once '../include/firma.class.php'; require_once '../include/organisationseinheit.class.php'; +require_once '../include/mitarbeiter.class.php'; +require_once '../include/datum.class.php'; require_once '../include/wawi_konto.class.php'; require_once '../include/wawi_bestellung.class.php'; -require_once '../include/mitarbeiter.class.php'; -require_once('../include/datum.class.php'); +require_once '../include/wawi_kostenstelle.class.php'; +require_once '../include/benutzerberechtigung.class.php'; $aktion =''; + +if(isset($_POST['getKonto'])) +{ + $id = $_POST['id']; + if(is_numeric($id)) + { + $konto = new wawi_konto(); + $konto->getKontoFromKostenstelle($id); + if(count($konto->result)>0) + { + foreach($konto->result as $ko) + { + echo '\n"; + } + } + else + echo ""; + } + else + echo ""; + exit; +} + ?> WaWi Bestellung - + + + + + + + + @@ -98,11 +156,19 @@ $aktion =''; getBerechtigungen($user); + +$kst=new wawi_kostenstelle(); +$kst->loadArray($rechte->getKostenstelle($berechtigung_kurzbz)); + if (isset($_GET['method'])) $aktion = $_GET['method']; - if($aktion == 'suche') { if(!isset($_POST['submit'])) @@ -172,8 +238,7 @@ if($aktion == 'suche') echo "\n"; echo " Konto: \n"; echo "\n"; echo "\n"; - echo "\n"; echo "\n"; echo "Nur ohne Rechnung\n"; @@ -251,20 +315,21 @@ if($aktion == 'suche') foreach($bestellung->result as $row) { $brutto = $bestellung->getBrutto($row->bestellung_id); - $firma->load($row->firma_id); - $freigegeben = 'false'; - if($row->freigegeben == 't'); + $firmenname = ''; + if(is_numeric($row->firma_id)) { - $freigegeben = 'true'; + $firma->load($row->firma_id); + $firmenname = $firma->name; } + //Zeilen der Tabelle ausgeben echo "\n"; echo " bestellung_id\" title=\"Bearbeiten\"> bestellung_id\" onclick='return conf_del()' title='Löschen'> "; echo ''.$row->bestell_nr."\n"; echo ''.$row->bestellung_id."\n"; - echo ''.$firma->name."\n"; + echo ''.$firmenname."\n"; echo ''.$date->formatDatum($row->insertamum, 'd.m.Y')."\n"; - echo ''.$freigegeben."\n"; + echo ''.$freigegeben=($row->freigegeben=='t')?'ja':'nein'."\n"; echo ''.number_format($brutto,2)."\n"; echo ''.$row->titel."\n"; echo ''.$row->updateamum.' '.$row->updatevon ."\n"; @@ -280,5 +345,78 @@ if($aktion == 'suche') else echo "ungültiges Datumsformat"; } - -} \ No newline at end of file +} else if($aktion == 'new') + { + echo "

Neue Bestellung

"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Titel:"; + echo "
Kostenstelle:
Firma:
Konto: \n"; + echo "\n"; + echo "
 
\n"; + } + else if($aktion == 'save') + { + if(isset($_POST)) + { + $newBestellung = new wawi_bestellung(); + $newBestellung->titel = $_POST['titel']; + $newBestellung->kostenstelle_id = $_POST['filter_kst']; + $newBestellung->firma_id = $_POST['firma_id']; + $newBestellung->konto_id = $_POST['konto']; + + $newBestellung->insertamum = date('Y-m-d H:i:s'); + $newBestellung->insertvon = $user; + $newBestellung->updateamum = date('Y-m-d H:i:s'); + $newBestellung->updatevon = $user; + + $newBestellung->new = true; + $newBestellung->freigegeben = false; + + if (!$bestell_id = $newBestellung->save()) + echo $newBestellung->errormsg; + echo "Bestellung mit der ID ".$bestell_id." erfolgreich angelegt. "; + echo " Link drücken"; + } + + } + else if($_GET['method']=='delete') + { + $id = (isset($_GET['id'])?$_GET['id']:null); + + $bestellung = new wawi_bestellung(); + + if($bestellung->delete($id)) + { + echo 'Bestellung erfolgreich gelöscht.
'; + } + else + { + echo $bestellung->errormsg; + } + } \ No newline at end of file diff --git a/wawi/kostenstellenuebersicht.php b/wawi/kostenstellenuebersicht.php index a857553e2..c62b56cd0 100644 --- a/wawi/kostenstellenuebersicht.php +++ b/wawi/kostenstellenuebersicht.php @@ -122,6 +122,7 @@ if(isset($_GET['method'])) } echo "\n"; + echo "\n"; echo "Bezeichnung\n"; echo "bezeichnung\">\n";