flat view

This commit is contained in:
2021-01-22 14:46:49 +01:00
parent 19ca0482df
commit f0445d7fd9

View File

@ -91,4 +91,38 @@ end;
delimiter ;
alter table objekt modify column flaeche decimal(20, 2) not null;
alter table wohnung modify column flaeche decimal(20, 2) not null;
alter table betriebskosten_abrechnung modify column betrag decimal(20, 2) not null;
create or replace view jahresabrechnung_flat_v as
select o.shortname as objekt,
o.flaeche as gesamt_flaeche,
w.shortname as wohnung,
w.flaeche as flaeche,
m.anrede as anrede,
m.vorname as vorname,
m.nachname as nachname,
m.strasse as strasse,
m.plz as plz,
m.ort as ort,
j.nutzungszeit as nutzungszeit,
j.anteil_pro_flaeche as anteil_pro_flaeche,
j.anteil_pro_flaeche_nutzungszeit as anteil_pro_flaeche_nutzungszeit,
j.summe_zahlungen as summe_zahlungen,
j.summe_zahlungen_anteil_miete as summe_zahlungen_anteil_miete,
j.vorauszahlung as vorauszahlung,
j.nachzahlung as nachzahlung,
b.jahr as jahr,
b.betrag as gesamt_betriebskosten
from objekt o,
wohnung w,
mieter m,
jahresabrechnung_summary j,
betriebskosten_abrechnung b
where j.abrechnung = b.id and
j.mieter = m.id and
m.wohnung = w.id and
w.objekt = o.id;