Compare commits
49 Commits
overhead_a
...
master
Author | SHA1 | Date | |
---|---|---|---|
07dff73152 | |||
10b7f89831 | |||
69005569aa | |||
0e6ee3b2c5 | |||
3a56c4fa0f | |||
b79ef11401 | |||
18cd0eeebc | |||
06e8a2f4bf | |||
b1b81eeb07 | |||
fcd2633c72 | |||
f7eca3844d | |||
9a1e3231d6 | |||
0075416fc3 | |||
47e96c10b1 | |||
3e32613a78 | |||
74d0a6084b | |||
ac1636c162 | |||
d0771be1d1 | |||
452b4f69bd | |||
4553272c42 | |||
0d4e33505e | |||
2be6a6e140 | |||
4391cc1d8b | |||
b346cc07d0 | |||
169795c16e | |||
25f6de1c11 | |||
1c6fe0dd16 | |||
2a0bda012b | |||
5ca2f16757 | |||
292886f834 | |||
3debcf6c2d | |||
af7b388118 | |||
b561ec8a48 | |||
9cb599e2a6 | |||
d7c713404d | |||
7d8755aab9 | |||
f2f2100b8c | |||
b3a49b0fb6 | |||
e1ebfe254a | |||
b748ba7a77 | |||
ab365c65a1 | |||
0e4fd12238 | |||
cb632e9e8e | |||
2fc7922707 | |||
422a8d37ab | |||
006b488c63 | |||
1d36d99462 | |||
![]() |
05fb3c1677 | ||
cbc96036d9 |
12
.gitignore
vendored
12
.gitignore
vendored
@ -3,4 +3,14 @@ ENV
|
|||||||
api/config/dbconfig.ini
|
api/config/dbconfig.ini
|
||||||
api/config/authservice.pub
|
api/config/authservice.pub
|
||||||
cli/config/dbconfig.ini
|
cli/config/dbconfig.ini
|
||||||
|
cli/output/
|
||||||
|
*~
|
||||||
|
.*~
|
||||||
|
.vscode/
|
||||||
|
cli/*.tex
|
||||||
|
cli/*.log
|
||||||
|
cli/*.pdf
|
||||||
|
cli/*.aux
|
||||||
|
.DS_Store
|
||||||
|
.Rproj.user
|
||||||
|
.venv
|
||||||
|
@ -11,19 +11,6 @@ ARG CONF_DIR="${APP_DIR}/config"
|
|||||||
RUN \
|
RUN \
|
||||||
apt update && \
|
apt update && \
|
||||||
apt install -y postgresql-client-common && \
|
apt install -y postgresql-client-common && \
|
||||||
pip3 install psycopg2 && \
|
|
||||||
pip3 install dateparser && \
|
|
||||||
pip3 install connexion && \
|
|
||||||
pip3 install connexion[swagger-ui] && \
|
|
||||||
pip3 install uwsgi && \
|
|
||||||
pip3 install flask-cors && \
|
|
||||||
pip3 install python-jose[cryptography] && \
|
|
||||||
pip3 install loguru && \
|
|
||||||
pip3 install Cheetah3
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RUN \
|
|
||||||
mkdir -p ${APP_DIR} && \
|
mkdir -p ${APP_DIR} && \
|
||||||
mkdir -p ${CONF_DIR} && \
|
mkdir -p ${CONF_DIR} && \
|
||||||
useradd -d ${APP_DIR} -u 1000 user
|
useradd -d ${APP_DIR} -u 1000 user
|
||||||
@ -31,11 +18,15 @@ RUN \
|
|||||||
COPY *.py ${APP_DIR}/
|
COPY *.py ${APP_DIR}/
|
||||||
COPY openapi.yaml ${APP_DIR}/
|
COPY openapi.yaml ${APP_DIR}/
|
||||||
COPY methods.py ${APP_DIR}/
|
COPY methods.py ${APP_DIR}/
|
||||||
|
COPY requirements.txt ${APP_DIR}/
|
||||||
COPY server.ini ${CONF_DIR}/
|
COPY server.ini ${CONF_DIR}/
|
||||||
|
|
||||||
WORKDIR ${APP_DIR}
|
WORKDIR ${APP_DIR}
|
||||||
VOLUME ${CONF_DIR}
|
VOLUME ${CONF_DIR}
|
||||||
|
|
||||||
|
RUN \
|
||||||
|
pip3 install -r requirements.txt
|
||||||
|
|
||||||
USER 1000:1000
|
USER 1000:1000
|
||||||
|
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
|
176
api/methods.py
176
api/methods.py
@ -269,6 +269,9 @@ SELECT
|
|||||||
,account
|
,account
|
||||||
FROM tenant_t
|
FROM tenant_t
|
||||||
WHERE account = %s
|
WHERE account = %s
|
||||||
|
ORDER BY
|
||||||
|
lastname
|
||||||
|
,firstname
|
||||||
""",
|
""",
|
||||||
"params": (accountId, )
|
"params": (accountId, )
|
||||||
}
|
}
|
||||||
@ -283,6 +286,7 @@ SELECT
|
|||||||
,street
|
,street
|
||||||
,zip
|
,zip
|
||||||
,city
|
,city
|
||||||
|
,minus_area
|
||||||
,account
|
,account
|
||||||
FROM premise_t
|
FROM premise_t
|
||||||
ORDER BY
|
ORDER BY
|
||||||
@ -299,6 +303,7 @@ def insert_premise(user, token_info, **args):
|
|||||||
v_street = body["street"]
|
v_street = body["street"]
|
||||||
v_zip = body["zip"]
|
v_zip = body["zip"]
|
||||||
v_city = body["city"]
|
v_city = body["city"]
|
||||||
|
v_minus_area = body["minus_area"]
|
||||||
v_account = body["account"]
|
v_account = body["account"]
|
||||||
return dbInsert(user, token_info, {
|
return dbInsert(user, token_info, {
|
||||||
"statement": """
|
"statement": """
|
||||||
@ -308,6 +313,7 @@ INSERT INTO premise_t
|
|||||||
,street
|
,street
|
||||||
,zip
|
,zip
|
||||||
,city
|
,city
|
||||||
|
,minus_area
|
||||||
,account
|
,account
|
||||||
) VALUES (
|
) VALUES (
|
||||||
%s
|
%s
|
||||||
@ -315,6 +321,7 @@ INSERT INTO premise_t
|
|||||||
,%s
|
,%s
|
||||||
,%s
|
,%s
|
||||||
,%s
|
,%s
|
||||||
|
,%s
|
||||||
)
|
)
|
||||||
RETURNING *
|
RETURNING *
|
||||||
""",
|
""",
|
||||||
@ -323,6 +330,7 @@ INSERT INTO premise_t
|
|||||||
,v_street
|
,v_street
|
||||||
,v_zip
|
,v_zip
|
||||||
,v_city
|
,v_city
|
||||||
|
,v_minus_area
|
||||||
,v_account
|
,v_account
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
@ -340,6 +348,7 @@ SELECT
|
|||||||
,street
|
,street
|
||||||
,zip
|
,zip
|
||||||
,city
|
,city
|
||||||
|
,minus_area
|
||||||
,account
|
,account
|
||||||
FROM premise_t
|
FROM premise_t
|
||||||
WHERE id = %s
|
WHERE id = %s
|
||||||
@ -355,6 +364,7 @@ def update_premise(user, token_info, premiseId=None, **args):
|
|||||||
v_street = body["street"]
|
v_street = body["street"]
|
||||||
v_zip = body["zip"]
|
v_zip = body["zip"]
|
||||||
v_city = body["city"]
|
v_city = body["city"]
|
||||||
|
v_minus_area = body["minus_area"]
|
||||||
return dbUpdate(user, token_info, {
|
return dbUpdate(user, token_info, {
|
||||||
"statement": """
|
"statement": """
|
||||||
UPDATE premise_t
|
UPDATE premise_t
|
||||||
@ -363,6 +373,7 @@ UPDATE premise_t
|
|||||||
,street = %s
|
,street = %s
|
||||||
,zip = %s
|
,zip = %s
|
||||||
,city = %s
|
,city = %s
|
||||||
|
,minus_area = %s
|
||||||
WHERE id = %s
|
WHERE id = %s
|
||||||
RETURNING *
|
RETURNING *
|
||||||
""",
|
""",
|
||||||
@ -371,6 +382,7 @@ UPDATE premise_t
|
|||||||
v_street,
|
v_street,
|
||||||
v_zip,
|
v_zip,
|
||||||
v_city,
|
v_city,
|
||||||
|
v_minus_area,
|
||||||
premiseId
|
premiseId
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
@ -388,9 +400,12 @@ SELECT
|
|||||||
,street
|
,street
|
||||||
,zip
|
,zip
|
||||||
,city
|
,city
|
||||||
|
,minus_area
|
||||||
,account
|
,account
|
||||||
FROM premise_t
|
FROM premise_t
|
||||||
WHERE account = %s
|
WHERE account = %s
|
||||||
|
ORDER BY
|
||||||
|
description
|
||||||
""",
|
""",
|
||||||
"params": (accountId, )
|
"params": (accountId, )
|
||||||
}
|
}
|
||||||
@ -507,6 +522,9 @@ SELECT
|
|||||||
,flat_no
|
,flat_no
|
||||||
FROM flat_t
|
FROM flat_t
|
||||||
WHERE premise = %s
|
WHERE premise = %s
|
||||||
|
ORDER BY
|
||||||
|
premise
|
||||||
|
,description
|
||||||
""",
|
""",
|
||||||
"params": (premiseId, )
|
"params": (premiseId, )
|
||||||
}
|
}
|
||||||
@ -674,6 +692,9 @@ SELECT
|
|||||||
,flat
|
,flat
|
||||||
FROM overhead_advance_flat_mapping_t
|
FROM overhead_advance_flat_mapping_t
|
||||||
WHERE overhead_advance = %s
|
WHERE overhead_advance = %s
|
||||||
|
ORDER BY
|
||||||
|
overhead_advance
|
||||||
|
,flat
|
||||||
""",
|
""",
|
||||||
"params": (overhead_advanceId, )
|
"params": (overhead_advanceId, )
|
||||||
}
|
}
|
||||||
@ -688,6 +709,9 @@ SELECT
|
|||||||
,flat
|
,flat
|
||||||
FROM overhead_advance_flat_mapping_t
|
FROM overhead_advance_flat_mapping_t
|
||||||
WHERE flat = %s
|
WHERE flat = %s
|
||||||
|
ORDER BY
|
||||||
|
overhead_advance
|
||||||
|
,flat
|
||||||
""",
|
""",
|
||||||
"params": (flatId, )
|
"params": (flatId, )
|
||||||
}
|
}
|
||||||
@ -784,6 +808,9 @@ SELECT
|
|||||||
,premise
|
,premise
|
||||||
FROM parking_t
|
FROM parking_t
|
||||||
WHERE premise = %s
|
WHERE premise = %s
|
||||||
|
ORDER BY
|
||||||
|
premise
|
||||||
|
,description
|
||||||
""",
|
""",
|
||||||
"params": (premiseId, )
|
"params": (premiseId, )
|
||||||
}
|
}
|
||||||
@ -796,6 +823,7 @@ SELECT
|
|||||||
id
|
id
|
||||||
,description
|
,description
|
||||||
,premise
|
,premise
|
||||||
|
,area
|
||||||
FROM commercial_premise_t
|
FROM commercial_premise_t
|
||||||
ORDER BY
|
ORDER BY
|
||||||
premise
|
premise
|
||||||
@ -810,21 +838,25 @@ def insert_commercial_premise(user, token_info, **args):
|
|||||||
body = args["body"]
|
body = args["body"]
|
||||||
v_description = body["description"]
|
v_description = body["description"]
|
||||||
v_premise = body["premise"]
|
v_premise = body["premise"]
|
||||||
|
v_area = body["area"]
|
||||||
return dbInsert(user, token_info, {
|
return dbInsert(user, token_info, {
|
||||||
"statement": """
|
"statement": """
|
||||||
INSERT INTO commercial_premise_t
|
INSERT INTO commercial_premise_t
|
||||||
(
|
(
|
||||||
description
|
description
|
||||||
,premise
|
,premise
|
||||||
|
,area
|
||||||
) VALUES (
|
) VALUES (
|
||||||
%s
|
%s
|
||||||
,%s
|
,%s
|
||||||
|
,%s
|
||||||
)
|
)
|
||||||
RETURNING *
|
RETURNING *
|
||||||
""",
|
""",
|
||||||
"params": [
|
"params": [
|
||||||
v_description
|
v_description
|
||||||
,v_premise
|
,v_premise
|
||||||
|
,v_area
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
@ -839,6 +871,7 @@ SELECT
|
|||||||
id
|
id
|
||||||
,description
|
,description
|
||||||
,premise
|
,premise
|
||||||
|
,area
|
||||||
FROM commercial_premise_t
|
FROM commercial_premise_t
|
||||||
WHERE id = %s
|
WHERE id = %s
|
||||||
""",
|
""",
|
||||||
@ -851,18 +884,21 @@ def update_commercial_premise(user, token_info, commercial_premiseId=None, **arg
|
|||||||
body = args["body"]
|
body = args["body"]
|
||||||
v_description = body["description"]
|
v_description = body["description"]
|
||||||
v_premise = body["premise"]
|
v_premise = body["premise"]
|
||||||
|
v_area = body["area"]
|
||||||
return dbUpdate(user, token_info, {
|
return dbUpdate(user, token_info, {
|
||||||
"statement": """
|
"statement": """
|
||||||
UPDATE commercial_premise_t
|
UPDATE commercial_premise_t
|
||||||
SET
|
SET
|
||||||
description = %s
|
description = %s
|
||||||
,premise = %s
|
,premise = %s
|
||||||
|
,area = %s
|
||||||
WHERE id = %s
|
WHERE id = %s
|
||||||
RETURNING *
|
RETURNING *
|
||||||
""",
|
""",
|
||||||
"params": [
|
"params": [
|
||||||
v_description,
|
v_description,
|
||||||
v_premise,
|
v_premise,
|
||||||
|
v_area,
|
||||||
commercial_premiseId
|
commercial_premiseId
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
@ -878,8 +914,12 @@ SELECT
|
|||||||
id
|
id
|
||||||
,description
|
,description
|
||||||
,premise
|
,premise
|
||||||
|
,area
|
||||||
FROM commercial_premise_t
|
FROM commercial_premise_t
|
||||||
WHERE premise = %s
|
WHERE premise = %s
|
||||||
|
ORDER BY
|
||||||
|
premise
|
||||||
|
,description
|
||||||
""",
|
""",
|
||||||
"params": (premiseId, )
|
"params": (premiseId, )
|
||||||
}
|
}
|
||||||
@ -1011,6 +1051,9 @@ SELECT
|
|||||||
,enddate
|
,enddate
|
||||||
FROM tenancy_t
|
FROM tenancy_t
|
||||||
WHERE tenant = %s
|
WHERE tenant = %s
|
||||||
|
ORDER BY
|
||||||
|
description
|
||||||
|
,startdate
|
||||||
""",
|
""",
|
||||||
"params": (tenantId, )
|
"params": (tenantId, )
|
||||||
}
|
}
|
||||||
@ -1030,6 +1073,9 @@ SELECT
|
|||||||
,enddate
|
,enddate
|
||||||
FROM tenancy_t
|
FROM tenancy_t
|
||||||
WHERE flat = %s
|
WHERE flat = %s
|
||||||
|
ORDER BY
|
||||||
|
description
|
||||||
|
,startdate
|
||||||
""",
|
""",
|
||||||
"params": (flatId, )
|
"params": (flatId, )
|
||||||
}
|
}
|
||||||
@ -1049,6 +1095,9 @@ SELECT
|
|||||||
,enddate
|
,enddate
|
||||||
FROM tenancy_t
|
FROM tenancy_t
|
||||||
WHERE parking = %s
|
WHERE parking = %s
|
||||||
|
ORDER BY
|
||||||
|
description
|
||||||
|
,startdate
|
||||||
""",
|
""",
|
||||||
"params": (parkingId, )
|
"params": (parkingId, )
|
||||||
}
|
}
|
||||||
@ -1068,6 +1117,9 @@ SELECT
|
|||||||
,enddate
|
,enddate
|
||||||
FROM tenancy_t
|
FROM tenancy_t
|
||||||
WHERE commercial_premise = %s
|
WHERE commercial_premise = %s
|
||||||
|
ORDER BY
|
||||||
|
description
|
||||||
|
,startdate
|
||||||
""",
|
""",
|
||||||
"params": (commercial_premiseId, )
|
"params": (commercial_premiseId, )
|
||||||
}
|
}
|
||||||
@ -1263,6 +1315,7 @@ def get_account_entry_categorys(user, token_info):
|
|||||||
SELECT
|
SELECT
|
||||||
id
|
id
|
||||||
,description
|
,description
|
||||||
|
,considerMinusArea
|
||||||
,overhead_relevant
|
,overhead_relevant
|
||||||
FROM account_entry_category_t
|
FROM account_entry_category_t
|
||||||
ORDER BY
|
ORDER BY
|
||||||
@ -1276,21 +1329,25 @@ def insert_account_entry_category(user, token_info, **args):
|
|||||||
try:
|
try:
|
||||||
body = args["body"]
|
body = args["body"]
|
||||||
v_description = body["description"]
|
v_description = body["description"]
|
||||||
|
v_considerMinusArea = body["considerMinusArea"]
|
||||||
v_overhead_relevant = body["overhead_relevant"]
|
v_overhead_relevant = body["overhead_relevant"]
|
||||||
return dbInsert(user, token_info, {
|
return dbInsert(user, token_info, {
|
||||||
"statement": """
|
"statement": """
|
||||||
INSERT INTO account_entry_category_t
|
INSERT INTO account_entry_category_t
|
||||||
(
|
(
|
||||||
description
|
description
|
||||||
|
,considerMinusArea
|
||||||
,overhead_relevant
|
,overhead_relevant
|
||||||
) VALUES (
|
) VALUES (
|
||||||
%s
|
%s
|
||||||
,%s
|
,%s
|
||||||
|
,%s
|
||||||
)
|
)
|
||||||
RETURNING *
|
RETURNING *
|
||||||
""",
|
""",
|
||||||
"params": [
|
"params": [
|
||||||
v_description
|
v_description
|
||||||
|
,v_considerMinusArea
|
||||||
,v_overhead_relevant
|
,v_overhead_relevant
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
@ -1305,6 +1362,7 @@ def get_account_entry_category(user, token_info, account_entry_categoryId=None):
|
|||||||
SELECT
|
SELECT
|
||||||
id
|
id
|
||||||
,description
|
,description
|
||||||
|
,considerMinusArea
|
||||||
,overhead_relevant
|
,overhead_relevant
|
||||||
FROM account_entry_category_t
|
FROM account_entry_category_t
|
||||||
WHERE id = %s
|
WHERE id = %s
|
||||||
@ -1323,12 +1381,13 @@ SELECT
|
|||||||
,description
|
,description
|
||||||
,account
|
,account
|
||||||
,created_at
|
,created_at
|
||||||
|
,fiscal_year
|
||||||
,amount
|
,amount
|
||||||
,document_no
|
,document_no
|
||||||
,account_entry_category
|
,account_entry_category
|
||||||
FROM account_entry_t
|
FROM account_entry_t
|
||||||
ORDER BY
|
ORDER BY
|
||||||
amount
|
created_at
|
||||||
""",
|
""",
|
||||||
"params": ()
|
"params": ()
|
||||||
}
|
}
|
||||||
@ -1340,6 +1399,7 @@ def insert_account_entry(user, token_info, **args):
|
|||||||
v_description = body["description"]
|
v_description = body["description"]
|
||||||
v_account = body["account"]
|
v_account = body["account"]
|
||||||
v_created_at = body["created_at"]
|
v_created_at = body["created_at"]
|
||||||
|
v_fiscal_year = body["fiscal_year"]
|
||||||
v_amount = body["amount"]
|
v_amount = body["amount"]
|
||||||
v_document_no = body["document_no"]
|
v_document_no = body["document_no"]
|
||||||
v_account_entry_category = body["account_entry_category"]
|
v_account_entry_category = body["account_entry_category"]
|
||||||
@ -1350,6 +1410,7 @@ INSERT INTO account_entry_t
|
|||||||
description
|
description
|
||||||
,account
|
,account
|
||||||
,created_at
|
,created_at
|
||||||
|
,fiscal_year
|
||||||
,amount
|
,amount
|
||||||
,document_no
|
,document_no
|
||||||
,account_entry_category
|
,account_entry_category
|
||||||
@ -1360,6 +1421,7 @@ INSERT INTO account_entry_t
|
|||||||
,%s
|
,%s
|
||||||
,%s
|
,%s
|
||||||
,%s
|
,%s
|
||||||
|
,%s
|
||||||
)
|
)
|
||||||
RETURNING *
|
RETURNING *
|
||||||
""",
|
""",
|
||||||
@ -1367,6 +1429,7 @@ INSERT INTO account_entry_t
|
|||||||
v_description
|
v_description
|
||||||
,v_account
|
,v_account
|
||||||
,v_created_at
|
,v_created_at
|
||||||
|
,v_fiscal_year
|
||||||
,v_amount
|
,v_amount
|
||||||
,v_document_no
|
,v_document_no
|
||||||
,v_account_entry_category
|
,v_account_entry_category
|
||||||
@ -1385,6 +1448,7 @@ SELECT
|
|||||||
,description
|
,description
|
||||||
,account
|
,account
|
||||||
,created_at
|
,created_at
|
||||||
|
,fiscal_year
|
||||||
,amount
|
,amount
|
||||||
,document_no
|
,document_no
|
||||||
,account_entry_category
|
,account_entry_category
|
||||||
@ -1405,11 +1469,14 @@ SELECT
|
|||||||
,description
|
,description
|
||||||
,account
|
,account
|
||||||
,created_at
|
,created_at
|
||||||
|
,fiscal_year
|
||||||
,amount
|
,amount
|
||||||
,document_no
|
,document_no
|
||||||
,account_entry_category
|
,account_entry_category
|
||||||
FROM account_entry_t
|
FROM account_entry_t
|
||||||
WHERE account = %s
|
WHERE account = %s
|
||||||
|
ORDER BY
|
||||||
|
created_at
|
||||||
""",
|
""",
|
||||||
"params": (accountId, )
|
"params": (accountId, )
|
||||||
}
|
}
|
||||||
@ -1423,11 +1490,14 @@ SELECT
|
|||||||
,description
|
,description
|
||||||
,account
|
,account
|
||||||
,created_at
|
,created_at
|
||||||
|
,fiscal_year
|
||||||
,amount
|
,amount
|
||||||
,document_no
|
,document_no
|
||||||
,account_entry_category
|
,account_entry_category
|
||||||
FROM account_entry_t
|
FROM account_entry_t
|
||||||
WHERE account_entry_category = %s
|
WHERE account_entry_category = %s
|
||||||
|
ORDER BY
|
||||||
|
created_at
|
||||||
""",
|
""",
|
||||||
"params": (account_entry_categoryId, )
|
"params": (account_entry_categoryId, )
|
||||||
}
|
}
|
||||||
@ -1442,6 +1512,8 @@ SELECT
|
|||||||
,tenant
|
,tenant
|
||||||
,note
|
,note
|
||||||
FROM note_t
|
FROM note_t
|
||||||
|
ORDER BY
|
||||||
|
created_at
|
||||||
""",
|
""",
|
||||||
"params": ()
|
"params": ()
|
||||||
}
|
}
|
||||||
@ -1505,8 +1577,110 @@ SELECT
|
|||||||
,note
|
,note
|
||||||
FROM note_t
|
FROM note_t
|
||||||
WHERE tenant = %s
|
WHERE tenant = %s
|
||||||
|
ORDER BY
|
||||||
|
created_at
|
||||||
""",
|
""",
|
||||||
"params": (tenantId, )
|
"params": (tenantId, )
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def get_contracts(user, token_info):
|
||||||
|
return dbGetMany(user, token_info, {
|
||||||
|
"statement": """
|
||||||
|
SELECT
|
||||||
|
id
|
||||||
|
,supplier
|
||||||
|
,content
|
||||||
|
,identifier
|
||||||
|
,notes
|
||||||
|
FROM contract_t
|
||||||
|
ORDER BY
|
||||||
|
supplier
|
||||||
|
,content
|
||||||
|
""",
|
||||||
|
"params": ()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
def insert_contract(user, token_info, **args):
|
||||||
|
try:
|
||||||
|
body = args["body"]
|
||||||
|
v_supplier = body["supplier"]
|
||||||
|
v_content = body["content"]
|
||||||
|
v_identifier = body["identifier"]
|
||||||
|
v_notes = body["notes"]
|
||||||
|
return dbInsert(user, token_info, {
|
||||||
|
"statement": """
|
||||||
|
INSERT INTO contract_t
|
||||||
|
(
|
||||||
|
supplier
|
||||||
|
,content
|
||||||
|
,identifier
|
||||||
|
,notes
|
||||||
|
) VALUES (
|
||||||
|
%s
|
||||||
|
,%s
|
||||||
|
,%s
|
||||||
|
,%s
|
||||||
|
)
|
||||||
|
RETURNING *
|
||||||
|
""",
|
||||||
|
"params": [
|
||||||
|
v_supplier
|
||||||
|
,v_content
|
||||||
|
,v_identifier
|
||||||
|
,v_notes
|
||||||
|
]
|
||||||
|
})
|
||||||
|
except KeyError as e:
|
||||||
|
logger.warning("insert_contract: parameter missing: {}".format(e))
|
||||||
|
raise werkzeug.exceptions.UnprocessableEntity("parameter missing: {}".format(e))
|
||||||
|
|
||||||
|
|
||||||
|
def get_contract(user, token_info, contractId=None):
|
||||||
|
return dbGetOne(user, token_info, {
|
||||||
|
"statement": """
|
||||||
|
SELECT
|
||||||
|
id
|
||||||
|
,supplier
|
||||||
|
,content
|
||||||
|
,identifier
|
||||||
|
,notes
|
||||||
|
FROM contract_t
|
||||||
|
WHERE id = %s
|
||||||
|
""",
|
||||||
|
"params": (contractId, )
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
def update_contract(user, token_info, contractId=None, **args):
|
||||||
|
try:
|
||||||
|
body = args["body"]
|
||||||
|
v_supplier = body["supplier"]
|
||||||
|
v_content = body["content"]
|
||||||
|
v_identifier = body["identifier"]
|
||||||
|
v_notes = body["notes"]
|
||||||
|
return dbUpdate(user, token_info, {
|
||||||
|
"statement": """
|
||||||
|
UPDATE contract_t
|
||||||
|
SET
|
||||||
|
supplier = %s
|
||||||
|
,content = %s
|
||||||
|
,identifier = %s
|
||||||
|
,notes = %s
|
||||||
|
WHERE id = %s
|
||||||
|
RETURNING *
|
||||||
|
""",
|
||||||
|
"params": [
|
||||||
|
v_supplier,
|
||||||
|
v_content,
|
||||||
|
v_identifier,
|
||||||
|
v_notes,
|
||||||
|
contractId
|
||||||
|
]
|
||||||
|
})
|
||||||
|
except KeyError as e:
|
||||||
|
logger.warning("update_contract: parameter missing: {}".format(e))
|
||||||
|
raise werkzeug.exceptions.UnprocessableEntity("parameter missing: {}".format(e))
|
||||||
|
|
||||||
|
|
||||||
|
@ -129,6 +129,14 @@ SELECT
|
|||||||
#end for
|
#end for
|
||||||
FROM ${table.name}_t
|
FROM ${table.name}_t
|
||||||
WHERE ${column.name} = %s
|
WHERE ${column.name} = %s
|
||||||
|
#if $table.selectors
|
||||||
|
ORDER BY
|
||||||
|
#set $sep = ""
|
||||||
|
#for $selector in $table.selectors
|
||||||
|
$sep$selector
|
||||||
|
#set $sep = ","
|
||||||
|
#end for
|
||||||
|
#end if
|
||||||
""",
|
""",
|
||||||
"params": (${column.name}Id, )
|
"params": (${column.name}Id, )
|
||||||
}
|
}
|
||||||
|
110
api/openapi.yaml
110
api/openapi.yaml
@ -1440,6 +1440,92 @@ paths:
|
|||||||
$ref: '#/components/schemas/note'
|
$ref: '#/components/schemas/note'
|
||||||
security:
|
security:
|
||||||
- jwt: ['secret']
|
- jwt: ['secret']
|
||||||
|
/v1/contracts:
|
||||||
|
get:
|
||||||
|
tags: [ "contract" ]
|
||||||
|
summary: Return all normalized contracts
|
||||||
|
operationId: methods.get_contracts
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: contracts response
|
||||||
|
content:
|
||||||
|
'application/json':
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/contract'
|
||||||
|
security:
|
||||||
|
- jwt: ['secret']
|
||||||
|
post:
|
||||||
|
tags: [ "contract" ]
|
||||||
|
summary: Insert a contract
|
||||||
|
operationId: methods.insert_contract
|
||||||
|
requestBody:
|
||||||
|
description: contract
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/contract'
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: contract successfully inserted
|
||||||
|
content:
|
||||||
|
'application/json':
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/contract'
|
||||||
|
security:
|
||||||
|
- jwt: ['secret']
|
||||||
|
/v1/contracts/{contractId}:
|
||||||
|
get:
|
||||||
|
tags: [ "contract" ]
|
||||||
|
summary: Return the normalized contract with given id
|
||||||
|
operationId: methods.get_contract
|
||||||
|
parameters:
|
||||||
|
- name: contractId
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: contract response
|
||||||
|
content:
|
||||||
|
'application/json':
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/contract'
|
||||||
|
security:
|
||||||
|
- jwt: ['secret']
|
||||||
|
put:
|
||||||
|
tags: [ "contract" ]
|
||||||
|
summary: Update a contract
|
||||||
|
operationId: methods.update_contract
|
||||||
|
parameters:
|
||||||
|
- name: contractId
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
requestBody:
|
||||||
|
description: contract
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/contract'
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: contract successfully inserted
|
||||||
|
content:
|
||||||
|
'application/json':
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/contract'
|
||||||
|
security:
|
||||||
|
- jwt: ['secret']
|
||||||
|
|
||||||
# -------------------------------------------------------------------
|
# -------------------------------------------------------------------
|
||||||
# ATTENTION: This file will not be parsed by Cheetah
|
# ATTENTION: This file will not be parsed by Cheetah
|
||||||
@ -1644,6 +1730,8 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
city:
|
city:
|
||||||
type: string
|
type: string
|
||||||
|
minus_area:
|
||||||
|
type: number
|
||||||
account:
|
account:
|
||||||
type: integer
|
type: integer
|
||||||
flat:
|
flat:
|
||||||
@ -1714,6 +1802,9 @@ components:
|
|||||||
premise:
|
premise:
|
||||||
type: integer
|
type: integer
|
||||||
nullable: true
|
nullable: true
|
||||||
|
area:
|
||||||
|
type: number
|
||||||
|
nullable: true
|
||||||
tenancy:
|
tenancy:
|
||||||
description: tenancy
|
description: tenancy
|
||||||
type: object
|
type: object
|
||||||
@ -1776,6 +1867,8 @@ components:
|
|||||||
type: integer
|
type: integer
|
||||||
description:
|
description:
|
||||||
type: string
|
type: string
|
||||||
|
considerMinusArea:
|
||||||
|
type: boolean
|
||||||
overhead_relevant:
|
overhead_relevant:
|
||||||
type: boolean
|
type: boolean
|
||||||
account_entry:
|
account_entry:
|
||||||
@ -1790,6 +1883,8 @@ components:
|
|||||||
type: integer
|
type: integer
|
||||||
created_at:
|
created_at:
|
||||||
type: string
|
type: string
|
||||||
|
fiscal_year:
|
||||||
|
type: integer
|
||||||
amount:
|
amount:
|
||||||
type: number
|
type: number
|
||||||
document_no:
|
document_no:
|
||||||
@ -1809,6 +1904,21 @@ components:
|
|||||||
type: integer
|
type: integer
|
||||||
note:
|
note:
|
||||||
type: string
|
type: string
|
||||||
|
contract:
|
||||||
|
description: contract
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
supplier:
|
||||||
|
type: string
|
||||||
|
content:
|
||||||
|
type: string
|
||||||
|
identifier:
|
||||||
|
type: string
|
||||||
|
notes:
|
||||||
|
type: string
|
||||||
|
nullable: true
|
||||||
|
|
||||||
# -------------------------------------------------------------------
|
# -------------------------------------------------------------------
|
||||||
# ATTENTION: This file will not be parsed by Cheetah
|
# ATTENTION: This file will not be parsed by Cheetah
|
||||||
|
40
api/requirements.txt
Normal file
40
api/requirements.txt
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
attrs==22.2.0
|
||||||
|
certifi==2022.12.7
|
||||||
|
cffi==1.15.1
|
||||||
|
charset-normalizer==2.1.1
|
||||||
|
Cheetah3==3.2.6.post1
|
||||||
|
click==8.1.3
|
||||||
|
clickclick==20.10.2
|
||||||
|
connexion==2.14.1
|
||||||
|
cryptography==39.0.0
|
||||||
|
dateparser==1.1.5
|
||||||
|
ecdsa==0.18.0
|
||||||
|
Flask==2.2.2
|
||||||
|
Flask-Cors==3.0.10
|
||||||
|
idna==3.4
|
||||||
|
inflection==0.5.1
|
||||||
|
itsdangerous==2.1.2
|
||||||
|
Jinja2==3.1.2
|
||||||
|
jsonschema==4.17.3
|
||||||
|
loguru==0.6.0
|
||||||
|
MarkupSafe==2.1.1
|
||||||
|
packaging==22.0
|
||||||
|
psycopg2==2.9.5
|
||||||
|
pyasn1==0.4.8
|
||||||
|
pycparser==2.21
|
||||||
|
pyrsistent==0.19.3
|
||||||
|
python-dateutil==2.8.2
|
||||||
|
python-jose==3.3.0
|
||||||
|
pytz==2022.7
|
||||||
|
pytz-deprecation-shim==0.1.0.post0
|
||||||
|
PyYAML==6.0
|
||||||
|
regex==2022.10.31
|
||||||
|
requests==2.28.1
|
||||||
|
rsa==4.9
|
||||||
|
six==1.16.0
|
||||||
|
swagger-ui-bundle==0.0.9
|
||||||
|
tzdata==2022.7
|
||||||
|
tzlocal==4.2
|
||||||
|
urllib3==1.26.13
|
||||||
|
uWSGI==2.0.21
|
||||||
|
Werkzeug==2.2.2
|
@ -5,6 +5,6 @@ from flask_cors import CORS
|
|||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
||||||
app = connexion.App('hv2-api')
|
app = connexion.App('hv2-api')
|
||||||
app.add_api('./openapi.yaml')
|
app.add_api('./openapi.yaml', options = {"swagger_ui": True})
|
||||||
CORS(app.app)
|
CORS(app.app)
|
||||||
app.run(port=8080)
|
app.run(port=8080)
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
stages:
|
|
||||||
- check
|
|
||||||
- build
|
|
||||||
- deploy
|
|
||||||
|
|
||||||
variables:
|
|
||||||
IMAGE_NAME: $CI_REGISTRY/$CI_PROJECT_PATH
|
|
||||||
|
|
||||||
check:
|
|
||||||
image: registry.hottis.de/dockerized/base-build-env:latest
|
|
||||||
stage: check
|
|
||||||
tags:
|
|
||||||
- hottis
|
|
||||||
- linux
|
|
||||||
- docker
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_TAG
|
|
||||||
script:
|
|
||||||
- checksemver.py -v
|
|
||||||
--versionToValidate "${CI_COMMIT_TAG}"
|
|
||||||
--validateMessage
|
|
||||||
--messageToValidate "${CI_COMMIT_MESSAGE}"
|
|
||||||
|
|
||||||
build:
|
|
||||||
image: registry.hottis.de/dockerized/docker-bash:latest
|
|
||||||
stage: build
|
|
||||||
tags:
|
|
||||||
- hottis
|
|
||||||
- linux
|
|
||||||
- docker
|
|
||||||
script:
|
|
||||||
- docker build --tag $IMAGE_NAME:latest .
|
|
||||||
- if [ "$CI_COMMIT_TAG" != "" ]; then
|
|
||||||
docker tag $IMAGE_NAME:latest $IMAGE_NAME:${CI_COMMIT_TAG};
|
|
||||||
docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY;
|
|
||||||
docker push $IMAGE_NAME:latest;
|
|
||||||
docker push $IMAGE_NAME:${CI_COMMIT_TAG};
|
|
||||||
fi
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
stage: deploy
|
|
||||||
image: registry.hottis.de/dockerized/docker-bash:latest
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- hottis
|
|
||||||
- linux
|
|
||||||
- docker
|
|
||||||
variables:
|
|
||||||
GIT_STRATEGY: none
|
|
||||||
script:
|
|
||||||
- CONTAINER_NAME=$CI_PROJECT_NAME
|
|
||||||
- SERVICE_VOLUME=$CI_PROJECT_NAME"-conf"
|
|
||||||
- SERVICE_PORT=5000
|
|
||||||
- docker volume inspect $SERVICE_VOLUME || docker volume create $SERVICE_VOLUME
|
|
||||||
- docker stop $CONTAINER_NAME || echo "$CONTAINER_NAME not running, anyway okay"
|
|
||||||
- docker rm $CONTAINER_NAME || echo "$CONTAINER_NAME not exsting, anyway okay"
|
|
||||||
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY;
|
|
||||||
- docker pull $IMAGE_NAME:${CI_COMMIT_TAG}
|
|
||||||
- docker run -d --restart always --name $CONTAINER_NAME --network docker-server --ip 172.16.10.38 -v $SERVICE_VOLUME:/opt/app/config $IMAGE_NAME:${CI_COMMIT_TAG}
|
|
||||||
|
|
88
ci-script-ui
88
ci-script-ui
@ -1,88 +0,0 @@
|
|||||||
stages:
|
|
||||||
- check
|
|
||||||
- build
|
|
||||||
- dockerize
|
|
||||||
- deploy
|
|
||||||
|
|
||||||
variables:
|
|
||||||
IMAGE_NAME: $CI_REGISTRY/$CI_PROJECT_PATH
|
|
||||||
|
|
||||||
check:
|
|
||||||
image: registry.hottis.de/dockerized/base-build-env:latest
|
|
||||||
stage: check
|
|
||||||
tags:
|
|
||||||
- hottis
|
|
||||||
- linux
|
|
||||||
- docker
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_TAG
|
|
||||||
script:
|
|
||||||
- checksemver.py -v
|
|
||||||
--versionToValidate "$CI_COMMIT_TAG"
|
|
||||||
--validateMessage
|
|
||||||
--messageToValidate "$CI_COMMIT_MESSAGE"
|
|
||||||
|
|
||||||
|
|
||||||
build:
|
|
||||||
image: registry.hottis.de/hv2/hv2-node-build-env:1.0.0
|
|
||||||
stage: build
|
|
||||||
variables:
|
|
||||||
GIT_SUBMODULE_STRATEGY: recursive
|
|
||||||
tags:
|
|
||||||
- hottis
|
|
||||||
- linux
|
|
||||||
- docker
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- dist.tgz
|
|
||||||
expire_in: 1 day
|
|
||||||
script:
|
|
||||||
- cd hv2-ui
|
|
||||||
- if [ "$CI_COMMIT_TAG" != "" ]; then
|
|
||||||
sed -i -e 's/GITTAGVERSION/'"$CI_COMMIT_TAG"':'"$CI_COMMIT_SHORT_SHA"'/' ./src/app/navigation/navigation.component.html;
|
|
||||||
fi
|
|
||||||
- npm install
|
|
||||||
- for F in ./src/app/*.tmpl; do
|
|
||||||
python ../helpers/hv2-api/generate.py -s ../helpers/hv2-api/schema.json -t $F;
|
|
||||||
done
|
|
||||||
- ./node_modules/.bin/ng build --prod
|
|
||||||
- tar -czf ../dist.tgz dist
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dockerize:
|
|
||||||
image: registry.hottis.de/dockerized/docker-bash:latest
|
|
||||||
stage: dockerize
|
|
||||||
tags:
|
|
||||||
- hottis
|
|
||||||
- linux
|
|
||||||
- docker
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_TAG
|
|
||||||
script:
|
|
||||||
- tar -xzf dist.tgz
|
|
||||||
- docker build --tag $IMAGE_NAME:latest --tag $IMAGE_NAME:$CI_COMMIT_TAG .
|
|
||||||
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
|
||||||
- docker push $IMAGE_NAME:latest
|
|
||||||
- docker push $IMAGE_NAME:$CI_COMMIT_TAG
|
|
||||||
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
stage: deploy
|
|
||||||
image: registry.hottis.de/dockerized/docker-bash:latest
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- hottis
|
|
||||||
- linux
|
|
||||||
- docker
|
|
||||||
variables:
|
|
||||||
GIT_STRATEGY: none
|
|
||||||
script:
|
|
||||||
- CONTAINER_NAME=$CI_PROJECT_NAME
|
|
||||||
- docker stop $CONTAINER_NAME || echo "$CONTAINER_NAME not running, anyway okay"
|
|
||||||
- docker rm $CONTAINER_NAME || echo "$CONTAINER_NAME not exsting, anyway okay"
|
|
||||||
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY;
|
|
||||||
- docker pull $IMAGE_NAME:${CI_COMMIT_TAG}
|
|
||||||
- docker run -d --restart always --name $CONTAINER_NAME --network docker-server --ip 172.16.10.39 $IMAGE_NAME:${CI_COMMIT_TAG}
|
|
||||||
|
|
108
cli/AccountStatement.py
Normal file
108
cli/AccountStatement.py
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
from db import dbGetMany, dbGetOne
|
||||||
|
from loguru import logger
|
||||||
|
import datetime
|
||||||
|
import iso8601
|
||||||
|
from utils import getParam
|
||||||
|
from Cheetah.Template import Template
|
||||||
|
|
||||||
|
def perform(dbh, params):
|
||||||
|
year = getParam(params, 'year', datetime.datetime.today().year)
|
||||||
|
|
||||||
|
accountEntries = dbGetMany(
|
||||||
|
dbh,
|
||||||
|
{
|
||||||
|
"statement": "SELECT * FROM account_statement_v WHERE fiscal_year = %(year)s",
|
||||||
|
"params": {
|
||||||
|
'year': year
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
overview = dbGetMany(
|
||||||
|
dbh,
|
||||||
|
{
|
||||||
|
"statement": "select sum(amount), category from account_statement_v where fiscal_year = %(year)s group by category",
|
||||||
|
"params": {
|
||||||
|
'year': year
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
sum_related = dbGetOne(
|
||||||
|
dbh,
|
||||||
|
{
|
||||||
|
"statement": "select coalesce(sum(amount), 0::numeric(10,2)) as sum from account_statement_v where fiscal_year = %(year)s and category != 'nicht abrechenbare Positionen'",
|
||||||
|
"params": {
|
||||||
|
'year': year
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
sum_unrelated = dbGetOne(
|
||||||
|
dbh,
|
||||||
|
{
|
||||||
|
"statement": "select coalesce(sum(amount), 0::numeric(10,2)) as sum from account_statement_v where fiscal_year = %(year)s and category = 'nicht abrechenbare Positionen'",
|
||||||
|
"params": {
|
||||||
|
'year': year
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
sum_total = dbGetOne(
|
||||||
|
dbh,
|
||||||
|
{
|
||||||
|
"statement": "select sum(amount) as sum from account_statement_v where fiscal_year = %(year)s",
|
||||||
|
"params": {
|
||||||
|
'year': year
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
sum_error = dbGetMany(
|
||||||
|
dbh,
|
||||||
|
{
|
||||||
|
"statement": """
|
||||||
|
select coalesce(sum(amount), 0::numeric(10,2)) as sum, 1 as error, 'booked in %(year1)s, accounted in %(year0)s' as remark from account_statement_v where fiscal_year = %(year0)s and extract(year from created_at) = %(year1)s
|
||||||
|
union
|
||||||
|
select coalesce(sum(amount), 0::numeric(10,2)) as sum, 2 as error, 'booked in %(year0)s, accounted in %(year1)s' as remark from account_statement_v where fiscal_year = %(year1)s and extract(year from created_at) = %(year0)s
|
||||||
|
union
|
||||||
|
select coalesce(sum(amount), 0::numeric(10,2)) as sum, 3 as error, 'booked in %(year2)s, accounted in %(year1)s' as remark from account_statement_v where fiscal_year = %(year1)s and extract(year from created_at) = %(year2)s
|
||||||
|
union
|
||||||
|
select coalesce(sum(amount), 0::numeric(10,2)) as sum, 4 as error, 'booked in %(year1)s, accounted in %(year2)s' as remark from account_statement_v where fiscal_year = %(year2)s and extract(year from created_at) = %(year1)s
|
||||||
|
order by error
|
||||||
|
""",
|
||||||
|
"params": {
|
||||||
|
'year0': year - 1,
|
||||||
|
'year1': year,
|
||||||
|
'year2': year + 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
count_entries = dbGetMany(
|
||||||
|
dbh,
|
||||||
|
{
|
||||||
|
"statement": "select extract(month from created_at) as month, count(*) as count from account_statement_v where extract(year from created_at) = %(year)s group by month",
|
||||||
|
"params": {
|
||||||
|
"year": year
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
raw_total = sum_total['sum']
|
||||||
|
logger.info(f"{raw_total=}")
|
||||||
|
err1 = sum_error[0]['sum']
|
||||||
|
logger.info(f"{err1=}")
|
||||||
|
err2 = sum_error[1]['sum']
|
||||||
|
logger.info(f"{err2=}")
|
||||||
|
err3 = sum_error[2]['sum']
|
||||||
|
logger.info(f"{err3=}")
|
||||||
|
err4 = sum_error[3]['sum']
|
||||||
|
logger.info(f"{err4=}")
|
||||||
|
adjusted_total = raw_total + err1 - err2 - err3 + err4
|
||||||
|
logger.info(f"{adjusted_total=}")
|
||||||
|
|
||||||
|
template = getParam(params, 'template', 'accountStatement.tmpl')
|
||||||
|
input = { 'year': year, 'entries': accountEntries, 'overview': overview, 'related': sum_related, 'unrelated': sum_unrelated, 'total': sum_total, 'errors': sum_error, 'adjusted_total' :adjusted_total, 'count_entries': count_entries }
|
||||||
|
tmpl = Template(file=template, searchList=[ input ])
|
||||||
|
print(tmpl)
|
51
cli/AccountStatement.sh
Executable file
51
cli/AccountStatement.sh
Executable file
@ -0,0 +1,51 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SHOW="0"
|
||||||
|
PRINT="0"
|
||||||
|
while getopts "y:sphP:" flag
|
||||||
|
do
|
||||||
|
case "${flag}" in
|
||||||
|
h)
|
||||||
|
echo "y ... year for statement";
|
||||||
|
echo "s ... show output using evince";
|
||||||
|
echo "p ... print output";
|
||||||
|
echo "P ... printer name";
|
||||||
|
exit 1;
|
||||||
|
;;
|
||||||
|
y)
|
||||||
|
YEAR=${OPTARG}
|
||||||
|
;;
|
||||||
|
s)
|
||||||
|
SHOW="1"
|
||||||
|
;;
|
||||||
|
p)
|
||||||
|
PRINT="1"
|
||||||
|
;;
|
||||||
|
P)
|
||||||
|
PRINTER="-P ${OPTARG}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$YEAR" = "" ]; then
|
||||||
|
echo "give year for statement as argument"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
python3.10 hv2cli.py -o AccountStatement -p '{"year":'$YEAR'}' > ./output/$YEAR.tex
|
||||||
|
|
||||||
|
pushd ./output
|
||||||
|
|
||||||
|
pdflatex $YEAR.tex
|
||||||
|
pdflatex $YEAR.tex
|
||||||
|
pdflatex $YEAR.tex
|
||||||
|
|
||||||
|
if [ "$SHOW" = "1" ]; then
|
||||||
|
evince $YEAR.pdf
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$PRINT" = "1" ]; then
|
||||||
|
lpr $PRINTER $YEAR.pdf
|
||||||
|
fi
|
||||||
|
|
||||||
|
popd
|
@ -2,12 +2,20 @@ from db import dbGetMany, dbGetOne
|
|||||||
from loguru import logger
|
from loguru import logger
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
import datetime
|
import datetime
|
||||||
|
import iso8601
|
||||||
|
|
||||||
def perform(dbh, params):
|
def perform(dbh, params):
|
||||||
try:
|
try:
|
||||||
createdAt = params['created_at']
|
createdAt = iso8601.parse_date(params['created_at'])
|
||||||
|
except iso8601.iso8601.ParseError:
|
||||||
|
msg = f"Can not parse given date {params['created_at']}"
|
||||||
|
logger.error(msg)
|
||||||
|
raise Exception(msg)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
createdAt = datetime.datetime.today().strftime("%Y-%m-%d")
|
createdAt = datetime.datetime.today()
|
||||||
|
|
||||||
|
year = createdAt.year
|
||||||
|
createdAt = createdAt.strftime("%Y-%m-%d")
|
||||||
|
|
||||||
tenants = dbGetMany(dbh, { "statement": "SELECT * FROM tenant_t", "params": () })
|
tenants = dbGetMany(dbh, { "statement": "SELECT * FROM tenant_t", "params": () })
|
||||||
for tenant in tenants:
|
for tenant in tenants:
|
||||||
@ -99,11 +107,11 @@ def perform(dbh, params):
|
|||||||
accountEntry = dbGetOne(dbh, {
|
accountEntry = dbGetOne(dbh, {
|
||||||
"statement": """
|
"statement": """
|
||||||
INSERT INTO account_entry_t
|
INSERT INTO account_entry_t
|
||||||
(description, account, created_at, amount, account_entry_category)
|
(description, account, created_at, fiscal_year, amount, account_entry_category)
|
||||||
VALUES (%s, %s, %s, %s, (SELECT id FROM account_entry_category_t WHERE description = %s))
|
VALUES (%s, %s, %s, %s, %s, (SELECT id FROM account_entry_category_t WHERE description = %s))
|
||||||
RETURNING id
|
RETURNING id
|
||||||
""",
|
""",
|
||||||
"params": (request['description'], request['account'], request['created_at'], request['amount'], request['category'])
|
"params": (request['description'], request['account'], request['created_at'], year, request['amount'], request['category'])
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
logger.info(f" account entry entered with id {accountEntry['id']}")
|
logger.info(f" account entry entered with id {accountEntry['id']}")
|
362
cli/OverheadAccounts.py
Normal file
362
cli/OverheadAccounts.py
Normal file
@ -0,0 +1,362 @@
|
|||||||
|
from db import dbGetMany, dbGetOne
|
||||||
|
import datetime
|
||||||
|
from loguru import logger
|
||||||
|
from decimal import *
|
||||||
|
from utils import getParam
|
||||||
|
from Cheetah.Template import Template
|
||||||
|
import xlsxwriter
|
||||||
|
from dateutil.relativedelta import relativedelta
|
||||||
|
|
||||||
|
EPSILON = Decimal('0.000000001')
|
||||||
|
|
||||||
|
def perform(dbh, params):
|
||||||
|
year = getParam(params, 'year', datetime.datetime.today().year)
|
||||||
|
startDate = datetime.datetime(year, 1, 1, 0, 0, 0)
|
||||||
|
endDate = datetime.datetime(year, 12, 31, 23, 59, 59)
|
||||||
|
premises = (1, 2)
|
||||||
|
|
||||||
|
houses = {}
|
||||||
|
for premise in premises:
|
||||||
|
# get overhead sums by object, category and timespan
|
||||||
|
overheadItems = dbGetMany(
|
||||||
|
dbh,
|
||||||
|
{
|
||||||
|
"statement":
|
||||||
|
"""
|
||||||
|
select (coalesce(sum(ae.amount), 0::numeric(10,2)) * -1) as sum,
|
||||||
|
aec.description as category,
|
||||||
|
aec.considerminusarea as considerminusarea
|
||||||
|
from account_t a,
|
||||||
|
premise_t p,
|
||||||
|
account_entry_t ae,
|
||||||
|
account_entry_category_t aec
|
||||||
|
where p.account = a.id and
|
||||||
|
ae.account = a.id and
|
||||||
|
aec.overhead_relevant = 't' and
|
||||||
|
ae.account_entry_category = aec.id and
|
||||||
|
ae.fiscal_year = %(year)s and
|
||||||
|
p.id = %(premise)s
|
||||||
|
group by category, considerminusarea
|
||||||
|
union
|
||||||
|
select 0 as sum,
|
||||||
|
aec.description as category,
|
||||||
|
aec.considerminusarea as considerminusarea
|
||||||
|
from account_t a,
|
||||||
|
premise_t p,
|
||||||
|
account_entry_t ae,
|
||||||
|
account_entry_category_t aec
|
||||||
|
where p.account = a.id and
|
||||||
|
ae.account = a.id and
|
||||||
|
aec.overhead_relevant = 't' and
|
||||||
|
aec.id not in (select distinct account_entry_category from account_entry_t where fiscal_year = %(year)s and account = p.account) and
|
||||||
|
ae.fiscal_year = %(year)s and
|
||||||
|
p.id = %(premise)s
|
||||||
|
group by category, considerminusarea
|
||||||
|
union
|
||||||
|
select 120 as sum,
|
||||||
|
'16. Waschmaschine' as category,
|
||||||
|
false as considerminusarea
|
||||||
|
from premise_t
|
||||||
|
where id = %(premise)s
|
||||||
|
order by category
|
||||||
|
""",
|
||||||
|
"params": {
|
||||||
|
"year": year,
|
||||||
|
"premise": premise
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
# get areas and factors
|
||||||
|
totalArea = {}
|
||||||
|
flatArea = dbGetOne(
|
||||||
|
dbh,
|
||||||
|
{
|
||||||
|
"statement":
|
||||||
|
"""
|
||||||
|
select
|
||||||
|
sum(f.area) as flat_area
|
||||||
|
from
|
||||||
|
premise_t p,
|
||||||
|
flat_t f
|
||||||
|
where
|
||||||
|
f.premise = p.id and
|
||||||
|
p.id = %(premise)s
|
||||||
|
""",
|
||||||
|
"params": {
|
||||||
|
"premise": premise
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
totalArea['flat_area'] = flatArea['flat_area']
|
||||||
|
|
||||||
|
commercialArea = dbGetOne(
|
||||||
|
dbh,
|
||||||
|
{
|
||||||
|
"statement":
|
||||||
|
"""
|
||||||
|
select
|
||||||
|
coalesce(sum(c.area), 0) as commercial_area
|
||||||
|
from
|
||||||
|
premise_t p full outer join commercial_premise_t c on c.premise = p.id
|
||||||
|
where
|
||||||
|
p.id = %(premise)s
|
||||||
|
""",
|
||||||
|
"params": {
|
||||||
|
"premise": premise
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
totalArea['commercial_area'] = commercialArea['commercial_area']
|
||||||
|
|
||||||
|
minusAreaAndDetails = dbGetOne(
|
||||||
|
dbh,
|
||||||
|
{
|
||||||
|
"statement":
|
||||||
|
"""
|
||||||
|
select
|
||||||
|
p.minus_area as minus_area,
|
||||||
|
p.id as house_id,
|
||||||
|
p.description as house
|
||||||
|
from
|
||||||
|
premise_t p
|
||||||
|
where
|
||||||
|
p.id = %(premise)s
|
||||||
|
""",
|
||||||
|
"params": {
|
||||||
|
"premise": premise
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
totalArea['minus_area'] = minusAreaAndDetails['minus_area']
|
||||||
|
details = { 'id': minusAreaAndDetails['house_id'], 'description': minusAreaAndDetails['house'] }
|
||||||
|
|
||||||
|
totalArea['other_area'] = totalArea['commercial_area'] + totalArea['minus_area']
|
||||||
|
totalArea['total_area'] = totalArea['flat_area'] + totalArea['other_area']
|
||||||
|
totalArea['flat_factor'] = totalArea['flat_area'] / totalArea['total_area']
|
||||||
|
totalArea['other_factor'] = totalArea['other_area'] / totalArea['total_area']
|
||||||
|
totalArea['factor_check'] = totalArea['flat_factor'] + totalArea['other_factor']
|
||||||
|
|
||||||
|
totalSum = Decimal('0')
|
||||||
|
flatSum = Decimal('0')
|
||||||
|
otherSum = Decimal('0')
|
||||||
|
for overheadItem in overheadItems:
|
||||||
|
totalSum += overheadItem['sum']
|
||||||
|
overheadItem['flat_part'] = overheadItem['sum'] * totalArea['flat_factor'] if overheadItem['considerminusarea'] else overheadItem['sum']
|
||||||
|
flatSum += overheadItem['flat_part']
|
||||||
|
overheadItem['other_part'] = overheadItem['sum'] * totalArea['other_factor'] if overheadItem['considerminusarea'] else Decimal('0')
|
||||||
|
otherSum += overheadItem['other_part']
|
||||||
|
|
||||||
|
verifyDifference = totalSum - flatSum - otherSum
|
||||||
|
logger.debug(f"{totalSum=}, {verifyDifference=}")
|
||||||
|
if abs(verifyDifference) > EPSILON:
|
||||||
|
raise Exception(f"Verify Difference is too large: {premise=}, {verifyDifference=}")
|
||||||
|
|
||||||
|
umlageAusfallWagnis = flatSum * Decimal('0.02')
|
||||||
|
flatSum2 = flatSum + umlageAusfallWagnis
|
||||||
|
|
||||||
|
partByMonthArea = flatSum2 / Decimal('12') / totalArea['flat_area']
|
||||||
|
|
||||||
|
houses[details['id']] = {
|
||||||
|
'details': details,
|
||||||
|
'areas': totalArea,
|
||||||
|
'overhead_items': overheadItems,
|
||||||
|
'flat_sum': flatSum,
|
||||||
|
'flat_sum_2': flatSum2,
|
||||||
|
'other_sum': otherSum,
|
||||||
|
'total_sum': totalSum,
|
||||||
|
'umlage_ausfall_wagnis': umlageAusfallWagnis,
|
||||||
|
'part_by_montharea': partByMonthArea,
|
||||||
|
'year': year }
|
||||||
|
|
||||||
|
|
||||||
|
logger.info(f"{houses=}")
|
||||||
|
|
||||||
|
|
||||||
|
printOverviews = getParam(params, 'printOverviews', True)
|
||||||
|
if printOverviews:
|
||||||
|
overviewTemplate = getParam(params, 'overviewTemplate', 'betriebskostenuebersicht.tmpl')
|
||||||
|
overviewPrefix = getParam(params, 'overviewPrefix', 'overview')
|
||||||
|
overviewSuffix = getParam(params, 'overviewSuffix', 'tex')
|
||||||
|
|
||||||
|
for house in houses.values():
|
||||||
|
logger.debug(f"Processing item: {house}")
|
||||||
|
outputFile = f"./output/{overviewPrefix}-{house['details']['id']}.{overviewSuffix}"
|
||||||
|
tmpl = Template(file=overviewTemplate, searchList=[ house ])
|
||||||
|
logger.debug(tmpl)
|
||||||
|
with open(outputFile, 'w') as f:
|
||||||
|
f.write(str(tmpl))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# get flat tenants by object and timespan with paid overhead and due overhead
|
||||||
|
tenants = dbGetMany(
|
||||||
|
dbh,
|
||||||
|
{
|
||||||
|
"statement":
|
||||||
|
"""
|
||||||
|
select t.id as tenant_id,
|
||||||
|
t.salutation as tenant_salutation,
|
||||||
|
t.firstname as tenant_firstname,
|
||||||
|
t.lastname as tenant_lastname,
|
||||||
|
t.address1 as tenant_address1,
|
||||||
|
t.address2 as tenant_address2,
|
||||||
|
t.address3 as tenant_address3,
|
||||||
|
t.zip as tenant_zip,
|
||||||
|
t.city as tenant_city,
|
||||||
|
f.id as flat_id,
|
||||||
|
f.description as flat,
|
||||||
|
f.area as flat_area,
|
||||||
|
p.id as house_id,
|
||||||
|
p.description as house,
|
||||||
|
ty.startdate as startdate,
|
||||||
|
ty.enddate as enddate,
|
||||||
|
t.account as tenant_account,
|
||||||
|
fe.amount as fee,
|
||||||
|
fe.fee_type as fee_type
|
||||||
|
from tenant_t t,
|
||||||
|
premise_t p,
|
||||||
|
flat_t f,
|
||||||
|
tenancy_t ty,
|
||||||
|
tenancy_fee_mapping_t tyfm,
|
||||||
|
fee_t fe
|
||||||
|
where ty.tenant = t.id and
|
||||||
|
ty.flat = f.id and
|
||||||
|
ty.startdate <= %(startDate)s and
|
||||||
|
(ty.enddate >= %(endDate)s or ty.enddate is null) and
|
||||||
|
f.premise = p.id and
|
||||||
|
p.id in %(premises)s and
|
||||||
|
tyfm.tenancy = ty.id and
|
||||||
|
tyfm.fee = fe.id
|
||||||
|
order by house_id, tenant_id
|
||||||
|
""",
|
||||||
|
"params": {
|
||||||
|
"startDate": startDate,
|
||||||
|
"endDate": endDate,
|
||||||
|
"premises": premises
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
letters = []
|
||||||
|
for tenant in tenants:
|
||||||
|
letter = {}
|
||||||
|
|
||||||
|
paidTotal = dbGetOne(
|
||||||
|
dbh,
|
||||||
|
{
|
||||||
|
"statement":
|
||||||
|
"""
|
||||||
|
SELECT sum(amount) AS sum
|
||||||
|
FROM account_entry_t
|
||||||
|
WHERE account = %(account)s AND
|
||||||
|
account_entry_category = 2 AND
|
||||||
|
fiscal_year = %(year)s
|
||||||
|
""",
|
||||||
|
"params": {
|
||||||
|
"account": tenant['tenant_account'],
|
||||||
|
"year": year
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
tenant['paid_total'] = paidTotal['sum']
|
||||||
|
|
||||||
|
receivableFee = dbGetOne(
|
||||||
|
dbh,
|
||||||
|
{
|
||||||
|
"statement":
|
||||||
|
"""
|
||||||
|
SELECT sum(amount) * -1 AS sum
|
||||||
|
FROM account_entry_t
|
||||||
|
WHERE account = %(account)s AND
|
||||||
|
account_entry_category = 3 AND
|
||||||
|
fiscal_year = %(year)s
|
||||||
|
""",
|
||||||
|
"params": {
|
||||||
|
"account": tenant['tenant_account'],
|
||||||
|
"year": year
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
tenant['receivable_fee'] = receivableFee['sum']
|
||||||
|
|
||||||
|
delta = relativedelta((tenant['enddate'] or datetime.date(year, 12, 31)), (tenant['startdate'] if (tenant['startdate'].year == year) else datetime.date(year, 1, 1)))
|
||||||
|
tenant['rent_time'] = delta.months if delta.days == 0 else delta.months + 1
|
||||||
|
|
||||||
|
tenant['paid_overhead'] = paidTotal['sum'] - receivableFee['sum']
|
||||||
|
|
||||||
|
letter['tenant'] = tenant
|
||||||
|
letter['year'] = year
|
||||||
|
letter['flat_area'] = houses[tenant['house_id']]['areas']['flat_area']
|
||||||
|
letter['receivable_overhead'] = tenant['flat_area'] * houses[tenant['house_id']]['part_by_montharea'] * tenant['rent_time']
|
||||||
|
letter['unbalanced_overhead'] = tenant['paid_overhead'] - letter['receivable_overhead']
|
||||||
|
letter['unbalanced_overhead_unsigned'] = abs(letter['unbalanced_overhead'])
|
||||||
|
letter['total_overhead'] = houses[tenant['house_id']]['flat_sum_2']
|
||||||
|
|
||||||
|
letters.append(letter)
|
||||||
|
|
||||||
|
logger.info(f"{letter=}")
|
||||||
|
|
||||||
|
|
||||||
|
printLetters = getParam(params, 'printLetters', True)
|
||||||
|
if printLetters:
|
||||||
|
letterTemplate = getParam(params, 'letterTemplate', 'jahresabrechnung.tmpl')
|
||||||
|
letterPrefix = getParam(params, 'letterPrefix', 'letter')
|
||||||
|
letterSuffix = getParam(params, 'letterSuffix', 'tex')
|
||||||
|
|
||||||
|
for letter in letters:
|
||||||
|
logger.debug(f"Processing item: {letter}")
|
||||||
|
outputFile = f"./output/{letterPrefix}-{letter['tenant']['tenant_id']}.{letterSuffix}"
|
||||||
|
tmpl = Template(file=letterTemplate, searchList=[ letter ])
|
||||||
|
logger.debug(tmpl)
|
||||||
|
with open(outputFile, 'w') as f:
|
||||||
|
f.write(str(tmpl))
|
||||||
|
|
||||||
|
if printOverviews:
|
||||||
|
tenantsOverviewPrefix = getParam(params, 'tenantsOverviewPrefix', 'tenantsOverview')
|
||||||
|
tenantsOverviewSuffix = getParam(params, 'tenantsOverviewSuffix', 'xlsx')
|
||||||
|
|
||||||
|
logger.debug(f"Processing letters: {letters}")
|
||||||
|
outputFile = f"./output/{tenantsOverviewPrefix}-{year}.{tenantsOverviewSuffix}"
|
||||||
|
|
||||||
|
workbook = xlsxwriter.Workbook(outputFile)
|
||||||
|
worksheet = workbook.add_worksheet()
|
||||||
|
|
||||||
|
worksheet.write(0, 0, 'id')
|
||||||
|
worksheet.write(0, 1, 'lastname')
|
||||||
|
worksheet.write(0, 2, 'firstname')
|
||||||
|
worksheet.write(0, 3, 'house')
|
||||||
|
worksheet.write(0, 4, 'overhead_part_by_montharea')
|
||||||
|
worksheet.write(0, 5, 'flat')
|
||||||
|
worksheet.write(0, 6, 'flat_area')
|
||||||
|
worksheet.write(0, 7, 'fee')
|
||||||
|
worksheet.write(0, 8, 'rent_time')
|
||||||
|
worksheet.write(0, 9, 'paid_total')
|
||||||
|
worksheet.write(0, 10, 'receivable_fee')
|
||||||
|
worksheet.write(0, 11, 'paid_overhead')
|
||||||
|
worksheet.write(0, 12, 'receivable_overhead')
|
||||||
|
worksheet.write(0, 13, 'unbalanced_overhead')
|
||||||
|
|
||||||
|
row = 1
|
||||||
|
|
||||||
|
for entry in letters:
|
||||||
|
worksheet.write(row, 0, entry['tenant']['tenant_id'])
|
||||||
|
worksheet.write(row, 1, entry['tenant']['tenant_lastname'])
|
||||||
|
worksheet.write(row, 2, entry['tenant']['tenant_firstname'])
|
||||||
|
worksheet.write(row, 3, entry['tenant']['house'])
|
||||||
|
worksheet.write(row, 4, houses[entry['tenant']['house_id']]['part_by_montharea'])
|
||||||
|
worksheet.write(row, 5, entry['tenant']['flat'])
|
||||||
|
worksheet.write(row, 6, entry['tenant']['flat_area'])
|
||||||
|
worksheet.write(row, 7, entry['tenant']['fee'])
|
||||||
|
worksheet.write(row, 8, entry['tenant']['rent_time'])
|
||||||
|
worksheet.write(row, 9, entry['tenant']['paid_total'])
|
||||||
|
worksheet.write(row, 10, entry['tenant']['receivable_fee'])
|
||||||
|
worksheet.write(row, 11, entry['tenant']['paid_overhead'])
|
||||||
|
worksheet.write(row, 12, entry['receivable_overhead'])
|
||||||
|
worksheet.write(row, 13, entry['unbalanced_overhead'])
|
||||||
|
row += 1
|
||||||
|
|
||||||
|
workbook.close()
|
||||||
|
|
55
cli/OverheadAccounts.sh
Executable file
55
cli/OverheadAccounts.sh
Executable file
@ -0,0 +1,55 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
PRINT="0"
|
||||||
|
while getopts "y:phP:" flag
|
||||||
|
do
|
||||||
|
case "${flag}" in
|
||||||
|
h)
|
||||||
|
echo "y ... year for statement";
|
||||||
|
echo "p ... print output";
|
||||||
|
echo "P ... printer name";
|
||||||
|
exit 1;
|
||||||
|
;;
|
||||||
|
y)
|
||||||
|
YEAR=${OPTARG}
|
||||||
|
;;
|
||||||
|
p)
|
||||||
|
PRINT="1"
|
||||||
|
;;
|
||||||
|
P)
|
||||||
|
PRINTER="-P ${OPTARG}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$YEAR" = "" ]; then
|
||||||
|
echo "give year for statement as argument"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
python3.10 hv2cli.py -o OverheadAccounts -p '{"year":'$YEAR'}'
|
||||||
|
|
||||||
|
pushd ./output
|
||||||
|
|
||||||
|
for I in letter-*.tex; do
|
||||||
|
pdflatex $I
|
||||||
|
pdflatex $I
|
||||||
|
pdflatex $I
|
||||||
|
done
|
||||||
|
for I in overview-*.tex; do
|
||||||
|
pdflatex $I
|
||||||
|
pdflatex $I
|
||||||
|
pdflatex $I
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$PRINT" = "1" ]; then
|
||||||
|
for I in letter-*.pdf; do
|
||||||
|
lpr $PRINTER $I
|
||||||
|
done
|
||||||
|
for I in overview-*.pdf; do
|
||||||
|
lpr $PRINTER $I
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
popd
|
0
cli/accountStatement
Normal file
0
cli/accountStatement
Normal file
83
cli/accountStatement.tmplx
Normal file
83
cli/accountStatement.tmplx
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
\documentclass[10pt]{article}
|
||||||
|
\usepackage{german}
|
||||||
|
\usepackage{eurosym}
|
||||||
|
\usepackage[a4paper, landscape=true, left=2cm, right=2cm, top=2cm]{geometry}
|
||||||
|
\usepackage{icomma}
|
||||||
|
\usepackage{longtable}
|
||||||
|
\usepackage{color}
|
||||||
|
\setlength{\parindent}{0pt}
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
|
||||||
|
\subsection*{Account Statement $year}
|
||||||
|
|
||||||
|
\begin{longtable}{|r|r|p{6cm}|r|r|r|p{3cm}|r|p{5cm}|}
|
||||||
|
\hline \textcolor{blue}{\bf{ID}} & \textcolor{blue}{\bf{Date}} & \textcolor{blue}{\bf{Description}} & \textcolor{blue}{\bf{Amount}} & \textcolor{blue}{\bf{DocNo}} & \textcolor{blue}{\bf{Year}} & \textcolor{blue}{\bf{Category}} & \textcolor{blue}{\bf{IsRef}} & \textcolor{blue}{\bf{BaseAccount}} \\ \hline \hline
|
||||||
|
\endfirsthead
|
||||||
|
\hline \textcolor{blue}{\bf{ID}} & \textcolor{blue}{\bf{Date}} & \textcolor{blue}{\bf{Description}} & \textcolor{blue}{\bf{Amount}} & \textcolor{blue}{\bf{DocNo}} & \textcolor{blue}{\bf{Year}} & \textcolor{blue}{\bf{Category}} & \textcolor{blue}{\bf{IsRef}} & \textcolor{blue}{\bf{BaseAccount}} \\ \hline \hline
|
||||||
|
\endhead
|
||||||
|
\multicolumn{9}{r}{\em{to be continued}}
|
||||||
|
\endfoot
|
||||||
|
|
||||||
|
\endlastfoot
|
||||||
|
|
||||||
|
#for $entry in $entries
|
||||||
|
\tt{$entry['id']} & \tt{$entry['created_at']} & \tt{$entry['description']} & #slurp
|
||||||
|
#if $entry['amount'] <= 0
|
||||||
|
\textcolor{red}{#slurp
|
||||||
|
#end if
|
||||||
|
\tt{$entry['amount']} \,\euro{}#slurp
|
||||||
|
#if $entry['amount'] <= 0
|
||||||
|
}#slurp
|
||||||
|
#end if
|
||||||
|
& \tt{$entry['document_no']} & \tt{$entry['fiscal_year']} & \tt{$entry['category']} & \tt{$entry['is_reference']} & \tt{{$entry['base_account'].replace('_', ' ') }} \\ \hline
|
||||||
|
#end for
|
||||||
|
\end{longtable}
|
||||||
|
|
||||||
|
\pagebreak
|
||||||
|
\subsection*{Overviews}
|
||||||
|
|
||||||
|
\begin{tabular}{|l|r|} \hline
|
||||||
|
\hline \textcolor{blue}{\bf{category}} & \textcolor{blue}{\bf{sum}} \\
|
||||||
|
#for $entry in $overview
|
||||||
|
\hline \tt{$entry['category']} & #slurp
|
||||||
|
#if $entry['sum'] <= 0
|
||||||
|
\textcolor{red}{#slurp
|
||||||
|
#end if
|
||||||
|
\tt{$entry['sum']} \,\euro{}#slurp
|
||||||
|
#if $entry['sum'] <= 0
|
||||||
|
}#slurp
|
||||||
|
#end if
|
||||||
|
\\
|
||||||
|
#end for
|
||||||
|
|
||||||
|
\hline \hline related & \tt{$related['sum']} \,\euro{} \\
|
||||||
|
\hline unrelated & \tt{$unrelated['sum']} \,\euro{} \\
|
||||||
|
\hline total & \tt{$total['sum']} \,\euro{} \\
|
||||||
|
\hline \hline
|
||||||
|
\end{tabular}
|
||||||
|
|
||||||
|
\pagebreak
|
||||||
|
\subsection*{Errors}
|
||||||
|
|
||||||
|
\begin{tabular}{|r|r|l|} \hline
|
||||||
|
\hline \textcolor{blue}{\bf{type}} & \textcolor{blue}{\bf{sum}} & \textcolor{blue}{\bf{remark}} \\
|
||||||
|
#for $entry in $errors
|
||||||
|
\hline \tt{$entry['error']} & \tt{$entry['sum']} \,\euro{} & \tt{$entry['remark']} \\
|
||||||
|
#end for
|
||||||
|
\hline \tt{0} & \tt{$adjusted_total} \,\euro{} & \tt{adjusted total} \\
|
||||||
|
\hline \hline
|
||||||
|
\end{tabular}
|
||||||
|
|
||||||
|
\pagebreak
|
||||||
|
\subsection*{Counts}
|
||||||
|
|
||||||
|
\begin{tabular}{|r|r|} \hline
|
||||||
|
\hline \textcolor{blue}{\bf{Month}} & \textcolor{blue}{\bf{Count}} \\
|
||||||
|
#for $entry in $count_entries
|
||||||
|
\hline \tt{$entry['month']} & \tt{$entry['count']} \\
|
||||||
|
#end for
|
||||||
|
\hline \hline
|
||||||
|
\end{tabular}
|
||||||
|
|
||||||
|
\end{document}
|
47
cli/betriebskostenuebersicht.tmplx
Normal file
47
cli/betriebskostenuebersicht.tmplx
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
\documentclass[12pt]{article}
|
||||||
|
\renewcommand{\familydefault}{\sfdefault}
|
||||||
|
\usepackage{german}
|
||||||
|
\usepackage{eurosym}
|
||||||
|
\usepackage[a4paper, left=2cm, right=2cm, top=2cm]{geometry}
|
||||||
|
\usepackage{icomma}
|
||||||
|
\setlength{\parindent}{0pt}
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
|
||||||
|
\subsection*{Aufstellung}
|
||||||
|
über die Ermittlung der Betriebskosten gemäß §27 II. BV
|
||||||
|
|
||||||
|
\vspace{15mm}
|
||||||
|
|
||||||
|
\begin{tabular}{ll}
|
||||||
|
Objekt & $details['description'] \\
|
||||||
|
Jahr & $year \\
|
||||||
|
Eigent"umer & Nober Grundbesitz GmbH \\
|
||||||
|
\end{tabular}
|
||||||
|
|
||||||
|
\addvspace{1cm}
|
||||||
|
|
||||||
|
\begin{tabular}{|p{7cm}|r|r|r|}
|
||||||
|
\hline Art & Wohnungen & andere Fl"achen & Gesamtfl"ache \\
|
||||||
|
\hline
|
||||||
|
\hline Fl"ache & \tt{$areas['flat_area']\,m\textsuperscript{2}} & \tt{$areas['other_area']\,m\textsuperscript{2}} & \tt{$areas['total_area']\,m\textsuperscript{2}} \\
|
||||||
|
\hline Faktor & \tt{#echo '%.10f' % $areas['flat_factor'] #} & \tt{#echo '%.10f' % $areas['other_factor'] #} & \\
|
||||||
|
\hline \hline
|
||||||
|
|
||||||
|
#for $item in $overhead_items
|
||||||
|
\hline $item['category'] & \tt{#echo '%.2f' % $item['flat_part'] #\,\euro{}} & \tt{#echo '%.2f' % $item['other_part'] #\,\euro{}} & \tt{#echo '%.2f' % $item['sum'] #\,\euro{}} \\
|
||||||
|
#end for
|
||||||
|
|
||||||
|
\hline
|
||||||
|
% \hline \multicolumn{4}{c}{ } \\
|
||||||
|
\hline Zwischensumme & \tt{#echo '%.2f' % $flat_sum #\,\euro{}} & \tt{#echo '%.2f' % $other_sum #\,\euro{}} & \tt{#echo '%.2f' % $total_sum #\,\euro{}} \\
|
||||||
|
\hline Umlageausfallwagnis & \tt{#echo '%.2f' % $umlage_ausfall_wagnis #\,\euro{}} & & \\
|
||||||
|
\hline Summe & \tt{#echo '%.2f' % $flat_sum_2 #\,\euro{}} & & \\
|
||||||
|
|
||||||
|
\hline
|
||||||
|
% \hline \multicolumn{4}{c}{ } \\
|
||||||
|
\hline Anteil pro Monat und m\textsuperscript{2} & \tt{#echo '%.10f' % $part_by_montharea #\,\euro{}} & & \\
|
||||||
|
\hline
|
||||||
|
\end{tabular}
|
||||||
|
|
||||||
|
\end{document}
|
@ -12,7 +12,7 @@ def execDatabaseOperation(dbh, func, params):
|
|||||||
cur = None
|
cur = None
|
||||||
try:
|
try:
|
||||||
with dbh.cursor(cursor_factory = psycopg2.extras.RealDictCursor) as cur:
|
with dbh.cursor(cursor_factory = psycopg2.extras.RealDictCursor) as cur:
|
||||||
params["params"] = [ v if not v=='' else None for v in params["params"] ]
|
# params["params"] = [ v if not v=='' else None for v in params["params"] ]
|
||||||
logger.debug("edo: {}".format(str(params)))
|
logger.debug("edo: {}".format(str(params)))
|
||||||
return func(cur, params)
|
return func(cur, params)
|
||||||
except psycopg2.Error as err:
|
except psycopg2.Error as err:
|
||||||
@ -21,6 +21,7 @@ def execDatabaseOperation(dbh, func, params):
|
|||||||
|
|
||||||
|
|
||||||
def _opGetMany(cursor, params):
|
def _opGetMany(cursor, params):
|
||||||
|
#logger.warning(f"{params=}")
|
||||||
items = []
|
items = []
|
||||||
cursor.execute(params["statement"], params["params"])
|
cursor.execute(params["statement"], params["params"])
|
||||||
for itemObj in cursor:
|
for itemObj in cursor:
|
||||||
|
38
cli/fixDueDate.py
Normal file
38
cli/fixDueDate.py
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
from loguru import logger
|
||||||
|
from db import dbGetMany, dbGetOne
|
||||||
|
|
||||||
|
def perform(dbh, params):
|
||||||
|
accountEntries = dbGetMany(
|
||||||
|
dbh,
|
||||||
|
{
|
||||||
|
"statement":
|
||||||
|
"""
|
||||||
|
select id, due_at from account_entry_t where due_at is not null
|
||||||
|
""",
|
||||||
|
"params": {}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
for accountEntry in accountEntries:
|
||||||
|
id = accountEntry['id']
|
||||||
|
oldDueAt = accountEntry['due_at']
|
||||||
|
newDueAt = oldDueAt.replace(day=1)
|
||||||
|
logger.info(f"id: {id}, due_at: {oldDueAt} -> {newDueAt}")
|
||||||
|
|
||||||
|
fixedEntry = dbGetOne(
|
||||||
|
dbh,
|
||||||
|
{
|
||||||
|
"statement":
|
||||||
|
"""
|
||||||
|
UPDATE account_entry_t
|
||||||
|
SET due_at = %(dueAt)s
|
||||||
|
WHERE id = %(id)s
|
||||||
|
RETURNING *
|
||||||
|
""",
|
||||||
|
"params": {
|
||||||
|
"id": id,
|
||||||
|
"dueAt": newDueAt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
logger.info("fixed")
|
@ -8,25 +8,12 @@ import argparse
|
|||||||
import importlib
|
import importlib
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
DB_USER = ""
|
|
||||||
DB_PASS = ""
|
|
||||||
DB_HOST = ""
|
|
||||||
DB_NAME = ""
|
|
||||||
try:
|
|
||||||
DB_USER = os.environ["DB_USER"]
|
|
||||||
DB_PASS = os.environ["DB_PASS"]
|
|
||||||
DB_HOST = os.environ["DB_HOST"]
|
|
||||||
DB_NAME = os.environ["DB_NAME"]
|
|
||||||
except KeyError:
|
|
||||||
config = configparser.ConfigParser()
|
|
||||||
config.read('./config/dbconfig.ini')
|
|
||||||
DB_USER = config["database"]["user"]
|
|
||||||
DB_PASS = config["database"]["pass"]
|
|
||||||
DB_HOST = config["database"]["host"]
|
|
||||||
DB_NAME = config["database"]["name"]
|
|
||||||
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description="hv2cli.py")
|
parser = argparse.ArgumentParser(description="hv2cli.py")
|
||||||
|
parser.add_argument('--config', '-c',
|
||||||
|
help="Config file, default is ./config/dbconfig.ini",
|
||||||
|
required=False,
|
||||||
|
default="./config/dbconfig.ini")
|
||||||
parser.add_argument('--operation', '-o',
|
parser.add_argument('--operation', '-o',
|
||||||
help='Operation to perform.',
|
help='Operation to perform.',
|
||||||
required=True)
|
required=True)
|
||||||
@ -44,12 +31,30 @@ parser.add_argument('--nocolorize', '-n',
|
|||||||
action='store_true',
|
action='store_true',
|
||||||
default=False)
|
default=False)
|
||||||
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
operation = args.operation
|
operation = args.operation
|
||||||
params = json.loads(args.params)
|
params = json.loads(args.params)
|
||||||
logLevel = args.verbosity
|
logLevel = args.verbosity
|
||||||
noColorize = args.nocolorize
|
noColorize = args.nocolorize
|
||||||
|
|
||||||
|
DB_USER = ""
|
||||||
|
DB_PASS = ""
|
||||||
|
DB_HOST = ""
|
||||||
|
DB_NAME = ""
|
||||||
|
try:
|
||||||
|
DB_USER = os.environ["DB_USER"]
|
||||||
|
DB_PASS = os.environ["DB_PASS"]
|
||||||
|
DB_HOST = os.environ["DB_HOST"]
|
||||||
|
DB_NAME = os.environ["DB_NAME"]
|
||||||
|
except KeyError:
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
config.read(args.config)
|
||||||
|
DB_USER = config["database"]["user"]
|
||||||
|
DB_PASS = config["database"]["pass"]
|
||||||
|
DB_HOST = config["database"]["host"]
|
||||||
|
DB_NAME = config["database"]["name"]
|
||||||
|
|
||||||
|
|
||||||
logger.remove()
|
logger.remove()
|
||||||
logger.add(sys.stderr, colorize=(not noColorize), level=logLevel)
|
logger.add(sys.stderr, colorize=(not noColorize), level=logLevel)
|
||||||
|
74
cli/jahresabrechnung.tmplx
Normal file
74
cli/jahresabrechnung.tmplx
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
\documentclass[12pt]{dinbrief}
|
||||||
|
\usepackage{german}
|
||||||
|
\usepackage{eurosym}
|
||||||
|
|
||||||
|
|
||||||
|
\address{Nober Grundbesitz GbR\\
|
||||||
|
Eupenstr. 20\\
|
||||||
|
45259 Essen}
|
||||||
|
\backaddress{Nober Grundbesitz GbR, Eupenstr. 20, 45259 Essen}
|
||||||
|
\signature{Wolfgang Hottgenroth} %% Hier Unterschrift einfuegen
|
||||||
|
\nowindowrules
|
||||||
|
\writer{wh} %% Hier eigenen Namen oder Kuerzel einfuegen
|
||||||
|
\phone{0174}{3072474} %% Hier eigene Telefon einfuegen
|
||||||
|
|
||||||
|
\bottomtext{\sffamily\footnotesize Gesch"aftsf"uhrer: Wolfgang Hottgenroth, Robert Nober, Gregor Nober ---
|
||||||
|
EMail: hausverwaltung@nober.de\\
|
||||||
|
Bankverbindung: IBAN DE14 3605 0105 0001 5130 35, Sparkasse Essen}
|
||||||
|
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
\pagenumbering{gobble}
|
||||||
|
\begin{letter}{$tenant['tenant_firstname'] $tenant['tenant_lastname']\\
|
||||||
|
#if $tenant['tenant_address1']
|
||||||
|
$tenant['tenant_address1']\\
|
||||||
|
#end if
|
||||||
|
#if $tenant['tenant_address2']
|
||||||
|
$tenant['tenant_address2']\\
|
||||||
|
#end if
|
||||||
|
#if $tenant['tenant_address3']
|
||||||
|
$tenant['tenant_address3']\\
|
||||||
|
#end if
|
||||||
|
$tenant['tenant_zip'] $tenant['tenant_city']}
|
||||||
|
\subject{Betriebskostenabrechnung $year}
|
||||||
|
\opening{$tenant['tenant_salutation'],}
|
||||||
|
|
||||||
|
f"ur die im vergangenen Jahr angefallenen Betriebskosten ergibt sich f"ur Sie folgende Abrechnung.
|
||||||
|
|
||||||
|
\begin{tabular}{|p{10cm}|r|}
|
||||||
|
\hline Jahr & \tt{$year} \\
|
||||||
|
\hline Haus & $tenant['house'] \\
|
||||||
|
\hline Betriebskosten gesamt & \tt{#echo '%.2f' % $total_overhead #\,\euro{}} \\
|
||||||
|
\hline Gesamt-Wohnfl"ache & \tt{$flat_area\,m\textsuperscript{2}} \\
|
||||||
|
\hline Ihre Wohnung & $tenant['flat'] \\
|
||||||
|
\hline Ihre Wohnfl"ache & \tt{$tenant['flat_area']\,m\textsuperscript{2}} \\
|
||||||
|
\hline Ihre Mietzeit & \tt{$tenant['rent_time']\,Monate} \\
|
||||||
|
\hline Ihr Betriebskostenanteil nach Fl"ache und Mietzeit & \tt{#echo '%.2f' % $receivable_overhead #\,\euro{}} \\
|
||||||
|
\hline Ihre Zahlungen & \tt{$tenant['paid_total']\,\euro{}} \\
|
||||||
|
\hline davon Anteil Miete & \tt{$tenant['receivable_fee']\,\euro{}} \\
|
||||||
|
\hline davon Anteil Betriebskostenvorauszahlung & \tt{$tenant['paid_overhead']\,\euro{}} \\
|
||||||
|
\hline
|
||||||
|
#if $unbalanced_overhead < 0
|
||||||
|
Zuwenig
|
||||||
|
#else
|
||||||
|
Zuviel
|
||||||
|
#end if
|
||||||
|
gezahlte Betriebskosten & \tt{#echo '%.2f' % $unbalanced_overhead_unsigned #\,\euro{}} \\
|
||||||
|
\hline
|
||||||
|
\end{tabular}
|
||||||
|
|
||||||
|
#if $unbalanced_overhead < 0
|
||||||
|
Bitte "uberweisen Sie den Betrag von #echo '%.2f' % $unbalanced_overhead_unsigned #\,\euro{} kurzfristig auf mein Konto.
|
||||||
|
#else
|
||||||
|
Ich werde den Betrag von #echo '%.2f' % $unbalanced_overhead_unsigned #\,\euro{} in den n"achsten Tagen auf Ihr Konto "uberweisen.
|
||||||
|
#end if
|
||||||
|
|
||||||
|
Eine tabellarische "Ubersicht "uber die Zusammensetzung der Gesamt-Betriebskosten
|
||||||
|
finden Sie in der Anlage.
|
||||||
|
|
||||||
|
\closing{Mit freundlichen Gr"u"sen}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\end{letter}
|
||||||
|
\end{document}
|
2
cli/utils.py
Normal file
2
cli/utils.py
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
def getParam(params, attr, default):
|
||||||
|
return params[attr] if attr in params else default
|
@ -3,6 +3,10 @@ from Cheetah.Template import Template
|
|||||||
import glob
|
import glob
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description="generate.py")
|
parser = argparse.ArgumentParser(description="generate.py")
|
||||||
parser.add_argument('--schema', '-s',
|
parser.add_argument('--schema', '-s',
|
||||||
help='Schema file. Default: schema.json in the current folder.',
|
help='Schema file. Default: schema.json in the current folder.',
|
||||||
|
236
r-scripts/hv2-analysis/.Rhistory
Normal file
236
r-scripts/hv2-analysis/.Rhistory
Normal file
@ -0,0 +1,236 @@
|
|||||||
|
source("~/.active-rstudio-document")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
View(amounts)
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
View(amounts)
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
print(amounts)
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
print(amounts)
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
print(amounts)
|
||||||
|
print(amounts, digits=2)
|
||||||
|
print(amounts, width=100)
|
||||||
|
print(amounts, width=10)
|
||||||
|
print(amounts, width=100)
|
||||||
|
print(amounts, digits=10)
|
||||||
|
options(pillar.sigfig=7)
|
||||||
|
print(amounts)
|
||||||
|
options(pillar.sigfig=10)
|
||||||
|
print(amounts)
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
library(tidyverse)
|
||||||
|
flextable::flextable
|
||||||
|
library(table)
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
sum(amounts$fee)
|
||||||
|
sum(amounts$fee) + sum(amounts$overhead)
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
sum(amounts$Betriebskosten)
|
||||||
|
sum(amounts$Betriebskosten, na.rm = TRUE)
|
||||||
|
sum(amounts$Betriebskosten, na.rm = FALSE)
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
sum(amounts$Betriebskosten)
|
||||||
|
sum(amounts$Betriebskosten, na.rm = T)
|
||||||
|
sum(amounts$Betriebskosten, na.omit())
|
||||||
|
sum(amounts$Betriebskosten
|
||||||
|
)
|
||||||
|
sum(amounts$Betriebskosten)
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
amounts$Betriebskosten
|
||||||
|
amounts$Betriebskosten[is.na(.)]
|
||||||
|
amounts$Betriebskosten[is.na()]
|
||||||
|
amounts$Betriebskosten[NA]
|
||||||
|
amounts$Betriebskosten[1]
|
||||||
|
amounts$Betriebskosten[is.na()]
|
||||||
|
amounts$Betriebskosten[is.na]
|
||||||
|
d <- amounts$Betriebskosten
|
||||||
|
d
|
||||||
|
d[is.na(d)]
|
||||||
|
d[is.na(d)] <- 0
|
||||||
|
d
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
View(expense)
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
expense
|
||||||
|
expense[overhead_relevant==T]
|
||||||
|
expense[expense$overhead_relevant == T]
|
||||||
|
expense[expense$overhead_relevant == TRUE]
|
||||||
|
expense[expense$overhead_relevant]
|
||||||
|
expense %>% filter(overhead_relevant == TRUE)
|
||||||
|
source("~/Workspace/hv2-all-in-one/r-scripts/hv2-analysis/income.R")
|
||||||
|
View(expense)
|
||||||
|
knitr::opts_chunk$set(echo = TRUE)
|
||||||
|
total_fee <- sum(income$Miete)
|
||||||
|
knitr::opts_chunk$set(echo = TRUE)
|
||||||
|
library(tidyverse, warn.conflicts = FALSE)
|
||||||
|
library(DBI, warn.conflicts = FALSE)
|
||||||
|
library(tidyr, warn.conflicts = FALSE)
|
||||||
|
library(dplyr, warn.conflicts = FALSE)
|
||||||
|
YEAR <- 2021
|
||||||
|
HOME <- Sys.getenv("HOME")
|
||||||
|
Sys.setenv(PGHOST = "db.mainscnt.eu",
|
||||||
|
PGDATABASE = "hv2",
|
||||||
|
PGPORT = 5432,
|
||||||
|
PGUSER = "wn",
|
||||||
|
PGSSLMODE = "verify-ca",
|
||||||
|
PGSSLKEY = paste(HOME, "/keys/psql/wn-postgresql-client-2.key", sep=""),
|
||||||
|
PGSSLCERT = paste(HOME, "/keys/psql/wn-postgresql-client-2.crt", sep=""),
|
||||||
|
PGSSLROOTCERT = paste(HOME, "/keys/psql/postgres-ca.crt", sep=""))
|
||||||
|
con <- dbConnect(RPostgres::Postgres())
|
||||||
|
res <- dbSendQuery(con, "
|
||||||
|
select f.description as flat,
|
||||||
|
p.description as premise,
|
||||||
|
aec.description as category,
|
||||||
|
sum(ae.amount) as amount
|
||||||
|
from flat_t f,
|
||||||
|
premise_t p,
|
||||||
|
tenancy_t ty,
|
||||||
|
tenant_t t,
|
||||||
|
account_t a,
|
||||||
|
account_entry_t ae,
|
||||||
|
account_entry_category_t aec
|
||||||
|
where p.id = f.premise and
|
||||||
|
ty.flat = f.id and
|
||||||
|
ty.tenant = t.id and
|
||||||
|
a.id = t.account and
|
||||||
|
ae.account = a.id and
|
||||||
|
aec.id = ae.account_entry_category and
|
||||||
|
ae.fiscal_year = $1 and
|
||||||
|
aec.description in ('Mietzahlung', 'Mietforderung', 'Betriebskostenforderung', 'Betriebskostenausgleich')
|
||||||
|
group by p.description,
|
||||||
|
f.description,
|
||||||
|
aec.description;
|
||||||
|
")
|
||||||
|
dbBind(res, list(YEAR))
|
||||||
|
income <- dbFetch(res)
|
||||||
|
dbClearResult(res)
|
||||||
|
income <- income %>%
|
||||||
|
pivot_wider(names_from = category, values_from = amount) %>%
|
||||||
|
mutate(Miete := -1 * Mietforderung) %>%
|
||||||
|
mutate(Betriebskosten := Mietzahlung - Miete + Betriebskostenausgleich) %>%
|
||||||
|
select(flat, premise, Miete, Betriebskosten) %>%
|
||||||
|
arrange(premise, flat) %>%
|
||||||
|
mutate(across(where(is.numeric), ~num(., digits=2))) %>%
|
||||||
|
mutate(across(where(is.numeric), ~replace(., is.na(.), 0)))
|
||||||
|
knitr::kable(income)
|
||||||
|
total_fee <- sum(income$Miete)
|
||||||
|
total_overhead <- sum(income$Betriebskosten)
|
||||||
|
total_income <- total_fee + total_overhead
|
||||||
|
View(income)
|
||||||
|
knitr::opts_chunk$set(echo = TRUE)
|
||||||
|
library(tidyverse, warn.conflicts = FALSE)
|
||||||
|
library(DBI, warn.conflicts = FALSE)
|
||||||
|
library(tidyr, warn.conflicts = FALSE)
|
||||||
|
library(dplyr, warn.conflicts = FALSE)
|
||||||
|
YEAR <- 2021
|
||||||
|
HOME <- Sys.getenv("HOME")
|
||||||
|
Sys.setenv(PGHOST = "db.mainscnt.eu",
|
||||||
|
PGDATABASE = "hv2",
|
||||||
|
PGPORT = 5432,
|
||||||
|
PGUSER = "wn",
|
||||||
|
PGSSLMODE = "verify-ca",
|
||||||
|
PGSSLKEY = paste(HOME, "/keys/psql/wn-postgresql-client-2.key", sep=""),
|
||||||
|
PGSSLCERT = paste(HOME, "/keys/psql/wn-postgresql-client-2.crt", sep=""),
|
||||||
|
PGSSLROOTCERT = paste(HOME, "/keys/psql/postgres-ca.crt", sep=""))
|
||||||
|
con <- dbConnect(RPostgres::Postgres())
|
||||||
|
res <- dbSendQuery(con, "
|
||||||
|
select f.description as flat,
|
||||||
|
p.description as premise,
|
||||||
|
aec.description as category,
|
||||||
|
sum(ae.amount) as amount
|
||||||
|
from flat_t f,
|
||||||
|
premise_t p,
|
||||||
|
tenancy_t ty,
|
||||||
|
tenant_t t,
|
||||||
|
account_t a,
|
||||||
|
account_entry_t ae,
|
||||||
|
account_entry_category_t aec
|
||||||
|
where p.id = f.premise and
|
||||||
|
ty.flat = f.id and
|
||||||
|
ty.tenant = t.id and
|
||||||
|
a.id = t.account and
|
||||||
|
ae.account = a.id and
|
||||||
|
aec.id = ae.account_entry_category and
|
||||||
|
ae.fiscal_year = $1 and
|
||||||
|
aec.description in ('Mietzahlung', 'Mietforderung', 'Betriebskostenforderung', 'Betriebskostenausgleich')
|
||||||
|
group by p.description,
|
||||||
|
f.description,
|
||||||
|
aec.description;
|
||||||
|
")
|
||||||
|
dbBind(res, list(YEAR))
|
||||||
|
income <- dbFetch(res)
|
||||||
|
dbClearResult(res)
|
||||||
|
income <- income %>%
|
||||||
|
pivot_wider(names_from = category, values_from = amount) %>%
|
||||||
|
mutate(Miete := -1 * Mietforderung) %>%
|
||||||
|
mutate(Betriebskosten := Mietzahlung - Miete + Betriebskostenausgleich) %>%
|
||||||
|
select(flat, premise, Miete, Betriebskosten) %>%
|
||||||
|
arrange(premise, flat) %>%
|
||||||
|
mutate(across(where(is.numeric), ~num(., digits=2))) %>%
|
||||||
|
mutate(across(where(is.numeric), ~replace(., is.na(.), 0)))
|
||||||
|
knitr::kable(income)
|
||||||
|
total_fee <- sum(income$Miete)
|
||||||
|
total_overhead <- sum(income$Betriebskosten)
|
||||||
|
total_income <- total_fee + total_overhead
|
||||||
|
toString(total_fee)
|
||||||
|
total_fee$value
|
||||||
|
total_fee[1]
|
||||||
|
total_fee[2]
|
||||||
|
total_fee[1]
|
||||||
|
t=total_fee
|
||||||
|
t
|
||||||
|
unnest(t)
|
||||||
|
a <- 6.4234
|
||||||
|
a
|
||||||
|
num(a, digits=2)
|
||||||
|
a
|
||||||
|
format(a, digits=2)
|
||||||
|
format(a, digits=3)
|
||||||
|
a<-100.4234234
|
||||||
|
a
|
||||||
|
format(a, digits=3)
|
||||||
|
format(a, nsmall=2)
|
13
r-scripts/hv2-analysis/hv2-analysis.Rproj
Normal file
13
r-scripts/hv2-analysis/hv2-analysis.Rproj
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
Version: 1.0
|
||||||
|
|
||||||
|
RestoreWorkspace: Default
|
||||||
|
SaveWorkspace: Default
|
||||||
|
AlwaysSaveHistory: Default
|
||||||
|
|
||||||
|
EnableCodeIndexing: Yes
|
||||||
|
UseSpacesForTab: Yes
|
||||||
|
NumSpacesForTab: 2
|
||||||
|
Encoding: UTF-8
|
||||||
|
|
||||||
|
RnwWeave: Sweave
|
||||||
|
LaTeX: pdfLaTeX
|
173
r-scripts/hv2-analysis/income-expense-analysis.Rmd
Normal file
173
r-scripts/hv2-analysis/income-expense-analysis.Rmd
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
---
|
||||||
|
title: "HV2 Jahresabrechnung"
|
||||||
|
author: "Wolfgang Hottgenroth"
|
||||||
|
date: "2022-09-18"
|
||||||
|
output:
|
||||||
|
pdf_document: default
|
||||||
|
html_document: default
|
||||||
|
word_document: default
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
```{r setup, include=FALSE, echo=FALSE, message=FALSE}
|
||||||
|
knitr::opts_chunk$set(echo = FALSE, message=FALSE)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
```{r}
|
||||||
|
library(tidyverse, warn.conflicts = FALSE)
|
||||||
|
library(DBI, warn.conflicts = FALSE)
|
||||||
|
library(tidyr, warn.conflicts = FALSE)
|
||||||
|
library(dplyr, warn.conflicts = FALSE)
|
||||||
|
```
|
||||||
|
|
||||||
|
```{r}
|
||||||
|
YEAR <- 2021
|
||||||
|
|
||||||
|
HOME <- Sys.getenv("HOME")
|
||||||
|
Sys.setenv(PGHOST = "db.mainscnt.eu",
|
||||||
|
PGDATABASE = "hv2",
|
||||||
|
PGPORT = 5432,
|
||||||
|
PGUSER = "wn",
|
||||||
|
PGSSLMODE = "verify-ca",
|
||||||
|
PGSSLKEY = paste(HOME, "/keys/psql/wn-postgresql-client-2.key", sep=""),
|
||||||
|
PGSSLCERT = paste(HOME, "/keys/psql/wn-postgresql-client-2.crt", sep=""),
|
||||||
|
PGSSLROOTCERT = paste(HOME, "/keys/psql/postgres-ca.crt", sep=""))
|
||||||
|
|
||||||
|
|
||||||
|
con <- dbConnect(RPostgres::Postgres())
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
# Übersicht über die Einnahmen
|
||||||
|
|
||||||
|
```{r}
|
||||||
|
res <- dbSendQuery(con, "
|
||||||
|
select f.description as flat,
|
||||||
|
p.description as premise,
|
||||||
|
aec.description as category,
|
||||||
|
sum(ae.amount) as amount
|
||||||
|
from flat_t f,
|
||||||
|
premise_t p,
|
||||||
|
tenancy_t ty,
|
||||||
|
tenant_t t,
|
||||||
|
account_t a,
|
||||||
|
account_entry_t ae,
|
||||||
|
account_entry_category_t aec
|
||||||
|
where p.id = f.premise and
|
||||||
|
ty.flat = f.id and
|
||||||
|
ty.tenant = t.id and
|
||||||
|
a.id = t.account and
|
||||||
|
ae.account = a.id and
|
||||||
|
aec.id = ae.account_entry_category and
|
||||||
|
ae.fiscal_year = $1 and
|
||||||
|
aec.description in ('Mietzahlung', 'Mietforderung', 'Betriebskostenforderung', 'Betriebskostenausgleich')
|
||||||
|
group by p.description,
|
||||||
|
f.description,
|
||||||
|
aec.description;
|
||||||
|
")
|
||||||
|
dbBind(res, list(YEAR))
|
||||||
|
|
||||||
|
income <- dbFetch(res)
|
||||||
|
dbClearResult(res)
|
||||||
|
|
||||||
|
income <- income %>%
|
||||||
|
pivot_wider(names_from = category, values_from = amount) %>%
|
||||||
|
mutate(Miete := -1 * Mietforderung) %>%
|
||||||
|
mutate(Betriebskosten := Mietzahlung - Miete + Betriebskostenausgleich) %>%
|
||||||
|
select(flat, premise, Miete, Betriebskosten) %>%
|
||||||
|
arrange(premise, flat) %>%
|
||||||
|
# mutate(across(where(is.numeric), ~num(., digits=2))) %>%
|
||||||
|
mutate(across(where(is.numeric), ~replace(., is.na(.), 0)))
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
```{r}
|
||||||
|
knitr::kable(income)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
# Übersicht über die Ausgaben
|
||||||
|
|
||||||
|
```{r}
|
||||||
|
|
||||||
|
res <- dbSendQuery(con, "
|
||||||
|
select aec.overhead_relevant as overhead_relevant,
|
||||||
|
aec.description as category,
|
||||||
|
sum(ae.amount) as amount
|
||||||
|
from account_entry_category_t aec,
|
||||||
|
account_entry_t ae
|
||||||
|
where aec.id = ae.account_entry_category and
|
||||||
|
aec.id not in (2, 3, 4, 29) and
|
||||||
|
ae.fiscal_year = $1
|
||||||
|
group by aec.overhead_relevant,
|
||||||
|
aec.description
|
||||||
|
")
|
||||||
|
dbBind(res, list(YEAR))
|
||||||
|
|
||||||
|
expense <- dbFetch(res)
|
||||||
|
dbClearResult(res)
|
||||||
|
|
||||||
|
expense <- expense %>%
|
||||||
|
arrange(overhead_relevant, category) %>%
|
||||||
|
# mutate(across(where(is.numeric), ~num(., digits=2))) %>%
|
||||||
|
mutate(across(where(is.numeric), ~replace(., is.na(.), 0)))
|
||||||
|
```
|
||||||
|
|
||||||
|
```{r}
|
||||||
|
knitr::kable(expense)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Zusammenfassung
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```{r}
|
||||||
|
total_fee <- sum(income$Miete)
|
||||||
|
total_overhead <- sum(income$Betriebskosten)
|
||||||
|
total_income <- total_fee + total_overhead
|
||||||
|
|
||||||
|
total_expense <- sum(expense$amount)
|
||||||
|
overhead_relevant_expense <- expense %>%
|
||||||
|
filter(overhead_relevant == TRUE)
|
||||||
|
total_overhead_relevant_expense <- sum(overhead_relevant_expense$amount)
|
||||||
|
|
||||||
|
total <- total_income + total_expense
|
||||||
|
|
||||||
|
overview.income <- as_tibble(
|
||||||
|
data.frame(
|
||||||
|
"Kategorie" = c("Mieteinnahmen", "Betriebskostenvorauszahlungen", "Einnahmen ingesamt"),
|
||||||
|
"Betrag" = c(total_fee, total_overhead, total_income)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
overview.expense <- as_tibble(
|
||||||
|
data.frame(
|
||||||
|
"Kategorie" = c("Ausgaben insgesamt", "davon Betriebskostenausgaben"),
|
||||||
|
"Betrag" = c(-1 * total_expense, -1 * total_overhead_relevant_expense)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
overview.gain <- as_tibble(
|
||||||
|
data.frame(
|
||||||
|
"Überschuss" = c(total)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Einnahmen
|
||||||
|
```{r}
|
||||||
|
knitr::kable(overview.income)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Ausgaben
|
||||||
|
```{r}
|
||||||
|
knitr::kable(overview.expense)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Überschuss
|
||||||
|
```{r}
|
||||||
|
knitr::kable(overview.gain)
|
||||||
|
```
|
BIN
r-scripts/hv2-analysis/income-expense-analysis.docx
Normal file
BIN
r-scripts/hv2-analysis/income-expense-analysis.docx
Normal file
Binary file not shown.
720
r-scripts/hv2-analysis/income-expense-analysis.html
Normal file
720
r-scripts/hv2-analysis/income-expense-analysis.html
Normal file
File diff suppressed because one or more lines are too long
BIN
r-scripts/hv2-analysis/income-expense-analysis.pdf
Normal file
BIN
r-scripts/hv2-analysis/income-expense-analysis.pdf
Normal file
Binary file not shown.
118
r-scripts/hv2-analysis/income.R
Normal file
118
r-scripts/hv2-analysis/income.R
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
library(tidyverse, warn.conflicts = FALSE)
|
||||||
|
library(DBI, warn.conflicts = FALSE)
|
||||||
|
library(tidyr, warn.conflicts = FALSE)
|
||||||
|
library(dplyr, warn.conflicts = FALSE)
|
||||||
|
# library(lubridate, warn.conflicts = FALSE)
|
||||||
|
# library(R.utils, warn.conflicts = FALSE)
|
||||||
|
|
||||||
|
|
||||||
|
YEAR <- 2021
|
||||||
|
|
||||||
|
HOME <- Sys.getenv("HOME")
|
||||||
|
Sys.setenv(PGHOST = "db.mainscnt.eu",
|
||||||
|
PGDATABASE = "hv2",
|
||||||
|
PGPORT = 5432,
|
||||||
|
PGUSER = "wn",
|
||||||
|
PGSSLMODE = "verify-ca",
|
||||||
|
PGSSLKEY = paste(HOME, "/keys/psql/wn-postgresql-client-2.key", sep=""),
|
||||||
|
PGSSLCERT = paste(HOME, "/keys/psql/wn-postgresql-client-2.crt", sep=""),
|
||||||
|
PGSSLROOTCERT = paste(HOME, "/keys/psql/postgres-ca.crt", sep=""))
|
||||||
|
|
||||||
|
con <- dbConnect(RPostgres::Postgres())
|
||||||
|
|
||||||
|
res <- dbSendQuery(con, "
|
||||||
|
select f.description as flat,
|
||||||
|
p.description as premise,
|
||||||
|
aec.description as category,
|
||||||
|
sum(ae.amount) as amount
|
||||||
|
from flat_t f,
|
||||||
|
premise_t p,
|
||||||
|
tenancy_t ty,
|
||||||
|
tenant_t t,
|
||||||
|
account_t a,
|
||||||
|
account_entry_t ae,
|
||||||
|
account_entry_category_t aec
|
||||||
|
where p.id = f.premise and
|
||||||
|
ty.flat = f.id and
|
||||||
|
ty.tenant = t.id and
|
||||||
|
a.id = t.account and
|
||||||
|
ae.account = a.id and
|
||||||
|
aec.id = ae.account_entry_category and
|
||||||
|
ae.fiscal_year = $1 and
|
||||||
|
aec.description in ('Mietzahlung', 'Mietforderung', 'Betriebskostenforderung', 'Betriebskostenausgleich')
|
||||||
|
group by p.description,
|
||||||
|
f.description,
|
||||||
|
aec.description;
|
||||||
|
")
|
||||||
|
dbBind(res, list(YEAR))
|
||||||
|
|
||||||
|
income <- dbFetch(res)
|
||||||
|
dbClearResult(res)
|
||||||
|
|
||||||
|
income <- income %>%
|
||||||
|
pivot_wider(names_from = category, values_from = amount) %>%
|
||||||
|
mutate(Miete := -1 * Mietforderung) %>%
|
||||||
|
mutate(Betriebskosten := Mietzahlung - Miete + Betriebskostenausgleich) %>%
|
||||||
|
select(flat, premise, Miete, Betriebskosten) %>%
|
||||||
|
arrange(premise, flat) %>%
|
||||||
|
mutate(across(where(is.numeric), ~num(., digits=2))) %>%
|
||||||
|
mutate(across(where(is.numeric), ~replace(., is.na(.), 0)))
|
||||||
|
|
||||||
|
|
||||||
|
total_fee <- sum(income$Miete)
|
||||||
|
total_overhead <- sum(income$Betriebskosten)
|
||||||
|
total_income <- total_fee + total_overhead
|
||||||
|
|
||||||
|
|
||||||
|
res <- dbSendQuery(con, "
|
||||||
|
select aec.overhead_relevant as overhead_relevant,
|
||||||
|
aec.description as category,
|
||||||
|
sum(ae.amount) as amount
|
||||||
|
from account_entry_category_t aec,
|
||||||
|
account_entry_t ae
|
||||||
|
where aec.id = ae.account_entry_category and
|
||||||
|
aec.id not in (2, 3, 4, 29) and
|
||||||
|
ae.fiscal_year = $1
|
||||||
|
group by aec.overhead_relevant,
|
||||||
|
aec.description
|
||||||
|
")
|
||||||
|
dbBind(res, list(YEAR))
|
||||||
|
|
||||||
|
expense <- dbFetch(res)
|
||||||
|
dbClearResult(res)
|
||||||
|
|
||||||
|
expense <- expense %>%
|
||||||
|
arrange(overhead_relevant, category) #%>%
|
||||||
|
#mutate(across(where(is.numeric), ~num(., digits=2))) #%>%
|
||||||
|
#mutate(across(where(is.numeric), ~replace(., is.na(.), 0)))
|
||||||
|
|
||||||
|
total_expense <- sum(expense$amount)
|
||||||
|
|
||||||
|
overhead_relevant_expense <- expense %>%
|
||||||
|
filter(overhead_relevant == TRUE)
|
||||||
|
|
||||||
|
total_overhead_relevant_expense <- sum(overhead_relevant_expense$amount)
|
||||||
|
|
||||||
|
print("Einkuenfte pro Wohnung")
|
||||||
|
print(income)
|
||||||
|
|
||||||
|
print("Einkuenfte Miete")
|
||||||
|
print(total_fee)
|
||||||
|
print("Einkuenfte Betriebskosten")
|
||||||
|
print(total_overhead)
|
||||||
|
print("Einkuenfte Total")
|
||||||
|
print(total_income)
|
||||||
|
|
||||||
|
print("Ausgaben")
|
||||||
|
print(expense)
|
||||||
|
|
||||||
|
print(total_expense)
|
||||||
|
|
||||||
|
print("davon betriebskosten-relevant")
|
||||||
|
print(total_overhead_relevant_expense)
|
||||||
|
|
||||||
|
profit <- total_income + total_expense
|
||||||
|
print("Überschuss")
|
||||||
|
print(profit)
|
||||||
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
## Tools and Templates
|
## Tools and Templates
|
||||||
|
|
||||||
|
* venv for Python tools is used, remember to activate, install dependencies via ``requirements.txt``, keep it up to date using ``pip freeze > requirements.txt``
|
||||||
* all tools provide should work on Linux and on Windows, shell scripts are avoided
|
* all tools provide should work on Linux and on Windows, shell scripts are avoided
|
||||||
* templates files must be generated at development time, generated files must be put into the repository
|
* templates files must be generated at development time, generated files must be put into the repository
|
||||||
* use ``generate.py`` in the umbrella project's root without any arguments to generate all template files in all subdirectories using the ``schema.json`` from the umbrella project's root
|
* use ``generate.py`` in the umbrella project's root without any arguments to generate all template files in all subdirectories using the ``schema.json`` from the umbrella project's root
|
||||||
@ -14,3 +15,5 @@
|
|||||||
* make sure these configuration files are not added to the repository, they contain secrets
|
* make sure these configuration files are not added to the repository, they contain secrets
|
||||||
* in the development environment the API will answer at ``http://localhost:8080``, the Swagger-UI is available at ``http://localhost:8080/ui``
|
* in the development environment the API will answer at ``http://localhost:8080``, the Swagger-UI is available at ``http://localhost:8080/ui``
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
Cheetah3==3.2.6.post1
|
27
schema.json
27
schema.json
@ -33,6 +33,7 @@
|
|||||||
{ "name": "street", "sqltype": "varchar(128)", "notnull": true },
|
{ "name": "street", "sqltype": "varchar(128)", "notnull": true },
|
||||||
{ "name": "zip", "sqltype": "varchar(10)", "notnull": true },
|
{ "name": "zip", "sqltype": "varchar(10)", "notnull": true },
|
||||||
{ "name": "city", "sqltype": "varchar(128)", "notnull": true },
|
{ "name": "city", "sqltype": "varchar(128)", "notnull": true },
|
||||||
|
{ "name": "minus_area", "sqltype": "numeric(10,2)", "notnull": true, "default": 0},
|
||||||
{ "name": "account", "sqltype": "integer", "notnull": true, "foreignkey": true, "immutable": true, "unique": true }
|
{ "name": "account", "sqltype": "integer", "notnull": true, "foreignkey": true, "immutable": true, "unique": true }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -79,7 +80,8 @@
|
|||||||
"name": "commercial_premise",
|
"name": "commercial_premise",
|
||||||
"columns": [
|
"columns": [
|
||||||
{ "name": "description", "sqltype": "varchar(128)", "selector": 1 },
|
{ "name": "description", "sqltype": "varchar(128)", "selector": 1 },
|
||||||
{ "name": "premise", "sqltype": "integer", "foreignkey": true, "selector": 0 }
|
{ "name": "premise", "sqltype": "integer", "foreignkey": true, "selector": 0 },
|
||||||
|
{ "name": "area", "sqltype": "numeric(10,2)", "notnull": false }
|
||||||
],
|
],
|
||||||
"tableConstraints": [
|
"tableConstraints": [
|
||||||
"unique(description, premise)"
|
"unique(description, premise)"
|
||||||
@ -127,7 +129,8 @@
|
|||||||
"immutable": true,
|
"immutable": true,
|
||||||
"columns": [
|
"columns": [
|
||||||
{ "name": "description", "sqltype": "varchar(128)", "notnull": true, "selector": 0, "unique": true },
|
{ "name": "description", "sqltype": "varchar(128)", "notnull": true, "selector": 0, "unique": true },
|
||||||
{ "name": "overhead_relevant", "sqltype": "boolean", "notnull": true, "default": "true" }
|
{ "name": "considerMinusArea", "sqltype": "boolean", "notnull": true, "default": true },
|
||||||
|
{ "name": "overhead_relevant", "sqltype": "boolean", "notnull": true, "default": true }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -136,8 +139,9 @@
|
|||||||
"columns": [
|
"columns": [
|
||||||
{ "name": "description", "sqltype": "varchar(1024)", "notnull": true },
|
{ "name": "description", "sqltype": "varchar(1024)", "notnull": true },
|
||||||
{ "name": "account", "sqltype": "integer", "notnull": true, "foreignkey": true },
|
{ "name": "account", "sqltype": "integer", "notnull": true, "foreignkey": true },
|
||||||
{ "name": "created_at", "sqltype": "timestamp", "notnull": true, "default": "now()" },
|
{ "name": "created_at", "sqltype": "timestamp", "notnull": true, "default": "now()", "selector": 0 },
|
||||||
{ "name": "amount", "sqltype": "numeric(10,2)", "notnull": true, "selector": 0 },
|
{ "name": "fiscal_year", "sqltype": "integer", "notnull": true },
|
||||||
|
{ "name": "amount", "sqltype": "numeric(10,2)", "notnull": true },
|
||||||
{ "name": "document_no", "sqltype": "integer", "unique": true },
|
{ "name": "document_no", "sqltype": "integer", "unique": true },
|
||||||
{ "name": "account_entry_category", "sqltype": "integer", "notnull": true, "foreignkey": true }
|
{ "name": "account_entry_category", "sqltype": "integer", "notnull": true, "foreignkey": true }
|
||||||
],
|
],
|
||||||
@ -149,10 +153,23 @@
|
|||||||
"name": "note",
|
"name": "note",
|
||||||
"immutable": true,
|
"immutable": true,
|
||||||
"columns": [
|
"columns": [
|
||||||
{ "name": "created_at", "sqltype": "timestamp", "notnull": true, "default": "now()" },
|
{ "name": "created_at", "sqltype": "timestamp", "notnull": true, "default": "now()", "selector": 0 },
|
||||||
{ "name": "tenant", "sqltype": "integer", "notnull": true, "foreignkey": true },
|
{ "name": "tenant", "sqltype": "integer", "notnull": true, "foreignkey": true },
|
||||||
{ "name": "note", "sqltype": "varchar(4096)", "notnull": true }
|
{ "name": "note", "sqltype": "varchar(4096)", "notnull": true }
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "contract",
|
||||||
|
"immutable": false,
|
||||||
|
"columns": [
|
||||||
|
{ "name": "supplier", "sqltype": "varchar(256)", "notnull": true, "selector": 0 },
|
||||||
|
{ "name": "content", "sqltype": "varchar(256)", "notnull": true, "selector": 1 },
|
||||||
|
{ "name": "identifier", "sqltype": "varchar(256)", "notnull": true },
|
||||||
|
{ "name": "notes", "sqltype": "varchar(4096)", "notnull": false }
|
||||||
|
],
|
||||||
|
"tableConstraints": [
|
||||||
|
"unique(supplier, content)"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
92
schema/account-statement.sql
Normal file
92
schema/account-statement.sql
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
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,
|
||||||
|
ac.description as account,
|
||||||
|
ae.is_reference as is_reference,
|
||||||
|
bac.description as base_account
|
||||||
|
from joined_account_entry_v ae,
|
||||||
|
account_entry_category_t aec,
|
||||||
|
account_t ac,
|
||||||
|
account_t bac
|
||||||
|
where ae.account_entry_category = aec.id and
|
||||||
|
ae.account = ac.id and
|
||||||
|
ae.base_account = bac.id and
|
||||||
|
ac.id = 1000
|
||||||
|
order by created_at;
|
||||||
|
|
||||||
|
grant select on account_statement_v to hv2;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
create or replace view income_v as
|
||||||
|
select f.description as flat,
|
||||||
|
p.description as premise,
|
||||||
|
ae.amount as amount,
|
||||||
|
ty.id as tenancy_id,
|
||||||
|
t.lastname as tenant
|
||||||
|
|
||||||
|
|
||||||
|
from flat_t f,
|
||||||
|
premise_t p,
|
||||||
|
tenancy_t ty,
|
||||||
|
tenant_t t,
|
||||||
|
account_entry_t ae,
|
||||||
|
account_entry_category_t aec
|
||||||
|
|
||||||
|
where p.id = f.premise and
|
||||||
|
f.id = ty.flat and
|
||||||
|
t.id = ty.tenant and
|
||||||
|
ae.id = t.account and
|
||||||
|
aec.id = ae.account_entry_category and
|
||||||
|
aec.description = 'Mietzahlung' and
|
||||||
|
ae.fiscal_year = 2021
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
select f.description as flat,
|
||||||
|
p.description as premise,
|
||||||
|
--ty.id as tenancy_id,
|
||||||
|
--t.lastname || ', ' || t.firstname as tenant,
|
||||||
|
--a.description as account,
|
||||||
|
aec.description as category,
|
||||||
|
sum(ae.amount) as amount
|
||||||
|
from flat_t f,
|
||||||
|
premise_t p,
|
||||||
|
tenancy_t ty,
|
||||||
|
tenant_t t,
|
||||||
|
account_t a,
|
||||||
|
account_entry_t ae,
|
||||||
|
account_entry_category_t aec
|
||||||
|
where p.id = f.premise and
|
||||||
|
ty.flat = f.id and
|
||||||
|
ty.tenant = t.id and
|
||||||
|
a.id = t.account and
|
||||||
|
ae.account = a.id and
|
||||||
|
aec.id = ae.account_entry_category and
|
||||||
|
ae.fiscal_year = 2021 and
|
||||||
|
aec.description in ('Mietzahlung', 'Mietforderung', 'Betriebskostenforderung')
|
||||||
|
|
||||||
|
group by p.description,
|
||||||
|
f.description,
|
||||||
|
aec.description
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
select aec.overhead_relevant as overhead_relevant,
|
||||||
|
aec.description as category,
|
||||||
|
sum(ae.amount) as amount
|
||||||
|
from account_entry_category_t aec,
|
||||||
|
account_entry_t ae
|
||||||
|
where aec.id = ae.account_entry_category and
|
||||||
|
aec.id not in (2, 3, 4, 29) and
|
||||||
|
ae.fiscal_year = 2021
|
||||||
|
group by aec.overhead_relevant,
|
||||||
|
aec.description
|
||||||
|
order by aec.overhead_relevant;
|
11
schema/changes-contract.sql
Normal file
11
schema/changes-contract.sql
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
CREATE TABLE contract_t (
|
||||||
|
id serial not null primary key
|
||||||
|
,supplier varchar(256) not null
|
||||||
|
,content varchar(256) not null
|
||||||
|
,identifier varchar(256) not null
|
||||||
|
,unique(supplier, content)
|
||||||
|
);
|
||||||
|
|
||||||
|
GRANT SELECT, INSERT, UPDATE ON contract_t TO hv2;
|
||||||
|
GRANT SELECT, UPDATE ON contract_t_id_seq TO hv2;
|
126
schema/changes02.sql
Normal file
126
schema/changes02.sql
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
CREATE TABLE account_entry_reference_t (
|
||||||
|
id serial not null primary key,
|
||||||
|
account integer not null references account_t (id),
|
||||||
|
account_entry integer not null references account_entry_t (id)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE OR REPLACE VIEW joined_account_entry_v AS
|
||||||
|
SELECT ae.id as id,
|
||||||
|
ae.description as description,
|
||||||
|
ae.account as account,
|
||||||
|
ae.created_at as created_at,
|
||||||
|
ae.amount as amount,
|
||||||
|
ae.account_entry_category as account_entry_category,
|
||||||
|
ae.document_no as document_no,
|
||||||
|
ae.fiscal_year as fiscal_year,
|
||||||
|
false as is_reference,
|
||||||
|
0 as base_account
|
||||||
|
FROM account_entry_t ae
|
||||||
|
UNION
|
||||||
|
SELECT ae.id as id,
|
||||||
|
ae.description as description,
|
||||||
|
aer.account as account,
|
||||||
|
ae.created_at as created_at,
|
||||||
|
ae.amount as amount,
|
||||||
|
ae.account_entry_category as account_entry_category,
|
||||||
|
ae.document_no as document_no,
|
||||||
|
ae.fiscal_year as fiscal_year,
|
||||||
|
true as is_reference,
|
||||||
|
ae.account as base_account
|
||||||
|
FROM account_entry_t ae,
|
||||||
|
account_entry_reference_t aer
|
||||||
|
WHERE ae.id = aer.account_entry;
|
||||||
|
|
||||||
|
update account_t set description = 'fallback_account' where id = 33;
|
||||||
|
delete from account_t where id = 32;
|
||||||
|
|
||||||
|
insert into account_t (id, description) values (1000, 'ledger');
|
||||||
|
|
||||||
|
update account_entry_t set amount = amount * -1.0 where account=33;
|
||||||
|
update account_entry_t set amount = amount * -1.0 where account in (34,35,36,37);
|
||||||
|
|
||||||
|
|
||||||
|
DO $$
|
||||||
|
DECLARE
|
||||||
|
entry_id integer;
|
||||||
|
BEGIN
|
||||||
|
RAISE NOTICE 'Start migration';
|
||||||
|
|
||||||
|
FOR entry_id IN
|
||||||
|
SELECT id
|
||||||
|
FROM account_entry_t
|
||||||
|
WHERE account IN (33,34,35,36,37)
|
||||||
|
LOOP
|
||||||
|
RAISE NOTICE 'About to migrate entry %', entry_id;
|
||||||
|
INSERT INTO account_entry_reference_t (account, account_entry) VALUES (1000, entry_id);
|
||||||
|
END LOOP;
|
||||||
|
END;
|
||||||
|
$$;
|
||||||
|
|
||||||
|
update account_entry_t
|
||||||
|
set description = 'Miete ' || extract(year from created_at)::text || ' ' || to_char(to_date(extract(month from created_at)::text, 'MM'), 'Month')
|
||||||
|
where account_entry_category = 2 and description = 'Miete';
|
||||||
|
|
||||||
|
|
||||||
|
DO $$
|
||||||
|
DECLARE
|
||||||
|
entry RECORD;
|
||||||
|
tenant RECORD;
|
||||||
|
BEGIN
|
||||||
|
RAISE NOTICE 'Start migration of tenant accounts';
|
||||||
|
|
||||||
|
FOR entry IN
|
||||||
|
SELECT id, description, account
|
||||||
|
FROM account_entry_t
|
||||||
|
WHERE account_entry_category = 2
|
||||||
|
LOOP
|
||||||
|
RAISE NOTICE 'About to migrate entry %', entry.id;
|
||||||
|
INSERT INTO account_entry_reference_t (account, account_entry) VALUES (1000, entry.id);
|
||||||
|
SELECT *
|
||||||
|
INTO tenant
|
||||||
|
FROM tenant_t
|
||||||
|
WHERE account = entry.account;
|
||||||
|
RAISE NOTICE 'Tenant: % %', tenant.firstname, tenant.lastname;
|
||||||
|
UPDATE account_entry_t
|
||||||
|
SET description = description || ' ' || tenant.firstname || ' ' || tenant.lastname
|
||||||
|
WHERE id = entry.id;
|
||||||
|
END LOOP;
|
||||||
|
END;
|
||||||
|
$$;
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION maintain_ledger()
|
||||||
|
RETURNS TRIGGER
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
AS $$
|
||||||
|
DECLARE
|
||||||
|
tenant RECORD;
|
||||||
|
adjusted_description text;
|
||||||
|
BEGIN
|
||||||
|
IF ((NEW.description = 'Miete') AND (NEW.account_entry_category = 2)) THEN
|
||||||
|
SELECT firstname, lastname
|
||||||
|
INTO tenant
|
||||||
|
FROM tenant_t
|
||||||
|
WHERE account = NEW.account;
|
||||||
|
adjusted_description := 'Miete ' || extract(year from NEW.created_at)::text || ' ' || to_char(to_date(extract(month from NEW.created_at)::text, 'MM'), 'Month') || tenant.firstname || ' ' || tenant.lastname;
|
||||||
|
UPDATE account_entry_t
|
||||||
|
SET description = adjusted_description
|
||||||
|
WHERE id = NEW.id;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
INSERT INTO account_entry_reference_t (account, account_entry) VALUES (1000, NEW.id);
|
||||||
|
RETURN NEW;
|
||||||
|
END;
|
||||||
|
$$;
|
||||||
|
|
||||||
|
CREATE TRIGGER maintain_ledger_trigger
|
||||||
|
AFTER INSERT ON account_entry_t
|
||||||
|
FOR EACH ROW
|
||||||
|
WHEN (NEW.account != 1000 AND NEW.account_entry_category NOT IN (3, 4, 29))
|
||||||
|
EXECUTE FUNCTION maintain_ledger();
|
||||||
|
|
||||||
|
|
||||||
|
grant select, update on account_entry_reference_t_id_seq to hv2;
|
||||||
|
grant insert on account_entry_reference_t to hv2;
|
||||||
|
grant update on account_entry_t to hv2;
|
||||||
|
|
@ -39,6 +39,7 @@ CREATE TABLE premise_t (
|
|||||||
,street varchar(128) not null
|
,street varchar(128) not null
|
||||||
,zip varchar(10) not null
|
,zip varchar(10) not null
|
||||||
,city varchar(128) 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
|
,account integer not null references account_t (id) unique
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -91,6 +92,7 @@ CREATE TABLE commercial_premise_t (
|
|||||||
id serial not null primary key
|
id serial not null primary key
|
||||||
,description varchar(128)
|
,description varchar(128)
|
||||||
,premise integer references premise_t (id)
|
,premise integer references premise_t (id)
|
||||||
|
,area numeric(10,2)
|
||||||
,unique(description, premise)
|
,unique(description, premise)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -138,7 +140,8 @@ GRANT SELECT, UPDATE ON tenancy_fee_mapping_t_id_seq TO hv2;
|
|||||||
CREATE TABLE account_entry_category_t (
|
CREATE TABLE account_entry_category_t (
|
||||||
id serial not null primary key
|
id serial not null primary key
|
||||||
,description varchar(128) not null unique
|
,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;
|
GRANT SELECT, INSERT ON account_entry_category_t TO hv2;
|
||||||
@ -149,6 +152,7 @@ CREATE TABLE account_entry_t (
|
|||||||
,description varchar(1024) not null
|
,description varchar(1024) not null
|
||||||
,account integer not null references account_t (id)
|
,account integer not null references account_t (id)
|
||||||
,created_at timestamp not null default now()
|
,created_at timestamp not null default now()
|
||||||
|
,fiscal_year integer not null
|
||||||
,amount numeric(10,2) not null
|
,amount numeric(10,2) not null
|
||||||
,document_no integer unique
|
,document_no integer unique
|
||||||
,account_entry_category integer not null references account_entry_category_t (id)
|
,account_entry_category integer not null references account_entry_category_t (id)
|
||||||
@ -168,6 +172,18 @@ CREATE TABLE note_t (
|
|||||||
GRANT SELECT, INSERT ON note_t TO hv2;
|
GRANT SELECT, INSERT ON note_t TO hv2;
|
||||||
GRANT SELECT, UPDATE ON note_t_id_seq TO hv2;
|
GRANT SELECT, UPDATE ON note_t_id_seq TO hv2;
|
||||||
|
|
||||||
|
CREATE TABLE contract_t (
|
||||||
|
id serial not null primary key
|
||||||
|
,supplier varchar(256) not null
|
||||||
|
,content varchar(256) not null
|
||||||
|
,identifier varchar(256) not null
|
||||||
|
,notes varchar(4096)
|
||||||
|
,unique(supplier, content)
|
||||||
|
);
|
||||||
|
|
||||||
|
GRANT SELECT, INSERT, UPDATE ON contract_t TO hv2;
|
||||||
|
GRANT SELECT, UPDATE ON contract_t_id_seq TO hv2;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
17420
ui/hv2-ui/package-lock.json
generated
17420
ui/hv2-ui/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -37,8 +37,6 @@
|
|||||||
"@types/jasmine": "~3.6.0",
|
"@types/jasmine": "~3.6.0",
|
||||||
"@types/node": "^12.11.1",
|
"@types/node": "^12.11.1",
|
||||||
"codelyzer": "^6.0.0",
|
"codelyzer": "^6.0.0",
|
||||||
"jasmine-core": "~3.6.0",
|
|
||||||
"jasmine-spec-reporter": "~5.0.0",
|
|
||||||
"karma": "~5.1.0",
|
"karma": "~5.1.0",
|
||||||
"karma-chrome-launcher": "~3.1.0",
|
"karma-chrome-launcher": "~3.1.0",
|
||||||
"karma-coverage": "~2.0.3",
|
"karma-coverage": "~2.0.3",
|
||||||
|
@ -6,9 +6,13 @@
|
|||||||
<mat-datepicker-toggle matSuffix [for]="createdAtPicker"></mat-datepicker-toggle>
|
<mat-datepicker-toggle matSuffix [for]="createdAtPicker"></mat-datepicker-toggle>
|
||||||
<mat-datepicker #createdAtPicker></mat-datepicker>
|
<mat-datepicker #createdAtPicker></mat-datepicker>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field appearance="outline" *ngIf="!shallBeRentPayment">
|
<mat-form-field appearance="outline">
|
||||||
|
<mat-label>Jahr</mat-label>
|
||||||
|
<input matInput type="number" name="fiscalYear" [formControl]="presetFiscalYear" ngModel/>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline">
|
||||||
<mat-label>Kategorie</mat-label>
|
<mat-label>Kategorie</mat-label>
|
||||||
<mat-select ngModel name="category" [disabled]="shallBeRentPayment">
|
<mat-select ngModel name="category" [formControl]="presetCategory" >
|
||||||
<mat-option *ngFor="let p of accountEntryCategories" [value]="p.id">{{p.description}}</mat-option>
|
<mat-option *ngFor="let p of accountEntryCategories" [value]="p.id">{{p.description}}</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
@ -18,7 +22,7 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<mat-label>Beschreibung</mat-label>
|
<mat-label>Beschreibung</mat-label>
|
||||||
<input matInput name="description" ngModel/>
|
<input matInput name="description" [formControl]="presetDescription" ngModel/>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<button #addAccountEntryButton type="submit" mat-raised-button color="primary">Buchung speichern</button>
|
<button #addAccountEntryButton type="submit" mat-raised-button color="primary">Buchung speichern</button>
|
||||||
</form>
|
</form>
|
||||||
@ -32,6 +36,10 @@ Saldo: {{saldo?.saldo | number:'1.2-2'}} €
|
|||||||
<th mat-header-cell *matHeaderCellDef >Datum</th>
|
<th mat-header-cell *matHeaderCellDef >Datum</th>
|
||||||
<td mat-cell *matCellDef="let element">{{element.rawAccountEntry.created_at | date}}</td>
|
<td mat-cell *matCellDef="let element">{{element.rawAccountEntry.created_at | date}}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="fiscalYear">
|
||||||
|
<th mat-header-cell *matHeaderCellDef >Jahr</th>
|
||||||
|
<td mat-cell *matCellDef="let element">{{element.rawAccountEntry.fiscal_year}}</td>
|
||||||
|
</ng-container>
|
||||||
<ng-container matColumnDef="description">
|
<ng-container matColumnDef="description">
|
||||||
<th mat-header-cell *matHeaderCellDef>Beschreibung</th>
|
<th mat-header-cell *matHeaderCellDef>Beschreibung</th>
|
||||||
<td mat-cell *matCellDef="let element">{{element.rawAccountEntry.description}}</td>
|
<td mat-cell *matCellDef="let element">{{element.rawAccountEntry.description}}</td>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { ViewFlags } from '@angular/compiler/src/core';
|
import { ViewFlags } from '@angular/compiler/src/core';
|
||||||
import { Component, Input, OnInit, OnChanges, ViewChild } from '@angular/core';
|
import { Component, Input, OnInit, OnChanges, ViewChild } from '@angular/core';
|
||||||
|
import { FormControl } from '@angular/forms';
|
||||||
import { MatButton } from '@angular/material/button';
|
import { MatButton } from '@angular/material/button';
|
||||||
import { MatExpansionPanel } from '@angular/material/expansion';
|
import { MatExpansionPanel } from '@angular/material/expansion';
|
||||||
import { MatTableDataSource } from '@angular/material/table';
|
import { MatTableDataSource } from '@angular/material/table';
|
||||||
@ -30,17 +31,20 @@ export class AccountComponent implements OnInit {
|
|||||||
@Input() shallBeRentPayment: boolean
|
@Input() shallBeRentPayment: boolean
|
||||||
@ViewChild('addAccountEntryButton') addAccountEntryButton: MatButton
|
@ViewChild('addAccountEntryButton') addAccountEntryButton: MatButton
|
||||||
|
|
||||||
|
|
||||||
account: Account
|
account: Account
|
||||||
accountEntries: DN_AccountEntry[]
|
accountEntries: DN_AccountEntry[]
|
||||||
accountEntriesDataSource: MatTableDataSource<DN_AccountEntry>
|
accountEntriesDataSource: MatTableDataSource<DN_AccountEntry>
|
||||||
accountEntriesDisplayedColumns: string[] = [ "description", "document_no", "amount", "createdAt", "category", "overhead_relevant" ]
|
accountEntriesDisplayedColumns: string[] = [ "description", "document_no", "amount", "createdAt", "fiscalYear", "category", "overhead_relevant" ]
|
||||||
saldo: Saldo
|
saldo: Saldo
|
||||||
|
|
||||||
accountEntryCategories: AccountEntryCategory[]
|
accountEntryCategories: AccountEntryCategory[]
|
||||||
accountEntryCategoriesMap: Map<number, AccountEntryCategory>
|
accountEntryCategoriesMap: Map<number, AccountEntryCategory>
|
||||||
accountEntryCategoriesInverseMap: Map<string, AccountEntryCategory>
|
accountEntryCategoriesInverseMap: Map<string, AccountEntryCategory>
|
||||||
|
|
||||||
|
presetFiscalYear: FormControl
|
||||||
|
presetCategory: FormControl
|
||||||
|
presetDescription: FormControl
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private accountService: AccountService,
|
private accountService: AccountService,
|
||||||
@ -95,21 +99,14 @@ export class AccountComponent implements OnInit {
|
|||||||
let uniquenumber: UniqueNumber = await this.extApiService.getUniqueNumber();
|
let uniquenumber: UniqueNumber = await this.extApiService.getUniqueNumber();
|
||||||
this.messageService.add(`Got unique number as document_no: ${uniquenumber.number}`)
|
this.messageService.add(`Got unique number as document_no: ${uniquenumber.number}`)
|
||||||
let newAccountEntry: AccountEntry = {
|
let newAccountEntry: AccountEntry = {
|
||||||
description: formData.value.description,
|
description: this.presetDescription.value,
|
||||||
account: this.account.id,
|
account: this.account.id,
|
||||||
created_at: formData.value.createdAt,
|
created_at: formData.value.createdAt,
|
||||||
|
fiscal_year: this.presetFiscalYear.value,
|
||||||
amount: formData.value.amount,
|
amount: formData.value.amount,
|
||||||
id: 0,
|
id: 0,
|
||||||
document_no: uniquenumber.number,
|
document_no: uniquenumber.number,
|
||||||
account_entry_category: 0
|
account_entry_category: this.presetCategory.value
|
||||||
}
|
|
||||||
|
|
||||||
if (this.shallBeRentPayment) {
|
|
||||||
newAccountEntry.account_entry_category = this.accountEntryCategoriesInverseMap.get('Mietzahlung').id
|
|
||||||
this.messageService.add(`shall be rentpayment, category is ${newAccountEntry.account_entry_category}`)
|
|
||||||
} else {
|
|
||||||
newAccountEntry.account_entry_category = formData.value.category
|
|
||||||
this.messageService.add(`category is ${newAccountEntry.account_entry_category}`)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.messageService.add(`addAccountEntry: ${ JSON.stringify(newAccountEntry, undefined, 4) }`)
|
this.messageService.add(`addAccountEntry: ${ JSON.stringify(newAccountEntry, undefined, 4) }`)
|
||||||
@ -143,9 +140,29 @@ export class AccountComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async init(): Promise<void> {
|
private async init(): Promise<void> {
|
||||||
|
this.messageService.add(`AccountComponent.init start, account: ${this.selectedAccountId}`)
|
||||||
|
let currentDate = new Date()
|
||||||
|
let y = currentDate.getFullYear()
|
||||||
|
this.presetFiscalYear = new FormControl(y)
|
||||||
|
|
||||||
|
this.messageService.add(`AccountComponent.init a, account: ${this.selectedAccountId}`)
|
||||||
|
await this.getAccountEntryCategories()
|
||||||
|
|
||||||
|
if (this.shallBeRentPayment) {
|
||||||
|
this.messageService.add(`AccountComponent.init b, account: ${this.selectedAccountId}`)
|
||||||
|
this.presetCategory = new FormControl(this.accountEntryCategoriesInverseMap.get('Mietzahlung').id)
|
||||||
|
this.messageService.add(`AccountComponent.init c, account: ${this.selectedAccountId}`)
|
||||||
|
this.presetDescription = new FormControl("Miete")
|
||||||
|
this.messageService.add(`shall be rentpayment`)
|
||||||
|
this.messageService.add(`AccountComponent.init d, account: ${this.selectedAccountId}`)
|
||||||
|
} else {
|
||||||
|
this.presetCategory = new FormControl()
|
||||||
|
this.presetDescription = new FormControl()
|
||||||
|
}
|
||||||
|
|
||||||
this.messageService.add(`AccountComponent.init, account: ${this.selectedAccountId}`)
|
this.messageService.add(`AccountComponent.init, account: ${this.selectedAccountId}`)
|
||||||
this.getAccount()
|
this.getAccount()
|
||||||
await this.getAccountEntryCategories()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
@ -156,5 +173,4 @@ export class AccountComponent implements OnInit {
|
|||||||
this.init()
|
this.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,11 +20,14 @@ import { FeeDetailsComponent } from './fee-details/fee-details.component';
|
|||||||
import { EnterPaymentComponent } from './enter-payment/enter-payment.component';
|
import { EnterPaymentComponent } from './enter-payment/enter-payment.component';
|
||||||
import { HomeComponent } from './home/home.component';
|
import { HomeComponent } from './home/home.component';
|
||||||
import { LedgerComponent } from './ledger/ledger.component';
|
import { LedgerComponent } from './ledger/ledger.component';
|
||||||
|
import { ContractComponent } from './contract/contract.component';
|
||||||
|
import { MyContractsComponent } from './my-contracts/my-contracts.component';
|
||||||
|
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{ path: 'tenants', component: MyTenantsComponent, canActivate: [ AuthGuardService ] },
|
{ path: 'tenants', component: MyTenantsComponent, canActivate: [ AuthGuardService ] },
|
||||||
{ path: 'premises', component: MyPremisesComponent, canActivate: [ AuthGuardService ] },
|
{ path: 'premises', component: MyPremisesComponent, canActivate: [ AuthGuardService ] },
|
||||||
|
{ path: 'contracts', component: MyContractsComponent, canActivate: [ AuthGuardService ] },
|
||||||
{ path: 'flats', component: MyFlatsComponent, canActivate: [ AuthGuardService ] },
|
{ path: 'flats', component: MyFlatsComponent, canActivate: [ AuthGuardService ] },
|
||||||
{ path: 'parkings', component: MyParkingsComponent, canActivate: [ AuthGuardService ] },
|
{ path: 'parkings', component: MyParkingsComponent, canActivate: [ AuthGuardService ] },
|
||||||
{ path: 'commercialunits', component: MyCommercialUnitsComponent, canActivate: [ AuthGuardService ] },
|
{ path: 'commercialunits', component: MyCommercialUnitsComponent, canActivate: [ AuthGuardService ] },
|
||||||
@ -46,6 +49,8 @@ const routes: Routes = [
|
|||||||
{ path: 'fee', component: FeeDetailsComponent, canActivate: [ AuthGuardService ] },
|
{ path: 'fee', component: FeeDetailsComponent, canActivate: [ AuthGuardService ] },
|
||||||
{ path: 'enterPayment', component: EnterPaymentComponent, canActivate: [ AuthGuardService ] },
|
{ path: 'enterPayment', component: EnterPaymentComponent, canActivate: [ AuthGuardService ] },
|
||||||
{ path: 'ledger', component: LedgerComponent, canActivate: [ AuthGuardService ] },
|
{ path: 'ledger', component: LedgerComponent, canActivate: [ AuthGuardService ] },
|
||||||
|
{ path: 'contract', component: ContractComponent, canActivate: [ AuthGuardService ] },
|
||||||
|
{ path: 'contract/:id', component: ContractComponent, canActivate: [ AuthGuardService ] },
|
||||||
{ path: 'home', component: HomeComponent },
|
{ path: 'home', component: HomeComponent },
|
||||||
{ path: 'logout', component: LogoutComponent },
|
{ path: 'logout', component: LogoutComponent },
|
||||||
{ path: 'login', component: LoginComponent },
|
{ path: 'login', component: LoginComponent },
|
||||||
|
@ -50,6 +50,9 @@ import { EnterPaymentComponent } from './enter-payment/enter-payment.component';
|
|||||||
import { HomeComponent } from './home/home.component';
|
import { HomeComponent } from './home/home.component';
|
||||||
import { LedgerComponent } from './ledger/ledger.component';
|
import { LedgerComponent } from './ledger/ledger.component';
|
||||||
import { ErrorDialogComponent } from './error-dialog/error-dialog.component'
|
import { ErrorDialogComponent } from './error-dialog/error-dialog.component'
|
||||||
|
import { MatSortModule } from '@angular/material/sort';
|
||||||
|
import { ContractComponent } from './contract/contract.component';
|
||||||
|
import { MyContractsComponent } from './my-contracts/my-contracts.component';
|
||||||
|
|
||||||
registerLocaleData(localeDe)
|
registerLocaleData(localeDe)
|
||||||
|
|
||||||
@ -80,7 +83,9 @@ registerLocaleData(localeDe)
|
|||||||
EnterPaymentComponent,
|
EnterPaymentComponent,
|
||||||
HomeComponent,
|
HomeComponent,
|
||||||
LedgerComponent,
|
LedgerComponent,
|
||||||
ErrorDialogComponent
|
ErrorDialogComponent,
|
||||||
|
ContractComponent,
|
||||||
|
MyContractsComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
@ -102,7 +107,8 @@ registerLocaleData(localeDe)
|
|||||||
MatSelectModule,
|
MatSelectModule,
|
||||||
MatDatepickerModule,
|
MatDatepickerModule,
|
||||||
MatNativeDateModule,
|
MatNativeDateModule,
|
||||||
MatExpansionModule
|
MatExpansionModule,
|
||||||
|
MatSortModule
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
MatMomentDateModule
|
MatMomentDateModule
|
||||||
|
@ -22,6 +22,10 @@
|
|||||||
<mat-option *ngFor="let p of premises" [value]="p.id">{{p.description}}</mat-option>
|
<mat-option *ngFor="let p of premises" [value]="p.id">{{p.description}}</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline">
|
||||||
|
<mat-label>Fläche</mat-label>
|
||||||
|
<input type="number" matInput name="area" [(ngModel)]="commercialPremise.area"/>
|
||||||
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<button #submitButton type="submit" mat-raised-button color="primary">Speichern</button>
|
<button #submitButton type="submit" mat-raised-button color="primary">Speichern</button>
|
||||||
</form>
|
</form>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// export const serviceBaseUrl = "https://api.hv.nober.de";
|
// export const serviceBaseUrl = "https://api.hv.nober.de";
|
||||||
// export const serviceBaseUrl = "http://172.16.10.38:5000";
|
// export const serviceBaseUrl = "http://172.16.3.96:8080";
|
||||||
export const serviceBaseUrl = "http://localhost:8080"
|
export const serviceBaseUrl = "http://localhost:8080"
|
||||||
export const authserviceBaseUrl = "https://authservice.hottis.de"
|
export const authserviceBaseUrl = "https://authservice.hottis.de"
|
||||||
export const applicationId = "hv2"
|
export const applicationId = "hv2"
|
||||||
|
4
ui/hv2-ui/src/app/contract/contract.component.css
Normal file
4
ui/hv2-ui/src/app/contract/contract.component.css
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
.notearea {
|
||||||
|
width: 75%;
|
||||||
|
}
|
46
ui/hv2-ui/src/app/contract/contract.component.html
Normal file
46
ui/hv2-ui/src/app/contract/contract.component.html
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<section class="mat-typography">
|
||||||
|
<mat-card class="defaultCard">
|
||||||
|
<mat-card-header>
|
||||||
|
<mat-card-title>
|
||||||
|
{{contract?.supplier}} {{contract?.content}}
|
||||||
|
</mat-card-title>
|
||||||
|
<mat-card-subtitle>
|
||||||
|
ID: {{contract?.id}}
|
||||||
|
</mat-card-subtitle>
|
||||||
|
</mat-card-header>
|
||||||
|
<mat-card-content>
|
||||||
|
<div>>
|
||||||
|
<form (ngSubmit)="saveContract()">
|
||||||
|
<div>
|
||||||
|
<mat-form-field appearance="outline">
|
||||||
|
<mat-label>Partner</mat-label>
|
||||||
|
<input matInput name="supplier" [(ngModel)]="contract.supplier"/>
|
||||||
|
</mat-form-field>
|
||||||
|
</div><div>
|
||||||
|
<mat-form-field appearance="outline">
|
||||||
|
<mat-label>Gegenstand</mat-label>
|
||||||
|
<input matInput name="content" [(ngModel)]="contract.content"/>
|
||||||
|
</mat-form-field>
|
||||||
|
</div><div>
|
||||||
|
<mat-form-field appearance="outline">
|
||||||
|
<mat-label>ID</mat-label>
|
||||||
|
<input matInput name="identifier" [(ngModel)]="contract.identifier"/>
|
||||||
|
</mat-form-field>
|
||||||
|
</div><div>
|
||||||
|
<mat-form-field appearance="outline" class="notearea">
|
||||||
|
<mat-label>Notizen</mat-label>
|
||||||
|
<textarea matInput
|
||||||
|
cdkTextareaAutosize
|
||||||
|
#autosize="cdkTextareaAutosize"
|
||||||
|
cdkAutosizeMinRows="5"
|
||||||
|
cdkAutosizeMaxRows="10"
|
||||||
|
name="notes" [(ngModel)]="contract.notes"></textarea>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
<button #submitButton type="submit" mat-raised-button color="primary">Speichern</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</mat-card-content>
|
||||||
|
</mat-card>
|
||||||
|
</section>
|
25
ui/hv2-ui/src/app/contract/contract.component.spec.ts
Normal file
25
ui/hv2-ui/src/app/contract/contract.component.spec.ts
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ContractComponent } from './contract.component';
|
||||||
|
|
||||||
|
describe('ContractComponent', () => {
|
||||||
|
let component: ContractComponent;
|
||||||
|
let fixture: ComponentFixture<ContractComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ ContractComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(ContractComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
61
ui/hv2-ui/src/app/contract/contract.component.ts
Normal file
61
ui/hv2-ui/src/app/contract/contract.component.ts
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||||
|
import { MatButton } from '@angular/material/button';
|
||||||
|
import { MatTableDataSource } from '@angular/material/table';
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { ContractService } from '../data-object-service';
|
||||||
|
import { Contract, NULL_CommercialPremise, NULL_Contract } from '../data-objects';
|
||||||
|
import { MessageService } from '../message.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-contract',
|
||||||
|
templateUrl: './contract.component.html',
|
||||||
|
styleUrls: ['./contract.component.css']
|
||||||
|
})
|
||||||
|
export class ContractComponent implements OnInit {
|
||||||
|
|
||||||
|
@ViewChild('submitButton') submitButton: MatButton
|
||||||
|
|
||||||
|
contract: Contract = NULL_Contract
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private contractService: ContractService,
|
||||||
|
private messageService: MessageService,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private router: Router
|
||||||
|
) { }
|
||||||
|
|
||||||
|
async getContract(): Promise<void> {
|
||||||
|
try {
|
||||||
|
const id = +this.route.snapshot.paramMap.get('id')
|
||||||
|
if (id != 0) {
|
||||||
|
this.contract = await this.contractService.getContract(id)
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
this.messageService.add(JSON.stringify(err, undefined, 4))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async saveContract() {
|
||||||
|
try {
|
||||||
|
this.submitButton.disabled = true
|
||||||
|
this.messageService.add(`saveContract: ${ JSON.stringify(this.contract, undefined, 4) }`)
|
||||||
|
if (this.contract.id == 0) {
|
||||||
|
this.messageService.add("about to insert new contract")
|
||||||
|
this.contract = await this.contractService.postContract(this.contract)
|
||||||
|
this.messageService.add(`Successfully added contract with id ${this.contract.id}`)
|
||||||
|
} else {
|
||||||
|
this.messageService.add("about to update existing contract")
|
||||||
|
this.contract = await this.contractService.putContract(this.contract)
|
||||||
|
this.messageService.add(`Successfully changed contract with id ${this.contract.id}`)
|
||||||
|
}
|
||||||
|
this.router.navigate(['/contracts'])
|
||||||
|
} finally {
|
||||||
|
this.submitButton.disabled = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.getContract()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -27,6 +27,7 @@ import { TenancyFeeMapping } from './data-objects';
|
|||||||
import { AccountEntryCategory } from './data-objects';
|
import { AccountEntryCategory } from './data-objects';
|
||||||
import { AccountEntry } from './data-objects';
|
import { AccountEntry } from './data-objects';
|
||||||
import { Note } from './data-objects';
|
import { Note } from './data-objects';
|
||||||
|
import { Contract } from './data-objects';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -519,4 +520,35 @@ export class NoteService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Injectable({ providedIn: 'root' })
|
||||||
|
export class ContractService {
|
||||||
|
constructor(private messageService: MessageService, private http: HttpClient) { }
|
||||||
|
|
||||||
|
async getContracts(): Promise<Contract[]> {
|
||||||
|
this.messageService.add(`ContractService: get data`);
|
||||||
|
return this.http.get<Contract[]>(`${serviceBaseUrl}/v1/contracts`).toPromise()
|
||||||
|
}
|
||||||
|
|
||||||
|
async getContract(id: number): Promise<Contract> {
|
||||||
|
this.messageService.add(`ContractService: get data for ${id}`);
|
||||||
|
return this.http.get<Contract>(`${serviceBaseUrl}/v1/contracts/${id}`).toPromise()
|
||||||
|
}
|
||||||
|
|
||||||
|
async postContract(item: Contract): Promise<Contract> {
|
||||||
|
let itemStr: string = JSON.stringify(item, undefined, 4)
|
||||||
|
this.messageService.add(`ContractService: post data for ${itemStr}`);
|
||||||
|
return this.http.post<Contract>(`${serviceBaseUrl}/v1/contracts`, item).toPromise()
|
||||||
|
}
|
||||||
|
|
||||||
|
async putContract(item: Contract): Promise<Contract> {
|
||||||
|
let itemStr: string = JSON.stringify(item, undefined, 4)
|
||||||
|
this.messageService.add(`ContractService: put data for ${itemStr}`)
|
||||||
|
let id: number = item["id"]
|
||||||
|
return this.http.put<Contract>(`${serviceBaseUrl}/v1/contracts/${id}`, item).toPromise()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@ export interface Premise {
|
|||||||
street: string
|
street: string
|
||||||
zip: string
|
zip: string
|
||||||
city: string
|
city: string
|
||||||
|
minus_area: number
|
||||||
account: number
|
account: number
|
||||||
}
|
}
|
||||||
export const NULL_Premise: Premise = {
|
export const NULL_Premise: Premise = {
|
||||||
@ -60,6 +61,7 @@ export const NULL_Premise: Premise = {
|
|||||||
,street: ''
|
,street: ''
|
||||||
,zip: ''
|
,zip: ''
|
||||||
,city: ''
|
,city: ''
|
||||||
|
,minus_area: undefined
|
||||||
,account: undefined
|
,account: undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,11 +121,13 @@ export interface CommercialPremise {
|
|||||||
id: number
|
id: number
|
||||||
description: string
|
description: string
|
||||||
premise: number
|
premise: number
|
||||||
|
area: number
|
||||||
}
|
}
|
||||||
export const NULL_CommercialPremise: CommercialPremise = {
|
export const NULL_CommercialPremise: CommercialPremise = {
|
||||||
id: 0
|
id: 0
|
||||||
,description: ''
|
,description: ''
|
||||||
,premise: undefined
|
,premise: undefined
|
||||||
|
,area: undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Tenancy {
|
export interface Tenancy {
|
||||||
@ -178,11 +182,13 @@ export const NULL_TenancyFeeMapping: TenancyFeeMapping = {
|
|||||||
export interface AccountEntryCategory {
|
export interface AccountEntryCategory {
|
||||||
id: number
|
id: number
|
||||||
description: string
|
description: string
|
||||||
|
considerMinusArea: boolean
|
||||||
overhead_relevant: boolean
|
overhead_relevant: boolean
|
||||||
}
|
}
|
||||||
export const NULL_AccountEntryCategory: AccountEntryCategory = {
|
export const NULL_AccountEntryCategory: AccountEntryCategory = {
|
||||||
id: 0
|
id: 0
|
||||||
,description: ''
|
,description: ''
|
||||||
|
,considerMinusArea: false
|
||||||
,overhead_relevant: false
|
,overhead_relevant: false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,6 +197,7 @@ export interface AccountEntry {
|
|||||||
description: string
|
description: string
|
||||||
account: number
|
account: number
|
||||||
created_at: string
|
created_at: string
|
||||||
|
fiscal_year: number
|
||||||
amount: number
|
amount: number
|
||||||
document_no: number
|
document_no: number
|
||||||
account_entry_category: number
|
account_entry_category: number
|
||||||
@ -200,6 +207,7 @@ export const NULL_AccountEntry: AccountEntry = {
|
|||||||
,description: ''
|
,description: ''
|
||||||
,account: undefined
|
,account: undefined
|
||||||
,created_at: ''
|
,created_at: ''
|
||||||
|
,fiscal_year: undefined
|
||||||
,amount: undefined
|
,amount: undefined
|
||||||
,document_no: undefined
|
,document_no: undefined
|
||||||
,account_entry_category: undefined
|
,account_entry_category: undefined
|
||||||
@ -218,4 +226,19 @@ export const NULL_Note: Note = {
|
|||||||
,note: ''
|
,note: ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface Contract {
|
||||||
|
id: number
|
||||||
|
supplier: string
|
||||||
|
content: string
|
||||||
|
identifier: string
|
||||||
|
notes: string
|
||||||
|
}
|
||||||
|
export const NULL_Contract: Contract = {
|
||||||
|
id: 0
|
||||||
|
,supplier: ''
|
||||||
|
,content: ''
|
||||||
|
,identifier: ''
|
||||||
|
,notes: ''
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,30 +5,16 @@
|
|||||||
</mat-card-title>
|
</mat-card-title>
|
||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<mat-accordion>
|
<div>
|
||||||
<mat-expansion-panel (opened)="collapseExpenseDetails = true"
|
<span>Konto auswählen: </span>
|
||||||
(closed)="collapseExpenseDetails = false">
|
<mat-form-field appearance="outline">
|
||||||
<mat-expansion-panel-header>
|
<mat-select #mapSelect [(ngModel)]="accountId" name="account">
|
||||||
<mat-panel-title>
|
<mat-label>Mieter</mat-label>
|
||||||
Ausgaben
|
<mat-option *ngFor="let p of accounts" [value]="p.id">{{p.description}}</mat-option>
|
||||||
</mat-panel-title>
|
</mat-select>
|
||||||
<mat-panel-description>
|
</mat-form-field>
|
||||||
<div>Betriebskosten-relevante Ausgaben nicht hier sondern im Betriebskostenkonto unter "Meine Häuser" erfassen.</div>
|
</div>
|
||||||
</mat-panel-description>
|
|
||||||
</mat-expansion-panel-header>
|
<app-account [selectedAccountId]="accountId" [shallBeRentPayment]="false"></app-account>
|
||||||
<app-account #expenseAccountComponent [selectedAccountId]="expenseAccountId" [shallBeRentPayment]="false"></app-account>
|
|
||||||
</mat-expansion-panel>
|
|
||||||
<mat-expansion-panel (opened)="collapseIncomeDetails = true"
|
|
||||||
(closed)="collapseIncomeDetails = false">
|
|
||||||
<mat-expansion-panel-header>
|
|
||||||
<mat-panel-title>
|
|
||||||
Einnahmen
|
|
||||||
</mat-panel-title>
|
|
||||||
<mat-panel-description>
|
|
||||||
</mat-panel-description>
|
|
||||||
</mat-expansion-panel-header>
|
|
||||||
<app-account #incomeAccountComponent [selectedAccountId]="incomeAccountId" [shallBeRentPayment]="false"></app-account>
|
|
||||||
</mat-expansion-panel>
|
|
||||||
</mat-accordion>
|
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
</mat-card>
|
</mat-card>
|
@ -1,5 +1,6 @@
|
|||||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||||
import { AccountComponent } from '../account/account.component';
|
import { AccountComponent } from '../account/account.component';
|
||||||
|
import { AccountService } from '../data-object-service';
|
||||||
import { Account } from '../data-objects';
|
import { Account } from '../data-objects';
|
||||||
import { ExtApiService } from '../ext-data-object-service';
|
import { ExtApiService } from '../ext-data-object-service';
|
||||||
import { MessageService } from '../message.service';
|
import { MessageService } from '../message.service';
|
||||||
@ -11,29 +12,23 @@ import { MessageService } from '../message.service';
|
|||||||
})
|
})
|
||||||
export class LedgerComponent implements OnInit {
|
export class LedgerComponent implements OnInit {
|
||||||
|
|
||||||
incomeAccount: Account
|
accounts: Account[]
|
||||||
incomeAccountId: number
|
accountId: number
|
||||||
expenseAccount: Account
|
|
||||||
expenseAccountId: number
|
|
||||||
|
|
||||||
collapseIncomeDetails: boolean = false
|
|
||||||
collapseExpenseDetails: boolean = false
|
|
||||||
|
|
||||||
@ViewChild('incomeAccountComponent') incomeAccountComponent: AccountComponent
|
@ViewChild('accountComponent') accountComponent: AccountComponent
|
||||||
@ViewChild('expenseAccountComponent') expenseAccountComponent: AccountComponent
|
|
||||||
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private extApiService: ExtApiService,
|
private accountService: AccountService,
|
||||||
private messageService: MessageService
|
private messageService: MessageService
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
async getAccount(): Promise<void> {
|
async getAccount(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
this.messageService.add("Trying to load ledger account")
|
this.messageService.add("Trying to load accounts")
|
||||||
this.incomeAccount = await this.extApiService.getAccountByDescription('LedgerIncome')
|
this.accounts = await this.accountService.getAccounts()
|
||||||
this.expenseAccount = await this.extApiService.getAccountByDescription('LedgerExpense')
|
this.messageService.add("Accounts loaded")
|
||||||
this.messageService.add("Account loaded")
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.messageService.add(JSON.stringify(err, undefined, 4))
|
this.messageService.add(JSON.stringify(err, undefined, 4))
|
||||||
}
|
}
|
||||||
@ -41,8 +36,6 @@ export class LedgerComponent implements OnInit {
|
|||||||
|
|
||||||
async ngOnInit(): Promise<void> {
|
async ngOnInit(): Promise<void> {
|
||||||
await this.getAccount()
|
await this.getAccount()
|
||||||
this.incomeAccountId = this.incomeAccount.id
|
|
||||||
this.expenseAccountId = this.expenseAccount.id
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,13 @@
|
|||||||
<th mat-header-cell *matHeaderCellDef>Haus</th>
|
<th mat-header-cell *matHeaderCellDef>Haus</th>
|
||||||
<td mat-cell *matCellDef="let element">{{element.premise.description}}</td>
|
<td mat-cell *matCellDef="let element">{{element.premise.description}}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="area">
|
||||||
|
<th mat-header-cell *matHeaderCellDef>Fläche</th>
|
||||||
|
<td mat-cell *matCellDef="let element">{{element.commercialPremise.area | number:'1.2-2'}}</td>
|
||||||
|
</ng-container>
|
||||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;" [routerLink]="['/commercialunit/', row.commercialPremise.id]"></tr>
|
<tr mat-row *matRowDef="let row; columns: displayedColumns;" [routerLink]="['/commercialunit/', row.commercialPremise.id]"></tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
|
@ -21,7 +21,7 @@ export class MyCommercialUnitsComponent implements OnInit {
|
|||||||
dnCommercialPremises: DN_CommercialPremise[] = []
|
dnCommercialPremises: DN_CommercialPremise[] = []
|
||||||
|
|
||||||
dataSource: MatTableDataSource<DN_CommercialPremise>
|
dataSource: MatTableDataSource<DN_CommercialPremise>
|
||||||
displayedColumns: string[] = ["description", "premise"]
|
displayedColumns: string[] = ["description", "premise", "area"]
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private commercialPremiseService: CommercialPremiseService,
|
private commercialPremiseService: CommercialPremiseService,
|
||||||
|
31
ui/hv2-ui/src/app/my-contracts/my-contracts.component.html
Normal file
31
ui/hv2-ui/src/app/my-contracts/my-contracts.component.html
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<section class="mat-typography">
|
||||||
|
<mat-card class="defaultCard">
|
||||||
|
<mat-card-header>
|
||||||
|
<mat-card-title>
|
||||||
|
<span>Meine Verträge</span>
|
||||||
|
<span class="spacer"></span>
|
||||||
|
<a mat-button routerLink="/contract">Neu anlegen</a>
|
||||||
|
</mat-card-title>
|
||||||
|
</mat-card-header>
|
||||||
|
<mat-card-content>
|
||||||
|
<div>
|
||||||
|
<table mat-table [dataSource]="dataSource" #zftable>
|
||||||
|
<ng-container matColumnDef="supplier">
|
||||||
|
<th mat-header-cell *matHeaderCellDef>Partner</th>
|
||||||
|
<td mat-cell *matCellDef="let element">{{element.supplier}}</td>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="content">
|
||||||
|
<th mat-header-cell *matHeaderCellDef>Gegenstand</th>
|
||||||
|
<td mat-cell *matCellDef="let element">{{element.content}}</td>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="identifier">
|
||||||
|
<th mat-header-cell *matHeaderCellDef>ID</th>
|
||||||
|
<td mat-cell *matCellDef="let element">{{element.identifier}}</td>
|
||||||
|
</ng-container>
|
||||||
|
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||||
|
<tr mat-row *matRowDef="let row; columns: displayedColumns;" [routerLink]="['/contract/', row.id]"></tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</mat-card-content>
|
||||||
|
</mat-card>
|
||||||
|
</section>
|
@ -0,0 +1,25 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { MyContractsComponent } from './my-contracts.component';
|
||||||
|
|
||||||
|
describe('MyContractsComponent', () => {
|
||||||
|
let component: MyContractsComponent;
|
||||||
|
let fixture: ComponentFixture<MyContractsComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ MyContractsComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(MyContractsComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
38
ui/hv2-ui/src/app/my-contracts/my-contracts.component.ts
Normal file
38
ui/hv2-ui/src/app/my-contracts/my-contracts.component.ts
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { MatTableDataSource } from '@angular/material/table';
|
||||||
|
import { ContractService } from '../data-object-service';
|
||||||
|
import { Contract } from '../data-objects';
|
||||||
|
import { MessageService } from '../message.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-my-contracts',
|
||||||
|
templateUrl: './my-contracts.component.html',
|
||||||
|
styleUrls: ['./my-contracts.component.css']
|
||||||
|
})
|
||||||
|
export class MyContractsComponent implements OnInit {
|
||||||
|
|
||||||
|
contracts: Contract[]
|
||||||
|
dataSource: MatTableDataSource<Contract>
|
||||||
|
displayedColumns: string[] = [ "supplier", "content", "identifier" ]
|
||||||
|
|
||||||
|
constructor(private contractService: ContractService, private messageService: MessageService) { }
|
||||||
|
|
||||||
|
async getContracts(): Promise<void> {
|
||||||
|
try {
|
||||||
|
this.messageService.add("Trying to load contracts")
|
||||||
|
this.contracts = await this.contractService.getContracts();
|
||||||
|
this.messageService.add("Contracts loaded")
|
||||||
|
|
||||||
|
this.dataSource = new MatTableDataSource<Contract>(this.contracts)
|
||||||
|
} catch (err) {
|
||||||
|
this.messageService.add(JSON.stringify(err, undefined, 4))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.messageService.add("MyContractsComponent.ngOnInit")
|
||||||
|
this.getContracts()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -26,6 +26,10 @@
|
|||||||
<th mat-header-cell *matHeaderCellDef>Ort</th>
|
<th mat-header-cell *matHeaderCellDef>Ort</th>
|
||||||
<td mat-cell *matCellDef="let element">{{element.city}}</td>
|
<td mat-cell *matCellDef="let element">{{element.city}}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="minusArea">
|
||||||
|
<th mat-header-cell *matHeaderCellDef>Minus-Fläche</th>
|
||||||
|
<td mat-cell *matCellDef="let element">{{element.minus_area | number:'1.2-2'}}</td>
|
||||||
|
</ng-container>
|
||||||
<ng-container matColumnDef="account">
|
<ng-container matColumnDef="account">
|
||||||
<th mat-header-cell *matHeaderCellDef>Betriebskostenkonto</th>
|
<th mat-header-cell *matHeaderCellDef>Betriebskostenkonto</th>
|
||||||
<td mat-cell *matCellDef="let element">{{element.account}}</td>
|
<td mat-cell *matCellDef="let element">{{element.account}}</td>
|
||||||
|
@ -13,7 +13,7 @@ export class MyPremisesComponent implements OnInit {
|
|||||||
|
|
||||||
premises: Premise[]
|
premises: Premise[]
|
||||||
dataSource: MatTableDataSource<Premise>
|
dataSource: MatTableDataSource<Premise>
|
||||||
displayedColumns: string[] = [ "description", "street", "zip", "city", "account" ]
|
displayedColumns: string[] = [ "description", "street", "zip", "city", "minusArea", "account" ]
|
||||||
|
|
||||||
|
|
||||||
constructor(private premiseService: PremiseService, private messageService: MessageService) { }
|
constructor(private premiseService: PremiseService, private messageService: MessageService) { }
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
<a mat-list-item href="/premises">Meine Häuser</a>
|
<a mat-list-item href="/premises">Meine Häuser</a>
|
||||||
</mat-nav-list><mat-divider *ngIf="authenticated"></mat-divider><mat-nav-list *ngIf="authenticated">
|
</mat-nav-list><mat-divider *ngIf="authenticated"></mat-divider><mat-nav-list *ngIf="authenticated">
|
||||||
<a mat-list-item href="/ledger">Buchführung</a>
|
<a mat-list-item href="/ledger">Buchführung</a>
|
||||||
|
</mat-nav-list><mat-divider *ngIf="authenticated"></mat-divider><mat-nav-list *ngIf="authenticated">
|
||||||
|
<a mat-list-item href="/contracts">Verträge</a>
|
||||||
</mat-nav-list><mat-divider *ngIf="authenticated"></mat-divider><mat-nav-list *ngIf="authenticated">
|
</mat-nav-list><mat-divider *ngIf="authenticated"></mat-divider><mat-nav-list *ngIf="authenticated">
|
||||||
<a mat-list-item href="/logout">Abmelden</a>
|
<a mat-list-item href="/logout">Abmelden</a>
|
||||||
</mat-nav-list>
|
</mat-nav-list>
|
||||||
|
@ -40,6 +40,11 @@
|
|||||||
<mat-label>Ort</mat-label>
|
<mat-label>Ort</mat-label>
|
||||||
<input matInput name="city" [(ngModel)]="premise.city"/>
|
<input matInput name="city" [(ngModel)]="premise.city"/>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
</div><div>
|
||||||
|
<mat-form-field appearance="outline">
|
||||||
|
<mat-label>Minus-Fläche</mat-label>
|
||||||
|
<input type="number" matInput name="minusArea" [(ngModel)]="premise.minus_area"/>
|
||||||
|
</mat-form-field>
|
||||||
</div><div>
|
</div><div>
|
||||||
<mat-form-field appearance="outline" *ngIf="premise.account">
|
<mat-form-field appearance="outline" *ngIf="premise.account">
|
||||||
<mat-label>Betriebskostenkonto</mat-label>
|
<mat-label>Betriebskostenkonto</mat-label>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user