From 93bed5242d0710b58e84eed4a20bc566be45fad1 Mon Sep 17 00:00:00 2001 From: Meikel Bisping Date: Fri, 14 Mar 2025 09:39:48 +0100 Subject: [PATCH] Einzelbuchungen --- masken/888880040-buchungsbericht.xml | 1179 ++++++++++++++++++++++++++ 1 file changed, 1179 insertions(+) create mode 100644 masken/888880040-buchungsbericht.xml diff --git a/masken/888880040-buchungsbericht.xml b/masken/888880040-buchungsbericht.xml new file mode 100644 index 0000000..b0cc578 --- /dev/null +++ b/masken/888880040-buchungsbericht.xml @@ -0,0 +1,1179 @@ + + + + + + +delete from maskeninfo where tid = 888880040; +delete from themenbaum where maskeninfo_id = 888880040; +delete from felderinfo where tid in (select felderinfo_id from masken_felder_bez where maskeninfo_id = 888880040); +delete from masken_felder_bez where maskeninfo_id = 888880040; +delete from sachgeb_maske_bez where maskeninfo_id = 888880040; +delete from maske_system_bez where maskeninfo_id = 888880040; + + + +insert into maske_system_bez (maskeninfo_id,systeminfo_id) values (888880040,3); +insert into sachgeb_maske_bez (maskeninfo_id,sachgebiete_id) values (888880040,50); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880040); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880041); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880042); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880043); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880044); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880045); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880046); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880047); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880048); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880049); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880050); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880051); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880052); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880053); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880054); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880055); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880056); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880057); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880058); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880059); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880060); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880061); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880062); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880063); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880064); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880065); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880066); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880067); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880068); +insert into masken_felder_bez (maskeninfo_id,felderinfo_id) values (888880040,888880069); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +> SELECT year(today()) FROM xdummy;' where tid=888880052;]]> +> select ''1-ist'', ''Ist'' from xdummy' where tid=888880053;]]> + + + + + +> select ''1-bdat'', ''Buchungsdatum'' from xdummy;' where tid=888880059;]]> + + + + + + + + +> select ''kompakt'',''kompakt'' from xdummy' where tid=888880068;]]> + + +<#include "SuperX_general"/> + +select content from sx_repository where aktiv=1 and +art='FIN_FINANZIERUNGSQUELLE' and gueltig_seit<=date_val('1.1.<>') and gueltig_bis>=('1.1.<>') + + and id in (<>) + +select content from sx_repository where +art like 'FIN_KOSTENART%' and gueltig_seit<=date_val('1.1.<>') and gueltig_bis>=('1.1.<>') +/* and id=<> */ + + + +<#assign showBuchungssumme='nein'/> +<#assign showKontostand='nein'/> +<#assign post_processing1=''/> + +<#assign rbetrag_style="standard"/> +<#if .vars["CUSTOM_"+Maskennummer]?exists> +<#assign inlineTemplate=.vars["CUSTOM_"+Maskennummer]?interpret> +<@inlineTemplate/> + + +<#function rand min max> +<#assign objectConstructor = "freemarker.template.utility.ObjectConstructor"?new()> +<#local n1 = objectConstructor("java.util.Date")> + <#local n2 = n1.getTime()/> + <#local now=n2?string /> + <#local leng=now?length/> + <#local randomNum=0.36+("0."+now[(leng-1)]+now[(leng-2)..(leng-1)])?number/> + <#if (randomNum > 1)> + <#assign _rand = randomNum % 1 /> + <#else> + <#assign _rand = randomNum /> + + <#return (min + ((max - min) * _rand))/> + +<#assign zufall=rand(3,9)?string?replace(",",".")/> + + +--Referenz auf erste Kostenstelle wird fuer FREIES/ZWECKGEBUNDENES BUDGET benoetigt +<#assign kstelle=Kostenstelle.elements?first/> +<#macro kamrights> + --( + --(select count(*) from userinfo where tid=<> and administration=1)>0 or + --(select count(*) from fin_user_kam where buchungsab_fb='0' and projnr_ins='0' and userid=<>)>0 +--or +--( +--buchungsab_fb in (select buchungsab_fb from fin_user_kam where projnr_ins='0' and userid=<> ) +--or +--projnr_ins in (select projnr_ins from fin_user_kam where buchungsab_fb='0' and userid=<> ) +--or + --'ba_'|| buchungsab_fb || '_pr_' ||projnr_ins in (select 'ba_'|| buchungsab_fb || '_pr_' ||projnr_ins from fin_user_kam --where userid=<> ) +--) +--) +--kst_sql wird momentan nicht gebraucht +<#assign kst_sql>ch110_institut in <@printkeys Kostenstelle.allNeededKeysList /> +${SxFinRechte(kst_sql,'31.12.<>',"restrict_buchungen")} + +--start detailbuchungen +create temp table tmp_erg +( +sortkontostandbuch smallint default 1, --0 für Kontostand +sortserial serial, +sort1 integer, +ebene smallint default 3, +sortnr smallint default 1, +rechnungsjahr integer, +kapitel char(5), +dr char(5), +dr2 char(5), +titel char(10), + zweckbestimmung_ut char(3), + titelgruppe_gege char(5), + buchungsdatum date, + auswert_kz char(5), + huelnummer integer, + buchungskzmbs char(3), + voa_buchschl integer, + utnummer integer, + betrag decimal(14,2), + betrag2 decimal(14,2), + rbetrag decimal(14,2), + einnahmen_betrag decimal(14,2), + ausgaben_betrag decimal(14,2), + a_nr varchar(255), + op_kz char(1), + kommentar char(255), + buchungsab_fb char(10), + projnr_ins char(10), + ins2 char(10),ins3 char(10), + ch110_institut char(10), + kostenstelle varchar(12), + bga varchar(12), + fikr varchar(255), + fikr_name varchar(255), + kostentraeger char(12), + zpartnernummer char(10), + z_name char(50), + join_nr integer, + r_dat date, + ref_h integer, + r_nr varchar(255), + hhans decimal(17,2), + akts_plus_vojs decimal(17,2), + einnahmen decimal(17,2), + angeordnete decimal(17,2), + ausgaben decimal(17,2), + reste decimal(17,2), + vojs decimal(17,2), + fest decimal(17,2), + verfuegbar decimal(17,2), + verfuegbar_of decimal(17,2), + verfuegbar_geld decimal(17,2), + verfuegbar_misch decimal(17,2), -- gegen Ansatz bei Haushalt, gegen Geldeingang bei Drittmitteln + verfuegbar_misch_of decimal(17,2) +) <@informixnolog/>; + +<#if showKontostand="ja"> +<#if (FINANZIERUNGSQUELLEN?size>1)> FEHLER Kontostandanzeige nur bei einfacher Finanzierungsquelle (keine Mehrfachauswahl) + <#assign drtit="dr"/> --default + <#if (FINANZIERUNGSQUELLEN[0].content?length<2)> FEHLER kein gueltiger Eintrag fuer <> gefunden<#else> +<#assign inlineTemplate = FINANZIERUNGSQUELLEN[0].content?interpret> + +create temp table tmp_calc ( +buchungsab_fb varchar(10), +dritt smallint, +hhans decimal(17,2), + akts_plus_vojs decimal(17,2), -- Haushaltsreste + Vorjahresreste + einnahmen decimal(17,2), + angeordnete decimal(17,2), + ausgaben decimal(17,2), + reste decimal(17,2), + vojs decimal(17,2), + fest decimal(17,2) default 0, + verfuegbar decimal(17,2), + verfuegbar_of decimal(17,2), + verfuegbar_geld decimal(17,2), + verfuegbar_misch decimal(17,2), -- gegen Ansatz bei Haushalt, gegen Geldeingang bei Drittmitteln + verfuegbar_misch_of decimal(17,2) + ) <@informixnolog/>; + +select count(*) from fin_konto_aggr where 1=0 and <@inlineTemplate />; -- ggfs überschreiben + <#if "<>"!=""> <#assign drtit="tit"/> + <#if "<>"!=""> +<#if TMP_FINKOSTENART?length<2>FEHLER kein gueltiger Eintrag fuer <> gefunden +<#assign finkostenarttemplate = TMP_FINKOSTENART?interpret> + <#if TMP_FINKOSTENART?index_of("titel")>-1||"<>"="'no_dr'"> <#assign drtit="tit"/> + +insert into tmp_calc( buchungsab_fb,dritt,akts_plus_vojs,hhans,einnahmen,reste,vojs,angeordnete,ausgaben,fest,verfuegbar,verfuegbar_of,verfuegbar_geld,verfuegbar_misch) +select buchungsab_fb,dritt,sum(akt_soll_${drtit})+sum(vojs_${drtit}),sum(hhans_${drtit}),sum(einnahmen_${drtit}),sum(reste_${drtit}),sum(vojs_${drtit}),sum(angeordnete_${drtit}),sum(ausgaben_${drtit}), +sum(festgelegt_${drtit}),sum(verfuegbar_${drtit}),sum(verfuegbar_${drtit})+sum(festgelegt_${drtit}),sum(verfuegbar_geld),sum(verfuegbar_${drtit}) --default Haushalt +from +fin_konto_aggr where rechnungsjahr=<> +and <@inlineTemplate /> +/* and monat = <> */ +/* and kapitel in (<>) */ + /* and titel in ( <> ) */ + /* and zweckbestimmung_ut in ( <>) */ +<#if "<>"="'no_dr'"> +and (dr='' or dr is null) +<#else> +/* and (dr in (<>) */ +/* or dr2 in (<>)) */ + + /* and buchungsab_fb in (<>) */ + /* and projnr_ins in ( <> ) */ + /* and (buchungsab_fb in (<>) */ +/* or projnr_ins in (<>) ) */ + /* and ins2 in ( <> ) */ + /* and ins3 in ( <> ) */ + /* and sx_butype in (<>) */ +/* and titelgruppe_gege in <@printkeys .vars["Budgetherkunft"].allNeededKeys /> -- <> */ + + <#if Kostenträger?is_hash && Kostenträger.sichtname="externe Kostenträger"> + -- fuer externe Kostentraeger ist ein Join ueber proj noetig, Kostentraeger enthaelt Schluessel +/* and kostentraeger in (select projnr from fin_proj P where P.key_extkotr in <@printkeys Kostenträger.allNeededKeys/>) -- <> */ + <#else> +/* and kostentraeger in <@printkeys Kostenträger.allNeededKeys/> --<> */ + +/* and fikr in <@printkeys Kostenarten.allNeededKeysList /> -- <> */ + +<#if "<>"!=""> +and +<@finkostenarttemplate /> + +group by 1,2; +update tmp_calc set verfuegbar_misch=verfuegbar where dritt=0; +update tmp_calc set verfuegbar_misch=verfuegbar_geld where dritt=1; +update tmp_calc set verfuegbar_misch_of=verfuegbar_misch+fest; + +<#if Username?starts_with("demouser")> +update tmp_calc set hhans=hhans*${zufall} , + akts_plus_vojs=akts_plus_vojs*${zufall} , + einnahmen =einnahmen*${zufall}, + angeordnete =angeordnete*${zufall} , + ausgaben=ausgaben*${zufall}, +fest=fest*${zufall}, + vojs=vojs*${zufall}, + verfuegbar=verfuegbar*${zufall} , + verfuegbar_of=verfuegbar_of*${zufall} , +verfuegbar_geld=verfuegbar_geld*${zufall}, +verfuegbar_misch=verfuegbar_misch*${zufall}, +verfuegbar_misch_of=verfuegbar_misch_of*${zufall}; + + +insert into tmp_erg( sortkontostandbuch,akts_plus_vojs,hhans,einnahmen,reste,vojs,angeordnete,ausgaben,fest,verfuegbar,verfuegbar_of,verfuegbar_geld,verfuegbar_misch,verfuegbar_misch_of) +select 0,sum(akts_plus_vojs),sum(hhans),sum(einnahmen),sum(reste),sum(vojs),sum(angeordnete),sum(ausgaben), +sum(fest),sum(verfuegbar),sum(verfuegbar_of),sum(verfuegbar_geld),sum(verfuegbar_misch),sum(verfuegbar_misch_of) from tmp_calc group by 1; + -- Tabelle wird unten gedroppt evtl für post_processing1 noch gebraucht (s.Staatl. Akademie Stuttgart) + +create temp table tmp_buch +( +sortserial serial, +sort1 integer, +kontonr integer, +sortnr smallint default 1, +rechnungsjahr integer, +kapitel char(5), +dr char(5), +dr2 char(5), +titel char(10), + zweckbestimmung_ut char(3), + titelgruppe_gege char(5), + buchungsdatum date, + auswert_kz char(5), + huelnummer integer, + buchungskzmbs char(3), + voa_buchschl integer, + utnummer integer, + betrag decimal(14,2), + betrag2 decimal(14,2), + rbetrag decimal(14,2), + a_nr varchar(255), + op_kz char(1), + kommentar char(255), + buchungsab_fb char(10),projnr_ins char(10), + ins2 char(10),ins3 char(10), + ch110_institut char(10), + kostenstelle varchar(12), + bga varchar(12), + fikr char(12), + kostentraeger char(12), + zpartnernummer char(10), + z_name char(50), + join_nr integer, + r_dat date, + ref_h integer, + r_nr varchar(255) +) <@informixnolog/>; + +<#if SQLdialect='Postgres'>--Direkt einfuegen moeglich +insert into tmp_buch (kontonr,kapitel,dr,dr2,titel,rechnungsjahr, zweckbestimmung_ut, titelgruppe_gege, buchungsdatum,auswert_kz,huelnummer, buchungskzmbs, voa_buchschl, +utnummer,betrag, betrag2, rbetrag,a_nr,op_kz, buchungsab_fb,projnr_ins,ins2,ins3,ch110_institut, fikr, kostentraeger,zpartnernummer,join_nr, +z_name,kommentar,r_dat,ref_h,r_nr,kostenstelle,bga) + +select B.kontonr,B.kapitel,B.dr,B.dr2,B.titel, B.rechnungsjahr, B.zweckbestimmung_ut, B.titelgruppe_gege, B.buchungsdatum,B.auswert_kz,B.huelnummer::integer as huelnummer, B.buchungskzmbs, B.voa_buchschl, +B.utnummer,B.betrag, B.betrag2, B.rbetrag,B.a_nr,B.op_kz, B.buchungsab_fb,B.projnr_ins,B.ins2,B.ins3,B.ch110_institut, B.fikr, B.kostentraeger,B.zpartnernummer,B.join_nr, +D.z_name,D.kommentar,D.r_dat,D.ref_h,D.r_nr,B.kostenstelle,B.bga +--'k'||B.kapitel||'dr'||B.dr||'dr2:'||B.dr2||'t'||B.titel||'ut'||B.zweckbestimmung_ut||'k1:'|| B.buchungsab_fb || 'k2:' ||B.projnr_ins +from fin_buch B, fin_buch_d D +where B.join_nr=D.join_nr and +B.rechnungsjahr=D.rechnungsjahr and +B.rechnungsjahr=<> +/* and B.monat = <> */ +and ( +<#foreach fq in FINANZIERUNGSQUELLEN> +<#assign drtit="dr"/> --Standard kann von einzelnen Finanzierungsquellen umgestellt werden +<#if (fq.content?length<2)>FEHLER kein gueltiger Eintrag fuer Finanzierungsquelle gefunden<#else> +<#assign inlineTemplate = fq.content?interpret> +<#assign bedingung> +<@inlineTemplate /> + ${bedingung?replace("rechnungsjahr","B.rechnungsjahr")} + +<#if fq_has_next> +or + + +) +/* and B.kapitel in (<>) */ + /* and B.titel in ( <> ) */ + /* and zweckbestimmung_ut in ( <>) */ + <#if "<>"="'no_dr'"> +and (dr='' or dr is null) +<#else> +/* and (dr in (<>) */ +/* or dr2 in (<>)) */ + + /* and B.buchungsab_fb in (<>) */ + /* and B.projnr_ins in ( <> ) */ + /* and (buchungsab_fb in (<>) */ +/* or projnr_ins in (<>) ) */ + /* and B.ins2 in ( <> ) */ + /* and B.ins3 in ( <> ) */ + /* and B.buchungsdatum >= date_val(<>) */ + /* and B.buchungsdatum <= date_val(<>) */ + +/* and B.sx_butype in (<>) */ +/* and (B.titelgruppe_gege in <@printkeys .vars["Budgetherkunft"].allNeededKeys /> -- <> */ +/* and B.betrag >= <> */ +/* and B.betrag <= <> */ +/* and B.huelnummer = <> */ +/* and D.r_nr = <> */ + <#if Kostenträger?is_hash && Kostenträger.sichtname="externe Kostenträger"> + -- fuer externe Kostentraeger ist ein Join ueber proj noetig, Kostentraeger enthaelt Schluessel +/* and kostentraeger in (select projnr from fin_proj P where P.key_extkotr in <@printkeys Kostenträger.allNeededKeys/>) --<> */ + <#else> +/* and kostentraeger in <@printkeys Kostenträger.allNeededKeys/> -- <> */ + + +/* and B.auswert_kz = <> */ +/* and B.buchungskzmbs in (<>) */ +/* and r_dat >= date_val(<>) */ +/* and r_dat <= date_val(<>) */ +/* and B.fikr in <@printkeys Kostenarten.allNeededKeysList /> -- <> */ + +<#if "<>"="'0-alle'"> + +<#if "<>"="'1-ist'"> + and ((voa_buchschl>=400 and voa_buchschl<500) or (voa_buchschl>=600 and voa_buchschl<900)) + + <#if "<>"="'1b-ist_hhans_reste'"> + and + ( + --IST + ((voa_buchschl>=400 and voa_buchschl<500) or (voa_buchschl>=600 and voa_buchschl<900)) + --Titelschlüssel umfasst auch alle DR-Schlüssel +or voa_buchschl in (101, 151, 110, 160, 120, 170, 201, 251, 202, 252,104, 154, 112, 162) + +) + + <#if "<>"="'3-soll'"> --Berlinspezifische sind auch <300 + and (voa_buchschl<300 or voa_buchschl in (901,902,951,952)) + + <#if "<>"="'3b-aks'"> + <#if "<>"!=""||"<>"!=""|drtit='tit'> + --akts + and voa_buchschl in (101,151,102,152,104,154,110,160,111,161,112,162,120,170,201,251,202,252,203,253,204,254,206,256,103,153) + <#else> + --ans_a + and voa_buchschl in (101,151,102,152,104,154,110,160,111,161,112,162,201,251,202,252,203,253,204,254,206,256,103,153) + + + <#if "<>"="'3c-sonstzuweis'"> --akts-hans-reste-sperr + <#if "<>"!=""||"<>"!=""|drtit='tit'> + and voa_buchschl in (102,152,111,161,203,253,204,254,206,256) + <#else> + and voa_buchschl in (102,152,111,161,112,162,203,253,204,254,206,256) + + + + <#if "<>"="'2-stornos'"> + and B.voa_buchschl in (351,353,361,451,452,453,454,455,456,457,458,459,461,481,482,483,484,551,556,581,553,554,555,582,583,651,652,681,682,683,684,751,752,781,782,953,954,955,956) + + <#if "<>"="'4-fest'"> + and B.voa_buchschl in (301,351,302,352,303,353,304,354,311,361,312,362, + --inkl Aufloesungszahlungen + 402,452,414,464,404,454,406,456,408,458,411,461,533,583,633,683,634,684,904,954,906,956) + + <#if "<>"="'4b-ofest'"> + and ( (B.voa_buchschl in (301,303,311) and op_kz='1') + -- or B.voa_buchschl in (402,452,404,454,406,456,408,458,411,461,533,583,633,683,634,684,904,954,906,956) --inkl Aufloesungszahlungen + ) + + <#if "<>"="'5-anord'"> + and B.voa_buchschl>=300 --anord selbst 5er und 6er, aber andere koennten Referenzbuchungen sein + +<#if "<>"="'6-aus'"> + and (titel='' or substring(titel from 1 for 1)::smallint>=4) + <#if "<>"!=""||"<>"!=""||drtit='tit'> + and (B.voa_buchschl in (401,451, 402, 452, 414,464,403, 453, 404, 454, 405, 455, 406, 456, 407, 457, 408, 458,409,459, 411, 461, 801, 851, 802, 852, 803, 853, + 431,481,432,482,433, 483, 434, 484,861,811,812,862,813,863,814,864) --ausz_tit + or B.voa_buchschl in (601,651,602,652,701,751,702,752,715,821,871,822,872,823,873,824,874,631, 634,632,684, 681, 632, 682, 633, 683, 684, 831, 731, 781, 732, 782, 881, 832, 882) + ) + <#else> + + and (B.voa_buchschl in (401, 409,451, 459,402, 452, 414,464,403, 453, 404, 454, 405, 455, 406, 456, 407, 457, 408, 458, 411, 461, 801, 851, 802, 852, 803, 853) --ausz_dr + --Vorzeichen braucht nicht umgedreht werden aus-ein_a, bei ein_a sind alle Buchungsschluessel - + -- doppelt negativ gibt wieder positiv + or B.voa_buchschl in (631, 634, 681, 632, 682, 633, 683, 684, 831, 731, 781, 732, 782, 881, 832, 882) + --ein_a (Dr-Ebene) +) + + + <#if "<>"="'7-ein'"> + --ein (ein_e fuer DR sind alle in ein enthalten) + and B.voa_buchschl in (431, 481, 432, 482, 433, 483, 434, 484, 601, 651, 602, 652, 701, 751, 702, 752, 715, 811, 861, 812, 862, 813, 863, 814, 864, 821, 871, 822, 872, 823, 873, 824, 874, + --ausz (ausz_e fuer DR sind alle in ausz enthalten) + 401, 451, 402, 452, 414,464,403, 453, 404, 454, 405, 455, 406, 456, 407, 457, 408, 458, 409, 459, 411, 461, 801, 851, 802, 852, 803, 853, +431, 481, 432, 482, 433, 483, 434, 484, 861, 811, 812, 862, 813, 863, 814, 864) + and (titel='' or substring(titel from 1 for 1)::smallint<4) + + + <#if "<>"="'8-offsolle'"> +and voa_buchschl in (501, 551, 502, 552, 515, 516, 565, 553, 554, 555, 601, 651, 602, 652, 821, 871, 822, 872, 823, 873, 824, 874) +and op_kz='1' + + <#if "<>"="'9-hhans'"> + --Titelschlüssel umfasst auch alle DR-Schlüssel +and voa_buchschl in (101, 151, 110, 160, 120, 170, 201, 251, 202, 252) + + +<#if "<>"="'9b'"> -- das ist hhans + vojs + --Titelschlüssel umfasst auch alle DR-Schlüssel +and voa_buchschl in (101, 151, 110, 160, 120, 170, 201, 251, 202, 252, 901, 951, 952, 902, 907, 957) + + +<#if "<>"="'9b-hhans-reste'"> -- das ist hhans + reste + --Titelschlüssel umfasst auch alle DR-Schlüssel +and voa_buchschl in (101, 151, 110, 160, 120, 170, 201, 251, 202, 252,104, 154, 112, 162) + + +<#if "<>"="'10-reste'"> +and voa_buchschl in (104, 154, 112, 162) + + + + + + +<#if "<>"!=""> +and +<#if TMP_FINKOSTENART?length<2>FEHLER kein gueltiger Eintrag fuer <> gefunden +<#assign inlineTemplate = TMP_FINKOSTENART?interpret> +<@inlineTemplate /> + + + + <#if "<>"="'1-bdat'"> + order by buchungsdatum desc,buchungsab_fb, projnr_ins + + <#if "<>"="'1-bdatASC'"> + order by buchungsdatum,buchungsab_fb, projnr_ins + + <#if "<>"="'2-rdat'"> + order by r_dat desc,buchungsdatum desc, buchungsab_fb, projnr_ins + + <#if "<>"="'3-rnr'"> + order by r_nr,buchungsdatum desc, buchungsab_fb, projnr_ins + + <#if "<>"="'4-zpnr'"> + order by zpartnernummer,buchungsdatum desc, buchungsab_fb, projnr_ins + + <#if "<>"="'5-vwz'"> + order by kommentar,buchungsdatum desc, buchungsab_fb, projnr_ins + + <#if "<>"="'6-huel'"> + order by huelnummer,buchungsdatum desc, buchungsab_fb, projnr_ins + + <#if "<>"="'7-betrag_auf'"> + order by betrag,buchungsdatum desc, buchungsab_fb, projnr_ins + + <#if "<>"="'8-betrag_ab'"> + order by betrag desc,buchungsdatum desc, buchungsab_fb, projnr_ins + + <#if "<>"="'9-dat_tit'"> + order by buchungsdatum desc, titel + +--Informix kann kein insert .. select..ORDER BY, daher temp. Zwischentabelle noetig +<#if SQLdialect='Informix'> +into temp tmp_buch1 with no log + +; +<#if SQLdialect='Informix'> +insert into tmp_buch (kontonr,kapitel,dr,dr2,titel,rechnungsjahr, zweckbestimmung_ut, titelgruppe_gege, buchungsdatum,auswert_kz,huelnummer, buchungskzmbs, voa_buchschl, +utnummer,betrag, betrag2, rbetrag,a_nr,op_kz, buchungsab_fb,projnr_ins,ins2,ins3,ch110_institut, fikr, kostentraeger,zpartnernummer,join_nr, +z_name,kommentar,r_dat,ref_h,r_nr,kostenstelle,bga) +select kontonr,kapitel,dr,dr2,titel,rechnungsjahr, zweckbestimmung_ut, titelgruppe_gege, buchungsdatum,auswert_kz,huelnummer::integer, buchungskzmbs, voa_buchschl, +utnummer,betrag, betrag2, rbetrag,a_nr,op_kz, buchungsab_fb,projnr_ins,ins2,ins3,ch110_institut, fikr, kostentraeger,zpartnernummer,join_nr, +z_name,kommentar,r_dat,ref_h,r_nr,kostenstelle,bga from tmp_buch1; +drop table tmp_buch1; + + + +create index i_tmp_sab2 on tmp_buch(voa_buchschl); +<#if SQLdialect='Informix'>update statistics for table tmp_buch; + +update tmp_buch set sort1=sortserial*100; + + +--update tmp_buch set kommentar=(select distinct min(kommentar) from fin_buch_d where fin_buch_d.rechnungsjahr=year(tmp_buch.buchungsdatum) and fin_buch_d.join_nr=tmp_buch.join_nr) where buchungsdatum is not null; +--update tmp_buch set r_dat=(select r_dat from fin_buch_d where fin_buch_d.rechnungsjahr=year(tmp_buch.buchungsdatum) and fin_buch_d.join_nr=tmp_buch.join_nr) where buchungsdatum is not null; +--update tmp_buch set ref_h=(select ref_h from fin_buch_d where fin_buch_d.rechnungsjahr=year(tmp_buch.buchungsdatum) and fin_buch_d.join_nr=tmp_buch.join_nr) where buchungsdatum is not null; +--end detailbuch +--start ergtab +insert into tmp_erg (sortserial,sort1,ebene,sortnr,rechnungsjahr,kapitel,dr,dr2,titel,zweckbestimmung_ut,titelgruppe_gege,buchungsdatum,auswert_kz,huelnummer,buchungskzmbs,voa_buchschl,utnummer,betrag, + betrag2,rbetrag,a_nr,op_kz,kommentar,buchungsab_fb,projnr_ins,ins2,ins3,ch110_institut,fikr,kostentraeger,zpartnernummer,z_name,join_nr,r_dat,ref_h,r_nr,kostenstelle,bga) +SELECT sortserial, + sort1, 2, sortnr, rechnungsjahr, kapitel, dr, + dr2, titel, zweckbestimmung_ut, titelgruppe_gege, buchungsdatum, + auswert_kz, huelnummer::integer, buchungskzmbs, voa_buchschl, utnummer, betrag, + betrag2, rbetrag, a_nr, op_kz, kommentar, buchungsab_fb,projnr_ins,ins2,ins3, + ch110_institut, fikr, kostentraeger, zpartnernummer, z_name, + join_nr, r_dat, + ref_h, r_nr,kostenstelle,bga + from tmp_buch B + where 1=1 + --<#if "<>"="'2-stornos'"> + --and voa_buchschl in (351,353,361,451,452,453,454,455,456,457,458,459,461,481,482,483,484,551,556,581,553,554,555,582,583,651,652,681,682,683,684,751,752,781,782,953,954,955,956) + -- + <#if "<>"="'4-fest'"> + and voa_buchschl in (301,302,303,304,311,312) + -- ohne Stornos - werden nachgetragen (301,351,302,352,303,353,304,354,311,361,312,362) + + <#if "<>"="'5-anord'"> + and voa_buchschl>=500 and voa_buchschl<700 + ; +--end ergtab +--start ggfs. referenzierte Buchungen + +<#if "<>"="'2-stornos'" || "<>"="'4-fest'" || "<>"="'5-anord'" > +create index i_tmp_sab3 on tmp_buch(rechnungsjahr,join_nr); +create index i_tmp_sab3b on tmp_buch(huelnummer); +create index i_tmp_sab4 on tmp_buch(ref_h); + +<#if SQLdialect='Informix'>update statistics for table tmp_buch; +create temp table tmp_refbuch +( +sort1 integer, +ebene smallint default 3, +sortnr smallint default 1, +rechnungsjahr integer, +kapitel char(5), +dr char(5), +dr2 char(5), +titel char(10), + zweckbestimmung_ut char(3), + titelgruppe_gege char(5), + buchungsdatum date, + auswert_kz char(5), + huelnummer integer, + buchungskzmbs char(3), + voa_buchschl integer, + utnummer integer, + betrag decimal(14,2), + betrag2 decimal(14,2), + rbetrag decimal(14,2), + a_nr varchar(255), + op_kz char(1), + kommentar char(254), + buchungsab_fb char(10), + projnr_ins char(10), + ins2 char(10),ins3 char(10), + ch110_institut char(10), + kostenstelle varchar(12), + bga varchar(12), + fikr char(12), + kostentraeger char(12), + zpartnernummer char(10), + z_name char(50), + join_nr integer, + r_dat date, + ref_h integer, + r_nr varchar(255) + +) <@informixnolog/>; + +insert into tmp_refbuch (ebene, +sort1, +kapitel,dr,dr2, +titel , + zweckbestimmung_ut , + titelgruppe_gege , + buchungsdatum , + auswert_kz, + huelnummer , + buchungskzmbs , voa_buchschl,utnummer, + betrag ,betrag2,rbetrag,a_nr,op_kz, + -- kommentar , + buchungsab_fb ,projnr_ins ,ins2,ins3, + ch110_institut ,fikr,kostentraeger, + zpartnernummer,join_nr, kommentar,r_dat,ref_h,r_nr,kostenstelle,bga + + ) +select 4,S.sort1+1, B.kapitel,B.dr,B.dr2,B.titel, B.zweckbestimmung_ut, B.titelgruppe_gege, B.buchungsdatum, + B.auswert_kz,B.huelnummer::integer, + B.buchungskzmbs,B.voa_buchschl, B.utnummer,B.betrag, B.betrag2,B.rbetrag,B.a_nr,B.op_kz, B.buchungsab_fb,B.projnr_ins,B.ins2,B.ins3, + B.ch110_institut, B.fikr,B.kostentraeger,B.zpartnernummer,B.join_nr + <#if "<>"="'2-stornos'"> +,D.kommentar,D.r_dat,D.ref_h,D.r_nr,B.kostenstelle,B.bga + from fin_buch B,fin_buch_d D, tmp_erg S +where +B.rechnungsjahr=D.rechnungsjahr and +B.join_nr=D.join_nr and + + <#else> +,B.kommentar,B.r_dat,B.ref_h,B.r_nr,B.kostenstelle,B.bga +from tmp_buch B, tmp_erg S +where + + B.kapitel=S.kapitel + and B.dr=S.dr + and B.dr2=S.dr2 + and B.titel=S.titel + and B.zweckbestimmung_ut=S.zweckbestimmung_ut + and B.buchungsab_fb=S.buchungsab_fb + and B.projnr_ins=S.projnr_ins + and B.ins2=S.ins2 and B.ins3=B.ins3 + and B.ch110_institut=S.ch110_institut + -- and B.fikr=S.fikr kann unterschiedlich sein! + and B.kostentraeger=S.kostentraeger + <#if "<>"="'2-stornos'"> + and B.huelnummer=S.ref_h + and B.betrag=-S.betrag + + <#if "<>"="'4-fest'"||"<>"="'5-anord'"> + and S.huelnummer=B.ref_h + + ; +<#if "<>"="'2-stornos'" || "<>"="'4-fest'" || "<>"="'5-anord'" > +insert into tmp_refbuch (ebene,sort1,projnr_ins) +select distinct 3,S.sort1+2,''::char(5) + from tmp_erg S ; + +--update tmp_refbuch set kommentar=(select distinct min(kommentar) from fin_buch_d where fin_buch_d.rechnungsjahr=year(tmp_refbuch.buchungsdatum) and fin_buch_d.join_nr=tmp_refbuch.join_nr) where buchungsdatum is not null; +--update tmp_refbuch set r_dat=(select r_dat from fin_buch_d where fin_buch_d.rechnungsjahr=year(tmp_refbuch.buchungsdatum) and fin_buch_d.join_nr=tmp_refbuch.join_nr) where buchungsdatum is not null; +--update tmp_refbuch set ref_h=(select ref_h from fin_buch_d where fin_buch_d.rechnungsjahr=year(tmp_refbuch.buchungsdatum) and fin_buch_d.join_nr=tmp_refbuch.join_nr) where buchungsdatum is not null; + + +insert into tmp_erg (ebene,sort1, +kapitel,dr,dr2, +titel , + zweckbestimmung_ut , + titelgruppe_gege , + buchungsdatum , + auswert_kz, + huelnummer , + buchungskzmbs , voa_buchschl,utnummer, + betrag ,betrag2,rbetrag,a_nr,op_kz, + buchungsab_fb ,projnr_ins , + ins2,ins3, + ch110_institut ,fikr,kostentraeger, + zpartnernummer,join_nr, + z_name,kommentar,r_dat,ref_h,r_nr,kostenstelle,bga) +select ebene,sort1, +kapitel,dr,dr2, +titel , + zweckbestimmung_ut , + titelgruppe_gege , + buchungsdatum , + auswert_kz, + huelnummer ::integer , + buchungskzmbs , voa_buchschl,utnummer, + betrag ,betrag2,rbetrag,a_nr,op_kz, + buchungsab_fb ,projnr_ins ,ins2,ins3, + ch110_institut ,fikr,kostentraeger, + zpartnernummer,join_nr, + z_name,kommentar,r_dat,ref_h,r_nr,kostenstelle,bga from tmp_refbuch; + +drop table tmp_refbuch; + +--end referenzierte Buchungen + +--update tmp_erg set titel='xx' where (titel='' or titel is null) and (ebene=2 or ebene=4); + +--start schlussselect und ZP-Name filtern +--update tmp_erg set z_name=(select distinct min(zpartnername1) from fin_zp_d where tmp_erg.zpartnernummer=fin_zp_d.zpartnernummer) where zpartnernummer is not null; + +<#if "<>"!=""> +<#assign zp="%<>%"?replace("*","%")?replace("%%","%")?replace("'","") /> +create temp table tmp_zp (sort1 integer) <@informixnolog/>; +insert into tmp_zp (sort1) +select sort1 +from tmp_erg +where 1=1 +and trim(z_name) like '${zp}' +; + -- es sollen auch die zugehoerigen Buchungen geloescht werden, bei denen nicht unbedingt der zp mit angegeben ist +delete from tmp_erg +where sort1 not in (select sort1 from tmp_zp) +and sort1 not in (select sort1+1 from tmp_zp) +and sort1 not in (select sort1+2 from tmp_zp); + +drop table tmp_zp; + +update tmp_erg set rbetrag=null where trim(op_kz)!='1'; + +--<@selectintotmp source="tmp_erg" target="tmp_erg2" select="*">order by sort1; +--drop table tmp_erg; +drop table tmp_buch; +<#if showBuchungssumme='ja'> +<@selectintotmp source="tmp_erg" target="tmp_sum" select="max(sort1) as sort1,sum(betrag) as betrag, sum(rbetrag) as rbetrag"/>; +insert into tmp_erg (sort1) select sort1+1 from tmp_sum; +insert into tmp_erg (sort1, +<#if K_hs_nr=6860>ins2 <#else>kapitel +,betrag,rbetrag) select sort1+2,'Summe',betrag,rbetrag from tmp_sum; +drop table tmp_sum; + + +--select sort1,kapitel, titel, zweckbestimmung_ut, buchungsab_fb, projnr_ins, huelnummer, ref_h, buchungskzmbs, buchungsdatum, r_dat, round(betrag,2) as betrag, +--round(rbetrag,2) as rbetrag,zpartnernummer,z_name,kommentar,ch110_institut, kostentraeger, fikr from tmp_buch2; + +update tmp_erg set utnummer=null where utnummer=0; +update tmp_erg set fikr_name=(select kbez from fin_fikr where tmp_erg.fikr=fin_fikr.key) +where fikr is not null; +<#if K_hs_nr=6751> +update tmp_erg set fikr=(select trim(key)||'-'||kbez from fin_fikr where tmp_erg.fikr=fin_fikr.key) +where fikr is not null; + + + +<#if Username?starts_with("demouser")> +--KOntostandsbeträge oben schon auf demo gesetzt +update tmp_erg set betrag=betrag*${zufall} where betrag is not null; +update tmp_erg set betrag2=betrag2*${zufall} where betrag2 is not null; +update tmp_erg set rbetrag=rbetrag*${zufall} where rbetrag is not null; +update tmp_erg set kommentar='Buchungstext',z_name='Ein Zahlungspartner'; + + +update tmp_erg set ausgaben_betrag=betrag where substring(titel from 1 for 1)::smallint>=4 + and voa_buchschl<=900 and voa_buchschl>400 and + ( + (voa_buchschl<600 and voa_buchschl<=500 ) + or + (voa_buchschl>=600) + ); +-- +-- =WENN(N5>"900"; nix +-- ; WENN(N5>"400"; +-- WENN(N5<"600"; +-- WENN(N5>"500"; nix ;WENN(D5<"40000";L5;)); +-- WENN(D5<"40000";L5;)) +-- ;) +-- ) +-->900 -> nix +-->400 ja -> +-- <600? ja? +-- >500 ja? nix +-- nein? titel<4 Betrag (> 400 und <600 und <=500) +-- nein? titel<4 Betrag (>400 und >=600) +--=WENN(N5>"900";;WENN(N5>"400";WENN(N5<"600";WENN(N5>"500";;WENN(D5>"39999";L5;));WENN(D5>"39999";L5;));)) + +--Einnahmen nur titel anders =WENN(N5>"900";;WENN(N5>"400";WENN(N5<"600";WENN(N5>"500";;WENN(D5<"40000";L5;));WENN(D5<"40000";L5;));)) +update tmp_erg set einnahmen_betrag=betrag where substring(titel from 1 for 1)::smallint<4 + and voa_buchschl<=900 and voa_buchschl>400 and + ( + (voa_buchschl<600 and voa_buchschl<=500 ) + or + (voa_buchschl>=600) + ); + + -- Beispiel staatl. Adademie Stuttgart Kontostand unten anzeigen +<#if post_processing1?exists> +<#assign inlineTemplate=post_processing1?interpret> +<@inlineTemplate/> + + + +<#if showKontostand="ja"> +drop table tmp_calc; + + + + +<#if customize?exists> +<#assign cust=customize/> +<#if "<>"="'detailliert'"><#assign cust=customize_detailliert/> +select <#foreach f in cust.resulttable> + <#if rbetrag_style="standard"> + <#if f.field?index_of('rbetrag')==-1||"<>"="'4-fest'"||"<>"="'4b-ofest'"||"<>"="'8-offsolle'"||"<>"="'0-alle'"> --Restbetrag nur bei Festlegungen/ausst.Einn. anzeigen + <#if (f.field?index_of('round(betrag')==-1||("<>"!="'4b-ofest'"&&"<>"!="'8-offsolle'"))> +${f.field} <#if f_has_next>, + + + +<#if rbetrag_style="nur_festlegungen"> + <#if f.field?index_of('rbetrag')==-1||"<>"="'4-fest'"||"<>"="'4b-ofest'"> --Restbetrag nur bei Festlegungen + <#if (f.field?index_of('round(betrag')==-1||("<>"!="'4b-ofest'"))> +${f.field} <#if f_has_next>, + + + + + from tmp_erg order by sortkontostandbuch,sort1, buchungsdatum ; +<#else> +select kapitel,dr,dr2, titel, zweckbestimmung_ut, buchungsab_fb, projnr_ins,ins2,ins3, huelnummer,ref_h, buchungskzmbs, buchungsdatum, r_dat, r_nr, + <#if "<>"!="'4b-ofest'"&&"<>"!="'8-offsolle'">round(betrag,2) as betrag, + + <#if "<>"="'4-fest'"||"<>"="'4b-ofest'"||"<>"="'8-offsolle'"||"<>"="'0-alle'">round(rbetrag,2) as rbetrag, + zpartnernummer,z_name,kommentar,ch110_institut, kostentraeger, fikr from tmp_erg order by sortkontostandbuch,sort1, buchungsdatum ; + +--end schlussselect]]> + +<#if .vars["CUSTOM_"+Maskennummer]?exists> +<#assign inlineTemplate=.vars["CUSTOM_"+Maskennummer]?interpret> +<@inlineTemplate/> + +<#if customize?exists> +<#assign cust=customize/> +<#if "<>"="'detailliert'"><#assign cust=customize_detailliert/> +<#foreach f in cust.resulttable> +<#if rbetrag_style="standard"> +<#if f.field?index_of('rbetrag')==-1||"<>"="'4-fest'"||"<>"="'4b-ofest'"||"<>"="'8-offsolle'"||"<>"="'0-alle'"> + <#if (f.field?index_of('round(betrag')==-1||("<>"!="'4b-ofest'"&&"<>"!="'8-offsolle'"))> +Column CID=2 heading_text="${f.caption}" center_heading row_selectable col_selectable heading_platform readonly width=${f.width} + +<#if rbetrag_style="nur_festlegungen"> + <#if f.field?index_of('rbetrag')==-1||"<>"="'4-fest'"||"<>"="'4b-ofest'"> --Restbetrag nur bei Festlegungen + <#if (f.field?index_of('round(betrag')==-1||("<>"!="'4b-ofest'"))> +Column CID=2 heading_text="${f.caption}" center_heading row_selectable col_selectable heading_platform readonly width=${f.width} + + + + +<#else> +Column CID=2 heading_text="Kapitel" center_heading +row_selectable col_selectable heading_platform readonly width=14 +Column CID=2 heading_text="Dr" center_heading +row_selectable col_selectable heading_platform readonly width=10 +Column CID=2 heading_text="Dr2" center_heading +row_selectable col_selectable heading_platform readonly width=10 +Column CID=2 heading_text="Titel" center_heading +row_selectable col_selectable heading_platform readonly width=14 +Column CID=1 heading_text="Untertitel" center_heading +row_selectable col_selectable heading_platform readonly width=8 +Column CID=9 heading_text="FB/Projekt" center_heading +row_selectable col_selectable heading_platform readonly width=10 +Column CID=9 heading_text="Ins./Ausgabeart" center_heading +row_selectable col_selectable heading_platform readonly width=10 +Column CID=9 heading_text="Ins3" center_heading +row_selectable col_selectable heading_platform readonly width=10 +Column CID=9 heading_text="Ins4" center_heading +row_selectable col_selectable heading_platform readonly width=10 +Column CID=4 heading_text="HülNr." center_heading +row_selectable col_selectable heading_platform readonly width=8 +Column CID=4 heading_text="Ref-HülNr." center_heading +row_selectable col_selectable heading_platform readonly width=8 +Column CID=6 heading_text="BuchArt" center_heading +row_selectable col_selectable heading_platform readonly width=7 +Column CID=2 heading_text="BuDat" center_heading +row_selectable col_selectable heading_platform readonly width=14 +Column CID=2 heading_text="RechDat" center_heading +row_selectable col_selectable heading_platform readonly width=14 +Column CID=2 heading_text="RechNr" center_heading +row_selectable col_selectable heading_platform readonly width=14 + <#if "<>"!="'4b-ofest'"&&"<>"!="'8-offsolle'"> +Column CID=7 heading_text="Betrag" center_heading +row_selectable col_selectable rightJust heading_platform readonly width=15 + +<#if "<>"="'4-fest'"||"<>"="'4b-ofest'"||"<>"="'8-offsolle'"||"<>"="'0-alle'"> +Column CID=7 heading_text="Rest-Betrag" center_heading +row_selectable col_selectable rightJust heading_platform readonly width=15 + +Column CID=9 heading_text="ZpNr" center_heading +row_selectable col_selectable heading_platform readonly width=10 +Column CID=9 heading_text="Zpname" center_heading +row_selectable col_selectable heading_platform readonly width=30 +Column CID=9 heading_text="Kommentar" center_heading +row_selectable col_selectable heading_platform readonly width=20 +Column CID=9 heading_text="KoStelle" center_heading +row_selectable col_selectable heading_platform readonly width=12 +Column CID=9 heading_text="Kostenträger" center_heading +row_selectable col_selectable heading_platform readonly width=15 +Column CID=9 heading_text="KoArt" center_heading +row_selectable col_selectable heading_platform readonly width=12 + +@@@]]> + +> +--freemarker template +select 'Achtung Demodaten' from xdummy where 1=0 <#if Username?starts_with("demo")> or 1=1]]> + + +> select distinct kapitel,ktobez from fin_kapitel where jahr=<> order by ktobez]]> +> +--freemarker template +select distinct titel,ktobez from fin_titel where jahr=<> /* and kapitel in (<>) */ +<#if "<>"="'no_dr'"> +and (dr='' or dr is null) +<#else> +/* and (dr in (<>) */ +/* or dr2 in (<>)) */ + + order by ktobez]]> +>select tid,type,name,sortnr from sichten where art ='Geldgeber-Sicht (FIN)' and aktiv=1 order by sortnr,type,name;]]> +> select tid,type,name,sortnr from sichten where art='FIN-Kostenstellen-Sicht' and aktiv=1 order by sortnr,type,name]]> +> +--Freemarker Template +<#include "SQL_lingua_franca"/> +select distinct projnr_ins,trim(projnr_ins)||'-'||max(ktobez) from fin_projnr_ins where jahr=<> +/* and kapitel in (<>) */ +<#if "<>"="'no_dr'"> +and (dr='' or dr is null) +<#else> +/* and (dr in (<>) */ +/* or dr2 in (<>)) */ + + /* and buchungsab_fb in (<>) */ +and ${SxFinRechte("K2","31.12.<>","","","","","")} +group by 1 order by 1;]]> + +> +--freemarker template +select distinct buchungsab_fb,trim(buchungsab_fb)||'-'||max(ktobez) from fin_buchab_fb where jahr=<> +/* and kapitel in (<>) */ +<#if "<>"="'no_dr'"> +and (dr='' or dr is null) +<#else> +/* and (dr in (<>) */ +/* or dr2 in (<>)) */ + +and ${SxFinRechte("K1","31.12.<>","","","","")} +group by 1 order by 1]]> + + +> +--Freemarker Template +select ins2,trim(ins2)||'-'||max(ktobez) from fin_ins2 where + ${SxFinRechte("K3","31.12.<>","","","","","")} +/* and jahr=<> */ +/* and kapitel in (<>) */ +<#if "<>"="'no_dr'"> +and (dr='' or dr is null) +<#else> +/* and (dr in (<>) */ +/* or dr2 in (<>)) */ + + /* and buchungsab_fb in (<>) */ +/* and projnr_ins in (<>) */ +group by 1 order by 1;]]> +> SELECT distinct ord,name FROM aggregierung where kategorie='FIN-Jahr' and ord>=2020 order by 1 DESC;]]> +> select '0-alle', 'Alle Buchungen' from xdummy union select '1-ist', 'Ist' from xdummy union select '1b-ist_hhans_reste', 'Ist+Haushaltsansatz+Reste' from xdummy union select '2-stornos', 'Stornos' from xdummy union select '3-soll', 'Soll' from xdummy union select '3b-aks', 'Aktuelles Soll (Ansatz)' from xdummy union select '3c-sonstzuweis', 'Sonst.Zuweisungen' from xdummy union select '4-fest', 'Festlegungen' from xdummy union select '4b-ofest', 'offene Festleg.' from xdummy union select '5-anord', 'Annahmeanordnungen' from xdummy union select '6-aus','Ausgaben' from xdummy union select '7-ein','Einnahmen' from xdummy union select '8-offsolle','Ausstehende Einnamen (OP)' from xdummy union select '9-hhans','Haushaltsansatz' from xdummy union select '9b-hhans-reste','Haushaltsansatz und Reste' from xdummy union select '10-reste', 'Reste' from xdummy order by 2;]]> + + + +> select distinct dr,ktobez from fin_dr where jahr=<> + /* and kapitel in (<>) */ +union select 'no_dr','Keine Titelgruppe' from xdummy +order by ktobez]]> + +> select '1-bdat', 'Buchungsdatum' from xdummy union + select '1-bdatASC', 'Buchungsdatum absteigend' from xdummy union select '2-rdat', 'Rechnungsdatum' from xdummy union select '3-rnr', 'Rechnungsnummer' from xdummy union select '4-zpnr', 'Zahlungspartner' from xdummy union select '5-vwz', 'Verwendungszweck' from xdummy union select '6-huel', 'HÜL-Nummer' from xdummy union select '7-betrag_auf', 'Betrag aufsteigend' from xdummy union select '8-betrag_ab', 'Betrag absteigend' from xdummy union select '9-dat_tit', 'Buchungsdatum,Titel' from xdummy order by 1;]]> +> select tid,type,name,sortnr from sichten where art='FIN-Kostenträger-Sicht' and aktiv=1 order by sortnr,type,name]]> +> select buchungskzmbs, buchungskzmbs from fin_buchkzmbs;]]> +> +--Freemarker Template +select ins3,trim(ins3)||'-'||max(ktobez) from fin_ins3 + where + ${SxFinRechte("K4","31.12.<>","","","","","")} +/* and jahr=<> */ +/* and kapitel=<> */ +<#if "<>"="'no_dr'"> +and (dr='' or dr is null) +<#else> +/* and (dr in (<>) */ +/* or dr2 in (<>)) */ + +/* and titel in (<>) */ +/* and zweckbestimmung_ut in (<>) */ +/* and buchungsab_fb in (<>) */ + /* and projnr_ins in (<>) */ + /* and ins2 in (<>) */ +group by 1 order by 1]]> +> select id,caption from sx_repository where art='FIN_FINANZIERUNGSQUELLE' and aktiv=1 and gueltig_seit<=date_val('1.1.<>') and gueltig_bis>=date_val('31.12.<>')]]> +> select id,caption from sx_repository where +art like 'FIN_KOSTENART%' and gueltig_seit<=date_val('1.1.<>') and gueltig_bis>=('1.1.<>') order by sort1]]> +> select tid,type,name,sortnr from sichten where art='FIN-Kosten-/Erlösarten-Sicht' and aktiv=1 order by sortnr,type,name]]> +> +--freemarker template +select distinct zweckbestimmung_ut,ktobez from fin_zweck_ut where 1=1 /* and jahr=<> */ /* and kapitel=<> */ +<#if "<>"="'no_dr'"> +and (dr='' or dr is null) +<#else> +/* and (dr in (<>) */ +/* or dr2 in (<>)) */ + + /* and titel=<> */ order by ktobez]]> +> +<#assign template = FIN_DRITTMITTELPROJEKTE?interpret> +<@template/> +--erwartet drittmittelstartjahr und drittmittelprojektebedingung +select distinct buchungsab_fb,trim(buchungsab_fb)||'-'||max(ktobez) from fin_buchab_fb where jahr=<> +/* and kapitel in (<>) */ +<#if "<>"="'no_dr'"> +and (dr='' or dr is null) +<#else> +/* and (dr in (<>) */ +/* or dr2 in (<>)) */ + + /* and titel in (<>) */ +/* and zweckbestimmung_ut in (<>) */ +and ${SxFinRechte("K1","31.12.<>","","","","")} +and not (${drittmittelprojektebedingung}) +group by 1 +union +select distinct projnr_ins,trim(projnr_ins)||'-'||max(ktobez) from fin_projnr_ins where jahr=<> +/* and kapitel in (<>) */ +/* and (dr in (<>) */ +/* or dr2 in (<>)) */ + /* and titel in (<>) */ +/* and zweckbestimmung_ut in (<>) */ + +and ${SxFinRechte("K2","31.12.<>","","","","","")} +and not (${drittmittelprojektebedingung}) +group by 1 order by 1;]]> +> select 'kompakt','kompakt' from xdummy union select 'detailliert','detailliert' from xdummy]]> +> select val(substring(wert from 7 for 2)),name,ord from aggregierung +where kategorie='ZeitraumMonat' +and wert like 'monat=%' +order by 3]]> +