This commit is contained in:
2022-03-31 15:31:53 +02:00
24 changed files with 511 additions and 274 deletions

View File

@ -0,0 +1,17 @@
create or replace view account_statement_v as
select ae.id as id,
ae.description as description,
ae.created_at::timestamp::date as created_at,
ae.amount as amount,
ae.document_no as document_no,
ae.fiscal_year as fiscal_year,
aec.description as category,
aec.income as income,
ac.description as account
from account_entry_t ae,
account_entry_category_t aec,
account_t ac
where ae.account_entry_category = aec.id and
ae.account = ac.id and
aec.id not in (3, 4)
order by created_at;

View File

@ -39,6 +39,7 @@ CREATE TABLE premise_t (
,street varchar(128) not null
,zip varchar(10) not null
,city varchar(128) not null
,minus_area numeric(10,2) not null default 0
,account integer not null references account_t (id) unique
);
@ -139,7 +140,8 @@ GRANT SELECT, UPDATE ON tenancy_fee_mapping_t_id_seq TO hv2;
CREATE TABLE account_entry_category_t (
id serial not null primary key
,description varchar(128) not null unique
,overhead_relevant boolean not null default true
,considerMinusArea boolean not null default True
,overhead_relevant boolean not null default True
);
GRANT SELECT, INSERT ON account_entry_category_t TO hv2;
@ -150,7 +152,7 @@ CREATE TABLE account_entry_t (
,description varchar(1024) not null
,account integer not null references account_t (id)
,created_at timestamp not null default now()
,due_at timestamp
,fiscal_year integer not null
,amount numeric(10,2) not null
,document_no integer unique
,account_entry_category integer not null references account_entry_category_t (id)