jahresabrechnung
This commit is contained in:
@ -45,10 +45,15 @@ alter table miete drop constraint uk_miete_wohnung_gueltig_bis;
|
||||
alter table miete modify column gueltig_bis date null;
|
||||
alter table wohnung add column wohnungsnummer integer;
|
||||
alter table wohnung add constraint unique key uk_wohnung_objekt_wohnungsnummer (objekt, wohnungsnummer);
|
||||
update wohnung set wohnungsnummer = id + 100;
|
||||
alter table wohnung modify column wohnungsnummer integer not null;
|
||||
alter table betriebskosten_vorauszahlung drop constraint uk_betriebskosten_vorauszahlung_objekt_gueltig_bis;
|
||||
alter table betriebskosten_vorauszahlung modify gueltig_bis date null;
|
||||
alter table forderung modify column betrag decimal(20, 2) not null;
|
||||
alter table forderung add column anteil_miete decimal(20, 2);
|
||||
alter table forderung add column anteil_betriebskosten_vorauszahlung decimal(20, 2);
|
||||
alter table forderung add column anteil_betriebskosten_nachzahlung decimal(20, 2);
|
||||
alter table forderung add constraint ck_summe_anteile check (anteil_miete + anteil_betriebskosten_vorauszahlung + anteil_betriebskosten_nachzahlung = betrag);
|
||||
alter table zahlung modify column betrag decimal(20, 2) not null;
|
||||
|
||||
create or replace procedure insert_monatl_miet_forderung(in p_date date)
|
||||
@ -102,8 +107,8 @@ create or replace procedure insert_monatl_miet_forderung(in p_date date)
|
||||
set lc_time_names = 'de_DE';
|
||||
set v_kommentar = concat('Miete ', monthname(v_date), ' ', year(v_date));
|
||||
|
||||
insert into forderung (mieter, datum, betrag, kommentar, ref_wohnung)
|
||||
values(rec.id, v_date, v_forderung, v_kommentar, rec.wohnung);
|
||||
insert into forderung (mieter, datum, betrag, anteil_miete, anteil_betriebskosten_vorauszahlung, kommentar, ref_wohnung)
|
||||
values(rec.id, v_date, v_forderung, v_miete, v_betriebskosten_vorauszahlung, v_kommentar, rec.wohnung);
|
||||
|
||||
call log(concat('Mieter: ', cast(rec.id as char),
|
||||
', Wohnung: ',
|
||||
@ -130,3 +135,4 @@ end;
|
||||
|
||||
|
||||
|
||||
delimiter ;
|
Reference in New Issue
Block a user