Compare commits
No commits in common. '1a5de6e336d30ced4cf8b5ff1f51ea8de76b2e02' and '5c1b9825f8fdd3c2837e98a72a4127c6c6d0a9c7' have entirely different histories.
1a5de6e336
...
5c1b9825f8
10 changed files with 4 additions and 766 deletions
@ -1,24 +0,0 @@ |
|||||||
48550^Kostenstellen^0^0^0^150^250^100^char^30^0^12^<<SQL>> select tid,type,name from sichten where art='Kostenstellen-Sicht' and aktiv=1 order by type,name^^^ |
|
||||||
48551^Jahr von^10^0^0^150^50^1^integer^30^0^1^<<SQL>> SELECT distinct ord,name FROM aggregierung where kategorie='COB-Jahr' order by 1;^^<<SQL>> SELECT ord,name FROM aggregierung where kategorie='COB-Jahr' and ord=year(today()) ;^ |
|
||||||
48552^Zeitraum^12^0^0^150^150^1^sql^30^0^1^<<SQL>> select wert, name, ord from aggregierung where kategorie = 'ZeitraumCob' order by ord;^^^ |
|
||||||
48553^Kostenarten^4^0^0^150^150^100^char^30^0^12^<<SQL>> select tid,type,name from sichten where art='Kosten-/Erlösarten-Sicht' and aktiv=1 order by type,name^^^ |
|
||||||
48554^Spalten^300^0^0^150^190^10^char^30^0^1^<<SQL>>\ |
|
||||||
select C.uniquename, C.caption ,L.layout_id from rpta_column C, rpta_column2layout L where C.tid=L.column_id and layout_id in\ |
|
||||||
(select tid from rpta_column_layout where uniquename=<<Spaltenlayout>>) order by 2;^ ^ ^ |
|
||||||
48555^Kostenträger^2^0^0^100^250^100^char^30^0^12^<<SQL>> select tid,type,name from sichten where art='Kostenträger-Sicht' and aktiv=1 order by type,name^^^ |
|
||||||
48556^Geldgeber^16^0^0^150^200^100^char^20^0^12^<<SQL>>select tid,type,name,sortnr from sichten where art ='Geldgeber-Sicht (COB)' and aktiv=1 order by sortnr,type,name;^^^ |
|
||||||
48558^Monat von^13^0^0^150^150^1^integer^30^0^1^<<SQL>> select ord,name from aggregierung where kategorie = 'ZeitraumCob' and ord <=13 order by 1;^^^ |
|
||||||
48559^Monat bis^14^300^-1^100^100^1^integer^30^0^1^<<SQL>> select ord,name from aggregierung where kategorie = 'ZeitraumCob' and ord <=13 order by 1;^^^ |
|
||||||
48561^Filter bis Ebene^99^0^0^130^20^1^integer^30^0^0^^hidden^^ |
|
||||||
48562^Jahr bis^11^0^0^150^50^1^integer^30^0^1^<<SQL>> SELECT distinct ord,name FROM aggregierung where kategorie='COB-Jahr' order by 1;^^<<SQL>> SELECT ord,name FROM aggregierung where kategorie='COB-Jahr' and ord=year(today()) ;^ |
|
||||||
48563^Spaltenlayout^200^350^-1^140^180^1^char^30^1^1^<<SQL>> \ |
|
||||||
SELECT uniquename, caption, sortnr\ |
|
||||||
FROM rpta_column_layout \ |
|
||||||
where resultset_id in (select R.tid from rpta_resultset R where R.uniquename in ('cob_busa_aggr_stamm')\ |
|
||||||
and R.systeminfo_id=10)\ |
|
||||||
order by sortnr, caption;^ ^<<SQL>> SELECT uniquename, caption, sortnr\ |
|
||||||
FROM rpta_column_layout \ |
|
||||||
where resultset_id in (select R.tid from rpta_resultset R where R.uniquename in ('cob_busa_aggr_stamm')\ |
|
||||||
and R.systeminfo_id=10)\ |
|
||||||
order by sortnr, caption\ |
|
||||||
limit 1;^ |
|
||||||
@ -1 +0,0 @@ |
|||||||
48550^330^ |
|
||||||
@ -1,12 +0,0 @@ |
|||||||
48550^48550^ |
|
||||||
48550^48551^ |
|
||||||
48550^48552^ |
|
||||||
48550^48553^ |
|
||||||
48550^48554^ |
|
||||||
48550^48555^ |
|
||||||
48550^48556^ |
|
||||||
48550^48558^ |
|
||||||
48550^48559^ |
|
||||||
48550^48561^ |
|
||||||
48550^48562^ |
|
||||||
48550^48563^ |
|
||||||
@ -1,137 +0,0 @@ |
|||||||
48550^Primärkosten^--Freemarker Template\ |
|
||||||
<#include "SQL_lingua_franca"/>\ |
|
||||||
<#include "SuperX_general"/>\ |
|
||||||
--\ |
|
||||||
--Autor D. Quathamer 2024\ |
|
||||||
<sqlvars>\ |
|
||||||
<sqlvar name="my_base_rs"><![CDATA[\ |
|
||||||
select R.uniquename\ |
|
||||||
from rpta_resultset R, rpta_column_layout L\ |
|
||||||
where L.resultset_id=R.tid\ |
|
||||||
and L.uniquename=<<Spaltenlayout>>;]]>\ |
|
||||||
</sqlvar>\ |
|
||||||
<sqlvar name="basetable" type="hash"><![CDATA[\ |
|
||||||
SELECT distinct T.name,\ |
|
||||||
R.is_virtual,\ |
|
||||||
name as runtime_tablename\ |
|
||||||
from sx_tables T, rpta_resultset R \ |
|
||||||
where T.name=R.uniquename\ |
|
||||||
and T.name='${my_base_rs}'\ |
|
||||||
and R.is_virtual=0\ |
|
||||||
\ |
|
||||||
union\ |
|
||||||
select R.uniquename,\ |
|
||||||
R.is_virtual,\ |
|
||||||
'tmp_' || R.uniquename as runtime_tablename\ |
|
||||||
from rpta_resultset R where R.uniquename='${my_base_rs}'\ |
|
||||||
and R.is_virtual=1\ |
|
||||||
;\ |
|
||||||
]]>\ |
|
||||||
</sqlvar>\ |
|
||||||
<sqlvar name="rpta_resultset" type="hash"><![CDATA[\ |
|
||||||
select caption,\ |
|
||||||
uniquename,\ |
|
||||||
fieldclause,\ |
|
||||||
joinclause,\ |
|
||||||
whereclause,\ |
|
||||||
systeminfo_id\ |
|
||||||
from rpta_resultset\ |
|
||||||
where uniquename='${basetable.name}';\ |
|
||||||
\ |
|
||||||
]]></sqlvar>\ |
|
||||||
<sqlvar name="rpta_column_layout" type="hash"><![CDATA[\ |
|
||||||
select L.uniquename,\ |
|
||||||
L.caption,\ |
|
||||||
L.whereclause,\ |
|
||||||
R.is_virtual,\ |
|
||||||
L.sortclause\ |
|
||||||
from rpta_resultset R, rpta_column_layout L\ |
|
||||||
where L.resultset_id=R.tid\ |
|
||||||
and R.uniquename='${basetable.name}'\ |
|
||||||
and L.uniquename=<<Spaltenlayout>>;\ |
|
||||||
\ |
|
||||||
]]></sqlvar>\ |
|
||||||
<sqlvar name="columns" type="hashsequence"><![CDATA[\ |
|
||||||
SELECT C.srcfieldname,\ |
|
||||||
(case when string_not_null(C.targetfieldname)='' then C.srcfieldname else C.targetfieldname end) as targetfieldname,\ |
|
||||||
T.uniquename as coltype,\ |
|
||||||
C.is_aggregate,\ |
|
||||||
(case when string_not_null(CL.caption)='' then C.caption else CL.caption end) as caption,\ |
|
||||||
CL.is_visible,\ |
|
||||||
CL.visible_size as visible_width,\ |
|
||||||
F.sql_code as format_sql,\ |
|
||||||
F.uniquename as format_uniquename,\ |
|
||||||
C.col_function as colfunction,\ |
|
||||||
(case when string_not_null(CL.description)='' then C.description else CL.description end) as description\ |
|
||||||
FROM rpta_column_layout L, rpta_column C, rpta_column_type T,rpta_column2layout CL \ |
|
||||||
left outer join rpta_format_code F on (F.tid=CL.format_code_id)\ |
|
||||||
where L.tid=CL.layout_id\ |
|
||||||
and C.tid=CL.column_id\ |
|
||||||
and T.tid=C.column_type\ |
|
||||||
and L.uniquename=<<Spaltenlayout>>\ |
|
||||||
/* and C.uniquename in (<<Spalten>>) */\ |
|
||||||
order by CL.sortnr\ |
|
||||||
;\ |
|
||||||
]]></sqlvar>\ |
|
||||||
\ |
|
||||||
</sqlvars>\ |
|
||||||
\ |
|
||||||
\ |
|
||||||
\ |
|
||||||
<#assign filter="1=1\ |
|
||||||
/* and jahr = <<Jahr>> */\ |
|
||||||
/* and jahr >= <<Jahr von>> */\ |
|
||||||
/* and jahr <= <<Jahr bis>> */\ |
|
||||||
/* and monat >= <<Monat von>> */\ |
|
||||||
/* and monat <= <<Monat bis>> */\ |
|
||||||
/* AND <<Zeitraum>> */\ |
|
||||||
" />\ |
|
||||||
\ |
|
||||||
<#assign filter = filter + " and cob_busa_aggr.ch110_institut in "+Kostenstellen.allNeededKeysList /> \ |
|
||||||
/* <#assign filter = filter + " and cob_busa_aggr.projnr in "+Kostenträger.allNeededKeysList /> --<<Kostenträger>> */\ |
|
||||||
/* <#assign filter = filter + " and cob_busa_aggr.fikrkey in "+Kostenarten.allNeededKeysList /> --<<Kostenarten>> */\ |
|
||||||
/* <#assign filter = filter + " and cob_busa_aggr.ggnr in "+Geldgeber.allNeededKeysList /> --<<Geldgeber>> */\ |
|
||||||
\ |
|
||||||
\ |
|
||||||
<#if columns?has_content>\ |
|
||||||
\ |
|
||||||
<#if basetable.is_virtual==1>\ |
|
||||||
\ |
|
||||||
create temp table ${basetable.runtime_tablename} as\ |
|
||||||
select ${parseRepoVars(rpta_resultset.fieldclause)} \ |
|
||||||
from ${rpta_resultset.joinclause} \ |
|
||||||
where 1=1\ |
|
||||||
<#if rpta_resultset.whereclause != ""> \ |
|
||||||
--damit Repo Variablen interpretiert werden:\ |
|
||||||
<#assign whereclauseTemplate= "<#assign whereclause=\\""+rpta_resultset.whereclause +"\\">"/>\ |
|
||||||
<#assign t2=whereclauseTemplate?interpret />\ |
|
||||||
<@t2/>\ |
|
||||||
\ |
|
||||||
${whereclause} \ |
|
||||||
</#if>\ |
|
||||||
and ${filter}\ |
|
||||||
;\ |
|
||||||
</#if>\ |
|
||||||
\ |
|
||||||
\ |
|
||||||
<@rpta_interpret_column_layout nonvirtualTableFilter=filter />\ |
|
||||||
\ |
|
||||||
</#if> --wenn columns?has_content^--Freemarker Template\ |
|
||||||
XIL List\ |
|
||||||
sizable_columns horizontal_scrolling\ |
|
||||||
drop_and_delete movable_columns \ |
|
||||||
white_space_color=COLOR_WHITE fixed_columns=1\ |
|
||||||
min_heading_height=55\ |
|
||||||
<#foreach column in columns>\ |
|
||||||
<#if column.is_visible!=0>\ |
|
||||||
Column CID=0 heading_text="${column.caption}" center_heading explanation="${column.description}"\ |
|
||||||
row_selectable heading_platform readonly\ |
|
||||||
width=${column.visible_width} text_size=60\ |
|
||||||
</#if>\ |
|
||||||
</#foreach>\ |
|
||||||
<#if 1=0>\ |
|
||||||
Column CID=0 heading_text="sortnr" center_heading explanation=""\ |
|
||||||
row_selectable heading_platform readonly\ |
|
||||||
width=5 text_size=60\ |
|
||||||
</#if>\ |
|
||||||
@@@^^^Übersicht über Kosten, Erlöse, Primär- und Sekundärkosten wahlweise nach Kostenstelle, Kostenart oder Kostenträger^drop table if exists tmp_stud2; drop table if exists tmp_stud3;^-leer-^^700^360^0^1^^ |
|
||||||
@ -1 +0,0 @@ |
|||||||
27^48550^ |
|
||||||
@ -1,477 +0,0 @@ |
|||||||
|
|
||||||
--freemarker template |
|
||||||
<sqlvars> |
|
||||||
<sqlvar name="cob_busa_aggr_exists"> |
|
||||||
select sp_table_exists('cob_busa_aggr') from xdummy; |
|
||||||
</sqlvar> |
|
||||||
<sqlvar name="fact_table_source"> |
|
||||||
select name |
|
||||||
from sx_tables where name ='cob_busa_aggr' |
|
||||||
|
|
||||||
</sqlvar> |
|
||||||
<sqlvar name="added_tables" type="hashsequence"><![CDATA[ |
|
||||||
|
|
||||||
--Vorbereitung: |
|
||||||
UPDATE sx_tables |
|
||||||
SET caption = 'Geldgeber' |
|
||||||
WHERE name='cob_geldgeber'; |
|
||||||
UPDATE sx_tables |
|
||||||
SET caption = 'Kostenstelle' |
|
||||||
WHERE name='cob_inst'; |
|
||||||
UPDATE sx_tables |
|
||||||
SET caption = 'Kostenträger' |
|
||||||
WHERE name='cob_proj'; |
|
||||||
UPDATE sx_tables |
|
||||||
SET caption = 'Kostenarten' |
|
||||||
WHERE name='cob_fikr'; |
|
||||||
|
|
||||||
|
|
||||||
select 10::smallint as sortnr, |
|
||||||
name, trim(name) ||'_' as prefix, |
|
||||||
caption, |
|
||||||
'cob_geldgeber.ggnr=cob_busa_aggr.ggnr' as joinclause |
|
||||||
from sx_tables where name in ('cob_geldgeber') |
|
||||||
union |
|
||||||
select 20::smallint as sortnr, |
|
||||||
name, trim(name) ||'_' as prefix, |
|
||||||
caption, |
|
||||||
'cob_inst.key_apnr=cob_busa_aggr.instnr' as joinclause |
|
||||||
from sx_tables where name in ('cob_inst') |
|
||||||
union |
|
||||||
select 30::smallint as sortnr, |
|
||||||
name, trim(name) ||'_' as prefix, |
|
||||||
caption, |
|
||||||
'cob_proj.projnr=cob_busa_aggr.projnr' as joinclause |
|
||||||
from sx_tables where name in ('cob_proj') |
|
||||||
union |
|
||||||
select 40::smallint as sortnr, |
|
||||||
name, trim(name) ||'_' as prefix, |
|
||||||
caption, |
|
||||||
'cob_fikr.key=cob_busa_aggr.fikrkey' as joinclause |
|
||||||
from sx_tables where name in ('cob_fikr') |
|
||||||
union |
|
||||||
select 50::smallint as sortnr, |
|
||||||
name, trim(name) ||'_' as prefix, |
|
||||||
caption, |
|
||||||
'organigramm.key_apnr=cob_busa_aggr.ch110_institut' as joinclause |
|
||||||
from sx_tables where name in ('organigramm') |
|
||||||
|
|
||||||
]]></sqlvar> |
|
||||||
<sqlvar name="fields_target" type="hashsequence"><![CDATA[ |
|
||||||
<#if fact_table_source?exists> |
|
||||||
select tid, table_name, |
|
||||||
name, |
|
||||||
name as targetname |
|
||||||
from sx_fields where table_name ='${fact_table_source}' |
|
||||||
and currentlyused=1 |
|
||||||
|
|
||||||
union |
|
||||||
</#if> |
|
||||||
select tid,table_name, |
|
||||||
name, |
|
||||||
'cob_geldgeber_' || name as targetname |
|
||||||
from sx_fields where table_name ='cob_geldgeber' |
|
||||||
and currentlyused=1 |
|
||||||
and name in ('ggnr','ggdruck') |
|
||||||
union |
|
||||||
select tid,table_name, |
|
||||||
name, |
|
||||||
'cob_inst_' || name as targetname |
|
||||||
from sx_fields where table_name ='cob_inst' |
|
||||||
and currentlyused=1 |
|
||||||
and name in ('key_apnr', |
|
||||||
'parent', |
|
||||||
'drucktext', |
|
||||||
'name', |
|
||||||
'ebene', |
|
||||||
'lehre', |
|
||||||
'gueltig_seit', |
|
||||||
'gueltig_bis', |
|
||||||
'orgstruktur', |
|
||||||
'fins', |
|
||||||
'lehr', |
|
||||||
'bund_kategorie', |
|
||||||
'bund_lehr_forsch', |
|
||||||
'bund_fachgebiet', |
|
||||||
'land_fachgebiet', |
|
||||||
'sis_fachbereich', |
|
||||||
'land_institut', |
|
||||||
'bund_rahmenplan') |
|
||||||
union |
|
||||||
select tid,table_name, |
|
||||||
name, |
|
||||||
'cob_proj_' || name as targetname |
|
||||||
from sx_fields where table_name ='cob_proj' |
|
||||||
and currentlyused=1 |
|
||||||
union |
|
||||||
select tid,table_name, |
|
||||||
name, |
|
||||||
'cob_fikr_' || name as targetname |
|
||||||
from sx_fields where table_name ='cob_fikr' |
|
||||||
and currentlyused=1 |
|
||||||
and name not in ('tid') |
|
||||||
union |
|
||||||
select tid,table_name, |
|
||||||
name, |
|
||||||
'organigramm_' || name as targetname |
|
||||||
from sx_fields where table_name ='organigramm' |
|
||||||
and currentlyused=1 |
|
||||||
and name in ('key_apnr', |
|
||||||
'parent', |
|
||||||
'drucktext', |
|
||||||
'name', |
|
||||||
'ebene', |
|
||||||
'lehre', |
|
||||||
'gueltig_seit', |
|
||||||
'gueltig_bis', |
|
||||||
'orgstruktur') |
|
||||||
|
|
||||||
|
|
||||||
]]> |
|
||||||
</sqlvar> |
|
||||||
</sqlvars> |
|
||||||
|
|
||||||
<#if cob_busa_aggr_exists==1 && fact_table_source?exists > |
|
||||||
|
|
||||||
<#assign fact_table_target = {"name":"cob_busa_aggr_stamm", "caption":"Primärkosten"} |
|
||||||
/> |
|
||||||
|
|
||||||
|
|
||||||
CREATE temp table tmp_tables( |
|
||||||
name CHAR(255) , |
|
||||||
caption CHAR(255) , |
|
||||||
description CHAR(255) , |
|
||||||
table_type CHAR(255) , |
|
||||||
systeminfo_id INTEGER , |
|
||||||
systeminfo_orig INTEGER , |
|
||||||
thema CHAR(255) , |
|
||||||
sachgebiete_id CHAR(255) |
|
||||||
); |
|
||||||
CREATE temp TABLE tmp_fields( |
|
||||||
tid serial NOT NULL, |
|
||||||
table_name VARCHAR(255) not null, |
|
||||||
name VARCHAR(255) not null, |
|
||||||
caption VARCHAR(255) , |
|
||||||
description VARCHAR(255) , |
|
||||||
field_type VARCHAR(255) not null, |
|
||||||
field_size VARCHAR(255) , |
|
||||||
field_not_null smallint, |
|
||||||
currentlyused SMALLINT , |
|
||||||
is_primarykey SMALLINT default 0 , |
|
||||||
foreignkey_tab VARCHAR(255) , |
|
||||||
foreignkey_col VARCHAR(255) , |
|
||||||
foreignkey_int VARCHAR(255) , |
|
||||||
foreignkey_cap VARCHAR(255) , |
|
||||||
foreignkey_cond VARCHAR(255) , |
|
||||||
foreignkey_func VARCHAR(255) , |
|
||||||
check_integrity SMALLINT, |
|
||||||
is_sum SMALLINT default 1, |
|
||||||
foreignkey_uniquename VARCHAR(255) |
|
||||||
|
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
update sx_fields set |
|
||||||
is_sum=0 |
|
||||||
where table_name='cob_busa_aggr' |
|
||||||
and name not in ('betrag'); |
|
||||||
|
|
||||||
update sx_fields set |
|
||||||
is_sum=1 |
|
||||||
where table_name='cob_busa_aggr' |
|
||||||
and name in ('betrag'); |
|
||||||
|
|
||||||
|
|
||||||
insert into tmp_tables ( |
|
||||||
name, |
|
||||||
caption, |
|
||||||
description, |
|
||||||
table_type, |
|
||||||
systeminfo_id, |
|
||||||
thema, |
|
||||||
sachgebiete_id |
|
||||||
) |
|
||||||
select |
|
||||||
'${fact_table_target.name}', |
|
||||||
'${fact_table_target.caption}', |
|
||||||
description, |
|
||||||
table_type, |
|
||||||
systeminfo_id, |
|
||||||
thema, |
|
||||||
sachgebiete_id |
|
||||||
from sx_tables where name='${fact_table_source}' |
|
||||||
; |
|
||||||
|
|
||||||
|
|
||||||
insert into tmp_fields (table_name, |
|
||||||
name, |
|
||||||
caption, |
|
||||||
description, |
|
||||||
field_type, |
|
||||||
field_size, |
|
||||||
field_not_null, |
|
||||||
currentlyused, |
|
||||||
is_primarykey, |
|
||||||
foreignkey_tab, |
|
||||||
foreignkey_col, |
|
||||||
foreignkey_int, |
|
||||||
foreignkey_cap, |
|
||||||
foreignkey_cond, |
|
||||||
foreignkey_func, |
|
||||||
check_integrity, |
|
||||||
is_sum, |
|
||||||
foreignkey_uniquename) |
|
||||||
select '${fact_table_target.name}' as table_name, |
|
||||||
name, |
|
||||||
caption, |
|
||||||
description, |
|
||||||
field_type, |
|
||||||
field_size, |
|
||||||
field_not_null, |
|
||||||
currentlyused, |
|
||||||
is_primarykey, |
|
||||||
foreignkey_tab, |
|
||||||
foreignkey_col, |
|
||||||
foreignkey_int, |
|
||||||
foreignkey_cap, |
|
||||||
foreignkey_cond, |
|
||||||
foreignkey_func, |
|
||||||
check_integrity, |
|
||||||
is_sum, |
|
||||||
foreignkey_uniquename |
|
||||||
from sx_fields where table_name ='${fact_table_source}' |
|
||||||
and currentlyused=1; |
|
||||||
<#foreach added_table in added_tables> |
|
||||||
insert into tmp_fields (table_name, |
|
||||||
name, |
|
||||||
caption, |
|
||||||
description, |
|
||||||
field_type, |
|
||||||
field_size, |
|
||||||
field_not_null, |
|
||||||
currentlyused, |
|
||||||
is_primarykey, |
|
||||||
foreignkey_tab, |
|
||||||
foreignkey_col, |
|
||||||
foreignkey_int, |
|
||||||
foreignkey_cap, |
|
||||||
foreignkey_cond, |
|
||||||
foreignkey_func, |
|
||||||
check_integrity, |
|
||||||
is_sum, |
|
||||||
foreignkey_uniquename) |
|
||||||
select '${fact_table_target.name}' as table_name, |
|
||||||
'${added_table.prefix}' || name, |
|
||||||
'${added_table.caption}: ' || caption, |
|
||||||
description, |
|
||||||
field_type, |
|
||||||
field_size, |
|
||||||
field_not_null, |
|
||||||
currentlyused, |
|
||||||
is_primarykey, |
|
||||||
foreignkey_tab, |
|
||||||
foreignkey_col, |
|
||||||
foreignkey_int, |
|
||||||
foreignkey_cap, |
|
||||||
foreignkey_cond, |
|
||||||
foreignkey_func, |
|
||||||
check_integrity, |
|
||||||
is_sum, |
|
||||||
foreignkey_uniquename |
|
||||||
from sx_fields where table_name ='${added_table.name}' |
|
||||||
and currentlyused=1; |
|
||||||
</#foreach> |
|
||||||
|
|
||||||
CREATE temp TABLE tmp_rpta_resultset |
|
||||||
( |
|
||||||
caption varchar(255), |
|
||||||
uniquename varchar(255), |
|
||||||
fieldclause text, |
|
||||||
joinclause text, |
|
||||||
whereclause text, |
|
||||||
systeminfo_id integer |
|
||||||
); |
|
||||||
|
|
||||||
insert into tmp_rpta_resultset(caption, |
|
||||||
uniquename, |
|
||||||
systeminfo_id) |
|
||||||
select '${fact_table_target.caption}', |
|
||||||
'${fact_table_target.name}', |
|
||||||
10 |
|
||||||
; |
|
||||||
|
|
||||||
|
|
||||||
update tmp_rpta_resultset set fieldclause=' |
|
||||||
<#foreach field_target in fields_target> |
|
||||||
${field_target.table_name}.${field_target.name} as ${field_target.targetname}, |
|
||||||
</#foreach> |
|
||||||
null::varchar as dummy', |
|
||||||
joinclause='${fact_table_source} |
|
||||||
<#foreach added_table in added_tables> |
|
||||||
left outer join ${added_table.name} on (${added_table.joinclause}) |
|
||||||
</#foreach>'; |
|
||||||
|
|
||||||
select * into temp tmp_rs1 |
|
||||||
from rpta_resultset |
|
||||||
; |
|
||||||
|
|
||||||
update rpta_resultset set caption=T.caption, |
|
||||||
fieldclause=T.fieldclause, |
|
||||||
joinclause=T.joinclause, |
|
||||||
whereclause=T.whereclause |
|
||||||
from tmp_rpta_resultset T |
|
||||||
where T.systeminfo_id=rpta_resultset.systeminfo_id |
|
||||||
and T.uniquename=rpta_resultset.uniquename |
|
||||||
; |
|
||||||
|
|
||||||
insert into rpta_resultset(caption, |
|
||||||
uniquename, |
|
||||||
fieldclause, |
|
||||||
joinclause, |
|
||||||
whereclause, |
|
||||||
systeminfo_id) |
|
||||||
select caption, |
|
||||||
uniquename, |
|
||||||
fieldclause, |
|
||||||
joinclause, |
|
||||||
whereclause, |
|
||||||
systeminfo_id |
|
||||||
from tmp_rpta_resultset |
|
||||||
where 0=(select count(*) |
|
||||||
from tmp_rs1 T |
|
||||||
where T.systeminfo_id=tmp_rpta_resultset.systeminfo_id |
|
||||||
and T.uniquename=tmp_rpta_resultset.uniquename) |
|
||||||
; |
|
||||||
drop table tmp_rpta_resultset; |
|
||||||
drop table tmp_rs1; |
|
||||||
|
|
||||||
delete from sx_tables where name |
|
||||||
in (select T.name from tmp_tables T); |
|
||||||
|
|
||||||
insert into sx_tables (name,caption,description,table_type,systeminfo_id,systeminfo_orig,thema,sachgebiete_id) |
|
||||||
select name,caption,description,table_type,systeminfo_id,systeminfo_orig,thema,sachgebiete_id |
|
||||||
from tmp_tables; |
|
||||||
|
|
||||||
|
|
||||||
delete from sx_fields where table_name |
|
||||||
in (select T.table_name from tmp_fields T); |
|
||||||
|
|
||||||
insert into sx_fields (table_name,name,caption,description,field_type, |
|
||||||
field_size, |
|
||||||
field_not_null, |
|
||||||
currentlyUsed, |
|
||||||
foreignkey_tab, |
|
||||||
foreignkey_col, |
|
||||||
foreignkey_cap, |
|
||||||
foreignkey_int, |
|
||||||
foreignkey_cond, |
|
||||||
foreignkey_func, |
|
||||||
check_integrity, |
|
||||||
is_sum, |
|
||||||
foreignkey_uniquename |
|
||||||
) |
|
||||||
select |
|
||||||
F.table_name,F.name,F.caption,F.description,F.field_type, |
|
||||||
F.field_size, |
|
||||||
F.field_not_null, |
|
||||||
F.currentlyUsed, |
|
||||||
F.foreignkey_tab, |
|
||||||
F.foreignkey_col, |
|
||||||
F.foreignkey_cap, |
|
||||||
F.foreignkey_int, |
|
||||||
F.foreignkey_cond, |
|
||||||
F.foreignkey_func, |
|
||||||
F.check_integrity, |
|
||||||
F.is_sum, |
|
||||||
F.foreignkey_uniquename |
|
||||||
|
|
||||||
from tmp_fields F; |
|
||||||
|
|
||||||
|
|
||||||
drop table tmp_fields; |
|
||||||
drop table tmp_tables; |
|
||||||
|
|
||||||
|
|
||||||
--rpta_column füllen: |
|
||||||
select * into temp tmp_rc1 |
|
||||||
from rpta_column; |
|
||||||
|
|
||||||
|
|
||||||
create temp table tmp_rpta_column( |
|
||||||
uniquename varchar(255) NOT NULL, |
|
||||||
caption varchar(255), |
|
||||||
srcfieldname varchar(255), |
|
||||||
column_type integer, |
|
||||||
col_function text, |
|
||||||
is_aggregate smallint, |
|
||||||
resultset_id integer, |
|
||||||
description text, |
|
||||||
custom integer default 0 |
|
||||||
); |
|
||||||
|
|
||||||
insert into tmp_rpta_column( uniquename, |
|
||||||
caption, |
|
||||||
srcfieldname, |
|
||||||
column_type, |
|
||||||
col_function, |
|
||||||
is_aggregate, |
|
||||||
resultset_id, |
|
||||||
description) |
|
||||||
select F.name as uniquename, |
|
||||||
coalesce(T.caption,T.name) || ' - ' || F.caption, |
|
||||||
F.name as srcfieldname, |
|
||||||
1 as column_type, |
|
||||||
(case when F.is_sum=1 then 'sum' else null::varchar end) as col_function, |
|
||||||
(case when F.is_sum=1 then 1 else 0 end) as is_aggregate, |
|
||||||
R.tid as resultset_id, |
|
||||||
F.description |
|
||||||
from rpta_resultset R, sx_fields F left outer join sx_tables T on (T.name=F.table_name) |
|
||||||
where F.table_name='${fact_table_target.name}' |
|
||||||
and R.uniquename='${fact_table_target.name}' |
|
||||||
and F.currentlyused=1 |
|
||||||
; |
|
||||||
|
|
||||||
update rpta_column set |
|
||||||
caption=T.caption, |
|
||||||
srcfieldname=T.srcfieldname, |
|
||||||
column_type=T.column_type, |
|
||||||
col_function=T.col_function, |
|
||||||
is_aggregate=T.is_aggregate, |
|
||||||
resultset_id=R.tid, |
|
||||||
description=T.description, |
|
||||||
custom=T.custom |
|
||||||
from tmp_rpta_column T, rpta_resultset R |
|
||||||
where T.uniquename=rpta_column.uniquename |
|
||||||
and rpta_column.resultset_id=R.tid |
|
||||||
and R.uniquename='${fact_table_target.name}' |
|
||||||
; |
|
||||||
insert into rpta_column( uniquename, |
|
||||||
caption, |
|
||||||
srcfieldname, |
|
||||||
column_type, |
|
||||||
col_function, |
|
||||||
is_aggregate, |
|
||||||
resultset_id, |
|
||||||
description, |
|
||||||
custom) |
|
||||||
select T.uniquename, |
|
||||||
T.caption, |
|
||||||
T.srcfieldname, |
|
||||||
T.column_type, |
|
||||||
T.col_function, |
|
||||||
T.is_aggregate, |
|
||||||
R.tid as resultset_id, |
|
||||||
T.description, |
|
||||||
T.custom |
|
||||||
from tmp_rpta_column T, rpta_resultset R |
|
||||||
where R.uniquename='${fact_table_target.name}' |
|
||||||
and 0=(select count(*) from tmp_rc1 C |
|
||||||
where C.uniquename=T.uniquename |
|
||||||
and C.resultset_id=R.tid) |
|
||||||
; |
|
||||||
|
|
||||||
drop table tmp_rpta_column; |
|
||||||
drop table tmp_rc1; |
|
||||||
|
|
||||||
</#if> --wenn cob_busa_aggr_exists=1 |
|
||||||
@ -1,94 +0,0 @@ |
|||||||
--freemarker template |
|
||||||
<#include "RPTA-Makros"/> |
|
||||||
<sqlvars> |
|
||||||
<sqlvar name="rpta_installed"> |
|
||||||
select count(*) from systeminfo where tid=330; |
|
||||||
</sqlvar> |
|
||||||
</sqlvars> |
|
||||||
<#assign rpta_column_layout = {"uniquename":"cob_busa_aggr_stamm_kost", |
|
||||||
"caption":"Primärkosten und Erlöse nach Kostenstelle", |
|
||||||
"rpta_resultset":"cob_busa_aggr_stamm", |
|
||||||
"whereclause":"", |
|
||||||
"description":"" |
|
||||||
} |
|
||||||
/> |
|
||||||
|
|
||||||
<#assign rpta_columns = [ |
|
||||||
{"uniquename":"s_kostenstelle", |
|
||||||
"caption":"Kostenstelle Sichtelement-ID", |
|
||||||
"srcfieldname":"", |
|
||||||
"targetfieldname":"s_kostenstelle", |
|
||||||
"column_type":"logicalColumn", |
|
||||||
"col_function":"instnr", |
|
||||||
"is_visible":"0", |
|
||||||
"format_code":"", |
|
||||||
"visible_size":"30", |
|
||||||
"is_aggregate":"0", |
|
||||||
"description":"kostenstelle" |
|
||||||
}, |
|
||||||
{"uniquename":"cob_busa_aggr_stamm_ebene", |
|
||||||
"caption":"Ebene", |
|
||||||
"srcfieldname":"", |
|
||||||
"targetfieldname":"ebene", |
|
||||||
"column_type":"logicalColumn", |
|
||||||
"col_function":"null::integer", |
|
||||||
"is_visible":"1", |
|
||||||
"format_code":"", |
|
||||||
"visible_size":"5", |
|
||||||
"is_aggregate":"0", |
|
||||||
"description":"" |
|
||||||
}, |
|
||||||
{"uniquename":"cob_busa_aggr_stamm_kost_sicht", |
|
||||||
"caption":"Kostenstelle", |
|
||||||
"srcfieldname":"s_kostenstelle", |
|
||||||
"targetfieldname":"kostenstelle", |
|
||||||
"column_type":"treeColumn", |
|
||||||
"col_function":"Kostenstellen", |
|
||||||
"is_visible":"1", |
|
||||||
"format_code":"", |
|
||||||
"visible_size":"30", |
|
||||||
"is_aggregate":"0", |
|
||||||
"description":"Kostenstelle" |
|
||||||
}, |
|
||||||
{"uniquename":"kosten", |
|
||||||
"caption":"Kosten", |
|
||||||
"srcfieldname":"", |
|
||||||
"targetfieldname":"kosten", |
|
||||||
"column_type":"logicalColumn", |
|
||||||
"col_function":"case when kokl_faktor = 1 then betrag else 0 end", |
|
||||||
"format_code":"", |
|
||||||
"is_visible":"1", |
|
||||||
"is_aggregate":1, |
|
||||||
"visible_size":10, |
|
||||||
"description":"" |
|
||||||
}, |
|
||||||
{"uniquename":"erloese", |
|
||||||
"caption":"Erlöse", |
|
||||||
"srcfieldname":"", |
|
||||||
"targetfieldname":"erloese", |
|
||||||
"column_type":"logicalColumn", |
|
||||||
"col_function":"case when kokl_faktor = -1 then betrag else 0 end", |
|
||||||
"format_code":"", |
|
||||||
"is_visible":"1", |
|
||||||
"is_aggregate":1, |
|
||||||
"visible_size":10, |
|
||||||
"description":"" |
|
||||||
}, |
|
||||||
{"uniquename":"kosten_erloese_saldo", |
|
||||||
"caption":"Saldo", |
|
||||||
"srcfieldname":"", |
|
||||||
"targetfieldname":"kosten_erloese_saldo", |
|
||||||
"column_type":"logicalColumn", |
|
||||||
"col_function":"betrag*kokl_faktor", |
|
||||||
"format_code":"", |
|
||||||
"is_visible":"1", |
|
||||||
"is_aggregate":1, |
|
||||||
"visible_size":10, |
|
||||||
"description":"" |
|
||||||
} |
|
||||||
] |
|
||||||
/> |
|
||||||
|
|
||||||
<#if rpta_installed==1> |
|
||||||
<@rpta_column_layout_fuellen /> |
|
||||||
</#if> |
|
||||||
Loading…
Reference in new issue