diff --git a/include/tags.class.php b/include/tags.class.php index 23cd414f5..353b69093 100644 --- a/include/tags.class.php +++ b/include/tags.class.php @@ -137,7 +137,7 @@ class tags extends basis_db * Gibt alle Tags eines Bestelldetails zurück * @param $bestelldetail_id */ - public function GetTagsByBesteldetail($bestelldetail_id) + public function GetTagsByBestelldetail($bestelldetail_id) { if($bestelldetail_id == '') { diff --git a/system/checksystem.php b/system/checksystem.php index a9d0a0604..586af4b56 100644 --- a/system/checksystem.php +++ b/system/checksystem.php @@ -1578,6 +1578,8 @@ if(!@$db->db_query('SELECT * FROM wawi.tbl_konto LIMIT 1')) GRANT SELECT, INSERT, UPDATE, DELETE ON public.tbl_kontakt TO wawi; GRANT SELECT, INSERT, UPDATE, DELETE ON public.tbl_standort TO wawi; GRANT SELECT, INSERT, UPDATE, DELETE ON public.tbl_personfunktionstandort TO wawi; + GRANT SELECT ON public.tbl_studiensemester TO wawi; + GRANT SELECT ON public.tbl_studiengang TO wawi; GRANT SELECT, UPDATE ON SEQUENCE public.tbl_firma_firma_id_seq TO wawi; GRANT SELECT, UPDATE ON SEQUENCE public.tbl_person_person_id_seq TO wawi; @@ -1588,6 +1590,8 @@ if(!@$db->db_query('SELECT * FROM wawi.tbl_konto LIMIT 1')) GRANT SELECT, UPDATE ON SEQUENCE public.tbl_personfunktionstandort_personfunktionstandort_id_seq TO wawi; GRANT SELECT, UPDATE ON SEQUENCE wawi.seq_aufteilung_default_aufteilung_id TO wawi; GRANT SELECT, UPDATE ON SEQUENCE wawi.seq_aufteilung_aufteilung_id TO wawi; + GRANT SELECT, UPDATE ON SEQUENCE wawi.seq_bestellung_bestellung_id TO wawi; + GRANT SELECT, UPDATE ON SEQUENCE wawi.seq_bestelldetail_bestelldetail_id TO wawi; -- INDEX diff --git a/system/sync/kontokostenstelle.php b/system/sync/kontokostenstelle.php new file mode 100644 index 000000000..6eba01d8a --- /dev/null +++ b/system/sync/kontokostenstelle.php @@ -0,0 +1,41 @@ +, + * Andreas Oesterreicher and + * Karl Burkhart . + */ + +require_once('../../config/wawi.config.inc.php'); +require_once('../../include/basis_db.class.php'); +require_once('../../include/wawi_kostenstelle.class.php'); + +$kostenstelle = new wawi_kostenstelle(); +$kostenstelle->getAll(); +$db = new basis_db(); + +foreach($kostenstelle->result as $row) +{ + $qry = "INSERT INTO wawi.tbl_konto_kostenstelle(konto_id, kostenstelle_id, insertamum, insertvon) + SELECT konto_id, $row->kostenstelle_id, now(),'oesi' FROM wawi.tbl_konto WHERE konto_id<1000 + AND konto_id NOT IN(SELECT konto_id FROM wawi.tbl_konto_kostenstelle WHERE kostenstelle_id='$row->kostenstelle_id')"; + + if(!$db->db_query($qry)) + echo 'Failed:'.$qry; +} +echo '

DONE'; +?> \ No newline at end of file diff --git a/vilesci/statistik/wawi_tags.php b/vilesci/statistik/wawi_tags.php new file mode 100644 index 000000000..df1253ddd --- /dev/null +++ b/vilesci/statistik/wawi_tags.php @@ -0,0 +1,274 @@ +, + * Andreas Oesterreicher and + * Karl Burkhart . + */ +/** + * Auswertung der Bestellungen auf Kostenstellen und Tags + */ +require_once('../../config/wawi.config.inc.php'); +require_once('../../include/benutzerberechtigung.class.php'); +require_once('../../include/functions.inc.php'); +require_once('../../include/wawi_rechnung.class.php'); +require_once('../../include/wawi_bestellung.class.php'); +require_once('../../include/wawi_kostenstelle.class.php'); +require_once('../../include/studiensemester.class.php'); +require_once('../../include/tags.class.php'); + +$user = get_uid(); +$rechte = new benutzerberechtigung(); +$rechte->getBerechtigungen($user); + +$kst_array = $rechte->getKostenstelle(); + +if(count($kst_array)==0) + die('Sie benötigen eine Kostenstellenberechtigung um diese Seite anzuzeigen'); +?> + + + + WaWi - Tags - Auswertung + + + + + + + + + + +

Auswertung - Tags

+ Zurück'); + + $db = new basis_db(); + + //Vom Studiensemester + $studiensemester = $_POST['studiensemester']; + $stsem = new studiensemester(); + $stsem->load($studiensemester); + $beginn = $stsem->start; + $studiensemester2 = $stsem->getNextFrom($stsem->getNextFrom($studiensemester)); + $ende = $stsem->start; + if($beginn==$ende) + $ende = $stsem->ende; + + $kst_tags=array(); + $tags_array=array(); + + $qry = "SELECT + (menge*preisprove*(100+mwst)/100) as brutto, tbl_bestellung.bestellung_id, + tbl_bestellung.kostenstelle_id, tbl_bestelldetail.bestelldetail_id + FROM + wawi.tbl_bestellung + JOIN wawi.tbl_bestellung_bestellstatus USING(bestellung_id) + JOIN wawi.tbl_bestelldetail USING(bestellung_id) + WHERE + tbl_bestellung_bestellstatus.bestellstatus_kurzbz='Bestellung' + AND tbl_bestellung_bestellstatus.datum>='$beginn' AND tbl_bestellung_bestellstatus.datum<'$ende' + AND tbl_bestellung.freigegeben + AND + ( + EXISTS (SELECT 1 FROM wawi.tbl_bestellungtag WHERE bestellung_id=tbl_bestellung.bestellung_id) + OR + EXISTS (SELECT 1 FROM wawi.tbl_bestelldetailtag WHERE bestelldetail_id=tbl_bestelldetail.bestelldetail_id) + ) + "; + + if($result = $db->db_query($qry)) + { + while($row = $db->db_fetch_object($result)) + { + //Bestelldetailtags laden + $tags = new tags(); + $tags->GetTagsByBestelldetail($row->bestelldetail_id); + + if(count($tags->result)==0) + { + //Wenn kein Detailtag vorhanden ist, die Tags der Bestellung verwenden + $tags->GetTagsByBestellung($row->bestellung_id); + } + + foreach($tags->result as $tag) + { + if(!isset($tags_array[$tag->tag])) + $tags_array[$tag->tag]=0; + if(isset($kst_tags[$row->kostenstelle_id]) && isset($kst_tags[$row->kostenstelle_id][$tag->tag])) + $kst_tags[$row->kostenstelle_id][$tag->tag]+=$row->brutto; + else + $kst_tags[$row->kostenstelle_id][$tag->tag]=$row->brutto; + + } + } + } + else + die('Fehler bei Datenbankzugriff'); + //$tags_array = array_unique($tags_array); + //var_dump($tags_array); + //var_dump($kst_tags); + echo ' + + + '; + foreach(array_keys($tags_array) as $tags) + { + echo ''; + } + echo ' + + + + '; + + + foreach($kst_tags as $kst=>$tags_value) + { + $kst_summe=0; + + $kostenstelle = new wawi_kostenstelle(); + $kostenstelle->load($kst); + echo ''; + echo ''; + + foreach(array_keys($tags_array) as $tags) + { + if(isset($tags_value[$tags])) + { + echo ''; + //Kostenstellensumme berechnen + $kst_summe += $tags_value[$tags]; + + //Tagsumme berechnen + $tags_array[$tags]+=$tags_value[$tags]; + } + else + echo ''; + } + echo ''; + echo ''; + } + echo ' + + + '; + $gesamt_summe=0; + foreach($tags_array as $tags=>$summe) + { + $gesamt_summe+=$summe; + echo ''; + } + echo ''; + echo ' + +
Kostenstelle',$tags,'Summe
'.$kostenstelle->bezeichnung.'',number_format($tags_value[$tags],2,',','.'),' ',number_format($kst_summe,2,',','.'),'
Summe',number_format($summe,2,',','.'),'',number_format($gesamt_summe,2,',','.'),'
'; +} +else +{ + $kostenstelle = new wawi_kostenstelle(); + $kostenstelle->loadArray($kst_array); + echo 'Bitte markieren sie die Kostenstellen die auf der Auswertung aufscheinen sollen:

+
+ + + '; + $anzahl=0; + $gesamt = count($kst_array); + echo ''; + + echo ' + + + + + + +
'; + foreach($kostenstelle->result as $kst) + { + if($anzahl%(($gesamt/3)+1)==0) + { + echo '
'; + } + echo ' + + + '; + $anzahl++; + } + echo '
'.$kst->bezeichnung.'
Alle markieren
+
+ Studienjahr + +
+
+ +
'; +} +?> +







+ + \ No newline at end of file diff --git a/wawi/bestellung.php b/wawi/bestellung.php index 9d1ab21e3..4f71d3835 100644 --- a/wawi/bestellung.php +++ b/wawi/bestellung.php @@ -1250,7 +1250,7 @@ if($aktion == 'suche') echo "\n"; echo "\n"; $detail_tag = new tags(); - $detail_tag->GetTagsByBesteldetail($bestelldetail_id); + $detail_tag->GetTagsByBestelldetail($bestelldetail_id); $help = $detail_tag->GetStringTags(); echo ""; diff --git a/wawi/rechnung.php b/wawi/rechnung.php index bb36e9206..2e882effe 100644 --- a/wawi/rechnung.php +++ b/wawi/rechnung.php @@ -68,8 +68,7 @@ if(isset($_POST['getBetragRow']) && isset($_POST['id'])) - - +