From 5f6206790c0c52c54f121b4ed641c753cf0b84f5 Mon Sep 17 00:00:00 2001 From: Meikel Bisping Date: Wed, 4 Jan 2023 12:29:12 +0100 Subject: [PATCH] Weiterentwicklung xcube, Primaerkostenwuerfel --- src-modules/module/xcube/conf/xcube.xml | 79 ++-- src-modules/module/xcube/masken/21000.sql | 4 +- .../module/xcube/masken/21000_felderinfo.unl | 4 +- .../module/xcube/masken/21000_maskeninfo.unl | 4 +- .../module/xcube/masken/21500_felderinfo.unl | 13 + .../xcube/masken/21500_maske_system_bez.unl | 1 + .../xcube/masken/21500_masken_felder_bez.unl | 13 + .../module/xcube/masken/21500_maskeninfo.unl | 369 ++++++++++++++++++ .../xcube/masken/21500_sachgeb_maske_bez.unl | 1 + .../schluesseltabellen/xcube_dims_install.sql | 94 +++-- .../schluesseltabellen/xcube_install.sql | 51 ++- .../xcube_install_restrictions.sql | 15 +- 12 files changed, 572 insertions(+), 76 deletions(-) create mode 100644 src-modules/module/xcube/masken/21500_felderinfo.unl create mode 100644 src-modules/module/xcube/masken/21500_maske_system_bez.unl create mode 100644 src-modules/module/xcube/masken/21500_masken_felder_bez.unl create mode 100644 src-modules/module/xcube/masken/21500_maskeninfo.unl create mode 100644 src-modules/module/xcube/masken/21500_sachgeb_maske_bez.unl diff --git a/src-modules/module/xcube/conf/xcube.xml b/src-modules/module/xcube/conf/xcube.xml index 255f0aa..669e10f 100644 --- a/src-modules/module/xcube/conf/xcube.xml +++ b/src-modules/module/xcube/conf/xcube.xml @@ -4,54 +4,54 @@ - - - - - - - + + + + + + +
- - - - - - - - - + + + + + + + + +
- - - - + + + + - - - - - - - - + + + + + + + + - + - + @@ -69,13 +69,13 @@
- - - - + + + + - + @@ -90,8 +90,6 @@
- - @@ -108,6 +106,12 @@ POSTGRES + + + $XCUBE_PFAD/masken + POSTGRES + +
@@ -135,6 +139,7 @@ + diff --git a/src-modules/module/xcube/masken/21000.sql b/src-modules/module/xcube/masken/21000.sql index 6b916f3..c5f520c 100644 --- a/src-modules/module/xcube/masken/21000.sql +++ b/src-modules/module/xcube/masken/21000.sql @@ -24,8 +24,8 @@ from ${coldef.foreignkey_tab} where 1=1 <#if coldef.foreignkey_cond!=''> and ${coldef.foreignkey_cond} --{coldef.specific_restriction} ---ausblenden von Spalten, die gar nicht in konkretem Teilergebnis vorkommen -<#if "<>"="'ja'"> +--ausblenden von Spalten, die gar nicht in konkretem Teilergebnis vorkommen, geht derzeit nicht für virtuelle Spalten, -> Kernmodul +<#if coldef.is_virtual?number=0&&"<>"="'ja'"> and ${coldef.foreignkey_col}::varchar(255) in (select distinct ${coldef.name}::varchar(255) from ${table_name} where ${restriction} ) diff --git a/src-modules/module/xcube/masken/21000_felderinfo.unl b/src-modules/module/xcube/masken/21000_felderinfo.unl index 531284a..85cc467 100644 --- a/src-modules/module/xcube/masken/21000_felderinfo.unl +++ b/src-modules/module/xcube/masken/21000_felderinfo.unl @@ -33,8 +33,8 @@ and trim(F.table_name) || '.' || F.name in (select trim(tablename)||'.'||trim(fi order by 2;^^^ 21013^Studiengang^6^0^0^140^150^50^char^30^0^12^<> select tid,name,sortnr from sichten where art in ('SOS-Kostenstellen-Sicht', 'SOS-Studiengang-Sicht') order by 3,2;^^^ 21014^Schlüssel anzeigen^150^0^0^100^100^1^integer^30^1^999^<> select 1,'Ja' from xdummy union select 0,'Nein' from xdummy^^<> select 1,'Ja' from xdummy^ -21015^Ansicht in Ergebniszeilen^121^0^0^100^200^1^char^200^1^1^<> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_rowdim=1 order by 1^^<> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_rowdefault=1^ -21016^Ansicht in Ergebnisspalten^2001^0^0^100^150^1^char^200^1^1^<> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_coldim=1 order by 1^^<> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_coldefault=1^ +21015^Ansicht in Ergebniszeilen^121^0^0^100^200^1^char^200^1^1^<> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_rowdim=1 order by 2^^<> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_rowdefault=1^ +21016^Ansicht in Ergebnisspalten^2001^0^0^100^150^1^char^200^1^1^<> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_coldim=1 order by 2^^<> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_coldefault=1^ 21017^Zivilstatus^41^350^-1^140^180^1^sql^30^0^13^<> select attributevalue from personattribute_value_list where personattributetype_id = (select personattributetype_id from personattributetype where attributevalue = 'Status');^^^ 21018^Jahrgang^42^350^-1^140^180^1^sql^30^0^13^<> select attributevalue from personattribute_value_list where personattributetype_id = (select personattributetype_id from personattributetype where attributevalue = 'Jahrgang');^^^ 21019^Leere Zeilen ausblenden^130^350^-1^140^80^1^char^30^0^1^<> select 'ja','ja' from xdummy union select 'nein','nein' from xdummy^ ^<> select 'ja','ja' from xdummy^ diff --git a/src-modules/module/xcube/masken/21000_maskeninfo.unl b/src-modules/module/xcube/masken/21000_maskeninfo.unl index 5d91819..68273b0 100644 --- a/src-modules/module/xcube/masken/21000_maskeninfo.unl +++ b/src-modules/module/xcube/masken/21000_maskeninfo.unl @@ -24,8 +24,8 @@ from ${coldef.foreignkey_tab} where \ 1=1 \ <#if coldef.foreignkey_cond!=''> and ${coldef.foreignkey_cond} \ --{coldef.specific_restriction} \ ---ausblenden von Spalten, die gar nicht in konkretem Teilergebnis vorkommen\ -<#if "<>"="'ja'">\ +--ausblenden von Spalten, die gar nicht in konkretem Teilergebnis vorkommen, geht derzeit nicht für virtuelle Spalten, -> Kernmodul\ +<#if coldef.is_virtual?number=0&&"<>"="'ja'">\ and ${coldef.foreignkey_col}::varchar(255) in (select distinct ${coldef.name}::varchar(255) from ${table_name} where \ ${restriction} \ )\ diff --git a/src-modules/module/xcube/masken/21500_felderinfo.unl b/src-modules/module/xcube/masken/21500_felderinfo.unl new file mode 100644 index 0000000..b50426d --- /dev/null +++ b/src-modules/module/xcube/masken/21500_felderinfo.unl @@ -0,0 +1,13 @@ +21500^Geldgeber^9^300^-1^100^100^1^char^30^0^12^<>select tid,type,name,sortnr from sichten where art ='Geldgeber-Sicht (COB)' and aktiv=1 order by sortnr,type,name;^^ ^ +21501^Kostenstelle^0^0^0^100^250^1^char^4^0^12^<> select tid,type,name from sichten where art='Kostenstellen-Sicht' and aktiv=1 order by type,name^^^ +21502^Haushaltsjahr^10^0^0^100^50^1^integer^30^0^1^<> SELECT distinct ord,name FROM aggregierung where kategorie='COB-Jahr' order by 1;^^<> SELECT ord,name FROM aggregierung where kategorie='COB-Jahr' and ord=year(today()) ;^ +21503^Zeitraum^20^300^-1^100^100^1^sql^30^0^1^<> select wert, name from aggregierung where kategorie = 'ZeitraumCob';^^^ +21504^Kostenarten^1^0^0^100^250^1^char^30^0^12^<> select tid,type,name from sichten where art='Kosten-/Erlösarten-Sicht' and aktiv=1 order by type,name^^^ +21505^Monat von^30^0^0^100^100^1^integer^30^0^1^<> select ord,name from aggregierung where kategorie = 'ZeitraumCob' and ord <=13 order by 1;^^^ +21506^Monat bis^40^300^-1^100^100^1^integer^30^0^1^<> select ord,name from aggregierung where kategorie = 'ZeitraumCob' and ord <=13 order by 1;^^^ +21507^Ansicht in Ergebniszeilen^1000^0^0^100^200^1^char^200^1^1^<> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_rowdim=1 order by 2^^<> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_rowdefault=1^ +21508^Ansicht in Ergebnisspalten^1020^0^0^100^150^1^char^200^1^1^<> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_coldim=1 order by 2^^<> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_coldefault=1^ +21509^Leere Zeilen ausblenden^1010^350^-1^140^80^1^char^30^0^1^<> select 'ja','ja' from xdummy union select 'nein','nein' from xdummy^ ^<> select 'ja','ja' from xdummy^ +21510^Leere Spalten ausblenden^1030^0^0^100^100^1^char^30^0^1^<> select 'ja','ja' from xdummy union select 'nein','nein' from xdummy^^<> select 'ja','ja' from xdummy^ +21511^Kennzahl^1050^350^-1^150^180^1^integer^200^1^1^<> select tid,name from xcube_kennzahl where maskeninfo_id=${Maskennummer} order by sortnr,name;^hidden^<> select tid,name from xcube_kennzahl where maskeninfo_id=${Maskennummer} and is_default=1^ +21512^Kostenträger^5^0^0^100^250^1^char^30^0^12^<> select tid,type,name from sichten where art='Kostenträger-Sicht' and aktiv=1 order by type,name^^^ diff --git a/src-modules/module/xcube/masken/21500_maske_system_bez.unl b/src-modules/module/xcube/masken/21500_maske_system_bez.unl new file mode 100644 index 0000000..8dc4d50 --- /dev/null +++ b/src-modules/module/xcube/masken/21500_maske_system_bez.unl @@ -0,0 +1 @@ +21500^10^ diff --git a/src-modules/module/xcube/masken/21500_masken_felder_bez.unl b/src-modules/module/xcube/masken/21500_masken_felder_bez.unl new file mode 100644 index 0000000..c7a412b --- /dev/null +++ b/src-modules/module/xcube/masken/21500_masken_felder_bez.unl @@ -0,0 +1,13 @@ +21500^21500^ +21500^21501^ +21500^21502^ +21500^21503^ +21500^21504^ +21500^21505^ +21500^21506^ +21500^21507^ +21500^21508^ +21500^21509^ +21500^21510^ +21500^21511^ +21500^21512^ diff --git a/src-modules/module/xcube/masken/21500_maskeninfo.unl b/src-modules/module/xcube/masken/21500_maskeninfo.unl new file mode 100644 index 0000000..da812fe --- /dev/null +++ b/src-modules/module/xcube/masken/21500_maskeninfo.unl @@ -0,0 +1,369 @@ +21500^Primärbuchungswürfel^--freemarker template\ +-- Maskenfelder -Leere Zeilen ausblenden, leere SPalten ausblenden?\ +\ +select table_name from xcube where maskeninfo_id=${Maskennummer}\ +select aggrfunction from xcube_kennzahl where maskeninfo_id=${Maskennummer} and tid=<>\ +select nvl(restriction,''::char(1)) from xcube_kennzahl where maskeninfo_id=${Maskennummer} and tid=<>\ +select nvl(datatype,'decimal(17,2)'::varchar(30)) from xcube_kennzahl where maskeninfo_id=${Maskennummer} and tid=<>\ +--benoetigt falls Kennzahlen in Zeilen oder Splaten\ +select apnr,aggrfunction,nvl(restriction,''::char(1)) as restriction from xcube_kennzahl where maskeninfo_id=${Maskennummer}\ +select restriction from xcube where maskeninfo_id=<>]]>\ +>]]>\ +\ +\ +select distinct ${coldef.foreignkey_col} as apnr,${coldef.foreignkey_cap} as name,\ +1::smallint as detailgesamtsort,${coldef.sortfield} as tmp_sortfield\ +from ${coldef.foreignkey_tab} where \ +1=1 \ +<#if coldef.foreignkey_cond!=''> and ${coldef.foreignkey_cond} \ + --{coldef.specific_restriction} \ +--ausblenden von Spalten, die gar nicht in konkretem Teilergebnis vorkommen, geht derzeit nicht für virtuelle Spalten, -> Kernmodul\ +<#if coldef.is_virtual?number=0&&"<>"="'ja'">\ +and ${coldef.foreignkey_col}::varchar(255) in (select distinct ${coldef.name}::varchar(255) from ${table_name} where \ + ${restriction} \ +)\ +\ +<#if coldef.calc_gesamt?number=1> \ +union\ +select 'gesamt','Gesamt',2::smallint as detailgesamtsort,null as tmp_sortfield from xdummy\ + \ +order by detailgesamtsort,tmp_sortfield,name;\ +<#else>\ +select 'Sichtspalten aktiv' from xdummy;\ +\ +]]>\ +\ +\ +\ +\ +>]]>\ +\ +--nur bei wenn Ergzeilen_def nicht vom Typ Sicht relevant\ +\ +select 1::smallint as level, ${rowdef.foreignkey_col}::varchar(255) as key,--hier wird zur Vereinheitlichung mit Sichten Bezeichung "key" für eigentlichen Schluessel benoetigt\ +${rowdef.foreignkey_cap} as name,${rowdef.sortfield} as tmp_sortfield from ${rowdef.foreignkey_tab}\ +where 1=1\ +<#if rowdef.foreignkey_cond!=''> and ${rowdef.foreignkey_cond} \ + --{rowdef.specific_restriction} \ +<#if rowdef.calc_gesamt?number=1>\ +union\ +select 2,'gesamt','Gesamt',null as ${rowdef.sortfield} from xdummy\ +\ +order by level,tmp_sortfield; \ +<#else>\ +select 'nicht relevant' from xdummy;\ +]]>\ +\ +\ +>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">\ +select name,caption,is_sicht,calc_gesamt,foreignkey_tab,foreignkey_col,foreignkey_cap,\ +nvl(foreignkey_cond,''::varchar(1)) as foreignkey_cond,\ +--nvl(C.specific_restriction,''::varchar(1)) as specific_restriction,\ +C.sortfield\ +from xcube_dimconfig where maskeninfo_id=${Maskennummer} and name=<<2.Ansicht in Zeilen>>\ +<#else>\ +select 'keine zweite RowDef' from xdummy;\ +\ +]]>\ +\ +--nur bei wenn Ergzeilen_def nicht vom Typ Sicht relevant\ +>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>"&&zweiteRowDef.is_sicht=0>\ +select 1::smallint as level, ${zweiteRowDef.foreignkey_col}::varchar(255) as key,--hier wird zur Vereinheitlichung mit Sichten Bezeichung "key" für eigentlichen Schluessel benoetigt\ +${zweiteRowDef.foreignkey_cap} as name,${zweiteRowDef.sortfield} as tmp_sortfield from ${zweiteRowDef.foreignkey_tab}\ +where 1=1\ +<#if zweiteRowDef.foreignkey_cond!=''> and ${zweiteRowDef.foreignkey_cond} \ + --{zweiteRowDef.specific_restriction} \ + <#if zweiteRowDef.calc_gesamt?number=1>\ +union\ +select 2,'gesamt','Gesamt',null as ${zweiteRowDef.sortfield} from xdummy\ +\ +order by level,tmp_sortfield; \ +<#else>\ +select 'nicht relevant' from xdummy;\ +]]>\ +\ +\ +\ +\ +\ +<#function kennzahlInRowOrCol>\ +--TODO auch 2. Dimension in Zeilen/Spalten\ +<#if coldef.name="xckennzahl"||rowdef.name="xckennzahl"> <#return 1><#else> return <#return 0> \ +\ +\ +<#function hasVirtualColumns>\ +--TODO auch 2. Dimension in Zeilen/Spalten\ +<#if coldef.is_virtual?number=1||rowdef.is_virtual?number=1> <#return 1><#else> return <#return 0> \ +\ +\ +\ +<#if hasVirtualColumns()=1||kennzahlInRowOrCol()=1>\ +select * into temp tmp_rohdaten from \ +${table_name}\ +where \ + ${restriction};\ + <#if coldef.is_virtual?number=1> alter table tmp_rohdaten add column ${coldef.name} varchar(255); ${coldef.vcsql}; \ + <#if rowdef.is_virtual?number=1> alter table tmp_rohdaten add column ${rowdef.name} varchar(255); ${rowdef.vcsql}; \ + --create index ix_tmp_r1 on tmp_rohdaten(${coldef.name},${rowdef.name}); --Todo nicht xckennzahl ggfs. für 2. Dimension in Spalten\ +\ +\ +\ +<#if kennzahlInRowOrCol()=0>\ +create temp table tmp_cache (\ +colattrib varchar(255), <@addcomment comment=coldef.caption/>\ +rowattrib varchar(255), <@addcomment comment=rowdef.caption/>\ +row2attrib varchar(255),\ +value decimal(17,5));\ +insert into tmp_cache (colattrib,rowattrib,<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">row2attrib, value)\ +select ${coldef.name}::varchar(255), \ +${rowdef.name}::varchar(255),\ +<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">${zweiteRowDef.name}::varchar(255),\ +${aggrfunction}\ + \ +<#if hasVirtualColumns()=0> \ +from ${table_name} where \ + ${restriction}\ + <#if (aggrfunction_restriction?length>0)> and ${aggrfunction_restriction} \ + <#else>\ +from tmp_rohdaten\ +\ +\ + group by 1,2 <#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">,${zweiteRowDef.name} ;\ +create index ix_tmp_roh1 on tmp_cache (colattrib,rowattrib,row2attrib);\ +\ +\ +--moegliche attrib_nachbearbeitung\ +<#if kennzahlInRowOrCol()=0> \ +<#assign tmp_table="tmp_cache"/> <#assign rowfield="rowattrib"/> <#assign colfield="rowattrib"/> \ +<#else>\ +<#assign tmp_table="tmp_rohdaten"/> <#assign rowfield=rowdef.name/> <#assign colfield=coldef.name/> \ +\ +\ + <#if (rowdef.attrib_nachbearbeitung?length>1)>\ + ${rowdef.attrib_nachbearbeitung?replace("<>",tmp_table)?replace("<>",rowfield)};\ + -- z.B. update tmp_cache R set rowattrib='s_'||rowattrib;\ + \ + <#if (coldef.attrib_nachbearbeitung?length>1)>\ + ${coldef.attrib_nachbearbeitung?replace("<>",tmp_table)?replace("<>",colfield)};\ + -- z.B. update tmp_cache R set rowattrib='s_'||rowattrib;\ + \ + \ + \ + \ +\ +<#if coldef.is_sicht>0>\ +<#assign ergspalten=.vars[coldef.caption].elements/>\ +<#else>\ +<#assign ergspalten=nichtsicht_ergspalten/>\ +\ +create temp table tmp_erg (\ +ebene integer,\ +col1 varchar(255),\ +name varchar(255),\ +<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">col2 varchar(255),\ +<#assign i=0/>\ +<#foreach spalte in ergspalten>\ + <#assign i=i+1/>\ + c${i} decimal(17,5) default 0, <@addcomment comment=spalte.name/>\ + \ +\ +sortnr integer\ +) <@informixnolog/>;\ +\ +create index ix_tmp_erg on tmp_erg (sortnr);\ + \ +<#if rowdef.is_sicht>0> \ + <#assign zeilendef=.vars[rowdef.caption].elements/> --ermittelt des SichtObjekts anhand des Feldnames (aus felderinfo)\ +<#else>\ + <#assign zeilendef=nichtsicht_ergzeilen/>\ +\ +<#assign sortnr=0/>\ +<#foreach zeile in zeilendef>\ +<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">\ +<#foreach zeile2 in zweiteRow_nichtsicht_ergzeilen>\ +<#assign sortnr=sortnr+1/>\ + insert into tmp_erg (ebene,col1,name,col2,sortnr)\ + values (${zeile.level},'${zeile.key}','${zeile.name}','${zeile2.name}',${sortnr});\ + <#assign i=0/>\ +<#foreach spalte in ergspalten>\ + <#assign i=i+1/>\ + <@updateval i=i col=spalte row=zeile row2=zeile2 sortnr=sortnr/>\ + \ +\ +<#else>\ + <#assign sortnr=sortnr+1/>\ + insert into tmp_erg (ebene,col1,name,sortnr)\ + values (${zeile.level},'${zeile.key}','${zeile.name}',${sortnr});\ + <#assign i=0/>\ +<#foreach spalte in ergspalten>\ + <#assign i=i+1/>\ + <@updateval i=i col=spalte row=zeile row2='' sortnr=sortnr/>\ + \ + \ +\ +\ +<#macro updateval i col row row2 sortnr>\ +update tmp_erg T set c${i}=\ +<#if kennzahlInRowOrCol()=0>\ + (select nvl(sum(value),0) from tmp_cache R where 1=1 \ + <@colrestriction col=col/>\ + <@rowrestriction row=row row2=row2/>\ + ) \ + <#else> -- Kennzahl ist in Zeile oder Spalte\ + (select <@kennzahlSelect row=row col=col/>\ + from tmp_rohdaten R where 1=1 \ + <#if rowdef.name="xckennzahl"> <@kennzahlrestrict row=row col=col/> <#else> <@rowrestriction row=row row2=row2 rowattribname=rowdef.name/>\ + <#if coldef.name="xckennzahl"> <@kennzahlrestrict row=row col=col/> <#else> <@colrestriction col=col colattribname=coldef.name/>\ + \ + )\ + \ + where T.sortnr='${sortnr}'\ + ;\ + \ + \ + <#macro kennzahlrestrict row col>\ + <#if coldef.name="xckennzahl">\ + <#foreach k in kennzahlen>\ + <#if (col.apnr=k.apnr&&k.restriction?length>0)> and ${k.restriction} \ + \ + \ + <#if rowdef.name="xckennzahl">\ + <#foreach k in kennzahlen>\ + <#if (row.key=k.apnr&&k.restriction?length>0)> and ${k.restriction} \ + \ + \ + \ + \ + <#macro kennzahlSelect row col>\ + <#if coldef.name="xckennzahl">\ + <#foreach k in kennzahlen>\ + <#if col.apnr=k.apnr> ${k.aggrfunction} \ + \ + \ + <#if rowdef.name="xckennzahl">\ + <#foreach k in kennzahlen>\ + <#if row.key=k.apnr> ${k.aggrfunction} \ + \ + \ + \ + \ + \ + \ + \ + \ + <#macro colrestriction col colattribname='R.colattrib'>\ + <#if coldef.is_sicht==1>\ + and ${colattribname}::varchar(255) in ${col.subkeys}\ +<#else>\ +--TODO Sicht=2\ + <#if col.apnr!='gesamt'>\ + and ${colattribname}::varchar(255)='${col.apnr}' \ + \ + \ + \ + \ + <#macro rowrestriction row row2 rowattribname='R.rowattrib' >\ + <#if rowdef.is_sicht==1>\ + and ${rowattribname}::varchar(255) in ${row.subkeys}\ + <#elseif rowdef.is_sicht==2>\ + and ( ${row.strukturStr?replace('$1',' '+rowattribname+"::varchar(255)")} ) \ + <#else>\ + <#if row.key!='gesamt'> and ${rowattribname}::varchar(255)='${row.key}' \ + \ + <#if row2?is_hash> and R.row2attrib='${row2.key}' \ + \ + \ +drop table if exists tmp_cache;\ +\ +drop table if exists tmp_rohdaten;\ +\ +-- Kennzahl in Spalten/Zeilen ggfs. null\ +<#assign i=0/>\ + <#foreach spalte in ergspalten>\ + <#assign i=i+1/>\ + update tmp_erg set c${i}=0 where c${i} is null; \ +\ +\ +<#if "<>"="'ja'">\ +delete from tmp_erg where\ +<#assign i=0/>\ +<#foreach spalte in ergspalten>\ + <#assign i=i+1/>\ + c${i}=0 <#if spalte_has_next> and \ +;\ + \ +<#if "<>"="'institution'">\ +update tmp_erg set name=replace(name,col1||' - ','');\ +update tmp_erg set col1=(select max(uniquename) from organigramm where col1=trim(key_apnr))\ +where substring(col1 from 1 for 1)='_';\ +--vorher war ggfs _3 zu O005030, auch O005030 in Namen ersetzen\ +update tmp_erg set name=replace(name,col1||' - ','');\ + \ +\ +\ +\ +\ +select \ + <#if rowdef.is_sicht>0>ebene,col1,\ +name,\ +<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">col2,\ +<#assign i=0/>\ +<#foreach spalte in ergspalten>\ + <#assign i=i+1/>\ +c${i}::${datatype} <#if spalte_has_next>,\ +\ +\ +from tmp_erg order by sortnr;^--freemarker Template\ +XIL List\ + sizable_columns horizontal_scrolling\ + drop_and_delete movable_columns\ + white_space_color=COLOR_WHITE fixed_columns=1\ + min_heading_height=35\ +XIL List\ + sizable_columns horizontal_scrolling\ + drop_and_delete movable_columns\ + white_space_color=COLOR_WHITE fixed_columns=1\ + min_heading_height=35\ +<#if rowdef.is_sicht==1>\ +Column CID=0 heading_text="Ebene" center_heading\ + row_selectable heading_platform readonly\ + width=10 text_size=8\ +Column CID=20 heading_text="${.vars["Ansicht in ErgebniszeilenObject"].selectedItems[0].name}Nr" center_heading\ + row_selectable heading_platform readonly\ + width=10 text_size=10\ +\ +Column CID=20 heading_text="${.vars["Ansicht in ErgebniszeilenObject"].selectedItems[0].name}" center_heading\ + row_selectable heading_platform readonly\ + width=10 text_size=10\ +<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">\ +Column CID=20 heading_text="${.vars["2.Ansicht in ZeilenObject"].selectedItems[0].name}" center_heading\ + row_selectable heading_platform readonly\ + width=10 text_size=10\ +\ +<#if coldef.is_sicht>0>\ +<#assign ergspalten=.vars[coldef.caption].elements/>\ +<#else>\ +<#assign ergspalten=nichtsicht_ergspalten/>\ +\ +<#foreach spalte in ergspalten>\ +Column CID=1 heading_text="${spalte.name}" center_heading\ + row_selectable heading_platform readonly\ + width=12\ +\ +\ +\ +@@@^^^Dynamische Auswertungen von Primärbuchungen^drop table tmp_erg;^^2^600^400^0^1^^ diff --git a/src-modules/module/xcube/masken/21500_sachgeb_maske_bez.unl b/src-modules/module/xcube/masken/21500_sachgeb_maske_bez.unl new file mode 100644 index 0000000..4440e44 --- /dev/null +++ b/src-modules/module/xcube/masken/21500_sachgeb_maske_bez.unl @@ -0,0 +1 @@ +27^21500^ diff --git a/src-modules/module/xcube/schluesseltabellen/xcube_dims_install.sql b/src-modules/module/xcube/schluesseltabellen/xcube_dims_install.sql index 5f73f8b..a596242 100644 --- a/src-modules/module/xcube/schluesseltabellen/xcube_dims_install.sql +++ b/src-modules/module/xcube/schluesseltabellen/xcube_dims_install.sql @@ -1,32 +1,64 @@ -delete from xcube_dims where id in ('fs4','fssemzahl','hssemzahl'); +--Freemarker Template +-- TableFieldExists wird genutzt, um zu prüfen, ob die entsprechende Tabelle existiert +<#if TableFieldExists('aggregierung','ord')> +delete from xcube_dims where id='jahr'; +insert into xcube_dims (id, name,apnr,sort1) +select distinct 'jahr',ord::char(6),ord::char(6),ord from aggregierung where kategorie like '%-Jahr%'; +delete from xcube_dims where id='cob_jahr'; +insert into xcube_dims (id, name,apnr,sort1) +select distinct 'cob_jahr',ord::char(6),ord::char(6),ord from aggregierung where kategorie='COB-Jahr'; + + +delete from xcube_dims where id='monat'; +INSERT INTO xcube_dims (id,apnr,name,sort1) values +('monat','1','Januar',1), +('monat','2','Februar',2), +('monat','3','März',3), +('monat','4','April',4), +('monat','5','Mai',5), +('monat','6','Juni',6), +('monat','7','Juli',7), +('monat','8','August',8), +('monat','9','September',9), +('monat','10','Oktober',10), +('monat','11','November',11), +('monat','12','Dezember',12); + +-- priorität: semester, zul_semester, kenn_semester +<#if TableFieldExists('semester','eintrag')> +delete from xcube_dims where id='semester'; +insert into xcube_dims (id, name,apnr,sort1) +select 'semester',eintrag ,tid::varchar(50),tid from semester + where tid in (select distinct sem_rueck_beur_ein from sos_stg_aggr); +<#elseif TableFieldExists('zul_semester','eintrag')> +delete from xcube_dims where id='semester'; +insert into xcube_dims (id, apnr,sort1) +select 'semester',eintrag ,tid::varchar(50),tid from zul_semester; +<#elseif TableFieldExists('kenn_semester','eintrag')> +delete from xcube_dims where id='semester'; +insert into xcube_dims (id, apnr,sort1) +select 'semester',druck ,tid::varchar(50),tid from kenn_semester; + + + + + +<#if TableFieldExists('sos_stg_aggr','fach_sem_zahl')> +delete from xcube_dims where id='fssemzahl'; +INSERT INTO xcube_dims (id,apnr,name,sort1) +select distinct 'fssemzahl',fach_sem_zahl::varchar(10),fach_sem_zahl||'.FS',fach_sem_zahl from sos_stg_aggr; + + +<#if TableFieldExists('sos_stg_aggr','hssem')> +delete from xcube_dims where id='fssemzahl'; +INSERT INTO xcube_dims (id,apnr,name,sort1) +select distinct 'hssemzahl',hssem::varchar(10),hssem||'.HS',hssem from sos_stg_aggr; + + + + --Zum Testen -INSERT INTO xcube_dims (id,apnr,name,sort1,parent,strukturstr) -VALUES - ('fs4','0','FS<4',1,NULL,NULL), - ('fs4','1','FS>=4',2,NULL,NULL); - -INSERT INTO xcube_dims (id,apnr,name,sort1,parent,strukturstr) -VALUES - ('fssemzahl','1','1.FS',1,NULL,NULL), - ('fssemzahl','2','2.FS',2,NULL,NULL), - ('fssemzahl','3','3.FS',3,NULL,NULL), - ('fssemzahl','4','4.FS',4,NULL,NULL), - ('fssemzahl','5','5.FS',5,NULL,NULL), - ('fssemzahl','6','6.FS',6,NULL,NULL), - ('fssemzahl','7','7.FS',7,NULL,NULL), - ('fssemzahl','8','8.FS',8,NULL,NULL), - ('fssemzahl','9','9.FS',9,NULL,NULL), - ('fssemzahl','10','10.FS',10,NULL,NULL); - - INSERT INTO xcube_dims (id,apnr,name,sort1,parent,strukturstr) -VALUES - ('hssemzahl','1','1.HS',1,NULL,NULL), - ('hssemzahl','2','2.HS',2,NULL,NULL), - ('hssemzahl','3','3.HS',3,NULL,NULL), - ('hssemzahl','4','4.HS',4,NULL,NULL), - ('hssemzahl','10','10.HS',10,NULL,NULL), - ('hssemzahl','5','5.HS',5,NULL,NULL), - ('hssemzahl','6','6.HS',6,NULL,NULL), - ('hssemzahl','7','7.HS',7,NULL,NULL), - ('hssemzahl','8','8.HS',8,NULL,NULL), - ('hssemzahl','9','9.HS',9,NULL,NULL); +--INSERT INTO xcube_dims (id,apnr,name,sort1,parent,strukturstr) +--VALUES +-- -('fs4','0','FS<4',1,NULL,NULL), +-- ('fs4','1','FS>=4',2,NULL,NULL); \ No newline at end of file diff --git a/src-modules/module/xcube/schluesseltabellen/xcube_install.sql b/src-modules/module/xcube/schluesseltabellen/xcube_install.sql index b848930..b160e83 100644 --- a/src-modules/module/xcube/schluesseltabellen/xcube_install.sql +++ b/src-modules/module/xcube/schluesseltabellen/xcube_install.sql @@ -6,6 +6,12 @@ "sachgebiet":16, "table_name":"sos_stg_aggr", "maskeninfo_id":21000 +} , +{"name":"Primärbuchungswürfel", + "uniquename":"xcube_cob_busa_aggr", + "sachgebiet":27, + "table_name":"cob_busa_aggr", + "maskeninfo_id":21500 } ] /> @@ -17,9 +23,17 @@ "restriction":"", "datatype":"integer", "is_default":1, + "sortnr":1}, + { "maskeninfo_id":21500, + "apnr":"kosten", + "name":"Kosten", + "aggrfunction":"sum(betrag*kokl_faktor)", + "restriction":"", + "is_default":1, "sortnr":1} ] /> + <#assign xcube_dimconfig = [ {"maskeninfo_id":21000, "name":"fach_sem_zahl", @@ -63,7 +77,42 @@ "foreignkey_tab":"k_abint", "foreignkey_col":"abint", "foreignkey_cap":"dtxt", - "sortfield":"dtxt"} + "sortfield":"dtxt"}, + <#-- Primärbuchungswürfel --> + {"maskeninfo_id":21500, + "name":"jahr", + "caption":"Jahr", + "is_coldefault":1, + "foreignkey_tab":"xcube_dims", + "foreignkey_col":"apnr", + "foreignkey_cap":"name", + "foreignkey_cond":"id='cob_jahr'", + "sortfield":"sort1"}, + {"maskeninfo_id":21500, + "name":"monat", + "caption":"Monat", + "foreignkey_tab":"xcube_dims", + "foreignkey_col":"apnr", + "foreignkey_cap":"name", + "foreignkey_cond":"id='monat'", + "sortfield":"sort1"}, + {"maskeninfo_id":21500, + "name":"ch110_institut", + "caption":"Kostenstelle", + "is_rowdefault":1, + "is_sicht":1 }, + {"maskeninfo_id":21500, + "name":"fikrkey", + "caption":"Kostenarten", + "is_sicht":1 }, + {"maskeninfo_id":21500, + "name":"ggnr", + "caption":"Geldgeber", + "is_sicht":1 }, + {"maskeninfo_id":21500, + "name":"projnr", + "caption":"Kostenträger", + "is_sicht":1 } ] /> diff --git a/src-modules/module/xcube/schluesseltabellen/xcube_install_restrictions.sql b/src-modules/module/xcube/schluesseltabellen/xcube_install_restrictions.sql index ee2d8ff..845e096 100644 --- a/src-modules/module/xcube/schluesseltabellen/xcube_install_restrictions.sql +++ b/src-modules/module/xcube/schluesseltabellen/xcube_install_restrictions.sql @@ -8,4 +8,17 @@ update xcube set restriction='<> /* and ${<>} */ /* and L.abschluss in (<>) */ /* and '' || ca12_staat in <@printkeys Staatsangehörigkeit.allNeededKeysList/> --<> */ - ' where maskeninfo_id=21000; \ No newline at end of file + ' where maskeninfo_id=21000; + + update xcube set restriction=' +(bukz!=''PE'' or bukz is null) + /* and jahr=<> */ +and fikrkey in <@printkeys Kostenarten.allNeededKeys /> + and ch110_institut in <@printkeys Kostenstelle.allNeededKeys/> +/* AND <> */ +/* and monat >= <> */ +/* and monat <= <> */ +/* and (ggnr in <@printkeys .vars["Geldgeber"].allNeededKeys /> or <> =''null'')*/ +/* and (projnr in <@printkeys Kostenträger.allNeededKeys/> or <> =''null'') */ + +' where maskeninfo_id=21500; \ No newline at end of file