GithubHelp home page GithubHelp logo

westnetz / rechnung Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 3.0 480 KB

File based contract and invoice management system.

Home Page: https://rechnung.readthedocs.io

Makefile 1.80% CSS 5.17% Python 80.65% HTML 12.04% Jinja 0.34%
invoice contract yaml pdf jinja2 weasyprint

rechnung's Introduction

rechnung

rechnung is a command line based invoice generation system.

assets/westnetz_reudnetz.png

Features

  • purely file based (no database)
  • customizeable (invoice layout is HTML/CSS)

Installation

Clone this repository to your machine:

$ git clone https://github.com/westnetz/rechnung

Install the package

$ make install

Note: At the moment installation via pip only works, if you provide the -e option. Therefore it is recommended to use the provided make install method.

Getting Started

This section is a quick walkthrough all the features.

Initialization

Before you can start generating your own invoices you need to setup your working directory for rechnung. By invoking

$ rechnung init

all required directory and configuration files will be placed in the current working directory. It is recommended to do this in a clean directory.

Configuration and Customization

You can now edit the rechnung.config.yaml file to your needs. You need to enter the credentials for the mail server if you want to send out your invoices by email.

Customization of the invoices can be done by editing the invoice template templates/invoice_template.j2.html and the corresponding stylesheet in assets/inovice.css.

Creating invoices

After creating your customers, you can create your first invoices. The following command

$ rechnung create-invoices 2019 10

will create invoices for all customers who have a contract starting before and ending after october 2019.

You can force overwrite of existing invoices by giving the --force/-f option

$ rechnung create-invoices --force 2019 10

Individual invoices can be created by giving a specific customer id (cid)

$ rechnung create-invoices -c 1000 2019 10

After creating your invoices you can doublecheck for correctness.

Rendering invoices (create pdf files)

If everything is correct, you are ready to create your pdf invoice documents.

$ rechnung render-all

This command will render all invoice yaml files, which have no corresponding pdf file. I.e. if you happen to spot an error in an invoice pdf. Simply delete the pdf file, correct the mistake in the invoice yaml, and run the command again.

Sending invoices

If you want to use the included mail delivery service, you should customize the invoice mail template to your needs: assets/invoice_mail_template.j2.

After doing that, you can send all the invoices you just created to your customers:

$ rechnung send 2019 09

This command will send all invoices with the given suffix to the customer given in the invoice yaml file.

And that's it!

Copyright

  • Florian Rämisch, 2019
  • Paul Spooren, 2019

License

GNU General Public License v3

rechnung's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rechnung's Issues

Allow multiple invoices per month

Currently the invoices are created via <year>.<month> however a better approach would be to have <year>.<month>.<counter> to allow additional invoices like follow ups or something

INVALID HEADER

We need to add the date to the header.

This nondelivery report was generated by the program amavisd-new at host ********* [...]

INVALID HEADER

Missing required header field: "Date"

Testcoverage

We definitely need (more) tests, as this project is growing fast atm.

Send single invoice

Right now only all invoices matching a given prefixes can be sent (bulk). It should be possible to send single invoices by giving an invoice id.

rechnung init broken

a@tb:~/src/rechnung/test$ rechnung init
Initializing...
Traceback (most recent call last):
  File "/home/a/.local/bin/rechnung", line 11, in <module>
    load_entry_point('rechnung', 'console_scripts', 'rechnung')()
  File "/home/a/.local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/a/.local/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/a/.local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/a/.local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/a/.local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/a/src/rechnung/rechnung/cli.py", line 28, in init
    settings = get_settings_from_cwd(cwd, create_non_existing_dirs=True)
  File "/home/a/src/rechnung/rechnung/settings.py", line 81, in get_settings_from_cwd
    Path(cwd) / settings_file, create_non_existing_dirs=create_non_existing_dirs
  File "/home/a/src/rechnung/rechnung/settings.py", line 126, in get_settings_from_file
    s_value = base_path / settings_data["assets_dir"] / s_value
  File "/usr/lib/python3.7/pathlib.py", line 908, in __truediv__
    return self._make_child((key,))
  File "/usr/lib/python3.7/pathlib.py", line 695, in _make_child
    drv, root, parts = self._parse_args(args)
  File "/usr/lib/python3.7/pathlib.py", line 649, in _parse_args
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType

Remove {slug} from contracts

Contracts have a unique identifier (cid) and can be identified better by giving the name or email address of the other party. Therefore I propose to remove the slug property from the contracts.

Add CI

Currently there is no Continuous Integration.

Use pathlib only

Currently partly pathlib and partly os.path is used, it should be unified to the new standard.

CSV file for test cases

We need an "example" csv file / bank statement for testing the print-csv function of the cli.

Send reminder

It should be possible to send reminder email given either a cid oder invoice id, so basically the same as single sending a document (invoice or contract) but with a different text and subject

make install not working

It seams there is no install part in the Makefile therefor the 'make install' doesn't work.

.DEFAULT_GOAL := help

.PHONY: help
help:
	@grep -E '^[\.a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

.PHONY: check
check: bandit black-check pip-check test ## Run all checks

.PHONY: bandit
bandit: ## Run bandit
	python -m bandit -r rechnung

.PHONY: black-check
black-check: ## Check code formatting
	python -m black --check rechnung

.PHONY: black
black: ## Format code
	python -m black rechnung

.PHONY: test
test: ## Run unittests
	pytest -v rechnung --cov=./ --cov-report term-missing:skip-covered $(PYTEST_ARGS)

.PHONY: pip-check
pip-check: ## Verify that all python package dependencies are met
	python -m pip check

.PHONY: upgrade
upgrade: ## Update all packages as available
	python -m pip install --upgrade-strategy eager --upgrade $$(cat requirements.in | sed -n 's/==.*$$//p')
	python -m pip install --upgrade-strategy eager --upgrade $$(cat requirements-dev.in | sed -n 's/==.*$$//p')

.PHONY: docs
docs:
	rm -f docs/rechnung.rst
	rm -f docs/modules.rst
	sphinx-apidoc -o docs rechnung
	$(MAKE) -C docs clean
	$(MAKE) -C docs html

Community profile

In order to make contribution easier, we should create

  • Contributing guidelines
  • code of conduct
  • issue template
  • PR template

Licence

We need to agree on a License

print-stats and print-contracts do not calculate correctly

Both print-stats and print-contacts do not calculate the amount per month in total correctly.

$ rechnung print-contracts
1000: [email protected] 2019-06-01 36.79€

$ rechnung print-stats
1 contracts in total
13.37€ per month

Even though, the correct amount should be 60.21€ according to this contract.

contents of _contracts/1000.yaml"

address:

  • Martha Muster
  • "Rosa-Luxemburg-Allee 161"
  • 04161 Leipzig
    cid: '1000'
    dob: 1954-03-21
    start: 2019-06-01
    email: [email protected]
    name: Martha Muster
    notify: false
    phone: '+491234567890'
    slug: martha_muster
    items:
    • description: A great product
      price: 13.37
      quantity: 1
    • description: Another awesome product
      price: 23.42
      quantity: 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.