2020-09-21 14:11:30 +02:00
# Invoices
2020-09-22 14:26:41 +02:00
To generate invoices, you need multiple local configs. Your own information
should be present in `from.yaml` , the person (or company) you write the invoice
to should be present as a file in `recipients/<rname>.yaml` , where `rname` is
the selector. The specific information about this invoice should be in
`config.yaml` .
2020-09-21 14:11:30 +02:00
2020-09-22 14:26:41 +02:00
## Your own information: from.yaml
Have a file called `from.yaml` with your own information structured like this:
2020-09-21 14:11:30 +02:00
2020-09-22 14:01:51 +02:00
### Field descriptions
| Field | Type | description |
|:---|:---:|:---|
2020-09-22 14:26:41 +02:00
| `name` | string | Your full name. |
| `address` | string | Your Address. Both street and number. |
| `zip` | int | Your area ZIP code. |
| `city` | string | The city you live in. |
| `cityShort` | string | Shortened version of your city name. |
2020-10-01 23:28:25 +02:00
| `countryDE` | strang | Name of your country in German, used for an invoice in German. |
| `countryEN` | strang | Name of your country in English, used for an invoice in English. |
2020-09-22 14:26:41 +02:00
| `IBAN` | string | The IBAN of your bank account. |
| `BIC` | string | The BIC of your bank account. |
| `bank` | string | The name of your bank. |
2020-09-30 22:40:49 +02:00
| `phone` | string | Optional. Your phone number. |
| `email` | string | Optional. Your mail address. |
| `url` | string | Optional. Your homepage. |
2020-09-22 14:01:51 +02:00
### Example
2020-09-22 14:26:41 +02:00
```from.yaml
name: < name >
address: < address >
zip: < zip >
city: < name of city >
cityShort: < short name of city >
countryDE: Deutschland
countryEN: Germany
IBAN: < IBAN >
BIC: < BIC >
bank: < name of bank >
2020-09-21 14:11:30 +02:00
```
2020-09-30 22:40:49 +02:00
It's no big deal to leave some of the fields empty.
2020-09-22 14:26:41 +02:00
## Clients: recipients/\<rname\>.yaml
For every clients `rname` , have a `recipients/<rname>.yaml` file structured
2020-09-22 14:01:51 +02:00
like this:
### Field descriptions
| Field | Type | description |
|:---|:---:|:---|
2020-09-22 14:26:41 +02:00
| `name` | string | Your clients name. |
| `address` | string | Your clients business address. Both street and number. |
| `zip` | int | ZIP code of your clients address. |
2020-09-22 14:01:51 +02:00
| `city` | string | City correlating to the zip code. |
2020-09-22 14:26:41 +02:00
| `country` | string | Country of your clients business address. |
2020-09-22 14:01:51 +02:00
### Example
2020-09-21 14:11:30 +02:00
```recipients/< rname > .yaml
2020-09-22 14:01:51 +02:00
name: < name >
address: < address >
zip: < zip >
city: < city >
2020-09-22 14:26:41 +02:00
country: < country >
2020-09-22 14:01:51 +02:00
```
2020-09-22 14:26:41 +02:00
## Config: config.yaml
The main config is in a file called `config.yaml` :
2020-09-22 14:01:51 +02:00
### Field descriptions
| Field | Type | description |
|:---|:---:|:---|
2020-09-22 14:26:41 +02:00
| `title` | string | Title of the invoice. |
| `description` | string | Description of the work you did. |
| `range` | string | Timeframe during which you accumulated the given number of hours. |
| `hours` | int | Number of hours you worked for the given timeframe and client. |
| `default_recipient` | string | Filename (before the `.yaml` ) of your default client. |
| `last_id` | int | Since invoices need to have unique IDs, this number will be increased by one. After that, the config will be written back to the file. This deletes any prior comments. |
| `invoice_dir` | string | Directory in which the invoice will be generated. Needs to exist prior to execution. |
| `default_hourly_rate` | int | The hourly rate you bill for in this receipt. |
| `bank_fee` | int | Optional. Amount of bank fees you can invoice. |
2020-09-22 14:01:51 +02:00
### Example
2020-09-22 14:26:41 +02:00
```config.yaml
title: < invoice title >
description: < work description >
range: < timeframe in which you worked >
hours: < hours worked >
default_recipient: < rname >
last_id: < int >
invoice_dir: invoice # directory needs to exist
default_hourly_rate: < int >
2020-09-21 14:11:30 +02:00
```
## Structure
2020-09-30 22:52:52 +02:00
The directory structure of where you execute this script should look something
like this:
2020-09-21 14:11:30 +02:00
```
2020-09-30 22:52:52 +02:00
$ tree
.
├── invoice # content is generated, but folder needs to exist
│ ├── < id >
│ └── < id >
├── recipients
│ ├── < rname > .yaml
│ └── < rname > .yaml
├── from.yaml
└── config.yaml
2020-09-21 14:11:30 +02:00
```
## Setup
2020-09-30 22:52:52 +02:00
Make sure to install poetry first.
### Nix
`nix-env -iA nixpkgs.poetry`
### Other
According to [their website ](https://python-poetry.org/docs/#installation ),
this is the recommended way of installation:
`curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python`
### Install dependencies
Make sure to switch to a virtual environment prior to installing dependencies.
2020-09-21 14:11:30 +02:00
```
2020-09-30 22:52:52 +02:00
$ virtualenv -p python3 .venv
$ source .venv/bin/activate
$ poetry install # install dependencies
2020-09-21 14:11:30 +02:00
```
## Usage
```
$ python main.py create
2020-09-30 22:52:52 +02:00
... # you will be asked for details and further information interactively
2020-09-21 14:11:30 +02:00
$ python main.py compile
```