aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore270
-rw-r--r--LICENSE.txt675
-rw-r--r--abrechnung.py321
-rw-r--r--examples/beleg1.txt1
-rw-r--r--examples/beleg2.txt1
-rw-r--r--examples/beleg3.txt1
-rw-r--r--examples/ex1.csv8
-rw-r--r--modules/__init__.py0
-rw-r--r--modules/base.py39
-rw-r--r--modules/general.py560
-rw-r--r--modules/module.py0
-rw-r--r--out.pdfbin0 -> 102877 bytes
-rw-r--r--requirements.txt3
-rw-r--r--xembu.py489
-rw-r--r--xembu_testdata/belege/beleg001.txt10
-rw-r--r--xembu_testdata/belege/beleg002.txt10
-rw-r--r--xembu_testdata/belege/beleg003.txt10
-rw-r--r--xembu_testdata/belege/beleg004.txt10
-rw-r--r--xembu_testdata/belege/beleg005.txt10
-rw-r--r--xembu_testdata/belege/beleg006.txt10
-rw-r--r--xembu_testdata/belege/beleg007.txt10
-rw-r--r--xembu_testdata/belege/beleg008.txt10
-rw-r--r--xembu_testdata/belege/beleg009.txt10
-rw-r--r--xembu_testdata/belege/beleg010.txt10
-rw-r--r--xembu_testdata/belege/beleg011.txt10
-rw-r--r--xembu_testdata/belege/beleg012.txt10
-rw-r--r--xembu_testdata/belege/beleg013.txt10
-rw-r--r--xembu_testdata/belege/beleg014.txt10
-rw-r--r--xembu_testdata/belege/beleg015.txt10
-rw-r--r--xembu_testdata/belege/beleg016.txt10
-rw-r--r--xembu_testdata/belege/beleg017.txt10
-rw-r--r--xembu_testdata/belege/beleg018.txt10
-rw-r--r--xembu_testdata/belege/beleg019.txt10
-rw-r--r--xembu_testdata/belege/beleg020.txt10
-rw-r--r--xembu_testdata/belege/beleg021.txt10
-rw-r--r--xembu_testdata/belege/beleg022.txt10
-rw-r--r--xembu_testdata/belege/beleg023.txt10
-rw-r--r--xembu_testdata/belege/beleg024.txt10
-rw-r--r--xembu_testdata/belege/beleg025.txt10
-rw-r--r--xembu_testdata/belege/beleg026.txt10
-rw-r--r--xembu_testdata/belege/beleg027.txt10
-rw-r--r--xembu_testdata/belege/beleg028.txt10
-rw-r--r--xembu_testdata/belege/beleg029.txt10
-rw-r--r--xembu_testdata/belege/beleg030.txt10
-rw-r--r--xembu_testdata/belege/beleg031.txt10
-rw-r--r--xembu_testdata/belege/beleg032.txt10
-rw-r--r--xembu_testdata/belege/beleg033.txt10
-rw-r--r--xembu_testdata/belege/beleg034.txt10
-rw-r--r--xembu_testdata/belege/beleg035.txt10
-rw-r--r--xembu_testdata/belege/beleg036.txt10
-rw-r--r--xembu_testdata/belege/beleg037.txt10
-rw-r--r--xembu_testdata/belege/beleg038.txt10
-rw-r--r--xembu_testdata/belege/beleg039.txt10
-rw-r--r--xembu_testdata/belege/beleg040.txt10
-rw-r--r--xembu_testdata/belege/beleg041.txt10
-rw-r--r--xembu_testdata/belege/beleg042.txt10
-rw-r--r--xembu_testdata/belege/beleg043.txt10
-rw-r--r--xembu_testdata/belege/beleg044.txt10
-rw-r--r--xembu_testdata/belege/beleg045.txt10
-rw-r--r--xembu_testdata/belege/beleg046.txt10
-rw-r--r--xembu_testdata/belege/beleg047.txt10
-rw-r--r--xembu_testdata/belege/beleg048.txt10
-rw-r--r--xembu_testdata/belege/beleg049.txt10
-rw-r--r--xembu_testdata/belege/beleg050.txt10
-rw-r--r--xembu_testdata/belege/beleg051.txt10
-rw-r--r--xembu_testdata/belege/beleg052.txt10
-rw-r--r--xembu_testdata/belege/beleg053.txt10
-rw-r--r--xembu_testdata/belege/beleg054.txt10
-rw-r--r--xembu_testdata/belege/beleg055.txt10
-rw-r--r--xembu_testdata/belege/beleg056.txt10
-rw-r--r--xembu_testdata/belege/beleg057.txt10
-rw-r--r--xembu_testdata/belege/beleg058.txt10
-rw-r--r--xembu_testdata/belege/beleg059.txt10
-rw-r--r--xembu_testdata/belege/beleg060.txt10
-rw-r--r--xembu_testdata/belege/beleg061.txt10
-rw-r--r--xembu_testdata/belege/beleg062.txt10
-rw-r--r--xembu_testdata/belege/beleg063.txt10
-rw-r--r--xembu_testdata/belege/beleg064.txt10
-rw-r--r--xembu_testdata/belege/beleg065.txt10
-rw-r--r--xembu_testdata/belege/beleg066.txt10
-rw-r--r--xembu_testdata/belege/beleg067.txt10
-rw-r--r--xembu_testdata/belege/beleg068.txt10
-rw-r--r--xembu_testdata/belege/beleg069.txt10
-rw-r--r--xembu_testdata/belege/beleg070.txt10
-rw-r--r--xembu_testdata/belege/beleg071.txt10
-rw-r--r--xembu_testdata/belege/beleg072.txt10
-rw-r--r--xembu_testdata/belege/beleg073.txt10
-rw-r--r--xembu_testdata/belege/beleg074.txt10
-rw-r--r--xembu_testdata/belege/beleg075.txt10
-rw-r--r--xembu_testdata/belege/beleg076.txt10
-rw-r--r--xembu_testdata/belege/beleg077.txt10
-rw-r--r--xembu_testdata/belege/beleg078.txt10
-rw-r--r--xembu_testdata/belege/beleg079.txt10
-rw-r--r--xembu_testdata/belege/beleg080.txt10
-rw-r--r--xembu_testdata/belege/beleg081.txt10
-rw-r--r--xembu_testdata/belege/beleg082.txt10
-rw-r--r--xembu_testdata/belege/beleg083.txt10
-rw-r--r--xembu_testdata/belege/beleg084.txt10
-rw-r--r--xembu_testdata/belege/beleg085.txt10
-rw-r--r--xembu_testdata/belege/beleg086.txt10
-rw-r--r--xembu_testdata/belege/beleg087.txt10
-rw-r--r--xembu_testdata/belege/beleg088.txt10
-rw-r--r--xembu_testdata/belege/beleg089.txt10
-rw-r--r--xembu_testdata/belege/beleg090.txt10
-rw-r--r--xembu_testdata/belege/beleg091.txt10
-rw-r--r--xembu_testdata/belege/beleg092.txt10
-rw-r--r--xembu_testdata/belege/beleg093.txt10
-rw-r--r--xembu_testdata/belege/beleg094.txt10
-rw-r--r--xembu_testdata/belege/beleg095.txt10
-rw-r--r--xembu_testdata/belege/beleg096.txt10
-rw-r--r--xembu_testdata/belege/beleg097.txt10
-rw-r--r--xembu_testdata/belege/beleg098.txt10
-rw-r--r--xembu_testdata/belege/beleg099.txt10
-rw-r--r--xembu_testdata/belege/beleg100.txt10
-rw-r--r--xembu_testdata/testdata.csv101
115 files changed, 3469 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..9f4c102
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,270 @@
+# Created by https://www.toptal.com/developers/gitignore/api/python,vim,linux,windows,macos
+# Edit at https://www.toptal.com/developers/gitignore?templates=python,vim,linux,windows,macos
+
+### Linux ###
+*~
+
+# temporary files which can be created if a process still has a handle open of a deleted file
+.fuse_hidden*
+
+# KDE directory preferences
+.directory
+
+# Linux trash folder which might appear on any partition or disk
+.Trash-*
+
+# .nfs files are created when an open file is removed but is still being accessed
+.nfs*
+
+### macOS ###
+# General
+.DS_Store
+.AppleDouble
+.LSOverride
+
+# Icon must end with two \r
+Icon
+
+
+# Thumbnails
+._*
+
+# Files that might appear in the root of a volume
+.DocumentRevisions-V100
+.fseventsd
+.Spotlight-V100
+.TemporaryItems
+.Trashes
+.VolumeIcon.icns
+.com.apple.timemachine.donotpresent
+
+# Directories potentially created on remote AFP share
+.AppleDB
+.AppleDesktop
+Network Trash Folder
+Temporary Items
+.apdisk
+
+### macOS Patch ###
+# iCloud generated files
+*.icloud
+
+### Python ###
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+wheels/
+share/python-wheels/
+*.egg-info/
+.installed.cfg
+*.egg
+MANIFEST
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.nox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*.cover
+*.py,cover
+.hypothesis/
+.pytest_cache/
+cover/
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+local_settings.py
+db.sqlite3
+db.sqlite3-journal
+
+# Flask stuff:
+instance/
+.webassets-cache
+
+# Scrapy stuff:
+.scrapy
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+.pybuilder/
+target/
+
+# Jupyter Notebook
+.ipynb_checkpoints
+
+# IPython
+profile_default/
+ipython_config.py
+
+# pyenv
+# For a library or package, you might want to ignore these files since the code is
+# intended to run in multiple environments; otherwise, check them in:
+# .python-version
+
+# pipenv
+# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
+# However, in case of collaboration, if having platform-specific dependencies or dependencies
+# having no cross-platform support, pipenv may install dependencies that don't work, or not
+# install all needed dependencies.
+#Pipfile.lock
+
+# poetry
+# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
+# This is especially recommended for binary packages to ensure reproducibility, and is more
+# commonly ignored for libraries.
+# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
+#poetry.lock
+
+# pdm
+# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
+#pdm.lock
+# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
+# in version control.
+# https://pdm.fming.dev/#use-with-ide
+.pdm.toml
+
+# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
+__pypackages__/
+
+# Celery stuff
+celerybeat-schedule
+celerybeat.pid
+
+# SageMath parsed files
+*.sage.py
+
+# Environments
+.env
+.venv
+env/
+venv/
+ENV/
+env.bak/
+venv.bak/
+
+# Spyder project settings
+.spyderproject
+.spyproject
+
+# Rope project settings
+.ropeproject
+
+# mkdocs documentation
+/site
+
+# mypy
+.mypy_cache/
+.dmypy.json
+dmypy.json
+
+# Pyre type checker
+.pyre/
+
+# pytype static type analyzer
+.pytype/
+
+# Cython debug symbols
+cython_debug/
+
+# PyCharm
+# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
+# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
+# and can be added to the global gitignore or merged into this file. For a more nuclear
+# option (not recommended) you can uncomment the following to ignore the entire idea folder.
+#.idea/
+
+### Python Patch ###
+# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
+poetry.toml
+
+# ruff
+.ruff_cache/
+
+# LSP config files
+pyrightconfig.json
+
+### Vim ###
+# Swap
+[._]*.s[a-v][a-z]
+!*.svg # comment out if you don't need vector files
+[._]*.sw[a-p]
+[._]s[a-rt-v][a-z]
+[._]ss[a-gi-z]
+[._]sw[a-p]
+
+# Session
+Session.vim
+Sessionx.vim
+
+# Temporary
+.netrwhist
+# Auto-generated tag files
+tags
+# Persistent undo
+[._]*.un~
+
+### Windows ###
+# Windows thumbnail cache files
+Thumbs.db
+Thumbs.db:encryptable
+ehthumbs.db
+ehthumbs_vista.db
+
+# Dump file
+*.stackdump
+
+# Folder config file
+[Dd]esktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Windows Installer files
+*.cab
+*.msi
+*.msix
+*.msm
+*.msp
+
+# Windows shortcuts
+*.lnk
+
+# End of https://www.toptal.com/developers/gitignore/api/python,vim,linux,windows,macos
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..bb3c842
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,675 @@
+i GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<https://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<https://www.gnu.org/licenses/why-not-lgpl.html>.
+
diff --git a/abrechnung.py b/abrechnung.py
new file mode 100644
index 0000000..985863c
--- /dev/null
+++ b/abrechnung.py
@@ -0,0 +1,321 @@
+import pandas as pd
+import hashlib
+import matplotlib.pyplot as plt
+from matplotlib.backends.backend_pdf import PdfPages
+from matplotlib import font_manager
+from datetime import datetime
+import os
+import re
+import argparse
+import tarfile
+import subprocess
+
+def parse_csv(filename):
+ df = pd.read_csv(filename, sep=';', encoding='utf-8')
+ df['Betrag'] = df['Betrag'].fillna('0')
+ df['Betrag'] = df['Betrag'].apply(lambda x: str(x).replace('€', '').replace(',', '.').strip())
+ df['Kilometer'] = df['Position'].str.contains('Autofahrt', case=False)
+ def extract_km(row):
+ if row['Kilometer']:
+ match = re.search(r"((\d+,\d+\skm)|(\d+\.\d+\skm))", row['Betrag'])
+ if match:
+ return float(match.group(0).replace(',', '.').replace(" ", "").replace("km", ""))
+ else:
+ raise ValueError(f"Kilometerangabe unlesbar in Zeile: {row}")
+ return 0.0
+ df['km'] = df.apply(extract_km, axis=1)
+ df['Betrag'] = df.apply(lambda row: 0.0 if row['Kilometer'] else float(row['Betrag']), axis=1)
+ df['Datum'] = pd.to_datetime(df['Datum'], format="%Y-%m-%d", dayfirst=True)
+ return df
+
+def compute_hash(filepath, base_dir="."):
+ try:
+ full_path = os.path.join(base_dir, filepath)
+ with open(full_path, 'rb') as f:
+ return hashlib.sha1(f.read()).hexdigest()
+ except:
+ return None
+
+def compute_settlements(df):
+ personen = df['Name'].unique()
+
+ # Tankdaten
+ tankkosten_df = df[df['Position'].str.contains('Tanken', case=False)]
+ km_df = df[df['Position'].str.contains('Autofahrt', case=False)]
+ total_km = km_df['km'].sum()
+ total_tank = tankkosten_df['Betrag'].sum()
+ km_preis = total_tank / total_km if total_km else 0
+
+ # Gruppiert nach Person
+ km_pro_person = km_df.groupby('Name')['km'].sum().to_dict()
+ tank_auslagen = tankkosten_df.groupby('Name')['Betrag'].sum().to_dict()
+
+ # Sonstige Kosten
+ sonstige_df = df[~df['Position'].str.contains('Tanken|Autofahrt', case=False)]
+ total_sonstige = sonstige_df['Betrag'].sum()
+ sonstige_auslagen = sonstige_df.groupby('Name')['Betrag'].sum().to_dict()
+ sonstige_pro_person = total_sonstige / len(personen)
+
+ # Gesamtanteil und Auslagen pro Person
+ gesamt_anteil = {
+ p: km_pro_person.get(p, 0) * km_preis + sonstige_pro_person
+ for p in personen
+ }
+ gesamt_ausgelegt = {
+ p: tank_auslagen.get(p, 0) + sonstige_auslagen.get(p, 0)
+ for p in personen
+ }
+
+ # Saldo berechnen
+ saldo = {p: gesamt_ausgelegt[p] - gesamt_anteil[p] for p in personen}
+
+ return saldo, gesamt_ausgelegt, gesamt_anteil, km_df, km_preis
+
+def minimize_payments(saldo):
+ empfaenger = []
+ zahler = []
+ for person, betrag in saldo.items():
+ if round(betrag, 2) > 0:
+ empfaenger.append([person, round(betrag, 2)])
+ elif round(betrag, 2) < 0:
+ zahler.append([person, -round(betrag, 2)])
+ zahlungen = []
+ i = j = 0
+ while i < len(zahler) and j < len(empfaenger):
+ payer, amount = zahler[i]
+ receiver, need = empfaenger[j]
+ zahlung = min(amount, need)
+ zahlungen.append((payer, receiver, zahlung))
+ zahler[i][1] -= zahlung
+ empfaenger[j][1] -= zahlung
+ if zahler[i][1] == 0:
+ i += 1
+ if empfaenger[j][1] == 0:
+ j += 1
+ return zahlungen
+
+def create_pdf(df, saldo, ausgelegt, anteil, zahlungen, km_info, km_preis, pdf_path, base_dir=".", anteil_pro_person=None):
+ mono_font = font_manager.FontProperties(family='Inconsolata', size=8)
+
+ with PdfPages(pdf_path) as pdf:
+
+ columns = ['Datum', 'Position', 'Name', 'Betrag/km', 'Rechnung', 'SHA1']
+ table_data = []
+ for _, row in df.iterrows():
+ hash_str = compute_hash(row['Rechnung'], base_dir) if pd.notna(row['Rechnung']) else ''
+ table_data.append([
+ row['Datum'].strftime('%Y-%m-%d'),
+ row['Position'],
+ row['Name'],
+ f"{row['Betrag']:.2f} €" if not row['Kilometer'] else f"{row['km']} km",
+ row['Rechnung'] if pd.notna(row['Rechnung']) else '',
+ "{}\n{}".format(hash_str[:int(len(hash_str)/2)], hash_str[int(len(hash_str)/2):]) if hash_str else ""
+ ])
+
+ chunk_size = 25
+ fontprops = font_manager.FontProperties(size=8)
+
+ for start in range(0, len(table_data), chunk_size):
+ fig, ax = plt.subplots(figsize=(8.27, 11.69))
+ ax.axis('off')
+ table_data_chunk = table_data[start:start+chunk_size]
+
+ renderer = fig.canvas.get_renderer()
+ def get_text_width(text, prop):
+ text_obj = plt.text(0, 0, text, fontproperties=prop)
+ bb = text_obj.get_window_extent(renderer=renderer)
+ text_obj.remove()
+ return bb.width
+ col_widths = []
+ for col_idx in range(len(columns)):
+ max_width = get_text_width(columns[col_idx], fontprops)
+ for row in table_data_chunk:
+ max_width = max(max_width, get_text_width(str(row[col_idx]), fontprops))
+ col_widths.append(max_width)
+ col_widths_inches = [w / fig.dpi for w in col_widths]
+ total_width = sum(col_widths_inches)
+ scaled_widths = [w / total_width for w in col_widths_inches]
+
+ table = ax.table(cellText=table_data_chunk, colLabels=columns, loc='center', cellLoc='left')
+ table.auto_set_font_size(False)
+ for cell in table.get_celld().values():
+ cell.get_text().set_fontproperties(mono_font)
+ for (row, col), cell in table.get_celld().items():
+ if col < len(scaled_widths):
+ cell.set_width(scaled_widths[col])
+ cell.PAD = 0.05
+ table.scale(1, 2)
+ pdf.savefig()
+ plt.close()
+
+ fig, axs = plt.subplots(3, 2, figsize=(8.27, 11.69))
+ fig.suptitle("Auswertung", fontsize=14, fontproperties=mono_font)
+
+ df_plot = pd.DataFrame({'Ausgelegt': ausgelegt, 'Anteil': anteil})
+ df_plot.plot.bar(ax=axs[0, 0])
+ axs[0, 0].set_title('Ausgelegt vs. Anteil', fontproperties=mono_font)
+ axs[0, 0].tick_params(axis='x', rotation=0)
+ axs[0, 0].legend(prop=mono_font)
+
+ for name, group in km_info.groupby('Name'):
+ group_sorted = group.sort_values('Datum').copy()
+ group_sorted['km_cumsum'] = group_sorted['km'].cumsum()
+
+ monatserster = pd.Timestamp(group_sorted['Datum'].min().replace(day=1))
+ monatsletzter = pd.Timestamp(group_sorted['Datum'].max().replace(day=1)) + pd.offsets.MonthEnd(0)
+
+ null_row = pd.DataFrame({
+ 'Datum': [monatserster],
+ 'km_cumsum': [0]
+ })
+
+ end_row = pd.DataFrame({
+ 'Datum': [monatsletzter],
+ 'km_cumsum': [group_sorted['km_cumsum'].iloc[-1]]
+ })
+
+ plot_df = pd.concat([null_row, group_sorted[['Datum', 'km_cumsum']], end_row])
+ plot_df = plot_df.sort_values('Datum')
+
+ dates = plot_df['Datum']
+ values = plot_df['km_cumsum']
+
+ axs[0, 1].plot(dates, values, label=name, linewidth=1)
+ axs[0, 1].fill_between(dates, values, alpha=0.15)
+
+ axs[0, 1].set_title('Kumulativer km-Verlauf im Monat', fontproperties=mono_font)
+ axs[0, 1].set_ylabel('km', fontproperties=mono_font)
+ axs[0, 1].set_xlabel('Tag des Monats', fontproperties=mono_font)
+
+ alle_daten = km_info['Datum'].sort_values().unique()
+ axs[0, 1].set_xticks(alle_daten)
+ axs[0, 1].set_xticklabels([d.day for d in alle_daten], rotation=0)
+
+ axs[0, 1].legend(prop=mono_font)
+
+ axs[1, 0].set_title("Kumulative sonstige Ausgaben", fontproperties=mono_font)
+ sonstige = df[~df['Position'].str.contains('Tanken|Autofahrt', case=False)]
+ for name, group in sonstige.groupby('Name'):
+ group_sorted = group.sort_values('Datum').copy()
+ group_sorted['betrag_cumsum'] = group_sorted['Betrag'].cumsum()
+
+ monatserster = pd.Timestamp(group_sorted['Datum'].min().replace(day=1))
+ monatsletzter = pd.Timestamp(group_sorted['Datum'].max().replace(day=1)) + pd.offsets.MonthEnd(0)
+
+ null_row = pd.DataFrame({
+ 'Datum': [monatserster],
+ 'betrag_cumsum': [0]
+ })
+
+ end_row = pd.DataFrame({
+ 'Datum': [monatsletzter],
+ 'betrag_cumsum': [group_sorted['betrag_cumsum'].iloc[-1]]
+ })
+
+ plot_df = pd.concat([null_row, group_sorted[['Datum', 'betrag_cumsum']], end_row])
+ plot_df = plot_df.sort_values('Datum')
+
+ dates = plot_df['Datum']
+ values = plot_df['betrag_cumsum']
+
+ axs[1, 0].plot(dates, values, label=name, linewidth=1)
+ axs[1, 0].fill_between(dates, values, alpha=0.15)
+
+ axs[1, 0].set_ylabel("€", fontproperties=mono_font)
+ axs[1, 0].set_xlabel("Tag des Monats", fontproperties=mono_font)
+ alle_daten = pd.date_range(start=monatserster, end=monatsletzter)
+ axs[1, 0].set_xticks(alle_daten)
+ axs[1, 0].set_xticklabels([d.day for d in alle_daten], rotation=0, fontproperties=mono_font)
+ axs[1, 0].legend(prop=mono_font)
+
+ axs[2, 0].axis('off')
+
+ # Grundlagen berechnen
+ personen = list(ausgelegt.keys())
+ gesamt_km = km_info['km'].sum()
+ gesamt_tank = df[df['Position'].str.contains("Tanken", case=False)]['Betrag'].sum()
+ gesamt_sonstige = df[~df['Position'].str.contains("Tanken|Autofahrt", case=False)]['Betrag'].sum()
+ sonstige_pro_person = gesamt_sonstige / len(personen)
+ km_preis = gesamt_tank / gesamt_km if gesamt_km else 0
+
+ # Gruppierungen
+ km_pro_person = km_info.groupby('Name')['km'].sum().to_dict()
+ tank_auslagen = df[df['Position'].str.contains("Tanken", case=False)].groupby('Name')['Betrag'].sum().to_dict()
+ sonstige_auslagen = df[~df['Position'].str.contains("Tanken|Autofahrt", case=False)].groupby('Name')['Betrag'].sum().to_dict()
+
+ # KFZ-Ausgabe
+ kfztxt = ["KFZ:"]
+ for p in personen:
+ km = km_pro_person.get(p, 0)
+ anteil_km = (km / gesamt_km * 100) if gesamt_km > 0 else 0
+ ausgelegt_tank = tank_auslagen.get(p, 0)
+ anteil_tank = km * km_preis
+ kfztxt.append(
+ f"{p}: {km:.2f} km; {anteil_km:.1f} %; {ausgelegt_tank:.2f} €; {anteil_tank:.2f} €"
+ )
+ kfztxt.append(f"Gesamt: {gesamt_km:.2f} km; {gesamt_tank:.2f} €; {km_preis:.4f} € / km")
+
+ # Sonstige-Ausgabe
+ sonstigetxt = ["\nSonstige Auslagen:"]
+ for p in personen:
+ ausgelegt_sonstige = sonstige_auslagen.get(p, 0)
+ sonstigetxt.append(
+ f"{p}: {ausgelegt_sonstige:.2f} €; {sonstige_pro_person:.2f} €"
+ )
+ sonstigetxt.append(
+ f"Gesamt: {gesamt_sonstige:.2f} €; {sonstige_pro_person:.2f} € p.P."
+ )
+
+ # Zielbeträge
+ gesamttxt = ["\nBeträge ohne Ausgleich:"]
+ for p in personen:
+ km = km_pro_person.get(p, 0)
+ anteil_km = (km / gesamt_km * 100) if gesamt_km > 0 else 0
+ ausgelegt_tank = tank_auslagen.get(p, 0)
+ anteil_tank = km * km_preis
+ zielbetrag = ausgelegt_tank - anteil_tank + sonstige_auslagen.get(p, 0)
+ gesamttxt.append(f"{p}: {zielbetrag:.2f} €")
+
+ # Zusammensetzen und anzeigen
+ rechenweg = "\n".join(kfztxt + sonstigetxt + gesamttxt)
+ axs[2, 0].text(0, 1, rechenweg, verticalalignment='top', fontproperties=mono_font)
+
+ axs[2, 1].axis('off')
+ zahlungstext = "\n".join([f"{payer} → {receiver}: {betrag:.2f} €" for payer, receiver, betrag in zahlungen])
+ axs[2, 1].text(0, 1, "Ausgleich:\n" + zahlungstext, verticalalignment='top', fontproperties=mono_font)
+
+ for ax in axs.flat:
+ for label in ax.get_xticklabels() + ax.get_yticklabels():
+ label.set_fontproperties(mono_font)
+
+ pdf.savefig()
+ plt.close()
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument("monatspfad", help="Pfad zum Ordner im Format YYYY-MM")
+ parser.add_argument("zielpfad", help="Zielverzeichnis für .tar.zst Archiv")
+ args = parser.parse_args()
+
+ monat = os.path.basename(args.monatspfad)
+ csv_path = os.path.join(args.monatspfad, f"{monat}.csv")
+ pdf_path = os.path.join(args.monatspfad, f"{monat}.pdf")
+
+ df = parse_csv(csv_path)
+ if df['Datum'].isna().any():
+ fehlerhafte_zeilen = df[df['Datum'].isna()]
+ raise ValueError(f"Ungültige Datumsangaben in folgenden Zeilen:\n{fehlerhafte_zeilen}")
+
+ saldo, ausgelegt, anteil, km_info, km_preis = compute_settlements(df)
+ zahlungen = minimize_payments(saldo)
+ create_pdf(df, saldo, ausgelegt, anteil, zahlungen, km_info, km_preis, pdf_path, base_dir=args.monatspfad)
+
+ # Archivieren
+ archivpfad = os.path.join(args.zielpfad, f"{monat}.tar")
+ with tarfile.open(archivpfad, "w") as tar:
+ tar.add(args.monatspfad, arcname=monat)
+
+ subprocess.run(["zstd", "--rm", archivpfad], check=True)
+
+if __name__ == '__main__':
+ main()
diff --git a/examples/beleg1.txt b/examples/beleg1.txt
new file mode 100644
index 0000000..d7aef15
--- /dev/null
+++ b/examples/beleg1.txt
@@ -0,0 +1 @@
+wsnhurhujfnskm
diff --git a/examples/beleg2.txt b/examples/beleg2.txt
new file mode 100644
index 0000000..19812b6
--- /dev/null
+++ b/examples/beleg2.txt
@@ -0,0 +1 @@
+nsfuinsrfuijnuiofjsrnioj
diff --git a/examples/beleg3.txt b/examples/beleg3.txt
new file mode 100644
index 0000000..1a1e429
--- /dev/null
+++ b/examples/beleg3.txt
@@ -0,0 +1 @@
+jsfiujonrwfjuiognerjioun
diff --git a/examples/ex1.csv b/examples/ex1.csv
new file mode 100644
index 0000000..356a7bf
--- /dev/null
+++ b/examples/ex1.csv
@@ -0,0 +1,8 @@
+2025-12-12-18-44-30;Leo;A;C;Handtuch;10.00 €;;;beleg1.txt
+2025-12-12-18-44-30;Bene;A;C;Spülmittel;10.00 €;;;beleg2.txt
+2025-12-12-18-44-30;Leo;A;C;Handtuch;10.00 €;;;beleg3.txt
+2025-12-12-18-44-30;Leo;B;C;Tanken;45.00 €;;;beleg3.txt
+2025-12-12-18-44-30;Bene;B;C;Tanken;37.33 €;;;beleg3.txt
+2025-12-12-18-44-30;Leo;B;U;Autofahrt;111.0 km;;;beleg3.txt
+2025-12-12-18-44-30;Bene;B;U;Autofahrt;63.0 km;;;beleg3.txt
+
diff --git a/modules/__init__.py b/modules/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/modules/__init__.py
diff --git a/modules/base.py b/modules/base.py
new file mode 100644
index 0000000..7d04644
--- /dev/null
+++ b/modules/base.py
@@ -0,0 +1,39 @@
+from dataclasses import dataclass
+from typing import Any, Dict, List, Protocol
+
+import matplotlib.pyplot as plt
+from matplotlib.axes import Axes
+from matplotlib.font_manager import FontProperties
+
+
+@dataclass
+class Frame:
+ title: str
+
+ def render(self, ax: Axes, mono_font: FontProperties) -> None:
+ raise NotImplementedError
+
+@dataclass
+class BigFrame:
+ """
+ Nimmt eine halbe PDF-Seite ein (Renderer packt 2 BigFrames pro Seite).
+ """
+ title: str
+
+ def render(self, ax: Axes, mono_font: FontProperties) -> None:
+ raise NotImplementedError
+
+@dataclass
+class ModuleResult:
+ summary_text: str # NEU: wird im Hauptprogramm in die Konsole gedruckt
+ frames: List[Frame] # Kacheln (optional)
+ bigframes: List[BigFrame]
+ pages: List[plt.Figure] # Vollseiten (optional)
+
+
+class Module(Protocol):
+ name: str
+
+ def process(self, df, context: Dict[str, Any]) -> ModuleResult:
+ ...
+
diff --git a/modules/general.py b/modules/general.py
new file mode 100644
index 0000000..f7eca38
--- /dev/null
+++ b/modules/general.py
@@ -0,0 +1,560 @@
+from typing import Any, Dict, List, Tuple
+
+import pandas as pd
+import matplotlib.pyplot as plt
+from matplotlib.axes import Axes
+from matplotlib.font_manager import FontProperties
+
+import numpy as np
+import matplotlib.dates as mdates
+from dataclasses import dataclass
+from typing import Optional
+
+from .base import Frame, BigFrame, ModuleResult
+
+
+MONEY_UNITS = {"€", "eur", "EUR", "euro", "EURO"}
+
+
+def _is_money_unit(u: str) -> bool:
+ return str(u).strip() in MONEY_UNITS
+
+
+def compute_group_distribution(df: pd.DataFrame):
+ """
+ Liefert:
+ group_summary: dict group -> info
+ per_person: DataFrame columns [person, contributed, share, balance]
+ per_group_person: DataFrame detail columns [group, person, contributed, usage, share, balance]
+ """
+ # Explode Gruppen
+ work = df.copy()
+ work = work.explode("dist_groups")
+ work["group"] = work["dist_groups"].fillna("").astype(str).str.strip()
+ work = work[work["group"] != ""]
+
+ # C/U Normalisierung
+ work["flag"] = work["Distributionsflag"].astype(str).str.strip().str.upper()
+ work["person"] = work["Nutzer"].astype(str).str.strip()
+
+ # Contributions (Geld)
+ contrib = work[work["flag"] == "C"].copy()
+ if len(contrib) > 0:
+ bad_units = contrib[~contrib["unit"].apply(_is_money_unit)]
+ if len(bad_units) > 0:
+ raise ValueError(
+ "Contribution (C) muss Geld-Einheit haben (z.B. € / EUR). "
+ f"Problemzeilen:\n{bad_units[['Datum','Nutzer','group','Positionsbezeichnung','Positionswert','unit']]}"
+ )
+
+ # Usage (Beliebige Einheit, pro Gruppe sollte es sinnvoll einheitlich sein)
+ usage = work[work["flag"] == "U"].copy()
+
+ # Summen
+ contrib_by_gp = contrib.groupby(["group", "person"])["value"].sum().rename("contributed").reset_index()
+ contrib_tot = contrib.groupby("group")["value"].sum().rename("total_contrib").reset_index()
+
+ usage_by_gp = usage.groupby(["group", "person"])["value"].sum().rename("usage").reset_index()
+ usage_tot = usage.groupby("group")["value"].sum().rename("total_usage").reset_index()
+ usage_unit = usage.groupby("group")["unit"].agg(lambda s: s.dropna().astype(str).unique().tolist()).reset_index()
+ usage_unit = usage_unit.rename(columns={"unit": "usage_units"})
+
+ participants = work.groupby("group")["person"].agg(lambda s: sorted(set(s.tolist()))).reset_index()
+ participants = participants.rename(columns={"person": "participants"})
+
+ # group_summary
+ summary = (
+ participants.merge(contrib_tot, on="group", how="left")
+ .merge(usage_tot, on="group", how="left")
+ .merge(usage_unit, on="group", how="left")
+ )
+ summary["total_contrib"] = summary["total_contrib"].fillna(0.0)
+ summary["total_usage"] = summary["total_usage"].fillna(0.0)
+ summary["has_usage"] = summary["total_usage"].apply(lambda x: x > 0)
+ summary["mode"] = summary.apply(lambda r: "usage" if r["has_usage"] else "equal", axis=1)
+
+ # Detail pro (group, person)
+ detail = (
+ pd.DataFrame({"group": work["group"].unique()})
+ .assign(key=1)
+ .merge(pd.DataFrame({"person": work["person"].unique()}).assign(key=1), on="key")
+ .drop(columns=["key"])
+ )
+ # Nur relevante Paare, die in der Gruppe vorkommen
+ gp_person = work[["group", "person"]].drop_duplicates()
+ detail = detail.merge(gp_person, on=["group", "person"], how="inner")
+
+ detail = detail.merge(contrib_by_gp, on=["group", "person"], how="left").merge(usage_by_gp, on=["group", "person"], how="left")
+ detail["contributed"] = detail["contributed"].fillna(0.0)
+ detail["usage"] = detail["usage"].fillna(0.0)
+
+ # Shares berechnen pro Gruppe
+ shares = []
+ for _, row in summary.iterrows():
+ g = row["group"]
+ total_c = float(row["total_contrib"] or 0.0)
+ parts = row["participants"] or []
+ n = len(parts) if parts else 0
+
+ g_detail = detail[detail["group"] == g].copy()
+ # usage-mode, sobald es irgendeine U-Position gibt (auch wenn total_usage==0 → fallback)
+ g_has_any_u = (usage["group"] == g).any()
+
+ if g_has_any_u:
+ total_u = float(g_detail["usage"].sum())
+ if total_u > 0:
+ g_detail["share"] = g_detail["usage"] / total_u * total_c
+ mode = "usage"
+ else:
+ # fallback: gleichmäßig unter Teilnehmern der Gruppe
+ g_detail["share"] = (total_c / n) if n else 0.0
+ mode = "equal(fallback)"
+ else:
+ g_detail["share"] = (total_c / n) if n else 0.0
+ mode = "equal"
+
+ g_detail["mode"] = mode
+ shares.append(g_detail[["group", "person", "share", "mode"]])
+
+ shares_df = pd.concat(shares, ignore_index=True) if shares else pd.DataFrame(columns=["group","person","share","mode"])
+ detail = detail.merge(shares_df, on=["group", "person"], how="left")
+ detail["share"] = detail["share"].fillna(0.0)
+ detail["balance"] = detail["contributed"] - detail["share"]
+
+ # per_person totals
+ per_person = detail.groupby("person")[["contributed", "share", "balance"]].sum().reset_index()
+ per_person = per_person.sort_values("person")
+
+ # summary erweitern
+ # "Sobald es eine Position mit U gibt" zählt, auch wenn total_usage==0 (fallback)
+ has_any_u = usage.groupby("group").size().rename("u_count").reset_index()
+ summary = summary.merge(has_any_u, on="group", how="left")
+ summary["u_count"] = summary["u_count"].fillna(0).astype(int)
+ summary["mode"] = summary["u_count"].apply(lambda c: "usage" if c > 0 else "equal")
+
+ return summary, per_person, detail
+
+@dataclass
+class GroupTimeSeries:
+ group: str
+ times: pd.DatetimeIndex
+ participants: List[str]
+ usage_units: List[str]
+ xlim_start: pd.Timestamp
+ xlim_end: pd.Timestamp
+ contrib_cum: Dict[str, pd.Series] # € kumulativ
+ usage_cum: Dict[str, pd.Series] # unit kumulativ (z.B. km, stk)
+ share_cum: Dict[str, pd.Series] # € kumulativ (Anteil)
+ ratio: Dict[str, pd.Series] # Anteil/Ausgelegt
+
+
+def _auto_time_limits(tmin: pd.Timestamp, tmax: pd.Timestamp) -> tuple[pd.Timestamp, pd.Timestamp]:
+ # +/- 5% Intervall, bei 0 Intervall fallback 30 Minuten
+ dt = tmax - tmin
+ if dt <= pd.Timedelta(0):
+ margin = pd.Timedelta(minutes=30)
+ else:
+ margin = dt * 0.05
+ return (tmin - margin, tmax + margin)
+
+
+def _prepare_group_timeseries(df: pd.DataFrame, group: str) -> Optional[GroupTimeSeries]:
+ # explode Gruppen und filtere
+ work = df.copy().explode("dist_groups")
+ work["group"] = work["dist_groups"].fillna("").astype(str).str.strip()
+ work = work[work["group"] == group].copy()
+
+ work = work[pd.notna(work["Datum"])]
+ if work.empty:
+ return None
+
+ work["person"] = work["Nutzer"].astype(str).str.strip()
+ work["flag"] = work["Distributionsflag"].astype(str).str.strip().str.upper()
+
+ participants = sorted(work["person"].unique().tolist())
+
+ # timeline: alle Zeitpunkte der Gruppe (unique, sortiert)
+ times = pd.DatetimeIndex(sorted(work["Datum"].unique()))
+ tmin, tmax = times.min(), times.max()
+ x0, x1 = _auto_time_limits(tmin, tmax)
+
+ times = times.union(pd.DatetimeIndex([x0, x1])).sort_values()
+
+ # usage units (kann leer sein, oder mehrere – wir zeigen dann z.B. "km/stk")
+ usage_units = sorted(
+ work.loc[work["flag"] == "U", "unit"]
+ .dropna()
+ .astype(str)
+ .str.strip()
+ .unique()
+ .tolist()
+ )
+
+ # pro Person: Beiträge (C) und Nutzung (U) als kumulatives step-series auf timeline
+ contrib_cum: Dict[str, pd.Series] = {}
+ usage_cum: Dict[str, pd.Series] = {}
+
+ for p in participants:
+ c = work[(work["person"] == p) & (work["flag"] == "C")].copy()
+ u = work[(work["person"] == p) & (work["flag"] == "U")].copy()
+
+ # Beiträge: nach Datum aggregieren, reindex auf timeline, kumulieren
+ c_by_t = c.groupby("Datum")["value"].sum() if not c.empty else pd.Series(dtype=float)
+ c_by_t = c_by_t.reindex(times, fill_value=0.0)
+ contrib_cum[p] = c_by_t.cumsum()
+
+ # Nutzung: nach Datum aggregieren, reindex auf timeline, kumulieren
+ u_by_t = u.groupby("Datum")["value"].sum() if not u.empty else pd.Series(dtype=float)
+ u_by_t = u_by_t.reindex(times, fill_value=0.0)
+ usage_cum[p] = u_by_t.cumsum()
+
+ # share über Zeit: kumulative total contributions verteilt
+ total_contrib = sum((contrib_cum[p] for p in participants), start=pd.Series(0.0, index=times))
+ total_usage = sum((usage_cum[p] for p in participants), start=pd.Series(0.0, index=times))
+
+ has_any_u = (work["flag"] == "U").any()
+ n = len(participants) if participants else 1
+
+ share_cum: Dict[str, pd.Series] = {}
+ if has_any_u:
+ # usage-mode sobald U existiert; solange total_usage==0 => equal fallback
+ for p in participants:
+ # share = total_contrib * usage_p / total_usage, sonst total_contrib/n
+ usage_p = usage_cum[p]
+ with np.errstate(divide="ignore", invalid="ignore"):
+ share_usage = total_contrib * (usage_p / total_usage.replace(0.0, np.nan))
+ share_equal = total_contrib / float(n)
+ share = share_usage.where(total_usage > 0, share_equal)
+ share_cum[p] = share.fillna(0.0)
+ else:
+ # equal-mode immer
+ equal = total_contrib / float(n)
+ for p in participants:
+ share_cum[p] = equal
+
+ ratio: Dict[str, pd.Series] = {}
+ for p in participants:
+ denom = contrib_cum[p].astype(float)
+ r = share_cum[p].astype(float) / denom.where(denom > 0, np.nan)
+ ratio[p] = r.fillna(0.0)
+
+ return GroupTimeSeries(
+ group=group,
+ times=times,
+ participants=participants,
+ usage_units=usage_units,
+ xlim_start=x0,
+ xlim_end=x1,
+ contrib_cum=contrib_cum,
+ usage_cum=usage_cum,
+ share_cum=share_cum,
+ ratio=ratio,
+ )
+
+
+@dataclass
+class GroupChartBigFrame(BigFrame):
+ """
+ kind:
+ - 'usage_cum'
+ - 'contrib_cum'
+ - 'share_cum'
+ - 'ratio'
+ """
+ gts: GroupTimeSeries
+ kind: str
+
+ def render(self, ax: Axes, mono_font: FontProperties) -> None:
+ ax.axis("on")
+
+ locator = mdates.AutoDateLocator(minticks=3, maxticks=7)
+ formatter = mdates.ConciseDateFormatter(locator)
+ ax.xaxis.set_major_locator(locator)
+ ax.xaxis.set_major_formatter(formatter)
+ ax.xaxis.get_offset_text().set_visible(False) # <-- "2025-Dec" weg
+
+ ax.set_xlim(self.gts.xlim_start, self.gts.xlim_end)
+
+ if self.kind == "usage_cum":
+ series_map = self.gts.usage_cum
+ unit = "/".join(self.gts.usage_units) if self.gts.usage_units else ""
+ ax.set_ylabel(f"Verbrauch kumulativ {unit}".strip(), fontproperties=mono_font)
+
+ elif self.kind == "contrib_cum":
+ series_map = self.gts.contrib_cum
+ ax.set_ylabel("Contributions kumulativ €", fontproperties=mono_font)
+
+ elif self.kind == "share_cum":
+ series_map = self.gts.share_cum
+ ax.set_ylabel("Anteil kumulativ €", fontproperties=mono_font)
+
+ elif self.kind == "ratio":
+ series_map = self.gts.ratio
+ ax.set_ylabel("Anteil / Ausgelegt", fontproperties=mono_font)
+ ax.set_yscale("log") # <-- LOG
+
+ else:
+ raise ValueError(f"Unknown kind: {self.kind}")
+
+ # Plot + Sammeln für robuste y-Limits
+ all_vals = []
+
+ min_ratio = 1e-3 # „quasi 0“ für log, damit Kurven am Anfang nicht "mittendrin" starten
+
+ for p in self.gts.participants:
+ y = series_map[p].copy()
+
+ if self.kind == "ratio":
+ # NaN/0/Inf behandeln, damit die Kurve von Anfang an existiert
+ y = y.replace([np.inf, -np.inf], np.nan)
+ y = y.fillna(min_ratio)
+ y = y.clip(lower=min_ratio)
+ else:
+ y = y.replace([np.inf, -np.inf], np.nan).fillna(0.0)
+
+ # Steps für kumulative Kurven ist meist sauberer
+ ax.plot(self.gts.times, y.values, label=p, linewidth=1, drawstyle="steps-post")
+
+ v = y.values
+ v = v[np.isfinite(v)]
+ if v.size:
+ all_vals.append(v)
+
+ # y-Limits so setzen, dass wirklich ALLE Werte sichtbar sind
+ if all_vals:
+ vv = np.concatenate(all_vals)
+
+ if self.kind in ("usage_cum", "contrib_cum", "share_cum"):
+ vmax = float(np.nanmax(vv)) if vv.size else 0.0
+ if vmax <= 0:
+ ax.set_ylim(0, 1)
+ else:
+ ax.set_ylim(0, vmax * 1.08) # kleiner Puffer
+
+ elif self.kind == "ratio":
+ vpos = vv[vv > 0]
+ if vpos.size:
+ vmin = float(np.nanmin(vpos))
+ vmax = float(np.nanmax(vpos))
+ ax.set_ylim(vmin / 1.5, vmax * 1.5) # log: multiplicative padding
+
+ ax.grid(True, alpha=0.2)
+
+ leg = ax.legend(prop=mono_font, fontsize=7, loc="best", ncols=2)
+ if leg:
+ for t in leg.get_texts():
+ t.set_fontproperties(mono_font)
+
+ # Tick-Fonts monospace
+ for tick in ax.get_xticklabels() + ax.get_yticklabels():
+ tick.set_fontproperties(mono_font)
+
+@dataclass
+class TextFrame(Frame):
+ text: str
+
+ def render(self, ax: Axes, mono_font: FontProperties) -> None:
+ ax.text(0, 1, self.text, va="top", ha="left", fontproperties=mono_font)
+
+@dataclass
+class PlotBigFrame(BigFrame):
+ per_person: pd.DataFrame # erwartet Spalten: person, contributed, share
+
+ def render(self, ax: Axes, mono_font: FontProperties) -> None:
+ # Axes ist schon da, wir zeichnen direkt hinein
+ ax.axis("on")
+ plot_df = self.per_person.set_index("person")[["contributed", "share"]]
+ plot_df.plot.bar(ax=ax)
+ ax.tick_params(axis="x", rotation=0)
+ leg = ax.legend(prop=mono_font)
+ if leg:
+ for t in leg.get_texts():
+ t.set_fontproperties(mono_font)
+
+ for tick in ax.get_xticklabels() + ax.get_yticklabels():
+ tick.set_fontproperties(mono_font)
+
+ ax.xaxis.label.set_fontproperties(mono_font)
+ ax.yaxis.label.set_fontproperties(mono_font)
+
+
+class GeneralModule:
+ name = "general"
+
+ def process(self, df: pd.DataFrame, context: Dict[str, Any]) -> ModuleResult:
+ want_pdf = bool(context.get("want_pdf", True))
+
+ mono_font = context.get("mono_font") or FontProperties(family="DejaVu Sans Mono", size=8)
+
+ group_summary, per_person, detail = compute_group_distribution(df)
+
+ balance = {r["person"]: float(r["balance"]) for _, r in per_person.iterrows()}
+ payments = self._minimize_payments(balance)
+
+ # ---- NEU: Textauswertung für Konsole
+ summary_lines = []
+ summary_lines.append("General – Verteilung über Distributionsgruppen")
+ summary_lines.append("")
+ summary_lines.append("Gruppen:")
+ for _, r in group_summary.sort_values("group").iterrows():
+ g = r["group"]
+ total_c = float(r.get("total_contrib", 0.0))
+ u_count = int(r.get("u_count", 0))
+ mode = "usage" if u_count > 0 else "equal"
+ participants = r.get("participants", []) or []
+ summary_lines.append(f" - {g}: {total_c:.2f} €; mode={mode}; teilnehmer={len(participants)}")
+
+ summary_lines.append("")
+ summary_lines.append("Personen (Summe über alle Gruppen):")
+ for _, r in per_person.sort_values("person").iterrows():
+ summary_lines.append(
+ f" - {r['person']}: ausgelegt={r['contributed']:.2f} €; anteil={r['share']:.2f} €; saldo={r['balance']:.2f} €"
+ )
+
+ summary_lines.append("")
+ summary_lines.append("Ausgleich (minimiert):")
+ if payments:
+ for p, r, a in payments:
+ summary_lines.append(f" - {p} → {r}: {a:.2f} €")
+ else:
+ summary_lines.append(" (keine Zahlungen nötig)")
+
+ summary_text = "\n".join(summary_lines)
+
+ frames: List[Frame] = []
+ bigframes: List[BigFrame] = []
+ pages: List[plt.Figure] = []
+
+ if want_pdf:
+ frames.extend(self._make_frames(group_summary, per_person, payments))
+
+ # BigFrame: Gesamt-Balkenplot bleibt (wie vorher)
+ bigframes.append(
+ PlotBigFrame(
+ title="General – Ausgelegt vs Anteil (Summe über Gruppen)",
+ per_person=per_person.copy(),
+ )
+ )
+
+ # NEU: pro Distributionsgruppe 4 BigFrame-Charts
+ for g in sorted(group_summary["group"].unique().tolist()):
+ gts = _prepare_group_timeseries(df, g)
+ if not gts:
+ continue
+
+ bigframes.append(GroupChartBigFrame(
+ title=f"{g} – Kumulativer Verbrauch pro Person",
+ gts=gts,
+ kind="usage_cum",
+ ))
+ bigframes.append(GroupChartBigFrame(
+ title=f"{g} – Kumulative Contributions pro Person",
+ gts=gts,
+ kind="contrib_cum",
+ ))
+ bigframes.append(GroupChartBigFrame(
+ title=f"{g} – Anteil pro Person (zeitlicher Verlauf)",
+ gts=gts,
+ kind="share_cum",
+ ))
+ bigframes.append(GroupChartBigFrame(
+ title=f"{g} – Verhältnis Anteil/Ausgelegt (zeitlicher Verlauf)",
+ gts=gts,
+ kind="ratio",
+ ))
+
+ # Pages: nur noch Detailseiten, keine Balkenplot-Seite mehr
+ pages.extend(self._make_pages(group_summary, per_person, detail, mono_font))
+
+ return ModuleResult(summary_text=summary_text, frames=frames, bigframes=bigframes, pages=pages)
+
+ def _minimize_payments(self, balance: Dict[str, float]):
+ receivers = []
+ payers = []
+ for p, amt in balance.items():
+ a = round(float(amt), 2)
+ if a > 0:
+ receivers.append([p, a])
+ elif a < 0:
+ payers.append([p, -a])
+
+ out = []
+ i = j = 0
+ while i < len(payers) and j < len(receivers):
+ payer, avail = payers[i]
+ recv, need = receivers[j]
+ pay = min(avail, need)
+ out.append((payer, recv, pay))
+ payers[i][1] -= pay
+ receivers[j][1] -= pay
+ if round(payers[i][1], 2) == 0:
+ i += 1
+ if round(receivers[j][1], 2) == 0:
+ j += 1
+ return out
+
+ def _make_frames(self, group_summary: pd.DataFrame, per_person: pd.DataFrame, payments: List[Tuple[str,str,float]]) -> List[Frame]:
+ # Frame 1: Gruppen-Übersicht
+ lines = ["Gruppenübersicht:"]
+ for _, r in group_summary.sort_values("group").iterrows():
+ g = r["group"]
+ total_c = float(r.get("total_contrib", 0.0))
+ u_count = int(r.get("u_count", 0))
+ parts = r.get("participants", [])
+ mode = "usage" if u_count > 0 else "equal"
+ lines.append(f"- {g}: {total_c:.2f} €; mode={mode}; teilnehmer={len(parts)}")
+
+ f1 = TextFrame(title="General: Gruppen", text="\n".join(lines))
+
+ # Frame 2: Personen-Totale
+ lines = ["Personen (Summe über alle Gruppen):", "Person | contributed | share | balance"]
+ for _, r in per_person.iterrows():
+ lines.append(f"{r['person']}: {r['contributed']:.2f} €; {r['share']:.2f} €; {r['balance']:.2f} €")
+ f2 = TextFrame(title="General: Personen", text="\n".join(lines))
+
+ # Frame 3: Ausgleich
+ lines = ["Ausgleich (minimiert):"]
+ if payments:
+ for p, r, a in payments:
+ lines.append(f"{p} → {r}: {a:.2f} €")
+ else:
+ lines.append("(keine Zahlungen nötig)")
+ f3 = TextFrame(title="General: Ausgleich", text="\n".join(lines))
+
+ return [f1, f2, f3]
+
+ def _make_pages(self, group_summary, per_person, detail, mono_font) -> List[plt.Figure]:
+ pages: List[plt.Figure] = []
+
+ # Textseiten: pro Gruppe Detail (ggf. mehrere)
+ # Wir machen je Gruppe eine Seite, wenn es nicht zu viele sind
+ for g in sorted(detail["group"].unique().tolist()):
+ gdet = detail[detail["group"] == g].sort_values("person")
+ total_c = float(group_summary[group_summary["group"] == g]["total_contrib"].iloc[0]) if (group_summary["group"] == g).any() else 0.0
+ u_count = int(group_summary[group_summary["group"] == g]["u_count"].iloc[0]) if (group_summary["group"] == g).any() else 0
+ mode = "usage" if u_count > 0 else "equal"
+
+ lines = [
+ f"Gruppe: {g}",
+ f"Total Contribution: {total_c:.2f} €",
+ f"Mode: {mode}",
+ "",
+ "Person | contributed | usage | share | balance",
+ ]
+ for _, r in gdet.iterrows():
+ lines.append(
+ f"{r['person']}: {r['contributed']:.2f} €; {r['usage']:.4f}; {r['share']:.2f} €; {r['balance']:.2f} €"
+ )
+
+ fig, ax = plt.subplots(figsize=(8.27, 11.69))
+ ax.axis("off")
+ ax.text(0, 1, "\n".join(lines), va="top", ha="left", fontproperties=mono_font)
+ pages.append(fig)
+
+ # Optional: Nutzungsverläufe für Gruppen mit unit "km"
+ # (nur wenn U vorhanden und unit in den U-rows km ist)
+ # Dafür brauchen wir zeitliche Daten → aus detail nicht möglich, also direkt aus df wäre besser.
+ # Wenn du willst, ergänze ich das als eigene Seite pro km-Gruppe auf Basis der Original-DF.
+
+ return pages
+
diff --git a/modules/module.py b/modules/module.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/modules/module.py
diff --git a/out.pdf b/out.pdf
new file mode 100644
index 0000000..bb63505
--- /dev/null
+++ b/out.pdf
Binary files differ
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..2e3fc80
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,3 @@
+pandas>=2.0
+matplotlib>=3.7
+
diff --git a/xembu.py b/xembu.py
new file mode 100644
index 0000000..5c4c701
--- /dev/null
+++ b/xembu.py
@@ -0,0 +1,489 @@
+#!/usr/bin/env python3
+import argparse
+import os
+import tarfile
+import subprocess
+from typing import Dict, List, Optional
+
+import pandas as pd
+import matplotlib.pyplot as plt
+from matplotlib.backends.backend_pdf import PdfPages
+from matplotlib import font_manager
+
+from modules.base import Frame, BigFrame, Module, ModuleResult
+from modules.general import GeneralModule
+
+from datetime import datetime
+
+CSV_COLUMNS = [
+ "Datum",
+ "Nutzer",
+ "Distributionsgruppe",
+ "Distributionsflag",
+ "Positionsbezeichnung",
+ "Positionswert",
+ "Modules",
+ "Parameters",
+ "Beleg",
+]
+
+
+def _pick_mono_font(size: int = 8) -> font_manager.FontProperties:
+ for fam in ["Inconsolata", "DejaVu Sans Mono", "monospace"]:
+ try:
+ return font_manager.FontProperties(family=fam, size=size)
+ except Exception:
+ pass
+ return font_manager.FontProperties(size=size)
+
+def _decorate_figure(fig, mono_font, title: str, generated_at: str, page: int, total_pages: int):
+ # Margins: links/rechts 2cm, oben/unten 1cm
+ margin_lr_cm = 2.0
+ margin_tb_cm = 1.0
+
+ # Zusätzlicher Abstand (Bänder) zwischen Header/Footer und Content
+ header_gap_cm = 1.3 # mehr Abstand nach unten
+ footer_gap_cm = 2.0 # mehr Abstand nach oben (2-zeiliger Footer)
+
+ cm_to_in = 1 / 2.54
+ margin_lr_in = margin_lr_cm * cm_to_in
+ margin_tb_in = margin_tb_cm * cm_to_in
+ header_gap_in = header_gap_cm * cm_to_in
+ footer_gap_in = footer_gap_cm * cm_to_in
+
+ w_in, h_in = fig.get_size_inches()
+
+ mx = min(0.45, margin_lr_in / w_in)
+ my = min(0.45, margin_tb_in / h_in)
+ header_gap = header_gap_in / h_in
+ footer_gap = footer_gap_in / h_in
+
+ # Content-Bereich: innerhalb der Margins + zusätzlich Platz für Header/Footer
+ top = 1 - my - header_gap
+ bottom = my + footer_gap
+ if top <= bottom:
+ # Fallback, falls es zu eng wird
+ top = 1 - my
+ bottom = my
+
+ fig.subplots_adjust(left=mx, right=1 - mx, top=top, bottom=bottom)
+
+ # Header/Footer Positionen: jeweils an der inneren Kante der Margins
+ left_x = mx
+ right_x = 1 - mx
+ header_y = 1 - my
+ footer_y = my
+
+ # Kopfzeile
+ fig.text(left_x, header_y, title, ha="left", va="top", fontproperties=mono_font, fontsize=9)
+ fig.text(right_x, header_y, generated_at, ha="right", va="top", fontproperties=mono_font, fontsize=9)
+
+ # Fußzeile links (zweizeilig)
+ footer_left = (
+ "xembu - eXtensiblE Multiuser Bookkeeping Utility\n"
+ "Copyright (C) 2024 Leonard Kugis\n"
+ "This program comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt"
+ )
+ fig.text(left_x, footer_y, footer_left, ha="left", va="bottom",
+ fontproperties=mono_font, fontsize=7, linespacing=1.1)
+
+ # Fußzeile rechts
+ fig.text(right_x, footer_y, f"{page} / {total_pages}", ha="right", va="bottom",
+ fontproperties=mono_font, fontsize=8)
+
+def _read_csv_flexible(path: str) -> pd.DataFrame:
+ df = pd.read_csv(path, sep=";", encoding="utf-8", header=0)
+ if not set(CSV_COLUMNS).issubset(set(df.columns)):
+ df = pd.read_csv(path, sep=";", encoding="utf-8", header=None, names=CSV_COLUMNS)
+ return df
+
+
+def parse_value_unit(s: str):
+ if s is None or (isinstance(s, float) and pd.isna(s)):
+ return 0.0, ""
+ txt = str(s).strip()
+ if not txt:
+ return 0.0, ""
+ parts = txt.split()
+ if len(parts) < 2:
+ num = txt.replace(",", ".").replace("€", "").strip()
+ return float(num), ""
+ unit = parts[-1].strip()
+ num_str = " ".join(parts[:-1]).strip().replace(",", ".").replace("€", "").strip()
+ return float(num_str), unit
+
+
+def parse_modules_list(s: str) -> List[str]:
+ if s is None or (isinstance(s, float) and pd.isna(s)):
+ return []
+ mods = [m.strip() for m in str(s).split(",")]
+ return [m for m in mods if m]
+
+
+def parse_groups_list(s: str) -> List[str]:
+ if s is None or (isinstance(s, float) and pd.isna(s)):
+ return []
+ gs = [g.strip() for g in str(s).split(",")]
+ return [g for g in gs if g]
+
+
+def parse_parameters_list(s: str) -> List[tuple]:
+ if s is None or (isinstance(s, float) and pd.isna(s)):
+ return []
+ txt = str(s).strip()
+ if not txt:
+ return []
+ import re
+
+ tuples = []
+ for m in re.finditer(r"\(([^()]*)\)", txt):
+ inner = m.group(1).strip()
+ if inner == "":
+ tuples.append(tuple())
+ continue
+ parts = [p.strip() for p in inner.split(",") if p.strip() != ""]
+ vals = []
+ for p in parts:
+ try:
+ if "." in p:
+ vals.append(float(p))
+ else:
+ vals.append(int(p))
+ except Exception:
+ try:
+ vals.append(float(p))
+ except Exception:
+ vals.append(p)
+ tuples.append(tuple(vals))
+ return tuples
+
+
+def parse_csv(path: str) -> pd.DataFrame:
+ df = _read_csv_flexible(path)
+
+ df["Datum"] = pd.to_datetime(df["Datum"], format="%Y-%m-%d-%H-%M-%S", errors="coerce")
+ df["Nutzer"] = df["Nutzer"].astype(str).str.strip()
+ df["Distributionsflag"] = df["Distributionsflag"].astype(str).str.strip().str.upper()
+ df["Positionsbezeichnung"] = df["Positionsbezeichnung"].astype(str).str.strip()
+
+ df["dist_groups"] = df["Distributionsgruppe"].apply(parse_groups_list)
+ df["modules_list"] = df["Modules"].apply(parse_modules_list)
+ df["params_list"] = df["Parameters"].apply(parse_parameters_list)
+
+ vals_units = df["Positionswert"].apply(parse_value_unit)
+ df["value"] = vals_units.apply(lambda x: x[0])
+ df["unit"] = vals_units.apply(lambda x: x[1])
+
+ df["Beleg"] = df["Beleg"].where(df["Beleg"].notna(), "")
+ return df
+
+
+def compute_hash(filepath: str, base_dir: str = ".") -> Optional[str]:
+ import hashlib
+ try:
+ if not filepath:
+ return None
+ full_path = os.path.join(base_dir, filepath)
+ with open(full_path, "rb") as f:
+ return hashlib.sha1(f.read()).hexdigest()
+ except Exception:
+ return None
+
+def _build_positions_table_figs(df: pd.DataFrame, base_dir: str, mono_font):
+ figures = []
+
+ columns = [
+ "Datum", "Nutzer", "Distributionsgruppe", "Flag",
+ "Positionsbezeichnung", "Positionswert",
+ "Modules", "Parameters", "Beleg", "SHA1",
+ ]
+
+ table_data = []
+ for _, row in df.sort_values("Datum").iterrows():
+ sha1 = compute_hash(str(row["Beleg"]), base_dir=base_dir) if row["Beleg"] else None
+ sha1_fmt = ""
+ if sha1:
+ sha1_fmt = sha1[: len(sha1) // 2] + "\n" + sha1[len(sha1) // 2 :]
+
+ groups_str = ", ".join(row["dist_groups"]) if isinstance(row["dist_groups"], list) else str(row["Distributionsgruppe"])
+ mods_str = ", ".join(row["modules_list"]) if isinstance(row["modules_list"], list) else str(row["Modules"])
+ params_str = str(row["params_list"]) if isinstance(row["params_list"], list) else str(row["Parameters"])
+
+ table_data.append([
+ row["Datum"].strftime("%Y-%m-%d %H:%M:%S") if pd.notna(row["Datum"]) else "INVALID",
+ row["Nutzer"],
+ groups_str,
+ row["Distributionsflag"],
+ row["Positionsbezeichnung"],
+ f"{row['value']:.4f} {row['unit']}".strip(),
+ mods_str,
+ params_str,
+ str(row["Beleg"]) if row["Beleg"] else "",
+ sha1_fmt,
+ ])
+
+ chunk_size = 16
+ fontprops = font_manager.FontProperties(size=8)
+
+ for start in range(0, len(table_data), chunk_size):
+ fig, ax = plt.subplots(figsize=(8.27, 11.69))
+ ax.axis("off")
+ chunk = table_data[start:start + chunk_size]
+
+ renderer = fig.canvas.get_renderer()
+
+ def get_text_width(text, prop):
+ t = plt.text(0, 0, str(text), fontproperties=prop)
+ bb = t.get_window_extent(renderer=renderer)
+ t.remove()
+ return bb.width
+
+ col_widths = []
+ for col_idx in range(len(columns)):
+ max_w = get_text_width(columns[col_idx], fontprops)
+ for r in chunk:
+ max_w = max(max_w, get_text_width(r[col_idx], fontprops))
+ col_widths.append(max_w)
+
+ col_widths_inches = [w / fig.dpi for w in col_widths]
+ total_w = sum(col_widths_inches) if sum(col_widths_inches) else 1.0
+ scaled = [w / total_w for w in col_widths_inches]
+
+ table = ax.table(cellText=chunk, colLabels=columns, loc="center", cellLoc="left")
+ table.auto_set_font_size(False)
+
+ for cell in table.get_celld().values():
+ cell.get_text().set_fontproperties(mono_font)
+ cell.PAD = 0.03
+
+ for (_, c), cell in table.get_celld().items():
+ if c < len(scaled):
+ cell.set_width(scaled[c])
+
+ table.scale(1, 2.0)
+ figures.append(fig)
+
+ return figures
+
+
+def _separator_page(pdf: PdfPages, title: str, mono_font):
+ fig, ax = plt.subplots(figsize=(8.27, 11.69))
+ ax.axis("off")
+ ax.text(0.5, 0.5, title, ha="center", va="center", fontproperties=mono_font, fontsize=18)
+ pdf.savefig(fig)
+ plt.close(fig)
+
+def _build_frame_figs(frames: List[Frame], mono_font):
+ figures = []
+ idx = 0
+ while idx < len(frames):
+ fig, axs = plt.subplots(3, 2, figsize=(8.27, 11.69))
+ axs = axs.flatten()
+
+ for i in range(6):
+ ax = axs[i]
+ ax.clear()
+ ax.axis("off")
+ if idx + i < len(frames):
+ fr = frames[idx + i]
+ ax.set_title(fr.title, fontproperties=mono_font, fontsize=10)
+ ax.set_title(fr.title, fontsize=10)
+ ax.title.set_fontproperties(mono_font)
+
+ fr.render(ax, mono_font)
+
+ figures.append(fig)
+ idx += 6
+ return figures
+
+def _build_bigframe_figs(bigframes: List[BigFrame], mono_font):
+ figures = []
+ idx = 0
+ while idx < len(bigframes):
+ fig, axs = plt.subplots(2, 1, figsize=(8.27, 11.69))
+ axs = axs.flatten() if hasattr(axs, "flatten") else [axs]
+
+ for i in range(2):
+ ax = axs[i]
+ ax.clear()
+ ax.axis("off")
+ if idx + i < len(bigframes):
+ bf = bigframes[idx + i]
+ ax.set_title(bf.title, fontproperties=mono_font, fontsize=11)
+ ax.set_title(bf.title, fontsize=11)
+ ax.title.set_fontproperties(mono_font)
+
+ bf.render(ax, mono_font)
+
+ figures.append(fig)
+ idx += 2
+ return figures
+
+def _render_pages(pdf: PdfPages, pages: List[plt.Figure]):
+ for fig in pages:
+ pdf.savefig(fig)
+ plt.close(fig)
+
+def create_pdf(
+ df: pd.DataFrame,
+ module_frames: List[Frame],
+ module_bigframes: List[BigFrame],
+ module_pages: List[plt.Figure],
+ pdf_path: str,
+ mono_font,
+ base_dir: str,
+ title: str,
+):
+ os.makedirs(os.path.dirname(os.path.abspath(pdf_path)) or ".", exist_ok=True)
+
+ generated_at = datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
+
+ # 1) Alle Seiten als Figures sammeln (damit wir total_pages kennen)
+ figs: List[plt.Figure] = []
+ figs.extend(_build_positions_table_figs(df, base_dir=base_dir, mono_font=mono_font))
+ figs.extend(_build_frame_figs(module_frames, mono_font=mono_font))
+ figs.extend(_build_bigframe_figs(module_bigframes, mono_font=mono_font))
+ figs.extend(module_pages) # bereits fertige Figures aus Modulen
+
+ total_pages = len(figs)
+
+ # 2) Speichern mit Header/Footer + Seitenzählung
+ with PdfPages(pdf_path) as pdf:
+ for i, fig in enumerate(figs, start=1):
+ _decorate_figure(fig, mono_font, title=title, generated_at=generated_at, page=i, total_pages=total_pages)
+ pdf.savefig(fig)
+ plt.close(fig)
+
+def create_bundle(archive_path: str, csv_path: str, df: pd.DataFrame, base_dir: str, pdf_path: Optional[str] = None):
+ """
+ Bundle enthält: CSV, optional PDF, und alle Belege (relative Pfade aus 'Beleg' relativ zu base_dir).
+ Ausgabe: .tar.zst (über externes zstd).
+ """
+ os.makedirs(os.path.dirname(os.path.abspath(archive_path)) or ".", exist_ok=True)
+
+ # Wir bauen ein temporäres .tar daneben und komprimieren danach.
+ tar_path = archive_path
+ if tar_path.endswith(".zst"):
+ tar_path = tar_path[:-4] # strip ".zst"
+ if not tar_path.endswith(".tar"):
+ tar_path = tar_path + ".tar"
+
+ # Sammle Belege
+ beleg_paths = []
+ for p in df["Beleg"].astype(str).tolist():
+ p = p.strip()
+ if p:
+ beleg_paths.append(p)
+
+ with tarfile.open(tar_path, "w") as tar:
+ # CSV
+ tar.add(csv_path, arcname=os.path.basename(csv_path))
+
+ # PDF optional
+ if pdf_path and os.path.exists(pdf_path):
+ tar.add(pdf_path, arcname=os.path.basename(pdf_path))
+
+ # Belege
+ missing = []
+ for rel in sorted(set(beleg_paths)):
+ abs_path = rel if os.path.isabs(rel) else os.path.join(base_dir, rel)
+ if os.path.exists(abs_path):
+ # arcname: möglichst den relativen Pfad behalten
+ arcname = os.path.basename(rel) if os.path.isabs(rel) else rel
+ tar.add(abs_path, arcname=arcname)
+ else:
+ missing.append(rel)
+
+ # zstd komprimieren → archive_path
+ # zstd -o <archive> <tar>
+ subprocess.run(["zstd", "-T0", "-o", archive_path, tar_path], check=True)
+
+ # tar löschen (zstd bekommt eine Kopie)
+ try:
+ os.remove(tar_path)
+ except Exception:
+ pass
+
+ if missing:
+ print("\n[WARN] Fehlende Belege (nicht im Bundle):")
+ for m in missing:
+ print(f" - {m}")
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument("csv", help="Pfad zur CSV-Datei")
+ parser.add_argument("--title", "-t", help="Titel für PDF-Kopfzeile (optional)")
+ parser.add_argument("--pdf", "-p", help="Pfad zur Ziel-PDF (optional)")
+ parser.add_argument("--bundle", "-b", help="Pfad zum Bundle (.tar.zst), enthält CSV, PDF (falls erzeugt) und Belege (optional)")
+ args = parser.parse_args()
+
+ csv_path = os.path.abspath(args.csv)
+ base_dir = os.path.dirname(csv_path) or "."
+
+ title = args.title if args.title else os.path.basename(csv_path)
+
+ df = parse_csv(csv_path)
+ if df["Datum"].isna().any():
+ bad = df[df["Datum"].isna()][CSV_COLUMNS]
+ raise ValueError(f"Ungültige Datumsangaben in folgenden Zeilen:\n{bad}")
+
+ want_pdf = bool(args.pdf)
+ mono_font = _pick_mono_font(size=8)
+
+ # Module-Registry
+ modules: Dict[str, Module] = {
+ "general": GeneralModule(),
+ # weitere Module später hier registrieren
+ }
+
+ # Modulzuordnung aus CSV
+ rows_for_module: Dict[str, List[int]] = {}
+ for idx, row in df.iterrows():
+ for m in row["modules_list"]:
+ rows_for_module.setdefault(m, []).append(idx)
+
+ results: List[ModuleResult] = []
+
+ # General immer
+ results.append(modules["general"].process(df, context={"base_dir": base_dir, "want_pdf": want_pdf, "mono_font": mono_font}))
+
+ # weitere Module optional
+ for mod_name, indices in rows_for_module.items():
+ if mod_name == "general":
+ continue
+ mod = modules.get(mod_name)
+ if not mod:
+ print(f"[INFO] Unbekanntes Modul '{mod_name}' – ignoriert (noch nicht registriert).")
+ continue
+ subdf = df.loc[indices].copy()
+ results.append(mod.process(subdf, context={"base_dir": base_dir, "want_pdf": want_pdf, "mono_font": mono_font}))
+
+ # ---- NEU: Konsolen-Auswertung je Modul
+ print("\n===== Auswertung =====")
+ for r in results:
+ print(r.summary_text)
+ print("")
+
+ # PDF optional
+ if args.pdf:
+ module_frames: List[Frame] = []
+ module_bigframes: List[BigFrame] = [] # NEU
+ module_pages: List[plt.Figure] = []
+ for r in results:
+ module_frames.extend(r.frames)
+ module_bigframes.extend(r.bigframes) # NEU
+ module_pages.extend(r.pages)
+
+ create_pdf(df, module_frames, module_bigframes, module_pages, args.pdf, mono_font, base_dir=base_dir, title=title)
+ print(f"[OK] PDF geschrieben: {args.pdf}")
+
+ # Bundle optional (enthält CSV + ggf. PDF + Belege)
+ if args.bundle:
+ create_bundle(args.bundle, csv_path, df, base_dir=base_dir, pdf_path=args.pdf if args.pdf else None)
+ print(f"[OK] Bundle geschrieben: {args.bundle}")
+
+
+if __name__ == "__main__":
+ main()
+
diff --git a/xembu_testdata/belege/beleg001.txt b/xembu_testdata/belege/beleg001.txt
new file mode 100644
index 0000000..986aece
--- /dev/null
+++ b/xembu_testdata/belege/beleg001.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-12-18-44-30
+Nutzer: Leo
+Gruppe: General
+Flag: C
+Position: Handtuch
+Wert: 10.00 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg002.txt b/xembu_testdata/belege/beleg002.txt
new file mode 100644
index 0000000..6789085
--- /dev/null
+++ b/xembu_testdata/belege/beleg002.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-12-18-44-30
+Nutzer: Bene
+Gruppe: General
+Flag: C
+Position: Spülmittel
+Wert: 10.00 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg003.txt b/xembu_testdata/belege/beleg003.txt
new file mode 100644
index 0000000..986aece
--- /dev/null
+++ b/xembu_testdata/belege/beleg003.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-12-18-44-30
+Nutzer: Leo
+Gruppe: General
+Flag: C
+Position: Handtuch
+Wert: 10.00 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg004.txt b/xembu_testdata/belege/beleg004.txt
new file mode 100644
index 0000000..a992afb
--- /dev/null
+++ b/xembu_testdata/belege/beleg004.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-12-18-44-30
+Nutzer: Leo
+Gruppe: KFZ
+Flag: C
+Position: Tanken
+Wert: 45.00 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg005.txt b/xembu_testdata/belege/beleg005.txt
new file mode 100644
index 0000000..eb4d886
--- /dev/null
+++ b/xembu_testdata/belege/beleg005.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-12-18-44-30
+Nutzer: Bene
+Gruppe: KFZ
+Flag: C
+Position: Tanken
+Wert: 37.33 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg006.txt b/xembu_testdata/belege/beleg006.txt
new file mode 100644
index 0000000..a9ce179
--- /dev/null
+++ b/xembu_testdata/belege/beleg006.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-12-18-44-30
+Nutzer: Leo
+Gruppe: KFZ
+Flag: U
+Position: Autofahrt
+Wert: 111.0 km
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg007.txt b/xembu_testdata/belege/beleg007.txt
new file mode 100644
index 0000000..d261f05
--- /dev/null
+++ b/xembu_testdata/belege/beleg007.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-12-18-44-30
+Nutzer: Bene
+Gruppe: KFZ
+Flag: U
+Position: Autofahrt
+Wert: 63.0 km
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg008.txt b/xembu_testdata/belege/beleg008.txt
new file mode 100644
index 0000000..9188674
--- /dev/null
+++ b/xembu_testdata/belege/beleg008.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-16-20-29-35
+Nutzer: Bene
+Gruppe: General
+Flag: C
+Position: Lebensmittel
+Wert: 45.01 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg009.txt b/xembu_testdata/belege/beleg009.txt
new file mode 100644
index 0000000..41f1e1f
--- /dev/null
+++ b/xembu_testdata/belege/beleg009.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-07-06-39-35
+Nutzer: Chris
+Gruppe: General
+Flag: C
+Position: Miete Küche
+Wert: 44.72 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg010.txt b/xembu_testdata/belege/beleg010.txt
new file mode 100644
index 0000000..e54c40c
--- /dev/null
+++ b/xembu_testdata/belege/beleg010.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-17-18-12-21
+Nutzer: Hanna
+Gruppe: General
+Flag: C
+Position: Putzzeug
+Wert: 36.25 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg011.txt b/xembu_testdata/belege/beleg011.txt
new file mode 100644
index 0000000..5df8388
--- /dev/null
+++ b/xembu_testdata/belege/beleg011.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-02-02-30-53
+Nutzer: Leo
+Gruppe: General
+Flag: C
+Position: Putzzeug
+Wert: 14.68 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg012.txt b/xembu_testdata/belege/beleg012.txt
new file mode 100644
index 0000000..befbbd7
--- /dev/null
+++ b/xembu_testdata/belege/beleg012.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-13-14-23-26
+Nutzer: Juri
+Gruppe: General
+Flag: C
+Position: Lebensmittel
+Wert: 34.55 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg013.txt b/xembu_testdata/belege/beleg013.txt
new file mode 100644
index 0000000..a04b0c6
--- /dev/null
+++ b/xembu_testdata/belege/beleg013.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-18-17-06-41
+Nutzer: Hanna
+Gruppe: General
+Flag: C
+Position: Kaffee
+Wert: 14.79 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg014.txt b/xembu_testdata/belege/beleg014.txt
new file mode 100644
index 0000000..06f4d49
--- /dev/null
+++ b/xembu_testdata/belege/beleg014.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-15-15-16-19
+Nutzer: Dana
+Gruppe: General
+Flag: C
+Position: Lebensmittel
+Wert: 46.01 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg015.txt b/xembu_testdata/belege/beleg015.txt
new file mode 100644
index 0000000..2949bb6
--- /dev/null
+++ b/xembu_testdata/belege/beleg015.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-05-05-00-29
+Nutzer: Finn
+Gruppe: General
+Flag: C
+Position: Brot
+Wert: 18.12 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg016.txt b/xembu_testdata/belege/beleg016.txt
new file mode 100644
index 0000000..8bbdba9
--- /dev/null
+++ b/xembu_testdata/belege/beleg016.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-06-13-25-45
+Nutzer: Emil
+Gruppe: General
+Flag: C
+Position: Putzzeug
+Wert: 7.38 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg017.txt b/xembu_testdata/belege/beleg017.txt
new file mode 100644
index 0000000..c9d806e
--- /dev/null
+++ b/xembu_testdata/belege/beleg017.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-03-16-20-28
+Nutzer: Emil
+Gruppe: General
+Flag: C
+Position: Brot
+Wert: 37.02 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg018.txt b/xembu_testdata/belege/beleg018.txt
new file mode 100644
index 0000000..57590c6
--- /dev/null
+++ b/xembu_testdata/belege/beleg018.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-20-22-11-10
+Nutzer: Leo
+Gruppe: General
+Flag: C
+Position: Snacks
+Wert: 33.10 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg019.txt b/xembu_testdata/belege/beleg019.txt
new file mode 100644
index 0000000..09740f7
--- /dev/null
+++ b/xembu_testdata/belege/beleg019.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-10-12-30-44
+Nutzer: Bene
+Gruppe: General
+Flag: C
+Position: Wasser
+Wert: 19.00 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg020.txt b/xembu_testdata/belege/beleg020.txt
new file mode 100644
index 0000000..9927ac2
--- /dev/null
+++ b/xembu_testdata/belege/beleg020.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-16-14-12-33
+Nutzer: Juri
+Gruppe: General
+Flag: C
+Position: Brot
+Wert: 35.49 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg021.txt b/xembu_testdata/belege/beleg021.txt
new file mode 100644
index 0000000..4112242
--- /dev/null
+++ b/xembu_testdata/belege/beleg021.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-18-10-26-34
+Nutzer: Bene
+Gruppe: General
+Flag: C
+Position: Lebensmittel
+Wert: 40.35 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg022.txt b/xembu_testdata/belege/beleg022.txt
new file mode 100644
index 0000000..8f6839b
--- /dev/null
+++ b/xembu_testdata/belege/beleg022.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-20-02-20-41
+Nutzer: Dana
+Gruppe: General
+Flag: C
+Position: Putzzeug
+Wert: 51.61 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg023.txt b/xembu_testdata/belege/beleg023.txt
new file mode 100644
index 0000000..895222d
--- /dev/null
+++ b/xembu_testdata/belege/beleg023.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-22-08-45-47
+Nutzer: Bene
+Gruppe: General
+Flag: C
+Position: Kaffee
+Wert: 18.12 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg024.txt b/xembu_testdata/belege/beleg024.txt
new file mode 100644
index 0000000..138aea0
--- /dev/null
+++ b/xembu_testdata/belege/beleg024.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-16-18-18-46
+Nutzer: Emil
+Gruppe: General
+Flag: C
+Position: Miete Küche
+Wert: 23.47 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg025.txt b/xembu_testdata/belege/beleg025.txt
new file mode 100644
index 0000000..7ad656e
--- /dev/null
+++ b/xembu_testdata/belege/beleg025.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-06-10-02-48
+Nutzer: Dana
+Gruppe: General
+Flag: C
+Position: Putzzeug
+Wert: 37.33 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg026.txt b/xembu_testdata/belege/beleg026.txt
new file mode 100644
index 0000000..1ef0429
--- /dev/null
+++ b/xembu_testdata/belege/beleg026.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-05-11-41-43
+Nutzer: Hanna
+Gruppe: General
+Flag: C
+Position: Deko
+Wert: 11.48 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg027.txt b/xembu_testdata/belege/beleg027.txt
new file mode 100644
index 0000000..98849ca
--- /dev/null
+++ b/xembu_testdata/belege/beleg027.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-10-13-02-55
+Nutzer: Dana
+Gruppe: General
+Flag: C
+Position: Wasser
+Wert: 14.74 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg028.txt b/xembu_testdata/belege/beleg028.txt
new file mode 100644
index 0000000..b14c07c
--- /dev/null
+++ b/xembu_testdata/belege/beleg028.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-09-04-54-30
+Nutzer: Leo
+Gruppe: General
+Flag: C
+Position: Deko
+Wert: 49.66 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg029.txt b/xembu_testdata/belege/beleg029.txt
new file mode 100644
index 0000000..44d60fb
--- /dev/null
+++ b/xembu_testdata/belege/beleg029.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-20-20-58-23
+Nutzer: Emil
+Gruppe: General
+Flag: C
+Position: Kaffee
+Wert: 17.53 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg030.txt b/xembu_testdata/belege/beleg030.txt
new file mode 100644
index 0000000..66bfd0d
--- /dev/null
+++ b/xembu_testdata/belege/beleg030.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-06-10-54-23
+Nutzer: Juri
+Gruppe: General
+Flag: C
+Position: Brot
+Wert: 14.33 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg031.txt b/xembu_testdata/belege/beleg031.txt
new file mode 100644
index 0000000..7868ef2
--- /dev/null
+++ b/xembu_testdata/belege/beleg031.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-13-10-49-23
+Nutzer: Finn
+Gruppe: General
+Flag: C
+Position: Snacks
+Wert: 10.29 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg032.txt b/xembu_testdata/belege/beleg032.txt
new file mode 100644
index 0000000..934e528
--- /dev/null
+++ b/xembu_testdata/belege/beleg032.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-04-17-20-26
+Nutzer: Chris
+Gruppe: General
+Flag: C
+Position: Wasser
+Wert: 33.26 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg033.txt b/xembu_testdata/belege/beleg033.txt
new file mode 100644
index 0000000..9ec0599
--- /dev/null
+++ b/xembu_testdata/belege/beleg033.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-19-11-10-01
+Nutzer: Juri
+Gruppe: General
+Flag: C
+Position: Kaffee
+Wert: 54.07 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg034.txt b/xembu_testdata/belege/beleg034.txt
new file mode 100644
index 0000000..853e8d7
--- /dev/null
+++ b/xembu_testdata/belege/beleg034.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-11-00-40-03
+Nutzer: Emil
+Gruppe: General
+Flag: C
+Position: Deko
+Wert: 59.84 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg035.txt b/xembu_testdata/belege/beleg035.txt
new file mode 100644
index 0000000..8529c60
--- /dev/null
+++ b/xembu_testdata/belege/beleg035.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-04-16-35-02
+Nutzer: Hanna
+Gruppe: General
+Flag: C
+Position: Snacks
+Wert: 7.27 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg036.txt b/xembu_testdata/belege/beleg036.txt
new file mode 100644
index 0000000..ff8528b
--- /dev/null
+++ b/xembu_testdata/belege/beleg036.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-02-11-26-50
+Nutzer: Bene
+Gruppe: General
+Flag: C
+Position: Miete Küche
+Wert: 38.39 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg037.txt b/xembu_testdata/belege/beleg037.txt
new file mode 100644
index 0000000..f45d807
--- /dev/null
+++ b/xembu_testdata/belege/beleg037.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-20-13-25-10
+Nutzer: Finn
+Gruppe: General
+Flag: C
+Position: Papier
+Wert: 5.68 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg038.txt b/xembu_testdata/belege/beleg038.txt
new file mode 100644
index 0000000..458e71d
--- /dev/null
+++ b/xembu_testdata/belege/beleg038.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-10-14-18-33
+Nutzer: Juri
+Gruppe: General
+Flag: C
+Position: Snacks
+Wert: 32.69 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg039.txt b/xembu_testdata/belege/beleg039.txt
new file mode 100644
index 0000000..47b046a
--- /dev/null
+++ b/xembu_testdata/belege/beleg039.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-14-18-16-38
+Nutzer: Leo
+Gruppe: General
+Flag: C
+Position: Putzzeug
+Wert: 41.54 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg040.txt b/xembu_testdata/belege/beleg040.txt
new file mode 100644
index 0000000..10b6290
--- /dev/null
+++ b/xembu_testdata/belege/beleg040.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-14-08-48-28
+Nutzer: Dana
+Gruppe: General
+Flag: C
+Position: Brot
+Wert: 8.47 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg041.txt b/xembu_testdata/belege/beleg041.txt
new file mode 100644
index 0000000..f5c3121
--- /dev/null
+++ b/xembu_testdata/belege/beleg041.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-11-21-16-08
+Nutzer: Anna
+Gruppe: General
+Flag: C
+Position: Snacks
+Wert: 2.19 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg042.txt b/xembu_testdata/belege/beleg042.txt
new file mode 100644
index 0000000..f46ee72
--- /dev/null
+++ b/xembu_testdata/belege/beleg042.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-18-20-38-56
+Nutzer: Dana
+Gruppe: General
+Flag: C
+Position: Wasser
+Wert: 46.19 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg043.txt b/xembu_testdata/belege/beleg043.txt
new file mode 100644
index 0000000..a1ae4e9
--- /dev/null
+++ b/xembu_testdata/belege/beleg043.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-16-02-45-03
+Nutzer: Bene
+Gruppe: KFZ
+Flag: C
+Position: Tanken
+Wert: 39.91 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg044.txt b/xembu_testdata/belege/beleg044.txt
new file mode 100644
index 0000000..46cf3ef
--- /dev/null
+++ b/xembu_testdata/belege/beleg044.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-05-06-06-32
+Nutzer: Emil
+Gruppe: KFZ
+Flag: C
+Position: Parken
+Wert: 83.48 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg045.txt b/xembu_testdata/belege/beleg045.txt
new file mode 100644
index 0000000..7f71056
--- /dev/null
+++ b/xembu_testdata/belege/beleg045.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-15-20-54-37
+Nutzer: Dana
+Gruppe: KFZ
+Flag: C
+Position: Waschanlage
+Wert: 11.56 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg046.txt b/xembu_testdata/belege/beleg046.txt
new file mode 100644
index 0000000..be36f23
--- /dev/null
+++ b/xembu_testdata/belege/beleg046.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-10-03-27-05
+Nutzer: Dana
+Gruppe: KFZ
+Flag: C
+Position: Tanken
+Wert: 14.63 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg047.txt b/xembu_testdata/belege/beleg047.txt
new file mode 100644
index 0000000..34c5be7
--- /dev/null
+++ b/xembu_testdata/belege/beleg047.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-22-15-28-39
+Nutzer: Emil
+Gruppe: KFZ
+Flag: C
+Position: Tanken
+Wert: 16.85 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg048.txt b/xembu_testdata/belege/beleg048.txt
new file mode 100644
index 0000000..02889d9
--- /dev/null
+++ b/xembu_testdata/belege/beleg048.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-13-03-06-35
+Nutzer: Hanna
+Gruppe: KFZ
+Flag: C
+Position: Parken
+Wert: 71.27 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg049.txt b/xembu_testdata/belege/beleg049.txt
new file mode 100644
index 0000000..eac88ed
--- /dev/null
+++ b/xembu_testdata/belege/beleg049.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-04-10-47-36
+Nutzer: Greta
+Gruppe: KFZ
+Flag: C
+Position: Waschanlage
+Wert: 85.75 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg050.txt b/xembu_testdata/belege/beleg050.txt
new file mode 100644
index 0000000..fd5ff70
--- /dev/null
+++ b/xembu_testdata/belege/beleg050.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-05-08-11-36
+Nutzer: Dana
+Gruppe: KFZ
+Flag: C
+Position: Parken
+Wert: 79.79 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg051.txt b/xembu_testdata/belege/beleg051.txt
new file mode 100644
index 0000000..f67c340
--- /dev/null
+++ b/xembu_testdata/belege/beleg051.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-11-14-29-44
+Nutzer: Bene
+Gruppe: KFZ
+Flag: C
+Position: Parken
+Wert: 70.42 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg052.txt b/xembu_testdata/belege/beleg052.txt
new file mode 100644
index 0000000..654a3c2
--- /dev/null
+++ b/xembu_testdata/belege/beleg052.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-18-01-52-37
+Nutzer: Bene
+Gruppe: KFZ
+Flag: C
+Position: Parken
+Wert: 34.94 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg053.txt b/xembu_testdata/belege/beleg053.txt
new file mode 100644
index 0000000..2ca2033
--- /dev/null
+++ b/xembu_testdata/belege/beleg053.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-17-15-17-09
+Nutzer: Greta
+Gruppe: KFZ
+Flag: C
+Position: Waschanlage
+Wert: 45.05 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg054.txt b/xembu_testdata/belege/beleg054.txt
new file mode 100644
index 0000000..a89f071
--- /dev/null
+++ b/xembu_testdata/belege/beleg054.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-13-21-30-35
+Nutzer: Finn
+Gruppe: KFZ
+Flag: C
+Position: Tanken
+Wert: 29.83 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg055.txt b/xembu_testdata/belege/beleg055.txt
new file mode 100644
index 0000000..dd12482
--- /dev/null
+++ b/xembu_testdata/belege/beleg055.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-02-21-17-52
+Nutzer: Dana
+Gruppe: KFZ
+Flag: C
+Position: Tanken
+Wert: 57.06 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg056.txt b/xembu_testdata/belege/beleg056.txt
new file mode 100644
index 0000000..9c146d5
--- /dev/null
+++ b/xembu_testdata/belege/beleg056.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-06-22-03-05
+Nutzer: Emil
+Gruppe: KFZ
+Flag: C
+Position: Tanken
+Wert: 10.58 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg057.txt b/xembu_testdata/belege/beleg057.txt
new file mode 100644
index 0000000..00b8ed9
--- /dev/null
+++ b/xembu_testdata/belege/beleg057.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-18-12-20-50
+Nutzer: Greta
+Gruppe: KFZ
+Flag: C
+Position: Tanken
+Wert: 28.32 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg058.txt b/xembu_testdata/belege/beleg058.txt
new file mode 100644
index 0000000..cea6ab3
--- /dev/null
+++ b/xembu_testdata/belege/beleg058.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-02-02-17-57
+Nutzer: Dana
+Gruppe: KFZ
+Flag: U
+Position: Autofahrt
+Wert: 20.2 km
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg059.txt b/xembu_testdata/belege/beleg059.txt
new file mode 100644
index 0000000..5fb7914
--- /dev/null
+++ b/xembu_testdata/belege/beleg059.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-07-02-38-51
+Nutzer: Dana
+Gruppe: KFZ
+Flag: U
+Position: Autofahrt
+Wert: 148.8 km
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg060.txt b/xembu_testdata/belege/beleg060.txt
new file mode 100644
index 0000000..f7257e9
--- /dev/null
+++ b/xembu_testdata/belege/beleg060.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-06-12-48-07
+Nutzer: Emil
+Gruppe: KFZ
+Flag: U
+Position: Autofahrt
+Wert: 33.4 km
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg061.txt b/xembu_testdata/belege/beleg061.txt
new file mode 100644
index 0000000..b50740b
--- /dev/null
+++ b/xembu_testdata/belege/beleg061.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-22-18-01-31
+Nutzer: Emil
+Gruppe: KFZ
+Flag: U
+Position: Autofahrt
+Wert: 128.9 km
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg062.txt b/xembu_testdata/belege/beleg062.txt
new file mode 100644
index 0000000..9cb79fa
--- /dev/null
+++ b/xembu_testdata/belege/beleg062.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-07-05-33-22
+Nutzer: Finn
+Gruppe: KFZ
+Flag: U
+Position: Autofahrt
+Wert: 178.6 km
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg063.txt b/xembu_testdata/belege/beleg063.txt
new file mode 100644
index 0000000..026d94b
--- /dev/null
+++ b/xembu_testdata/belege/beleg063.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-05-22-55-18
+Nutzer: Hanna
+Gruppe: KFZ
+Flag: U
+Position: Autofahrt
+Wert: 25.8 km
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg064.txt b/xembu_testdata/belege/beleg064.txt
new file mode 100644
index 0000000..b180064
--- /dev/null
+++ b/xembu_testdata/belege/beleg064.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-11-19-06-19
+Nutzer: Dana
+Gruppe: KFZ
+Flag: U
+Position: Autofahrt
+Wert: 96.1 km
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg065.txt b/xembu_testdata/belege/beleg065.txt
new file mode 100644
index 0000000..52983d7
--- /dev/null
+++ b/xembu_testdata/belege/beleg065.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-12-16-03-41
+Nutzer: Greta
+Gruppe: KFZ
+Flag: U
+Position: Autofahrt
+Wert: 16.6 km
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg066.txt b/xembu_testdata/belege/beleg066.txt
new file mode 100644
index 0000000..7b91233
--- /dev/null
+++ b/xembu_testdata/belege/beleg066.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-17-04-39-55
+Nutzer: Greta
+Gruppe: KFZ
+Flag: U
+Position: Autofahrt
+Wert: 26.2 km
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg067.txt b/xembu_testdata/belege/beleg067.txt
new file mode 100644
index 0000000..5e048b3
--- /dev/null
+++ b/xembu_testdata/belege/beleg067.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-11-02-32-38
+Nutzer: Greta
+Gruppe: KFZ
+Flag: U
+Position: Autofahrt
+Wert: 78.0 km
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg068.txt b/xembu_testdata/belege/beleg068.txt
new file mode 100644
index 0000000..4b2d452
--- /dev/null
+++ b/xembu_testdata/belege/beleg068.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-22-05-57-38
+Nutzer: Hanna
+Gruppe: KFZ
+Flag: U
+Position: Autofahrt
+Wert: 58.5 km
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg069.txt b/xembu_testdata/belege/beleg069.txt
new file mode 100644
index 0000000..9462125
--- /dev/null
+++ b/xembu_testdata/belege/beleg069.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-05-22-48-16
+Nutzer: Emil
+Gruppe: KFZ
+Flag: U
+Position: Autofahrt
+Wert: 101.5 km
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg070.txt b/xembu_testdata/belege/beleg070.txt
new file mode 100644
index 0000000..be07638
--- /dev/null
+++ b/xembu_testdata/belege/beleg070.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-11-13-45-49
+Nutzer: Bene
+Gruppe: KFZ
+Flag: U
+Position: Autofahrt
+Wert: 64.9 km
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg071.txt b/xembu_testdata/belege/beleg071.txt
new file mode 100644
index 0000000..cf1006d
--- /dev/null
+++ b/xembu_testdata/belege/beleg071.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-07-09-31-22
+Nutzer: Hanna
+Gruppe: KFZ
+Flag: U
+Position: Autofahrt
+Wert: 100.3 km
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg072.txt b/xembu_testdata/belege/beleg072.txt
new file mode 100644
index 0000000..09b3ed7
--- /dev/null
+++ b/xembu_testdata/belege/beleg072.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-22-05-46-19
+Nutzer: Emil
+Gruppe: KFZ
+Flag: U
+Position: Autofahrt
+Wert: 26.1 km
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg073.txt b/xembu_testdata/belege/beleg073.txt
new file mode 100644
index 0000000..9c84aca
--- /dev/null
+++ b/xembu_testdata/belege/beleg073.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-13-00-24-41
+Nutzer: Finn
+Gruppe: Bier
+Flag: C
+Position: Craft Beer
+Wert: 32.17 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg074.txt b/xembu_testdata/belege/beleg074.txt
new file mode 100644
index 0000000..f5a29c3
--- /dev/null
+++ b/xembu_testdata/belege/beleg074.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-05-07-54-29
+Nutzer: Chris
+Gruppe: Bier
+Flag: C
+Position: Bierkasten
+Wert: 34.57 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg075.txt b/xembu_testdata/belege/beleg075.txt
new file mode 100644
index 0000000..3525f85
--- /dev/null
+++ b/xembu_testdata/belege/beleg075.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-07-18-29-31
+Nutzer: Dana
+Gruppe: Bier
+Flag: C
+Position: Craft Beer
+Wert: 18.27 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg076.txt b/xembu_testdata/belege/beleg076.txt
new file mode 100644
index 0000000..65b3b22
--- /dev/null
+++ b/xembu_testdata/belege/beleg076.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-19-01-33-00
+Nutzer: Dana
+Gruppe: Bier
+Flag: C
+Position: Bierkasten
+Wert: 11.51 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg077.txt b/xembu_testdata/belege/beleg077.txt
new file mode 100644
index 0000000..3a7df83
--- /dev/null
+++ b/xembu_testdata/belege/beleg077.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-06-14-49-11
+Nutzer: Hanna
+Gruppe: Bier
+Flag: C
+Position: Flaschenbier
+Wert: 27.34 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg078.txt b/xembu_testdata/belege/beleg078.txt
new file mode 100644
index 0000000..7506cd8
--- /dev/null
+++ b/xembu_testdata/belege/beleg078.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-02-19-30-37
+Nutzer: Emil
+Gruppe: Bier
+Flag: C
+Position: Bierkasten
+Wert: 7.45 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg079.txt b/xembu_testdata/belege/beleg079.txt
new file mode 100644
index 0000000..f97aa19
--- /dev/null
+++ b/xembu_testdata/belege/beleg079.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-12-21-44-57
+Nutzer: Bene
+Gruppe: Bier
+Flag: C
+Position: Bierkasten
+Wert: 33.86 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg080.txt b/xembu_testdata/belege/beleg080.txt
new file mode 100644
index 0000000..e77fc33
--- /dev/null
+++ b/xembu_testdata/belege/beleg080.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-03-06-40-05
+Nutzer: Bene
+Gruppe: Bier
+Flag: C
+Position: Bierkasten
+Wert: 23.26 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg081.txt b/xembu_testdata/belege/beleg081.txt
new file mode 100644
index 0000000..1a84dd6
--- /dev/null
+++ b/xembu_testdata/belege/beleg081.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-17-17-20-23
+Nutzer: Finn
+Gruppe: Bier
+Flag: C
+Position: Craft Beer
+Wert: 9.48 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg082.txt b/xembu_testdata/belege/beleg082.txt
new file mode 100644
index 0000000..91a92b0
--- /dev/null
+++ b/xembu_testdata/belege/beleg082.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-15-03-51-35
+Nutzer: Finn
+Gruppe: Bier
+Flag: C
+Position: Flaschenbier
+Wert: 23.24 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg083.txt b/xembu_testdata/belege/beleg083.txt
new file mode 100644
index 0000000..1dc9e50
--- /dev/null
+++ b/xembu_testdata/belege/beleg083.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-16-08-48-57
+Nutzer: Leo
+Gruppe: Bier
+Flag: C
+Position: Craft Beer
+Wert: 25.06 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg084.txt b/xembu_testdata/belege/beleg084.txt
new file mode 100644
index 0000000..4dbdc2d
--- /dev/null
+++ b/xembu_testdata/belege/beleg084.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-15-01-16-06
+Nutzer: Emil
+Gruppe: Bier
+Flag: C
+Position: Craft Beer
+Wert: 11.92 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg085.txt b/xembu_testdata/belege/beleg085.txt
new file mode 100644
index 0000000..8323d92
--- /dev/null
+++ b/xembu_testdata/belege/beleg085.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-18-17-12-43
+Nutzer: Emil
+Gruppe: Bier
+Flag: C
+Position: Bierkasten
+Wert: 13.70 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg086.txt b/xembu_testdata/belege/beleg086.txt
new file mode 100644
index 0000000..1e31a2d
--- /dev/null
+++ b/xembu_testdata/belege/beleg086.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-04-12-14-31
+Nutzer: Greta
+Gruppe: Bier
+Flag: C
+Position: Craft Beer
+Wert: 15.17 €
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg087.txt b/xembu_testdata/belege/beleg087.txt
new file mode 100644
index 0000000..af1dff1
--- /dev/null
+++ b/xembu_testdata/belege/beleg087.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-19-13-59-34
+Nutzer: Leo
+Gruppe: Bier
+Flag: U
+Position: Bier getrunken
+Wert: 1.1 stk
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg088.txt b/xembu_testdata/belege/beleg088.txt
new file mode 100644
index 0000000..de6c37c
--- /dev/null
+++ b/xembu_testdata/belege/beleg088.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-16-09-51-05
+Nutzer: Leo
+Gruppe: Bier
+Flag: U
+Position: Bier getrunken
+Wert: 1.8 stk
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg089.txt b/xembu_testdata/belege/beleg089.txt
new file mode 100644
index 0000000..d3a6618
--- /dev/null
+++ b/xembu_testdata/belege/beleg089.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-06-12-10-16
+Nutzer: Greta
+Gruppe: Bier
+Flag: U
+Position: Bier getrunken
+Wert: 2.5 stk
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg090.txt b/xembu_testdata/belege/beleg090.txt
new file mode 100644
index 0000000..22389e4
--- /dev/null
+++ b/xembu_testdata/belege/beleg090.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-09-19-18-44
+Nutzer: Leo
+Gruppe: Bier
+Flag: U
+Position: Bier getrunken
+Wert: 10.7 stk
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg091.txt b/xembu_testdata/belege/beleg091.txt
new file mode 100644
index 0000000..b4d1e03
--- /dev/null
+++ b/xembu_testdata/belege/beleg091.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-10-07-15-54
+Nutzer: Greta
+Gruppe: Bier
+Flag: U
+Position: Bier getrunken
+Wert: 2.7 stk
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg092.txt b/xembu_testdata/belege/beleg092.txt
new file mode 100644
index 0000000..b12cfc3
--- /dev/null
+++ b/xembu_testdata/belege/beleg092.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-21-13-41-29
+Nutzer: Greta
+Gruppe: Bier
+Flag: U
+Position: Bier getrunken
+Wert: 7.7 stk
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg093.txt b/xembu_testdata/belege/beleg093.txt
new file mode 100644
index 0000000..b4b0998
--- /dev/null
+++ b/xembu_testdata/belege/beleg093.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-20-22-10-11
+Nutzer: Hanna
+Gruppe: Bier
+Flag: U
+Position: Bier getrunken
+Wert: 8.3 stk
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg094.txt b/xembu_testdata/belege/beleg094.txt
new file mode 100644
index 0000000..0a92f58
--- /dev/null
+++ b/xembu_testdata/belege/beleg094.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-14-19-04-45
+Nutzer: Greta
+Gruppe: Bier
+Flag: U
+Position: Bier getrunken
+Wert: 11.2 stk
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg095.txt b/xembu_testdata/belege/beleg095.txt
new file mode 100644
index 0000000..89e53b7
--- /dev/null
+++ b/xembu_testdata/belege/beleg095.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-03-20-20-36
+Nutzer: Bene
+Gruppe: Bier
+Flag: U
+Position: Bier getrunken
+Wert: 3.9 stk
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg096.txt b/xembu_testdata/belege/beleg096.txt
new file mode 100644
index 0000000..b4909dd
--- /dev/null
+++ b/xembu_testdata/belege/beleg096.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-03-22-21-10
+Nutzer: Bene
+Gruppe: Bier
+Flag: U
+Position: Bier getrunken
+Wert: 4.0 stk
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg097.txt b/xembu_testdata/belege/beleg097.txt
new file mode 100644
index 0000000..3701da6
--- /dev/null
+++ b/xembu_testdata/belege/beleg097.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-16-00-20-20
+Nutzer: Finn
+Gruppe: Bier
+Flag: U
+Position: Bier getrunken
+Wert: 8.9 stk
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg098.txt b/xembu_testdata/belege/beleg098.txt
new file mode 100644
index 0000000..f6427b3
--- /dev/null
+++ b/xembu_testdata/belege/beleg098.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-06-06-36-14
+Nutzer: Greta
+Gruppe: Bier
+Flag: U
+Position: Bier getrunken
+Wert: 6.6 stk
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg099.txt b/xembu_testdata/belege/beleg099.txt
new file mode 100644
index 0000000..5388dbd
--- /dev/null
+++ b/xembu_testdata/belege/beleg099.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-07-10-17-19
+Nutzer: Hanna
+Gruppe: Bier
+Flag: U
+Position: Bier getrunken
+Wert: 2.0 stk
+Modules:
+Parameters:
diff --git a/xembu_testdata/belege/beleg100.txt b/xembu_testdata/belege/beleg100.txt
new file mode 100644
index 0000000..2e2988e
--- /dev/null
+++ b/xembu_testdata/belege/beleg100.txt
@@ -0,0 +1,10 @@
+Xembu Testbeleg
+----------------
+Datum: 2025-12-11-14-45-02
+Nutzer: Greta
+Gruppe: Bier
+Flag: U
+Position: Bier getrunken
+Wert: 1.5 stk
+Modules:
+Parameters:
diff --git a/xembu_testdata/testdata.csv b/xembu_testdata/testdata.csv
new file mode 100644
index 0000000..c110972
--- /dev/null
+++ b/xembu_testdata/testdata.csv
@@ -0,0 +1,101 @@
+Datum;Nutzer;Distributionsgruppe;Distributionsflag;Positionsbezeichnung;Positionswert;Modules;Parameters;Beleg
+2025-12-02-02-17-57;Dana;KFZ;U;Autofahrt;20.2 km;;;belege/beleg058.txt
+2025-12-02-02-30-53;Leo;General;C;Putzzeug;14.68 €;;;belege/beleg011.txt
+2025-12-02-11-26-50;Bene;General;C;Miete Küche;38.39 €;;;belege/beleg036.txt
+2025-12-02-19-30-37;Emil;Bier;C;Bierkasten;7.45 €;;;belege/beleg078.txt
+2025-12-02-21-17-52;Dana;KFZ;C;Tanken;57.06 €;;;belege/beleg055.txt
+2025-12-03-06-40-05;Bene;Bier;C;Bierkasten;23.26 €;;;belege/beleg080.txt
+2025-12-03-16-20-28;Emil;General;C;Brot;37.02 €;;;belege/beleg017.txt
+2025-12-03-20-20-36;Bene;Bier;U;Bier getrunken;3.9 stk;;;belege/beleg095.txt
+2025-12-03-22-21-10;Bene;Bier;U;Bier getrunken;4.0 stk;;;belege/beleg096.txt
+2025-12-04-10-47-36;Greta;KFZ;C;Waschanlage;85.75 €;;;belege/beleg049.txt
+2025-12-04-12-14-31;Greta;Bier;C;Craft Beer;15.17 €;;;belege/beleg086.txt
+2025-12-04-16-35-02;Hanna;General;C;Snacks;7.27 €;;;belege/beleg035.txt
+2025-12-04-17-20-26;Chris;General;C;Wasser;33.26 €;;;belege/beleg032.txt
+2025-12-05-05-00-29;Finn;General;C;Brot;18.12 €;;;belege/beleg015.txt
+2025-12-05-06-06-32;Emil;KFZ;C;Parken;83.48 €;;;belege/beleg044.txt
+2025-12-05-07-54-29;Chris;Bier;C;Bierkasten;34.57 €;;;belege/beleg074.txt
+2025-12-05-08-11-36;Dana;KFZ;C;Parken;79.79 €;;;belege/beleg050.txt
+2025-12-05-11-41-43;Hanna;General;C;Deko;11.48 €;;;belege/beleg026.txt
+2025-12-05-22-48-16;Emil;KFZ;U;Autofahrt;101.5 km;;;belege/beleg069.txt
+2025-12-05-22-55-18;Hanna;KFZ;U;Autofahrt;25.8 km;;;belege/beleg063.txt
+2025-12-06-06-36-14;Greta;Bier;U;Bier getrunken;6.6 stk;;;belege/beleg098.txt
+2025-12-06-10-02-48;Dana;General;C;Putzzeug;37.33 €;;;belege/beleg025.txt
+2025-12-06-10-54-23;Juri;General;C;Brot;14.33 €;;;belege/beleg030.txt
+2025-12-06-12-10-16;Greta;Bier;U;Bier getrunken;2.5 stk;;;belege/beleg089.txt
+2025-12-06-12-48-07;Emil;KFZ;U;Autofahrt;33.4 km;;;belege/beleg060.txt
+2025-12-06-13-25-45;Emil;General;C;Putzzeug;7.38 €;;;belege/beleg016.txt
+2025-12-06-14-49-11;Hanna;Bier;C;Flaschenbier;27.34 €;;;belege/beleg077.txt
+2025-12-06-22-03-05;Emil;KFZ;C;Tanken;10.58 €;;;belege/beleg056.txt
+2025-12-07-02-38-51;Dana;KFZ;U;Autofahrt;148.8 km;;;belege/beleg059.txt
+2025-12-07-05-33-22;Finn;KFZ;U;Autofahrt;178.6 km;;;belege/beleg062.txt
+2025-12-07-06-39-35;Chris;General;C;Miete Küche;44.72 €;;;belege/beleg009.txt
+2025-12-07-09-31-22;Hanna;KFZ;U;Autofahrt;100.3 km;;;belege/beleg071.txt
+2025-12-07-10-17-19;Hanna;Bier;U;Bier getrunken;2.0 stk;;;belege/beleg099.txt
+2025-12-07-18-29-31;Dana;Bier;C;Craft Beer;18.27 €;;;belege/beleg075.txt
+2025-12-09-04-54-30;Leo;General;C;Deko;49.66 €;;;belege/beleg028.txt
+2025-12-09-19-18-44;Leo;Bier;U;Bier getrunken;10.7 stk;;;belege/beleg090.txt
+2025-12-10-03-27-05;Dana;KFZ;C;Tanken;14.63 €;;;belege/beleg046.txt
+2025-12-10-07-15-54;Greta;Bier;U;Bier getrunken;2.7 stk;;;belege/beleg091.txt
+2025-12-10-12-30-44;Bene;General;C;Wasser;19.00 €;;;belege/beleg019.txt
+2025-12-10-13-02-55;Dana;General;C;Wasser;14.74 €;;;belege/beleg027.txt
+2025-12-10-14-18-33;Juri;General;C;Snacks;32.69 €;;;belege/beleg038.txt
+2025-12-11-00-40-03;Emil;General;C;Deko;59.84 €;;;belege/beleg034.txt
+2025-12-11-02-32-38;Greta;KFZ;U;Autofahrt;78.0 km;;;belege/beleg067.txt
+2025-12-11-13-45-49;Bene;KFZ;U;Autofahrt;64.9 km;;;belege/beleg070.txt
+2025-12-11-14-29-44;Bene;KFZ;C;Parken;70.42 €;;;belege/beleg051.txt
+2025-12-11-14-45-02;Greta;Bier;U;Bier getrunken;1.5 stk;;;belege/beleg100.txt
+2025-12-11-19-06-19;Dana;KFZ;U;Autofahrt;96.1 km;;;belege/beleg064.txt
+2025-12-11-21-16-08;Anna;General;C;Snacks;2.19 €;;;belege/beleg041.txt
+2025-12-12-16-03-41;Greta;KFZ;U;Autofahrt;16.6 km;;;belege/beleg065.txt
+2025-12-12-18-44-30;Leo;General;C;Handtuch;10.00 €;;;belege/beleg001.txt
+2025-12-12-18-44-30;Bene;General;C;Spülmittel;10.00 €;;;belege/beleg002.txt
+2025-12-12-18-44-30;Leo;General;C;Handtuch;10.00 €;;;belege/beleg003.txt
+2025-12-12-18-44-30;Leo;KFZ;C;Tanken;45.00 €;;;belege/beleg004.txt
+2025-12-12-18-44-30;Bene;KFZ;C;Tanken;37.33 €;;;belege/beleg005.txt
+2025-12-12-18-44-30;Leo;KFZ;U;Autofahrt;111.0 km;;;belege/beleg006.txt
+2025-12-12-18-44-30;Bene;KFZ;U;Autofahrt;63.0 km;;;belege/beleg007.txt
+2025-12-12-21-44-57;Bene;Bier;C;Bierkasten;33.86 €;;;belege/beleg079.txt
+2025-12-13-00-24-41;Finn;Bier;C;Craft Beer;32.17 €;;;belege/beleg073.txt
+2025-12-13-03-06-35;Hanna;KFZ;C;Parken;71.27 €;;;belege/beleg048.txt
+2025-12-13-10-49-23;Finn;General;C;Snacks;10.29 €;;;belege/beleg031.txt
+2025-12-13-14-23-26;Juri;General;C;Lebensmittel;34.55 €;;;belege/beleg012.txt
+2025-12-13-21-30-35;Finn;KFZ;C;Tanken;29.83 €;;;belege/beleg054.txt
+2025-12-14-08-48-28;Dana;General;C;Brot;8.47 €;;;belege/beleg040.txt
+2025-12-14-18-16-38;Leo;General;C;Putzzeug;41.54 €;;;belege/beleg039.txt
+2025-12-14-19-04-45;Greta;Bier;U;Bier getrunken;11.2 stk;;;belege/beleg094.txt
+2025-12-15-01-16-06;Emil;Bier;C;Craft Beer;11.92 €;;;belege/beleg084.txt
+2025-12-15-03-51-35;Finn;Bier;C;Flaschenbier;23.24 €;;;belege/beleg082.txt
+2025-12-15-15-16-19;Dana;General;C;Lebensmittel;46.01 €;;;belege/beleg014.txt
+2025-12-15-20-54-37;Dana;KFZ;C;Waschanlage;11.56 €;;;belege/beleg045.txt
+2025-12-16-00-20-20;Finn;Bier;U;Bier getrunken;8.9 stk;;;belege/beleg097.txt
+2025-12-16-02-45-03;Bene;KFZ;C;Tanken;39.91 €;;;belege/beleg043.txt
+2025-12-16-08-48-57;Leo;Bier;C;Craft Beer;25.06 €;;;belege/beleg083.txt
+2025-12-16-09-51-05;Leo;Bier;U;Bier getrunken;1.8 stk;;;belege/beleg088.txt
+2025-12-16-14-12-33;Juri;General;C;Brot;35.49 €;;;belege/beleg020.txt
+2025-12-16-18-18-46;Emil;General;C;Miete Küche;23.47 €;;;belege/beleg024.txt
+2025-12-16-20-29-35;Bene;General;C;Lebensmittel;45.01 €;;;belege/beleg008.txt
+2025-12-17-04-39-55;Greta;KFZ;U;Autofahrt;26.2 km;;;belege/beleg066.txt
+2025-12-17-15-17-09;Greta;KFZ;C;Waschanlage;45.05 €;;;belege/beleg053.txt
+2025-12-17-17-20-23;Finn;Bier;C;Craft Beer;9.48 €;;;belege/beleg081.txt
+2025-12-17-18-12-21;Hanna;General;C;Putzzeug;36.25 €;;;belege/beleg010.txt
+2025-12-18-01-52-37;Bene;KFZ;C;Parken;34.94 €;;;belege/beleg052.txt
+2025-12-18-10-26-34;Bene;General;C;Lebensmittel;40.35 €;;;belege/beleg021.txt
+2025-12-18-12-20-50;Greta;KFZ;C;Tanken;28.32 €;;;belege/beleg057.txt
+2025-12-18-17-06-41;Hanna;General;C;Kaffee;14.79 €;;;belege/beleg013.txt
+2025-12-18-17-12-43;Emil;Bier;C;Bierkasten;13.70 €;;;belege/beleg085.txt
+2025-12-18-20-38-56;Dana;General;C;Wasser;46.19 €;;;belege/beleg042.txt
+2025-12-19-01-33-00;Dana;Bier;C;Bierkasten;11.51 €;;;belege/beleg076.txt
+2025-12-19-11-10-01;Juri;General;C;Kaffee;54.07 €;;;belege/beleg033.txt
+2025-12-19-13-59-34;Leo;Bier;U;Bier getrunken;1.1 stk;;;belege/beleg087.txt
+2025-12-20-02-20-41;Dana;General;C;Putzzeug;51.61 €;;;belege/beleg022.txt
+2025-12-20-13-25-10;Finn;General;C;Papier;5.68 €;;;belege/beleg037.txt
+2025-12-20-20-58-23;Emil;General;C;Kaffee;17.53 €;;;belege/beleg029.txt
+2025-12-20-22-10-11;Hanna;Bier;U;Bier getrunken;8.3 stk;;;belege/beleg093.txt
+2025-12-20-22-11-10;Leo;General;C;Snacks;33.10 €;;;belege/beleg018.txt
+2025-12-21-13-41-29;Greta;Bier;U;Bier getrunken;7.7 stk;;;belege/beleg092.txt
+2025-12-22-05-46-19;Emil;KFZ;U;Autofahrt;26.1 km;;;belege/beleg072.txt
+2025-12-22-05-57-38;Hanna;KFZ;U;Autofahrt;58.5 km;;;belege/beleg068.txt
+2025-12-22-08-45-47;Bene;General;C;Kaffee;18.12 €;;;belege/beleg023.txt
+2025-12-22-15-28-39;Emil;KFZ;C;Tanken;16.85 €;;;belege/beleg047.txt
+2025-12-22-18-01-31;Emil;KFZ;U;Autofahrt;128.9 km;;;belege/beleg061.txt