Skip to main content

CLI invoice generator for business entities in the Czech republic

Project description

Billing Yard

Billing Yard is an open source CLI tool written in Python 3 for generating invoices as PDF files from JSON for business entities in the Czech republic. It supports invoices for both VAT payers and non VAT payers and generates a QR code with payment information for Czech banks.

If you like this software, please buy me a coffee.

Installation

First, please note that the software has WeasyPrint as a dependency and WeasyPrint needs some external third party libraries for correct functioning. The way to install these libraries will differ based on your operating system. So first you need to install these dependencies according to the manual below, then you can install Billing Yard itself.

The installation manual below expects you to know and understand how to work with pip and Virtual Environment.

Linux

Below, you can find how to install external third party libraries on different Linux distributions.

Debian

Debian 11 Bullseye or newer

apt install python3-pip libpango-1.0-0 libpangoft2-1.0-0 libharfbuzz-subset0

Ubuntu

Ubuntu 20.04 Focal Fossa or newer

apt install python3-pip libpango-1.0-0 libharfbuzz0b libpangoft2-1.0-0 libharfbuzz-subset0

Fedora

Fedora 39 or newer

dnf install python-pip pango

Archlinux

pacman -S python-pip pango

Alpine

Alpine Linux 3.17 or newer

apk add py3-pip so:libgobject-2.0.so.0 so:libpango-1.0.so.0 so:libharfbuzz.so.0 so:libharfbuzz-subset.so.0 so:libfontconfig.so.1 so:libpangoft2-1.0.so.0

macOS

Installation on macOS is recommended via Homebrew.

brew install python3 pango libffi

Windows and further support

For installation on Windows or further support, please see the official WeasyPrint installation guide. But please keep in mind that WeasyPrint must be installed as a dependency of Billing Yard and not directly using your OS package manager.

Installing Billing Yard

First you need to decide whether you want to use Virtual Environment or install Billing Yard globally. But note that installing in Virtual Environment is always preferred way. Then just make sure you are using Python 3.9 or newer and run following command, and you are done.

pip install billingyard

Basic usage

First step is to create configuration and data source files for generating an invoice. All configuration and data sources for an invoice are stored in JSON files. There are three schemas of JSON files, one for business entity (sender, receiver), one for an invoice without VAT and one for an invoice with VAT. Then you can generate the invoice itself.

Business entity

We create two business entities, sender (entity which issues the invoice) and receiver (entity which pays the invoice).

{
  "company": "Company s.r.o.",
  "street": "Ulice 38",
  "city": "Praha",
  "zip_code": "100 00",
  "country": "Česká republika",
  "company_id": "00011000",
  "vat_id": "CZ00011000"
}
  • company - the business name of the business entity
  • street - the street in the address of the business entity
  • city - the city in the address of the business entity
  • zip_code - the zip code in the address of the business entity
  • country - the country in the address of the business entity
  • company - the identifier given by Czech authority of the business entity
  • vat_id - the identifier for VAT purpose of the business entity
    • optional if business entity is not a VAT payer

Invoice for a non VAT payer

Below you can find the self explaining example of a non VAT payer invoice with further description.

{
  "invoice_number": "2021001",
  "issue_date": "01. 01. 2021",
  "due_date": "31. 01. 2021",
  "currency": "Kč",
  "bank": "Bank a.s.",
  "bank_account": "1234567890/1234",
  "iban": "CZ4100000000000123456789",
  "payment_method": "bank transfer",
  "register_info": "Fyzická osoba zapsaná v živnostenském rejstříku.",
  "invoice_lines": [
    {
      "description": "software development",
      "unit": "hr",
      "quantity": 20,
      "unit_price": 1500
    }
  ]
}
  • invoice_number - a unique identifier of the invoice
    • completely up to you, but keep in mind local policies from government
  • issue_date - the date of issue of the invoice
    • optional, if not set current date is used
  • due_date - the last day, when the invoice must be paid
  • currency - the currency in which is the invoice issued
  • bank - the bank of the sender business entity
  • bank_account - the bank account number of the sender business entity
  • iban - the IBAN of the sender business entity
    • optional, if not set, the QR code with payment information are not generated in the invoice
  • payment_method - the agreed instrument to pay the invoice
    • e.g. bank transfer, cash, credit card
    • this text is directly rendered in the invoice
  • register_info - the info about record in government registers of the sender business entity
    • the typical examples in Czech are "Fyzická osoba zapsaná v živnostenském rejstříku." or "Společnost je zapsána v obchodním rejstříku vedeném u Městského soudu v Praze, oddílu C, vložce 2396."
  • invoice_lines - the list of items that are invoiced

Each invoice line consists of following properties.

  • description - the name or more exhaustive description of the invoiced item
  • unit - the unit which we can use to count the invoiced item
    • e.g. hour, piece, meter, square meter etc
  • quantity - the amount of invoiced items in previously specified unit
  • unit_price - the price of the invoiced item for one unit

All dates have DD. MM. YYYY format.

Invoice for a VAT payer

Below you can find the self explaining example of a VAT payer invoice with further description.

{
  "invoice_number": "2021001",
  "issue_date": "01. 01. 2021",
  "supply_date": "01. 01. 2021",
  "due_date": "31. 01. 2021",
  "currency": "Kč",
  "bank": "Bank a.s.",
  "bank_account": "1234567890/1234",
  "iban": "CZ4100000000000123456789",
  "payment_method": "bank transfer",
  "register_info": "Fyzická osoba zapsaná v živnostenském rejstříku.",
  "invoice_lines": [
    {
      "description": "software development",
      "unit": "hr",
      "quantity": 20,
      "unit_price": 1500,
      "vat_rate": 0.21
    }
  ]
}
  • invoice_number - a unique identifier of the invoice
    • completely up to you, but keep in mind local policies from government
  • issue_date - the date of issue of the invoice
    • optional, if not set current date is used
  • supply_date - the date of taxable supply
    • optional, if not set current date is used
  • due_date - the last day, when the invoice must be paid
  • currency - the currency in which is the invoice issued
  • bank - the bank of the sender business entity
  • bank_account - the bank account number of the sender business entity
  • iban - the IBAN of the sender business entity
    • optional, if not set, the QR code with payment information are not generated in the invoice
  • payment_method - the agreed instrument to pay the invoice
    • e.g. bank transfer, cash, credit card
    • this text is directly rendered in the invoice
  • register_info - the info about record in government registers of the sender business entity
    • the typical examples in Czech are "Fyzická osoba zapsaná v živnostenském rejstříku." or "Společnost je zapsána v obchodním rejstříku vedeném u Městského soudu v Praze, oddílu C, vložce 2396."
  • invoice_lines - the list of items that are invoiced

Each invoice line consists of following properties.

  • description - the name or more exhaustive description of the invoiced item
  • unit - the unit which we can use to count the invoiced item
    • e.g. hour, piece, meter, square meter etc
  • quantity - the amount of invoiced items in previously specified unit
  • unit_price - the price of the invoiced item for one unit without VAT
  • vat_rate - the rate of VAT for this invoiced item

All dates have DD. MM. YYYY format.

Generating an invoice

If you installed Billing Yard using Virtual Environment, just activate this environment and run one of the following commands, depending on whether you are a VAT payer or not. If you installed Billing Yard globally, just run one of the commands.

billingyard -s sender.json issue-invoice -i invoice.json -r receiver.json

The option -s expects path to JSON data file with information about a sender business entity. It can be omitted, if its name is sender.json and it is located in the same directory from which is the command executed.

The option -i expects path to JSON data file with the invoice data.

The option -r expects path to JSON data file with information about a sender business entity.

billingyard -s sender.json issue-invoice -i invoice_vat.json -r receiver.json --vat

The option --vat is used to generate an invoice for a VAT payer sender business entity. Please do not forget, that in this case, you have to also provide correct invoice JSON data file with all needed attributes.

License

This software is released under MIT License and use other third party software.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

billingyard-1.2.0.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

billingyard-1.2.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file billingyard-1.2.0.tar.gz.

File metadata

  • Download URL: billingyard-1.2.0.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for billingyard-1.2.0.tar.gz
Algorithm Hash digest
SHA256 60133b44f816d812ad7077c3262b4f3ba137df97d2d99e05d6976897a912faf9
MD5 90994bcc9cbf0c64bb1df69b29b275d1
BLAKE2b-256 ea7446c9816ad55fa64a921760cf7c231267eea775e35b7982b3f3b93f14444d

See more details on using hashes here.

Provenance

The following attestation bundles were made for billingyard-1.2.0.tar.gz:

Publisher: publish.yml on MartinVondrak/billing-yard

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file billingyard-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: billingyard-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for billingyard-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8bf4a0a14d38e076a1995b7e64009b255fb27598642b7d06d1f4e35d2367ebf4
MD5 18b9d64f72b516d2b5f255cef33de109
BLAKE2b-256 e8b971934cee95014fe2b8610c7db1a9e22f6a94ff84a909302836537842758b

See more details on using hashes here.

Provenance

The following attestation bundles were made for billingyard-1.2.0-py3-none-any.whl:

Publisher: publish.yml on MartinVondrak/billing-yard

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page