Skip to content

Commit

Permalink
README.md: add some basic documentation on how to use pyinvoice
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixSchwarz committed Jul 21, 2023
1 parent b09aa83 commit 6dec336
Showing 1 changed file with 96 additions and 1 deletion.
97 changes: 96 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,99 @@
"pyinvoice" is a Python tool to generate PDF invoices using a custom XML format and weasyprint.
"pyinvoice" is a Python tool to generate PDF invoices using a custom XML format and [WeasyPrint](https://weasyprint.org/).

## Usage

pyinvoice is a command line tool which is really simple to use:

```shell
$ pyinvoice my-invoice.xml
```

Afterwards you should find a PDF file `my-invoice.pdf` right next to the xml file.
Before using pyinvoice for the first time you need to setup/configure some things.

## Installation/Setup

### Installation

TDB

### Create a HTML template for WeasyPrint

TDB

### Create a configuration file

pyinvoice uses a simple configuration file to store information about the invoice issuer.
That way you can use a single invoice template for different businesses.

If the configuration file is named `invoicing.ini` in the working directory where you called
pyinvoce the file will be picked up automatically. Otherwise you need to specify the config
file explicitely using `--config=/path/to/invoicing.ini`.

Example config:

```
[pyinvoice]
name = John Smith
street = Main Street 54
zip = 80331
city = Munich
tel = (089) 123456
email = [email protected]
domain = www.site.example
ustidnr = DE123456789
taxnr = 11/555/00123
bank_iban = DE12 1001 0010 0123 4567 89
bank_bic = PBNKDEFF
bank_name = Postbank
paypal = [email protected]
template = ./templates/invoice.html
```

Which data you put in there is up to you and the template you use. The only required key is
`template` which pyinvoice uses to load the right HTML template.


---

## Create an Invoice

To create an invoice you need to create an XML file with the right information. pyinvoice will calculate the
net sum, VAT values and the total sum automatically for you.

```xml
<?xml version="1.0" encoding='UTF-8'?>
<invoice invoiceSubject="Software to create PDF Invoices"
invoiceDate="21.07.2023" invoiceNumber="00213"
defaultVat="0.19">

<billingAddress>
<name>Customer Ltd</name>
<street>Business Street 2</street>
<zip>10715</zip>
<city>Berlin</city>
</billingAddress>

<item price="230">
Development of software to create PDF invoices
</item>
</invoice>
```

You can use multiple invoice `<item>` elements inside a single invoice. pyinvoice will sum the prices
for all positions automatically.


---

## Advanced Topics

### Custom check functions

TDB


### Item price calculation based on `hours` and `hourly_rate`
Expand Down

0 comments on commit 6dec336

Please sign in to comment.