Compare commits

...

5 Commits

Author SHA1 Message Date
07de16d256 Rest Budget in Grafana 2026-01-06 22:14:46 +01:00
3027cc0532 document_type added 2026-01-04 16:09:52 +01:00
0f2a879c8c falsche tag id zugewiesen 2026-01-04 15:37:37 +01:00
46309e5317 Systempromt 2026-01-04 15:26:25 +01:00
01a5156d7c Paperless mit Tags 2026-01-04 15:26:15 +01:00
4 changed files with 228 additions and 7 deletions

View File

@@ -0,0 +1,121 @@
SELECT
t.id
, a.id AS account_id
, a.name AS account_name
, aty.type
, t.amount
, tj.description AS tj_descr
, tj.date
, c.name AS category_name
FROM firefly.transactions AS t
INNER JOIN firefly.transaction_journals AS tj
ON t.transaction_journal_id = tj.id
LEFT JOIN firefly.category_transaction_journal as ctj
ON tj.id = ctj.transaction_journal_id
LEFT JOIN firefly.categories AS c
ON c.id = ctj.category_id
LEFT JOIN firefly.accounts AS a
ON t.account_id = a.id
LEFT JOIN firefly.account_types AS aty
ON a.account_type_id = aty.id
WHERE TRUE
AND tj.DATE BETWEEN '2025-11-28' AND '2025-11-28'
AND a.id = 1
;
/*
Total Expanses of the month
*/
SELECT
SUM(t.amount)
FROM firefly.transactions AS t
INNER JOIN firefly.transaction_journals AS tj
ON t.transaction_journal_id = tj.id
LEFT JOIN firefly.category_transaction_journal as ctj
ON tj.id = ctj.transaction_journal_id
LEFT JOIN firefly.categories AS c
ON c.id = ctj.category_id
LEFT JOIN firefly.accounts AS a
ON t.account_id = a.id
LEFT JOIN firefly.account_types AS aty
ON a.account_type_id = aty.id
WHERE TRUE
AND tj.DATE BETWEEN ${__from:date:iso} AND ${__to:date:iso}
AND a.id = 1
;
/*
Barchart with Budget
*/
SELECT
c.name AS category_name
, 500 AS budget
, ABS(SUM(t.amount)) AS current_status
FROM firefly.transactions AS t
INNER JOIN firefly.transaction_journals AS tj
ON t.transaction_journal_id = tj.id
LEFT JOIN firefly.category_transaction_journal as ctj
ON tj.id = ctj.transaction_journal_id
LEFT JOIN firefly.categories AS c
ON c.id = ctj.category_id
LEFT JOIN firefly.accounts AS a
ON t.account_id = a.id
LEFT JOIN firefly.account_types AS aty
ON a.account_type_id = aty.id
WHERE TRUE
AND tj.DATE BETWEEN "${__from:date:iso}" AND "${__to:date:iso}"
AND a.id = 1
GROUP BY 1,2
ORDER BY 3 ASC
LIMIT 10
;
/*
Barchart with Budget difference stacked
*/
WITH calc_budget AS (
SELECT
c.name AS category_name
, ABS(SUM(t.amount)) AS current_status
, CASE
WHEN c.name = 'Lebensmittel' THEN ${budget_lebensmittel}
WHEN c.name = 'Unterhaltung: Ausgehen' THEN ${budget_unterhaltung_ausgehen}
WHEN c.name = 'Sonstiges' THEN ${budget_sonstiges}
WHEN c.name = 'Online Einkäufe' THEN ${budget_online_einkaeufe}
WHEN c.name = 'Wohnen: Möbel' THEN ${budget_wohnen_moebel}
WHEN c.name = 'Drogerie' THEN ${budget_drogerie}
ELSE 0
END AS budget
FROM firefly.transactions AS t
INNER JOIN firefly.transaction_journals AS tj
ON t.transaction_journal_id = tj.id
LEFT JOIN firefly.category_transaction_journal as ctj
ON tj.id = ctj.transaction_journal_id
LEFT JOIN firefly.categories AS c
ON c.id = ctj.category_id
LEFT JOIN firefly.accounts AS a
ON t.account_id = a.id
LEFT JOIN firefly.account_types AS aty
ON a.account_type_id = aty.id
WHERE TRUE
AND tj.DATE BETWEEN "${__from:date:iso}" AND "${__to:date:iso}"
AND a.id = 1
AND c.name != "Monatliche Einzahlung"
GROUP BY 1,3
ORDER BY 2 DESC
)
SELECT
category_name
, current_status
, CASE
WHEN budget - current_status > 0 THEN budget - current_status
ELSE 0
END AS rest_budget
FROM calc_budget
WHERE TRUE
AND budget > 0
;

View File

@@ -0,0 +1,86 @@
DESC firefly.category_transaction_journal;
0:"id"
1:"category_id"
2:"transaction_journal_id"
firefly.transaction_journals
0:Array[20]
0:"id"
1:"created_at"
2:"updated_at"
3:"deleted_at"
4:"user_id"
5:"user_group_id"
6:"transaction_type_id"
7:"transaction_group_id"
8:"bill_id"
9:"transaction_currency_id"
10:"description"
11:"date"
12:"date_tz"
13:"interest_date"
14:"book_date"
15:"process_date"
16:"order"
17:"tag_count"
18:"encrypted"
19:"completed"
DESC firefly.transactions;
values:Array[6]
0:Array[18]
0:"id"
1:"created_at"
2:"updated_at"
3:"deleted_at"
4:"reconciled"
5:"account_id"
6:"transaction_journal_id"
7:"description"
8:"transaction_currency_id"
9:"amount"
10:"balance_before"
11:"balance_after"
12:"balance_dirty"
13:"foreign_amount"
14:"foreign_currency_id"
15:"identifier"
16:"native_amount"
17:"native_foreign_amount"
firefly.categories
values:Array[6]
0:Array[8]
0:"id"
1:"created_at"
2:"updated_at"
3:"deleted_at"
4:"user_id"
5:"user_group_id"
6:"name"
7:"encrypted"
firefly.accounts
values:Array[6]
0:Array[14]
0:"id"
1:"created_at"
2:"updated_at"
3:"deleted_at"
4:"user_id"
5:"user_group_id"
6:"account_type_id"
7:"name"
8:"virtual_balance"
9:"iban"
10:"active"
11:"encrypted"
12:"order"
13:"native_virtual_balance"

View File

@@ -1,7 +1,15 @@
[Korrespodent Start] [Korrespodent Start]
{{ $('getCorrespondent').item.json.toJsonString() }} {{ JSON.stringify($('getCorrespondent').all().map(i => ({ id: i.json.paperless_id, name: i.json.name }))) }}
[Korrespodent End] [Korrespodent End]
[Tags Start]
{{ JSON.stringify($('getTags').all().map(i => ({ id: i.json.paperless_id, name: i.json.name }))) }}
[Tags End]
[Documents Start]
{{ JSON.stringify($('getDocuments').all().map(i => ({ id: i.json.paperless_id, name: i.json.name }))) }}
[Documents End]
[Dokument Inhalt Start] [Dokument Inhalt Start]
{{ $('documentObject').item.json.document[0].content.substring(1,1000) }} {{ $('documentObject').item.json.document[0].content.substring(1,1000) }}
[Dokument Inhalt Ende] [Dokument Inhalt Ende]

View File

@@ -1,21 +1,27 @@
Kannst du bitte für dieses Dokument einen Title, Korrespondent und Dokumenttyp extrahieren. Die ich für mein Paperless verwenden kann? Kannst du bitte für dieses Dokument einen Title, Korrespondent, Dokumenttyp und Tags extrahieren. Die ich für mein Paperless verwenden kann?
Versuche erst einen passenden Korrespondent aus meiner Liste was ich anhänge zu finden. Wenn du es nicht findest weise selber eins zu. Versuche erst einen passenden Korrespondent und Tag aus meiner Liste was ich anhänge zu finden. Achte auf die Sin Wenn du es nicht findest weise einen passenden Vorschlag zu.
Stelle sicher das ausschließlich mit purem JSON. Nutze keine Markdown-Formatierung wie ` ` `json. Beginne direkt mit der öffnenden geschweiften Klammer {. Stelle sicher das ausschließlich mit purem JSON. Nutze keine Markdown-Formatierung wie ` ` `json. Beginne direkt mit der öffnenden geschweiften Klammer {.
Beispielantwort 1 wenn eine Korrespondent ID vorhanden ist Beispielantwort 1 wenn eine Korrespondent ID, Document_type und Tags vorhanden sind
{ {
"Title": "SLK Klinik Beinoperation", "Title": "SLK Klinik Beinoperation",
"Korrespondent-ID": 1, "Korrespondent-ID": 1,
"Korrespondent": "SLK Klinik", "Korrespondent": "SLK Klinik",
"Dokumenttyp": "Arztbrief" "Tags-ID":[6,8],
"Tags:["Arztbriefe", "Medikamente"],
"Document_type_id": 8,
"Document_typ": "Information"
} }
Beispielantwort 2 wenn eine Korrespondent ID nicht vorhanden ist Beispielantwort 2 wenn eine Korrespondent ID, Document_type und Tags nicht vorhanden sind
{ {
"Title": "SLK Klinik Beinoperation", "Title": "SLK Klinik Beinoperation",
"Korrespondent-ID": null, "Korrespondent-ID": null,
"Korrespondent": "SLK Klinik", "Korrespondent": "SLK Klinik",
"Tags-ID":[null],
"Tags:["Operation", "Varatharajan"],
"Document_type_id": null,
"Dokumenttyp": "Arztbrief" "Dokumenttyp": "Arztbrief"
} }