diff --git a/src-modules/module/rpta/conf/rpta.xml b/src-modules/module/rpta/conf/rpta.xml index 1bdb423..ec23bf0 100644 --- a/src-modules/module/rpta/conf/rpta.xml +++ b/src-modules/module/rpta/conf/rpta.xml @@ -366,7 +366,7 @@ parent="Berichtsassistent">Abfragen zur Administration von Berichtsassistent $RPTA_PFAD/masken - + $RPTA_PFAD/masken @@ -378,7 +378,13 @@ parent="Berichtsassistent">Abfragen zur Administration von Berichtsassistent $RPTA_PFAD/masken - + + + + $RPTA_PFAD/masken + + + $RPTA_PFAD/masken @@ -555,6 +561,8 @@ scriptfile="" database=""/> + + @@ -562,7 +570,10 @@ scriptfile="" database=""/> + + + @@ -610,6 +621,8 @@ scriptfile="" database=""/> + + @@ -618,6 +631,9 @@ scriptfile="" database=""/> + + + diff --git a/src-modules/module/rpta/masken/48430_felderinfo.unl b/src-modules/module/rpta/masken/48430_felderinfo.unl new file mode 100644 index 0000000..d40a93b --- /dev/null +++ b/src-modules/module/rpta/masken/48430_felderinfo.unl @@ -0,0 +1,40 @@ +48430^Spaltenlayout^3000^350^-1^140^180^1^char^30^1^1^<>SELECT uniquename,\ + caption\ +FROM rpta_column_layout \ +where resultset_id in (select R.tid from rpta_resultset R where R.uniquename in ('rpta_zul_antr_aggr','rpta_zul_antr_aggr_archiv')\ +and R.systeminfo_id=130)\ +order by sortnr, caption\ + ;^ ^<>SELECT uniquename,\ + caption\ +FROM rpta_column_layout \ +where resultset_id in (select R.tid from rpta_resultset R where R.uniquename='rpta_zul_antr_aggr_archiv'\ +and R.systeminfo_id=130);^ +48431^Seit Semester^10^0^0^140^80^1^integer^30^0^1^<> select tid, eintrag from semester order by tid DESC;^ ^<> select case when tid % 10 = 1 then tid+1 else tid+9 end,\ + (select eintrag from semester where tid in \ + (select case when tid % 10 = 1 then tid+1 else tid+9 end from semester where today() between sem_beginn and sem_ende)) \ +from semester \ +where today() between sem_beginn and sem_ende;^ +48432^Fächer^30^0^0^130^200^6^integer^1000^0^12^<> select tid,name,sortnr from sichten where art='Fächer-Sicht' order by 3,2;^ ^ ^ +48433^Abschluss^40^0^0^100^200^3^char^1500^0^12^<> select tid,name,sortnr from sichten where art='SOS-Abschluss-Sicht' order by 3,2;^ ^ ^ +48434^bis Fachsemester^1000^300^-1^200^100^1^integer^30^0^999^^ ^ ^ +48435^Semestertyp^22^350^-1^140^80^1^integer^255^0^1^<> select 1,'nur Sommersemester' from xdummy union select 2,'nur Wintersemester' from xdummy^ ^ ^ +48436^Hochschulzugangsberechtigung^120^300^-1^200^200^1^sql^30^0^999^hs_zugangsber^ ^ ^ +48437^Bis Semester^20^350^-1^140^80^1^integer^30^0^1^<> select tid, eintrag from semester order by tid DESC;^ ^<> select case when tid % 10 = 1 then tid+1 else tid+9 end,\ + (select eintrag from semester where tid in \ + (select case when tid % 10 = 1 then tid+1 else tid+9 end from semester where today() between sem_beginn and sem_ende)) \ +from semester \ +where today() between sem_beginn and sem_ende;^ +48438^Staatsangehörigkeit^150^0^0^140^150^10^char^30^0^12^<> select tid,name,sortnr from sichten where art='SOS-Staaten-Sicht' order by 3,2;^ ^ ^ +48439^Studiengang^25^0^0^140^150^50^char^1000^0^12^<> select tid,name,sortnr from sichten where art in ('SOS-Kostenstellen-Sicht', 'SOS-Studiengang-Sicht') order by 3,2;^ ^ ^ +48440^Semester^100^0^0^140^80^1^integer^30^0^1^<> select tid, eintrag from semester order by tid DESC;^hidden^ ^ +48441^Stichtag^23^330^-1^130^100^1^sql^30^1^999^<> select tid, name from sos_stichtag where stichtagsart='Studierende';^ ^<> select tid, name from sos_stichtag where stichtagsart='Studierende' and appl_key='0';^ +48442^Hörerstatus^200^330^-1^140^150^1^sql^30^0^999^<> select apnr, eintrag from hoererstatus order by 2^ ^<> select apnr, eintrag from hoererstatus where eintrag='alle';^ +48443^Jahr^110^0^0^140^80^1^integer^30^0^13^^ ^ ^ +48444^Filter Studierende^100^0^0^140^150^1^sql^20^0^1^<> SELECT id,caption from sx_repository where aktiv =1 and today() between gueltig_seit and gueltig_bis and art='SOS_STUD_FILTER' order by 2;^ ^ ^ +48445^Nur Endsemester^21^0^0^140^80^1^integer^30^0^999^<> select 1,'ja' from xdummy^Eintrag^ ^ +48446^Matrikel-Nr.^35^350^-1^140^80^1^char^30^0^13^^ ^ ^ +48448^Köpfe oder Fälle ?^0^0^0^140^150^1^sql^70^0^999^<> select apnr, eintrag from koepfe_oder_faelle order by 2^ ^<> select apnr, eintrag from koepfe_oder_faelle where eintrag = 'Fälle';^ +48452^Geschlecht^110^0^0^140^80^1^integer^30^0^1^<> SELECT apnr,druck FROM cif where key = 9003 and apnr between 1 and 4 order by 1;^ ^ ^ +48453^Spalten^3001^0^0^150^190^10^char^30^0^999^<>\ +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=<>) order by 2;^ ^ ^ diff --git a/src-modules/module/rpta/masken/48430_maske_system_bez.unl b/src-modules/module/rpta/masken/48430_maske_system_bez.unl new file mode 100644 index 0000000..7218754 --- /dev/null +++ b/src-modules/module/rpta/masken/48430_maske_system_bez.unl @@ -0,0 +1 @@ +48430^7^ diff --git a/src-modules/module/rpta/masken/48430_masken_felder_bez.unl b/src-modules/module/rpta/masken/48430_masken_felder_bez.unl new file mode 100644 index 0000000..dffc0ea --- /dev/null +++ b/src-modules/module/rpta/masken/48430_masken_felder_bez.unl @@ -0,0 +1,20 @@ +48430^48430^ +48430^48431^ +48430^48432^ +48430^48433^ +48430^48434^ +48430^48435^ +48430^48436^ +48430^48437^ +48430^48438^ +48430^48439^ +48430^48440^ +48430^48441^ +48430^48442^ +48430^48443^ +48430^48444^ +48430^48445^ +48430^48446^ +48430^48448^ +48430^48452^ +48430^48453^ diff --git a/src-modules/module/rpta/masken/48430_maskeninfo.unl b/src-modules/module/rpta/masken/48430_maskeninfo.unl new file mode 100644 index 0000000..3842894 --- /dev/null +++ b/src-modules/module/rpta/masken/48430_maskeninfo.unl @@ -0,0 +1,156 @@ +48430^Bewerbungen und Zulassungen^--Freemarker Template\ +<#include "SQL_lingua_franca"/>\ +<#include "SuperX_general"/>\ +--\ +--Autor D. Quathamer 2024\ +\ +>;]]>\ +\ +\ +\ +\ +>;\ +\ +]]>\ +>\ +/* and C.uniquename in (<>) */\ +order by CL.sortnr\ + ;\ +]]>\ += <> */\ +/* and tid <= <> */\ +<#if "<>"="1" || "<>"="2">\ +and substring('' || tid from 5 for 1)='<>'\ +\ +;\ +\ +]]>\ +\ +\ +<#assign semester_filter ="1=1\ +/* and bewsem >= <> */\ +/* and bewsem <= <> */\ +" />\ +<#if "<>"="1" || "<>"="2">\ +<#assign semester_filter = semester_filter+ " and substring('' || bewsem from 5 for 1)='<>'" />\ +\ +<#if "<>"="1">\ +--nur Endsemester\ +<#assign semester_filter = semester_filter+ " and 1=1 and bewsem = "+endsemester /> \ +\ +\ +<#assign filter="1=1\ +/* and bewsem = <> */\ +--/* and stichtag = <> */\ +--/* and <> */\ +--/* and <>*/\ +/* and geschlecht = <> */\ +/* and substring('' || bewsem from 5 for 1)='<>' */\ +/* and ${<>} */\ +" />\ +\ +<#assign filter= filter + " and " + semester_filter />\ +\ +\ +<#assign filter = filter + " and 's_' || tid_stg in "+Studiengang.allNeededKeysList /> \ +/* <#assign filter = filter + " and '' || ca12_staat in "+Staatsangehörigkeit.allNeededKeysList /> --<> */\ +/* <#assign filter = filter + " and stg in "+Fächer.allNeededKeysList /> --<> */\ +/* <#assign filter = filter + " and tid_stg in (select L2.tid from lehr_stg_ab L2 where L2.abschluss in "+Abschluss.allNeededKeysList +")" /> --<> */\ + \ +\ +<#if columns?has_content>\ +\ +<#if basetable.is_virtual==1>\ +\ +create temp table ${basetable.runtime_tablename} as\ +select ${rpta_resultset.fieldclause} \ +from ${rpta_resultset.joinclause} \ +where 1=1\ +<#if rpta_resultset.whereclause != ""> \ +${rpta_resultset.whereclause} \ +and ${filter}\ +;\ +\ +\ +\ +<@rpta_interpret_column_layout nonvirtualTableFilter=1/>\ +\ + --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 1=0>\ +Column CID=0 heading_text="sortnr" center_heading explanation=""\ + row_selectable heading_platform readonly\ + width=5 text_size=60\ +\ +@@@^Studienfach^Anzahl bzw. Anteil^Bewerbungen und Zulassungen^drop table if exists tmp_stud2; drop table if exists tmp_stud3;^^2^850^540^^1^<>SELECT description FROM rpta_column_layout where tid=<>;^ diff --git a/src-modules/module/rpta/masken/48430_sachgeb_maske_bez.unl b/src-modules/module/rpta/masken/48430_sachgeb_maske_bez.unl new file mode 100644 index 0000000..43c077c --- /dev/null +++ b/src-modules/module/rpta/masken/48430_sachgeb_maske_bez.unl @@ -0,0 +1 @@ +16^48430^ diff --git a/src-modules/module/rpta/schluesseltabellen/bewerbungen_datenblatt_historisiert_virtuell.sql b/src-modules/module/rpta/schluesseltabellen/bewerbungen_datenblatt_historisiert_virtuell.sql new file mode 100644 index 0000000..36412b9 --- /dev/null +++ b/src-modules/module/rpta/schluesseltabellen/bewerbungen_datenblatt_historisiert_virtuell.sql @@ -0,0 +1,400 @@ +--freemarker template + + +select sp_table_exists('zul_antr_aggr_archiv') from xdummy; + + +select name + from sx_tables where name ='zul_antr_aggr_archiv' + + + + + + +select tid, table_name, + name, + name as targetname + from sx_fields where table_name ='${fact_table_source}' + and currentlyused=1 + <#foreach added_table in added_tables> + union + select tid,table_name, + name, + '${added_table.prefix}' || name as targetname + from sx_fields where table_name ='${added_table.name}' + and currentlyused=1 + + + order by 1 + +]]> + + + +<#if zul_antr_aggr_archiv_exists==1 && fact_table_source?exists > + +<#assign fact_table_target = {"name":"rpta_zul_antr_aggr_archiv", "caption":"Bewerbungen und Zulassungen historisiert"} + /> + + +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) + +); + + +--Vorbereitung: +-- UPDATE sx_tables +-- SET caption = 'Institution' +-- WHERE name='man_organigramm'; +-- UPDATE sx_tables + -- SET caption = 'Studienart' +-- WHERE name = 'sos_k_stuart'; +-- UPDATE sx_tables + -- SET caption = 'Studiumstyp' +-- WHERE name = 'sos_k_stutyp'; +-- UPDATE sx_tables + -- SET caption = 'Studienform' +-- WHERE name = 'sos_k_stufrm'; +-- UPDATE sx_tables + -- SET caption = 'Hörerstatus' +-- WHERE name = 'sos_k_hrst'; + + + +--drop view if exists sos_stud_astat; + + + +update sx_fields set + is_sum=0 + where table_name='zul_antr_aggr_archiv' + and name not in ('value','value1','value2'); +update sx_fields set + is_sum=1 + where table_name='zul_antr_aggr_archiv' + and name in ('value','value1','value2'); + + +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; + + +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}', + 130 +; + + +update tmp_rpta_resultset set fieldclause=' +<#foreach field_target in fields_target> +${field_target.table_name}.${field_target.name} as ${field_target.targetname}, + +null::varchar as dummy', +joinclause='${fact_table_source} +<#foreach added_table in added_tables> +left outer join ${added_table.name} on (${added_table.joinclause}) +'; + +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; + + --wenn zul_antr_aggr_archiv_exists=1 diff --git a/src-modules/module/rpta/schluesseltabellen/bewerbungen_datenblatt_virtuell.sql b/src-modules/module/rpta/schluesseltabellen/bewerbungen_datenblatt_virtuell.sql new file mode 100644 index 0000000..3163bc9 --- /dev/null +++ b/src-modules/module/rpta/schluesseltabellen/bewerbungen_datenblatt_virtuell.sql @@ -0,0 +1,400 @@ +--freemarker template + + +select sp_table_exists('zul_antr_aggr') from xdummy; + + +select name + from sx_tables where name ='zul_antr_aggr' + + + + + + +select tid, table_name, + name, + name as targetname + from sx_fields where table_name ='${fact_table_source}' + and currentlyused=1 + <#foreach added_table in added_tables> + union + select tid,table_name, + name, + '${added_table.prefix}' || name as targetname + from sx_fields where table_name ='${added_table.name}' + and currentlyused=1 + + + order by 1 + +]]> + + + +<#if zul_antr_aggr_exists==1 && fact_table_source?exists > + +<#assign fact_table_target = {"name":"rpta_zul_antr_aggr", "caption":"Bewerbungen und Zulassungen"} + /> + + +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) + +); + + +--Vorbereitung: +-- UPDATE sx_tables +-- SET caption = 'Institution' +-- WHERE name='man_organigramm'; +-- UPDATE sx_tables + -- SET caption = 'Studienart' +-- WHERE name = 'sos_k_stuart'; +-- UPDATE sx_tables + -- SET caption = 'Studiumstyp' +-- WHERE name = 'sos_k_stutyp'; +-- UPDATE sx_tables + -- SET caption = 'Studienform' +-- WHERE name = 'sos_k_stufrm'; +-- UPDATE sx_tables + -- SET caption = 'Hörerstatus' +-- WHERE name = 'sos_k_hrst'; + + + +--drop view if exists sos_stud_astat; + + + +update sx_fields set + is_sum=0 + where table_name='zul_antr_aggr' + and name not in ('value','value1','value2'); +update sx_fields set + is_sum=1 + where table_name='zul_antr_aggr' + and name in ('value','value1','value2'); + + +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; + + +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}', + 130 +; + + +update tmp_rpta_resultset set fieldclause=' +<#foreach field_target in fields_target> +${field_target.table_name}.${field_target.name} as ${field_target.targetname}, + +null::varchar as dummy', +joinclause='${fact_table_source} +<#foreach added_table in added_tables> +left outer join ${added_table.name} on (${added_table.joinclause}) +'; + +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; + + --wenn zul_antr_aggr_exists=1 diff --git a/src-modules/module/rpta/schluesseltabellen/rpta_column_layout_zul_antr_aggr_basic.sql b/src-modules/module/rpta/schluesseltabellen/rpta_column_layout_zul_antr_aggr_basic.sql new file mode 100644 index 0000000..de5efa8 --- /dev/null +++ b/src-modules/module/rpta/schluesseltabellen/rpta_column_layout_zul_antr_aggr_basic.sql @@ -0,0 +1,77 @@ +--freemarker template +<#include "RPTA-Makros"/> + + +select count(*) from rpta_resultset where uniquename='rpta_zul_antr_aggr'; + + +<#assign rpta_column_layout = {"uniquename":"zul_antr_aggr_basic", +"caption":"Zulassungen 1. FS", +"rpta_resultset":"rpta_zul_antr_aggr", +"whereclause":"stgsem=1", +"sortclause":"bewsem", +"description":"bewsem" +} + /> + +<#assign rpta_columns = [ +{"uniquename":"bewerbungen", +"caption":"Bewerbungen", +"srcfieldname":"summe", +"column_type":"physicalColumn", +"col_function":"", +"is_visible":"1", +"visible_size":"10", +"is_aggregate":"1", +"description":"" +}, +{"uniquename":"antrags_status_zu", +"caption":"Zugelassen", +"srcfieldname":"", +"targetfieldname":"antrags_status_zu", +"column_type":"logicalColumn", +"col_function":"case when zul_kz=''J'' then 1 else 0 end", +"is_visible":"1", +"visible_size":"10", +"is_aggregate":"1", +"description":"1" +}, +{"uniquename":"annahme_kz_j", +"caption":"Annahme", +"srcfieldname":"", +"targetfieldname":"annahme_kz_j", +"column_type":"logicalColumn", +"col_function":"case when annahme_kz=''J'' then 1 else 0 end", +"is_visible":"1", +"visible_size":"10", +"is_aggregate":"1", +"description":"1" +}, +{"uniquename":"einschreib_kz_j", +"caption":"Eingeschrieben", +"srcfieldname":"", +"targetfieldname":"einschreib_kz_j", +"column_type":"logicalColumn", +"col_function":"case when einschreib_kz=''J'' then 1 else 0 end", +"is_visible":"1", +"visible_size":"10", +"is_aggregate":"1", +"description":"1" +}, +{"uniquename":"bewsem", +"caption_der_spalte":"Bewerbungen und Zulassungen - Bewerbungssemester", +"caption_in_ergebnistabelle":"Bewerbungssemester", +"srcfieldname":"bewsem", +"column_type":"physicalColumn", +"col_function":"", +"is_visible":"1", +"visible_size":"10", +"is_aggregate":"0", +"description":"" +} +] + /> + + + +<@rpta_column_layout_fuellen /> diff --git a/src-modules/module/rpta/schluesseltabellen/rpta_column_layout_zul_antr_aggr_basic_archiv.sql b/src-modules/module/rpta/schluesseltabellen/rpta_column_layout_zul_antr_aggr_basic_archiv.sql new file mode 100644 index 0000000..87f273c --- /dev/null +++ b/src-modules/module/rpta/schluesseltabellen/rpta_column_layout_zul_antr_aggr_basic_archiv.sql @@ -0,0 +1,89 @@ +--freemarker template +<#include "RPTA-Makros"/> + + +select count(*) from rpta_resultset where uniquename='rpta_zul_antr_aggr_archiv'; + + +<#assign rpta_column_layout = {"uniquename":"zul_antr_aggr_basic_archiv", +"caption":"Zulassungen 1. FS historisiert", +"rpta_resultset":"rpta_zul_antr_aggr_archiv", +"whereclause":"stgsem=1", +"sortclause":"bewsem, archivierung_datum_kw", +"description":"bewsem" +} + /> + +<#assign rpta_columns = [ +{"uniquename":"bewerbungen", +"caption":"Bewerbungen", +"srcfieldname":"summe", +"column_type":"physicalColumn", +"col_function":"", +"is_visible":"1", +"visible_size":"10", +"is_aggregate":"1", +"description":"" +}, +{"uniquename":"antrags_status_zu", +"caption":"Zugelassen", +"srcfieldname":"", +"targetfieldname":"antrags_status_zu", +"column_type":"logicalColumn", +"col_function":"case when zul_kz=''J'' then 1 else 0 end", +"is_visible":"1", +"visible_size":"10", +"is_aggregate":"1", +"description":"1" +}, +{"uniquename":"annahme_kz_j", +"caption":"Annahme", +"srcfieldname":"", +"targetfieldname":"annahme_kz_j", +"column_type":"logicalColumn", +"col_function":"case when annahme_kz=''J'' then 1 else 0 end", +"is_visible":"1", +"visible_size":"10", +"is_aggregate":"1", +"description":"1" +}, +{"uniquename":"einschreib_kz_j", +"caption":"Eingeschrieben", +"srcfieldname":"", +"targetfieldname":"einschreib_kz_j", +"column_type":"logicalColumn", +"col_function":"case when einschreib_kz=''J'' then 1 else 0 end", +"is_visible":"1", +"visible_size":"10", +"is_aggregate":"1", +"description":"1" +}, +{"uniquename":"bewsem", +"caption_der_spalte":"Bewerbungen und Zulassungen - Bewerbungssemester", +"caption_in_ergebnistabelle":"Bewerbungssemester", +"srcfieldname":"bewsem", +"column_type":"physicalColumn", +"col_function":"", +"is_visible":"1", +"visible_size":"10", +"is_aggregate":"0", +"description":"" +}, +{"uniquename":"archivierung_datum_kw", +"caption_der_spalte":"Kalenderwoche des Archivierungsdatums", +"caption_in_ergebnistabelle":"Kalenderwoche des Archivierungsdatums", +"srcfieldname":"", +"targetfieldname":"archivierung_datum_kw", +"column_type":"logicalColumn", +"col_function":"week(archivierung_datum)", +"is_visible":"1", +"visible_size":"10", +"is_aggregate":"0", +"description":"" +} +] + /> + + + +<@rpta_column_layout_fuellen />