financian 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- financian-1.0.0/LICENSE +21 -0
- financian-1.0.0/PKG-INFO +48 -0
- financian-1.0.0/README.md +31 -0
- financian-1.0.0/pyproject.toml +3 -0
- financian-1.0.0/setup.cfg +30 -0
- financian-1.0.0/src/financian/__init__.py +3 -0
- financian-1.0.0/src/financian/cfinance.py +324 -0
- financian-1.0.0/src/financian/data.py +247 -0
- financian-1.0.0/src/financian/environ.py +26 -0
- financian-1.0.0/src/financian/param.py +24 -0
- financian-1.0.0/src/financian/schema.py +124 -0
- financian-1.0.0/src/financian/syslogin.py +117 -0
- financian-1.0.0/src/financian/task.py +397 -0
- financian-1.0.0/src/financian/template.py +189 -0
- financian-1.0.0/src/financian/title.py +113 -0
- financian-1.0.0/src/financian.egg-info/PKG-INFO +48 -0
- financian-1.0.0/src/financian.egg-info/SOURCES.txt +19 -0
- financian-1.0.0/src/financian.egg-info/dependency_links.txt +1 -0
- financian-1.0.0/src/financian.egg-info/requires.txt +1 -0
- financian-1.0.0/src/financian.egg-info/top_level.txt +1 -0
financian-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Asinerum Conlang Project
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
financian-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: financian
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Literp Financial Bookkeeping Web Tool
|
|
5
|
+
Home-page: https://github.com/asinerum/financian
|
|
6
|
+
Author: Asinerum Conlang Project
|
|
7
|
+
Author-email: asinerum.com@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.7
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: orderum>=1.0.1
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
|
|
18
|
+
# Literp Financial Bookkeeping Tool
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
```bash
|
|
22
|
+
pip install financian
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Sample Usage [Sep 22, 2026]
|
|
26
|
+
```bash
|
|
27
|
+
## nano financian.sh
|
|
28
|
+
export SETUPKEY_ENCRYPT_SECRET="very-strong-password"
|
|
29
|
+
export JWT_SECRET="very-strong-password"
|
|
30
|
+
export TOKEN_EXPIRE_MINUTES=30
|
|
31
|
+
export ADMIN_AUTHENTICATOR_EMAIL_LIST=EMAIL_LIST_SEPARATED_BY_COMMA
|
|
32
|
+
export SUPERVISOR_AUTHENTICATOR_EMAIL_LIST=EMAIL_LIST_SEPARATED_BY_COMMA
|
|
33
|
+
export STAFF_AUTHENTICATOR_EMAIL_LIST=EMAIL_LIST_SEPARATED_BY_COMMA
|
|
34
|
+
export FILE_AVRO_SUPERVISORS="../users/rolefbksupervisors.avro"
|
|
35
|
+
export FILE_AVRO_STAFF="../users/rolefbkstaff.avro"
|
|
36
|
+
export FILE_AVRO_DATA="../users/setupkeys.avro"
|
|
37
|
+
export FILE_DUCKDB_VECTOR="./temp.db"
|
|
38
|
+
uvia -a vapp -m financian [-p <PORT>] [-H <HOST>]
|
|
39
|
+
## The <PORT> is 21790 by default, but can be edited
|
|
40
|
+
## The <HOST> should be 127.0.0.1 for security reason
|
|
41
|
+
## chmod +x financian.sh
|
|
42
|
+
## ./financian.sh
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Detailed tips, tricks, and examples, can be found at project's repository
|
|
46
|
+
https://github.com/asinerum/financian
|
|
47
|
+
|
|
48
|
+
(C) 2026 Asinerum Conlang Project
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Literp Financial Bookkeeping Tool
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
```bash
|
|
5
|
+
pip install financian
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
## Sample Usage [Sep 22, 2026]
|
|
9
|
+
```bash
|
|
10
|
+
## nano financian.sh
|
|
11
|
+
export SETUPKEY_ENCRYPT_SECRET="very-strong-password"
|
|
12
|
+
export JWT_SECRET="very-strong-password"
|
|
13
|
+
export TOKEN_EXPIRE_MINUTES=30
|
|
14
|
+
export ADMIN_AUTHENTICATOR_EMAIL_LIST=EMAIL_LIST_SEPARATED_BY_COMMA
|
|
15
|
+
export SUPERVISOR_AUTHENTICATOR_EMAIL_LIST=EMAIL_LIST_SEPARATED_BY_COMMA
|
|
16
|
+
export STAFF_AUTHENTICATOR_EMAIL_LIST=EMAIL_LIST_SEPARATED_BY_COMMA
|
|
17
|
+
export FILE_AVRO_SUPERVISORS="../users/rolefbksupervisors.avro"
|
|
18
|
+
export FILE_AVRO_STAFF="../users/rolefbkstaff.avro"
|
|
19
|
+
export FILE_AVRO_DATA="../users/setupkeys.avro"
|
|
20
|
+
export FILE_DUCKDB_VECTOR="./temp.db"
|
|
21
|
+
uvia -a vapp -m financian [-p <PORT>] [-H <HOST>]
|
|
22
|
+
## The <PORT> is 21790 by default, but can be edited
|
|
23
|
+
## The <HOST> should be 127.0.0.1 for security reason
|
|
24
|
+
## chmod +x financian.sh
|
|
25
|
+
## ./financian.sh
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Detailed tips, tricks, and examples, can be found at project's repository
|
|
29
|
+
https://github.com/asinerum/financian
|
|
30
|
+
|
|
31
|
+
(C) 2026 Asinerum Conlang Project
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[metadata]
|
|
2
|
+
name = financian
|
|
3
|
+
version = 1.0.0
|
|
4
|
+
author = Asinerum Conlang Project
|
|
5
|
+
author_email = asinerum.com@gmail.com
|
|
6
|
+
description = Literp Financial Bookkeeping Web Tool
|
|
7
|
+
long_description = file: README.md
|
|
8
|
+
long_description_content_type = text/markdown
|
|
9
|
+
url = https://github.com/asinerum/financian
|
|
10
|
+
license = MIT
|
|
11
|
+
classifiers =
|
|
12
|
+
Programming Language :: Python :: 3
|
|
13
|
+
License :: OSI Approved :: MIT License
|
|
14
|
+
Operating System :: OS Independent
|
|
15
|
+
|
|
16
|
+
[options]
|
|
17
|
+
package_dir =
|
|
18
|
+
= src
|
|
19
|
+
packages = find:
|
|
20
|
+
python_requires = >=3.7
|
|
21
|
+
install_requires =
|
|
22
|
+
orderum >= 1.0.1
|
|
23
|
+
|
|
24
|
+
[options.packages.find]
|
|
25
|
+
where = src
|
|
26
|
+
|
|
27
|
+
[egg_info]
|
|
28
|
+
tag_build =
|
|
29
|
+
tag_date = 0
|
|
30
|
+
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Literp Financial Bookkeeping Tool
|
|
3
|
+
Dependencies:
|
|
4
|
+
pip install [tagrepo] uvia vapp financian
|
|
5
|
+
Start daemon:
|
|
6
|
+
export LLM_TRANSFORMER_MODEL="./all-MiniLM-L6-v2"
|
|
7
|
+
export SETUPKEY_ENCRYPT_SECRET="very-strong-password"
|
|
8
|
+
export JWT_SECRET="very-strong-password"
|
|
9
|
+
export TOKEN_EXPIRE_MINUTES=30
|
|
10
|
+
export ADMIN_AUTHENTICATOR_EMAIL_LIST=EMAIL_LIST_SEPARATED_BY_COMMA
|
|
11
|
+
export SUPERVISOR_AUTHENTICATOR_EMAIL_LIST=EMAIL_LIST_SEPARATED_BY_COMMA
|
|
12
|
+
export STAFF_AUTHENTICATOR_EMAIL_LIST=EMAIL_LIST_SEPARATED_BY_COMMA
|
|
13
|
+
export FILE_AVRO_SUPERVISORS="../users/rolefbksupervisors.avro"
|
|
14
|
+
export FILE_AVRO_STAFF="../users/rolefbkstaff.avro"
|
|
15
|
+
export FILE_AVRO_DATA="../users/setupkeys.avro"
|
|
16
|
+
export FILE_DUCKDB_VECTOR="./temp.db"
|
|
17
|
+
uvia -a vapp -m financian [-p <PORT>] [-H <HOST>]
|
|
18
|
+
VAPP routes:
|
|
19
|
+
Route: /callback -> callbackpage()
|
|
20
|
+
Route: /login -> loginpage()
|
|
21
|
+
Route: /call -> callpage()
|
|
22
|
+
GET -> request.query_params = {function, access_token, jsondata, module}
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
APP_PORT = 21790 ## for <uvia> and <vapp>
|
|
26
|
+
|
|
27
|
+
import uvicorn ## for <uvia>
|
|
28
|
+
from starlette.responses import HTMLResponse
|
|
29
|
+
from starlette.responses import RedirectResponse
|
|
30
|
+
from starlette.requests import Request
|
|
31
|
+
from jinja2 import Template
|
|
32
|
+
|
|
33
|
+
from tagrepo.frame import call_function
|
|
34
|
+
from tagrepo.filter import inputfilter
|
|
35
|
+
from tagrepo.format import dstrip, boolean
|
|
36
|
+
from tagrepo.auth import process_function_call, process_login_call
|
|
37
|
+
from tagrepo.http import RedirectResponseGet, RedirectResponsePost
|
|
38
|
+
|
|
39
|
+
from tagrepo.schema14 import Accounts, AccountsStatus, Details, DetailsStatus, Entries, EntriesStatus, Entryitems
|
|
40
|
+
from tagrepo.schema import DATED
|
|
41
|
+
from tagrepo.dataenv import CALLBACK
|
|
42
|
+
|
|
43
|
+
from tagrepo.html import *
|
|
44
|
+
from tagrepo.temp import *
|
|
45
|
+
|
|
46
|
+
from .param import get_request_account_options, get_request_detail_options, get_request_entry_options
|
|
47
|
+
|
|
48
|
+
from .task import *
|
|
49
|
+
from .title import *
|
|
50
|
+
|
|
51
|
+
## core <uvia> functions
|
|
52
|
+
|
|
53
|
+
def homepage():
|
|
54
|
+
async def submit(request: Request):
|
|
55
|
+
return HTMLResponse(Template(APP_TMP_DIRECTORY_MENU).render(
|
|
56
|
+
APP_CHARSET=APP_CHARSET,
|
|
57
|
+
APP_VIEWPORT=APP_VIEWPORT,
|
|
58
|
+
APP_TITLE=APP_DESC,
|
|
59
|
+
FORM_TITLE=FORM_TITLE,
|
|
60
|
+
directory_items=[
|
|
61
|
+
{"href": "/login", "name": LABEL_MENU_LOGIN},
|
|
62
|
+
{"href": call_function(FUNCTION_ROOTS_SELECT), "name": LABEL_ACCOUNT_INSERT},
|
|
63
|
+
{"href": call_function(FUNCTION_ROOTS_SELECT), "name": LABEL_ACCOUNTS_SELECT},
|
|
64
|
+
{"href": call_function(FUNCTION_ENTRY_INSERT), "name": LABEL_ENTRY_INSERT},
|
|
65
|
+
{"href": call_function(FUNCTION_DRAFT_ENTRIES_SELECT), "name": LABEL_DRAFT_ENTRIES_SELECT},
|
|
66
|
+
{"href": call_function(FUNCTION_PENDING_ENTRIES_SELECT), "name": LABEL_PENDING_ENTRIES_SELECT},
|
|
67
|
+
{"href": call_function(FUNCTION_POSTED_ENTRIES_SELECT), "name": LABEL_POSTED_ENTRIES_SELECT},
|
|
68
|
+
{"href": call_function(FUNCTION_ENTRIES_REVIEW), "name": LABEL_ENTRIES_REVIEW},
|
|
69
|
+
{"href": call_function(FUNCTION_ENTRYITEMS_JOURNAL_SELECT), "name": LABEL_ENTRYITEMS_JOURNAL_SELECT},
|
|
70
|
+
{"href": call_function(FUNCTION_ROOT_LEDGER_AGGREGATE), "name": LABEL_ROOT_LEDGER_AGGREGATE},
|
|
71
|
+
{"href": call_function(FUNCTION_ROOTS_BALANCE_AGGREGATE), "name": LABEL_ROOTS_BALANCE_AGGREGATE},
|
|
72
|
+
{"href": call_function(FUNCTION_ACCOUNTS_SEARCH), "name": LABEL_ACCOUNTS_SEARCH},
|
|
73
|
+
{"href": call_function(FUNCTION_DETAILS_SEARCH), "name": LABEL_DETAILS_SEARCH},
|
|
74
|
+
{"href": call_function(FUNCTION_ENTRIES_SEARCH), "name": LABEL_ENTRIES_SEARCH},
|
|
75
|
+
{"href": call_function("logout"), "name": LABEL_MENU_LOGOUT},
|
|
76
|
+
]
|
|
77
|
+
))
|
|
78
|
+
return submit
|
|
79
|
+
|
|
80
|
+
def loginpage():
|
|
81
|
+
async def submit(request: Request):
|
|
82
|
+
return await process_login_call(request, HTMLResponse, RedirectResponse)
|
|
83
|
+
return submit
|
|
84
|
+
|
|
85
|
+
def callpage():
|
|
86
|
+
async def submit(request: Request):
|
|
87
|
+
return await process_function_call(request, auth_functions, HTMLResponse, _callpage)
|
|
88
|
+
return submit
|
|
89
|
+
|
|
90
|
+
async def _callpage(request, func: str):
|
|
91
|
+
if func == FUNCTION_ROOT_SELECT:
|
|
92
|
+
root_id = request.query_params.get("id")
|
|
93
|
+
return HTMLResponse(select_root_page(request, root_id))
|
|
94
|
+
elif func == FUNCTION_ROOTS_SELECT:
|
|
95
|
+
if request.method == 'GET':
|
|
96
|
+
return HTMLResponse(select_roots_page(request))
|
|
97
|
+
else:
|
|
98
|
+
form = await request.form()
|
|
99
|
+
root_id = form.get("id") ## html form radio options
|
|
100
|
+
return HTMLResponse(select_accounts_page(request, root_id))
|
|
101
|
+
elif func == FUNCTION_ACCOUNT_INSERT:
|
|
102
|
+
root_id = request.query_params.get("root_id")
|
|
103
|
+
form = await request.form()
|
|
104
|
+
if not form.get(NAME):
|
|
105
|
+
return HTMLResponse(insert_account_page(request, root_id))
|
|
106
|
+
else:
|
|
107
|
+
form = inputfilter(dstrip(form), Accounts, excludes=[DATED])
|
|
108
|
+
insert = insert_account_page(request, root_id, **form)
|
|
109
|
+
if insert == CALLBACK: return RedirectResponseGet(url=call_function(f"{FUNCTION_ACCOUNTS_SELECT}&root_id={root_id}"))
|
|
110
|
+
return HTMLResponse(insert)
|
|
111
|
+
elif func == FUNCTION_ACCOUNTS_SELECT:
|
|
112
|
+
root_id = request.query_params.get("root_id")
|
|
113
|
+
return HTMLResponse(select_accounts_page(request, root_id))
|
|
114
|
+
elif func == FUNCTION_ACCOUNT_SELECT:
|
|
115
|
+
account_id = request.query_params.get("id")
|
|
116
|
+
return HTMLResponse(select_account_page(request, account_id))
|
|
117
|
+
elif func == FUNCTION_DETAIL_INSERT:
|
|
118
|
+
account_id = request.query_params.get("account_id")
|
|
119
|
+
if request.method == 'GET':
|
|
120
|
+
return HTMLResponse(insert_detail_page(request, account_id))
|
|
121
|
+
else:
|
|
122
|
+
form = await request.form()
|
|
123
|
+
form = inputfilter(dstrip(form), Details, excludes=[DATED])
|
|
124
|
+
insert = insert_detail_page(request, account_id, **form)
|
|
125
|
+
if insert == CALLBACK: return RedirectResponseGet(url=call_function(f"{FUNCTION_DETAILS_SELECT}&account_id={account_id}"))
|
|
126
|
+
return HTMLResponse(insert)
|
|
127
|
+
elif func == FUNCTION_DETAILS_SELECT:
|
|
128
|
+
account_id = request.query_params.get("account_id")
|
|
129
|
+
return HTMLResponse(select_details_page(request, account_id=account_id, **get_request_detail_options(request)))
|
|
130
|
+
elif func == FUNCTION_DETAILS_GLOBAL_SELECT:
|
|
131
|
+
return HTMLResponse(select_details_page(request, account_id="", **get_request_detail_options(request)))
|
|
132
|
+
elif func == FUNCTION_DETAIL_SELECT:
|
|
133
|
+
detail_id = request.query_params.get("id")
|
|
134
|
+
return HTMLResponse(select_detail_page(request, detail_id))
|
|
135
|
+
elif func == FUNCTION_DETAIL_UPDATE:
|
|
136
|
+
detail_id = request.query_params.get("id")
|
|
137
|
+
if request.method == 'GET':
|
|
138
|
+
return HTMLResponse(update_detail_page(request, detail_id))
|
|
139
|
+
else:
|
|
140
|
+
form = await request.form()
|
|
141
|
+
form = inputfilter(dstrip(form), Details, includes=UPDATE_INPUTS[Details])
|
|
142
|
+
update = update_detail_page(request, detail_id, **form)
|
|
143
|
+
if update == CALLBACK: return RedirectResponseGet(url=call_function(f"{FUNCTION_DETAIL_SELECT}&id={detail_id}"))
|
|
144
|
+
return HTMLResponse(update)
|
|
145
|
+
elif func == FUNCTION_ACCOUNT_UPDATE:
|
|
146
|
+
account_id = request.query_params.get("id")
|
|
147
|
+
if request.method == 'GET':
|
|
148
|
+
return HTMLResponse(update_account_page(request, account_id))
|
|
149
|
+
else:
|
|
150
|
+
form = await request.form()
|
|
151
|
+
form = inputfilter(dstrip(form), Accounts, includes=UPDATE_INPUTS[Accounts])
|
|
152
|
+
update = update_account_page(request, account_id, **form)
|
|
153
|
+
if update == CALLBACK: return RedirectResponseGet(url=call_function(f"{FUNCTION_ACCOUNT_SELECT}&id={account_id}"))
|
|
154
|
+
return HTMLResponse(update)
|
|
155
|
+
elif func == FUNCTION_ACCOUNT_UPGRADE:
|
|
156
|
+
account_id = request.query_params.get("id")
|
|
157
|
+
if request.method == 'GET':
|
|
158
|
+
return HTMLResponse(upgrade_account_page(request, account_id))
|
|
159
|
+
else:
|
|
160
|
+
form = await request.form()
|
|
161
|
+
status = form.get(STATUS)
|
|
162
|
+
update = upgrade_account_page(request, account_id, status=status)
|
|
163
|
+
if update == CALLBACK: return RedirectResponseGet(url=call_function(f"{FUNCTION_ACCOUNT_SELECT}&id={account_id}"))
|
|
164
|
+
return HTMLResponse(update)
|
|
165
|
+
elif func == FUNCTION_DETAIL_UPGRADE:
|
|
166
|
+
detail_id = request.query_params.get("id")
|
|
167
|
+
if request.method == 'GET':
|
|
168
|
+
return HTMLResponse(upgrade_detail_page(request, detail_id))
|
|
169
|
+
else:
|
|
170
|
+
form = await request.form()
|
|
171
|
+
status = form.get(STATUS)
|
|
172
|
+
update = upgrade_detail_page(request, detail_id, status=status)
|
|
173
|
+
if update == CALLBACK: return RedirectResponseGet(url=call_function(f"{FUNCTION_DETAIL_SELECT}&id={detail_id}"))
|
|
174
|
+
return HTMLResponse(update)
|
|
175
|
+
elif func == FUNCTION_ENTRY_INSERT:
|
|
176
|
+
if request.method == 'GET':
|
|
177
|
+
return HTMLResponse(insert_entry_page(request))
|
|
178
|
+
else:
|
|
179
|
+
form = await request.form()
|
|
180
|
+
form = inputfilter(dstrip(form), Entries) ## DATED included
|
|
181
|
+
insert = insert_entry_page(request, **form)
|
|
182
|
+
if insert == CALLBACK: return RedirectResponseGet(url=call_function(FUNCTION_ENTRIES_SELECT))
|
|
183
|
+
return HTMLResponse(insert)
|
|
184
|
+
elif func == FUNCTION_ENTRIES_SELECT:
|
|
185
|
+
return HTMLResponse(select_entries_page(request, **get_request_entry_options(request)))
|
|
186
|
+
elif func == FUNCTION_ENTRY_SELECT:
|
|
187
|
+
entry_id = request.query_params.get("id")
|
|
188
|
+
return HTMLResponse(select_entry_page(request, entry_id))
|
|
189
|
+
elif func == FUNCTION_ENTRY_UPDATE: ## hidden
|
|
190
|
+
entry_id = request.query_params.get("id")
|
|
191
|
+
if request.method == 'GET':
|
|
192
|
+
return HTMLResponse(update_entry_page(request, entry_id))
|
|
193
|
+
else:
|
|
194
|
+
form = await request.form()
|
|
195
|
+
form = inputfilter(dstrip(form), Entries, includes=UPDATE_INPUTS[Entries])
|
|
196
|
+
update = update_entry_page(request, entry_id, **form)
|
|
197
|
+
if update == CALLBACK: return RedirectResponseGet(url=call_function(f"{FUNCTION_ENTRY_SELECT}&id={entry_id}"))
|
|
198
|
+
return HTMLResponse(update)
|
|
199
|
+
elif func == FUNCTION_ENTRYITEM_INSERT:
|
|
200
|
+
entry_id = request.query_params.get("entry_id")
|
|
201
|
+
if request.method == 'GET':
|
|
202
|
+
return HTMLResponse(insert_entryitem_page(request, entry_id=entry_id))
|
|
203
|
+
else:
|
|
204
|
+
form = await request.form()
|
|
205
|
+
form = inputfilter(dstrip(form), Entryitems, excludes=[DATED])
|
|
206
|
+
insert = insert_entryitem_page(request, entry_id=entry_id, **form)
|
|
207
|
+
if insert == CALLBACK: return RedirectResponseGet(url=call_function(f"{FUNCTION_ENTRYITEMS_SELECT}&entry_id={entry_id}"))
|
|
208
|
+
return HTMLResponse(insert)
|
|
209
|
+
elif func == FUNCTION_ROOTS_POPUP:
|
|
210
|
+
search = request.query_params.get("search")
|
|
211
|
+
return HTMLResponse(popup_roots_page(request, search))
|
|
212
|
+
elif func == FUNCTION_ACCOUNTS_POPUP:
|
|
213
|
+
search = request.query_params.get("search")
|
|
214
|
+
parent = request.query_params.get("parent")
|
|
215
|
+
return HTMLResponse(popup_accounts_page(request, search, parent))
|
|
216
|
+
elif func == FUNCTION_DETAILS_POPUP:
|
|
217
|
+
search = request.query_params.get("search")
|
|
218
|
+
parent = request.query_params.get("parent")
|
|
219
|
+
return HTMLResponse(popup_details_page(request, search, parent))
|
|
220
|
+
elif func == FUNCTION_ENTRYITEMS_SELECT:
|
|
221
|
+
entry_id = request.query_params.get("entry_id")
|
|
222
|
+
return HTMLResponse(select_entryitems_page(request, entry_id))
|
|
223
|
+
elif func == FUNCTION_ENTRYITEM_SELECT:
|
|
224
|
+
entryitem_id = request.query_params.get("id")
|
|
225
|
+
return HTMLResponse(select_entryitem_page(request, entryitem_id))
|
|
226
|
+
elif func == FUNCTION_ENTRYITEM_UPDATE: ## hidden
|
|
227
|
+
entryitem_id = request.query_params.get("id")
|
|
228
|
+
if request.method == 'GET':
|
|
229
|
+
return HTMLResponse(update_entryitem_page(request, entryitem_id))
|
|
230
|
+
else:
|
|
231
|
+
form = await request.form()
|
|
232
|
+
form = inputfilter(dstrip(form), Entryitems, includes=UPDATE_INPUTS[Entryitems])
|
|
233
|
+
update = update_entryitem_page(request, entryitem_id, **form)
|
|
234
|
+
if update == CALLBACK: return RedirectResponseGet(url=call_function(f"{FUNCTION_ENTRYITEM_SELECT}&id={entryitem_id}"))
|
|
235
|
+
return HTMLResponse(update)
|
|
236
|
+
elif func == FUNCTION_ENTRY_UPGRADE:
|
|
237
|
+
entry_id = request.query_params.get("id")
|
|
238
|
+
if request.method == 'GET':
|
|
239
|
+
return HTMLResponse(upgrade_entry_page(request, entry_id))
|
|
240
|
+
else:
|
|
241
|
+
form = await request.form()
|
|
242
|
+
status = form.get(STATUS)
|
|
243
|
+
update = upgrade_entry_page(request, entry_id, status=status)
|
|
244
|
+
if update == CALLBACK: return RedirectResponseGet(url=call_function(f"{FUNCTION_ENTRY_SELECT}&id={entry_id}"))
|
|
245
|
+
return HTMLResponse(update)
|
|
246
|
+
elif func == FUNCTION_DRAFT_ENTRIES_SELECT:
|
|
247
|
+
return HTMLResponse(select_draft_entries_page(request, **get_request_entry_options(request)))
|
|
248
|
+
elif func == FUNCTION_PENDING_ENTRIES_SELECT:
|
|
249
|
+
return HTMLResponse(select_pending_entries_page(request, **get_request_entry_options(request)))
|
|
250
|
+
elif func == FUNCTION_POSTED_ENTRIES_SELECT:
|
|
251
|
+
return HTMLResponse(select_posted_entries_page(request, **get_request_entry_options(request)))
|
|
252
|
+
elif func == FUNCTION_NO_DRAFT_ENTRIES_SELECT: ## hidden
|
|
253
|
+
return HTMLResponse(select_no_draft_entries_page(request, **get_request_entry_options(request)))
|
|
254
|
+
elif func == FUNCTION_ENTRIES_REVIEW:
|
|
255
|
+
if request.method == 'GET':
|
|
256
|
+
return HTMLResponse(review_entries_page(request))
|
|
257
|
+
else:
|
|
258
|
+
form = await request.form()
|
|
259
|
+
status = form.get(STATUS)
|
|
260
|
+
return RedirectResponseGet(url=call_function(f"{FUNCTION_ENTRIES_SELECT}&status={status}"))
|
|
261
|
+
elif func == FUNCTION_ENTRYITEMS_JOURNAL_SELECT:
|
|
262
|
+
if request.method == 'GET':
|
|
263
|
+
return HTMLResponse(collect_entryitems_page(request))
|
|
264
|
+
else:
|
|
265
|
+
form = await request.form()
|
|
266
|
+
dated = form.get(DATED) or nowdate()
|
|
267
|
+
dated_end = form.get(DATED_END) or nowdate()
|
|
268
|
+
return HTMLResponse(collect_entryitems_page(request, dated, dated_end))
|
|
269
|
+
elif func == FUNCTION_ROOT_LEDGER_AGGREGATE:
|
|
270
|
+
if request.method == 'GET':
|
|
271
|
+
return HTMLResponse(aggregate_root_page(request))
|
|
272
|
+
else:
|
|
273
|
+
form = await request.form()
|
|
274
|
+
root_id = form.get(ROOT_ID)
|
|
275
|
+
dated = form.get(DATED) or nowdate()
|
|
276
|
+
dated_end = form.get(DATED_END) or nowdate()
|
|
277
|
+
return HTMLResponse(aggregate_root_page(request, root_id, dated, dated_end))
|
|
278
|
+
elif func == FUNCTION_ROOTS_BALANCE_AGGREGATE:
|
|
279
|
+
if request.method == 'GET':
|
|
280
|
+
return HTMLResponse(aggregate_roots_balance_page(request))
|
|
281
|
+
else:
|
|
282
|
+
form = await request.form()
|
|
283
|
+
dated = form.get(DATED) or ""
|
|
284
|
+
dated_end = form.get(DATED_END) or nowdate()
|
|
285
|
+
return HTMLResponse(aggregate_roots_balance_page(request, dated_end=dated_end, dated=dated))
|
|
286
|
+
elif func == FUNCTION_CFTYPE_POPUP:
|
|
287
|
+
return HTMLResponse(popup_cftype_page(request))
|
|
288
|
+
elif func == FUNCTION_CFLINE_POPUP:
|
|
289
|
+
return HTMLResponse(popup_cfline_page(request))
|
|
290
|
+
elif func == FUNCTION_ACCOUNTS_SEARCH:
|
|
291
|
+
author = request.query_params.get("author")
|
|
292
|
+
if request.method == 'GET':
|
|
293
|
+
return HTMLResponse(search_accounts_page(request))
|
|
294
|
+
else:
|
|
295
|
+
form = await request.form()
|
|
296
|
+
search = form.get("search")
|
|
297
|
+
seek = form.get("seek")
|
|
298
|
+
reset = form.get("reset")
|
|
299
|
+
search = search_accounts_page(request, search=search, reset=boolean(reset), seek=seek, author=author)
|
|
300
|
+
return HTMLResponse(search)
|
|
301
|
+
elif func == FUNCTION_DETAILS_SEARCH:
|
|
302
|
+
author = request.query_params.get("author")
|
|
303
|
+
if request.method == 'GET':
|
|
304
|
+
return HTMLResponse(search_details_page(request))
|
|
305
|
+
else:
|
|
306
|
+
form = await request.form()
|
|
307
|
+
search = form.get("search")
|
|
308
|
+
seek = form.get("seek")
|
|
309
|
+
reset = form.get("reset")
|
|
310
|
+
search = search_details_page(request, search=search, reset=boolean(reset), seek=seek, author=author)
|
|
311
|
+
return HTMLResponse(search)
|
|
312
|
+
elif func == FUNCTION_ENTRIES_SEARCH:
|
|
313
|
+
author = request.query_params.get("author")
|
|
314
|
+
if request.method == 'GET':
|
|
315
|
+
return HTMLResponse(search_entries_page(request))
|
|
316
|
+
else:
|
|
317
|
+
form = await request.form()
|
|
318
|
+
search = form.get("search")
|
|
319
|
+
seek = form.get("seek")
|
|
320
|
+
reset = form.get("reset")
|
|
321
|
+
search = search_entries_page(request, search=search, reset=boolean(reset), seek=seek, author=author)
|
|
322
|
+
return HTMLResponse(search)
|
|
323
|
+
else:
|
|
324
|
+
return HTMLResponse("Function not found or not accessible")
|