-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f357a2c
Showing
10 changed files
with
703 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# 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 | ||
|
||
.idea | ||
.venv | ||
config.yaml | ||
invoice_template.html | ||
invoices |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 dtrai2 | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Shiny Invoice | ||
|
||
This tool is meant as a simple and naive way to manage invoices locally. | ||
It is not meant to be published online and used as an enterprise tool. | ||
|
||
|
||
## Run | ||
|
||
To run shiny invoice you need to clone this repository and install the dependencies with (it is suggested to use a venv) | ||
|
||
```bash | ||
pip install -e . | ||
``` | ||
|
||
Once `shiny-invoice` is installed you need to create configuration file. | ||
A suitable example looks like this: | ||
|
||
```yaml | ||
paths: | ||
invoices_root_dir: /home/user/invoices/ # must be an absolute path, and it needs to end with / | ||
invoices_dir_paid: paid | ||
invoices_dir_unpaid: open | ||
html_template: shiny_invoice/default_invoice_template.html | ||
company: # here you can specify details of your company | ||
name: Company Name | ||
skills: | ||
- Primary Skill | ||
- Secondary Skill | ||
address: | ||
- Address line 1 | ||
- 4234 Addresline2 | ||
contact: | ||
- [email protected] | ||
- +49 123 456789 | ||
- shinyinvoice.de | ||
bank: | ||
name: SomeBank | ||
iban: DE12 1234 5678 9100 00 | ||
bic: BICCCCCCC | ||
tax_number: 11/2222/3333 | ||
tax_rate: 0.19 | ||
payment_terms_days: 14 | ||
invoice_defaults: # here you can set defaults, which will be used to prefill the invoice formular | ||
recipient: |- | ||
Comp 2 | ||
Compstreet Comp | ||
1335 Compvill | ||
items: | | ||
Services, Hours, Rate, Price | ||
Service 1, 40h, 100 €, 4.000 € | ||
``` | ||
Once everything is set up you can run `shiny-invoice` with: | ||
|
||
```bash | ||
shiny-invoice run --config config.yaml | ||
``` | ||
|
||
## Workflow | ||
|
||
This application manages the invoices as plain html files, which then can be turned into pdfs via the | ||
browsers print functionality. | ||
According to the configuration invoices can be separated into paid/unpaid directories. | ||
Based on that they will be also categorised inside the ui. | ||
The application does not offer ways to move or change files, this has to be done manually. | ||
The filename also needs to follow a specific pattern which is | ||
`<CREATED_AT_DATE>-<INVOICE_NUMBER>-<CUSTOMERNAME>.html` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
[build-system] | ||
requires = ["setuptools>=68.0.0", "wheel", "setuptools_scm>=8"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.setuptools] | ||
packages = ["shiny_invoice"] | ||
|
||
[tool.setuptools_scm] | ||
|
||
[project] | ||
name = "shiny-invoice" | ||
description = "Simply manage invoices" | ||
dynamic = ["version"] | ||
requires-python = ">=3.10" | ||
readme = "README.md" | ||
license = { file = "LICENSE" } | ||
classifiers = [ | ||
"Development Status :: 3 - Alpha", | ||
"License :: OSI Approved :: MIT License", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.12", | ||
"Topic :: Office/Business :: Financial :: Accounting", | ||
] | ||
keywords = [ | ||
"invoice", | ||
"finance", | ||
"accounting", | ||
] | ||
|
||
dependencies = [ | ||
"shiny", | ||
"click", | ||
"ruamel.yaml", | ||
"pandas" | ||
] | ||
|
||
[project.optional-dependencies] | ||
dev = [ | ||
"black", | ||
"pylint", | ||
"pre-commit" | ||
] | ||
|
||
[project.scripts] | ||
shiny-invoice = "shiny_invoice.shiny_invoice:cli" | ||
|
||
[tool.black] | ||
line-length = 100 | ||
target-version = ['py311'] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"/> | ||
<style> | ||
.invoice-wrapper { | ||
margin: auto; | ||
padding: 30px; | ||
font-size: 13px; | ||
line-height: 22px; | ||
font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; | ||
color: #555; | ||
} | ||
|
||
.invoice-wrapper .top { | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
|
||
.invoice-wrapper .top .title .name{ | ||
font-size: 2em; | ||
color: #333; | ||
} | ||
|
||
.invoice-wrapper .top .details { | ||
text-align: right; | ||
} | ||
|
||
.invoice-wrapper .addresses { | ||
display: flex; | ||
justify-content: space-between; | ||
margin: 2em 0; | ||
} | ||
|
||
.invoice-wrapper .addresses .sender{ | ||
text-align: right; | ||
|
||
} | ||
.invoice-wrapper .addresses .sender-small{ | ||
font-size: 0.7em; | ||
border-bottom: 1px solid #333; | ||
} | ||
|
||
.invoice-wrapper .addresses .recipient{ | ||
margin: 4em 0 0 0; | ||
} | ||
|
||
.invoice-wrapper .subject { | ||
font-size: 20px; | ||
font-weight: bold; | ||
margin: 0 0 1em 0; | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
|
||
.invoice-wrapper .greetings { | ||
margin-bottom: 1em; | ||
} | ||
|
||
.invoice-wrapper table { | ||
width: 100%; | ||
} | ||
|
||
.invoice-wrapper table td { | ||
padding: 2px; | ||
} | ||
|
||
.invoice-wrapper table tr td:first-child, .invoice-wrapper table thead th:first-child { | ||
text-align: left; | ||
} | ||
.invoice-wrapper table tr td { | ||
text-align: right; | ||
} | ||
|
||
.invoice-wrapper table thead th { | ||
background: #eee; | ||
border-bottom: 1px solid #ddd; | ||
font-weight: bold; | ||
} | ||
|
||
.invoice-wrapper table tr.item td { | ||
border-bottom: 1px solid #eee; | ||
} | ||
|
||
.invoice-wrapper .totals { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-end; | ||
} | ||
|
||
.invoice-wrapper .totals table{ | ||
width: fit-content; | ||
margin: 0.5em 0; | ||
} | ||
.invoice-wrapper .totals table td{ | ||
padding: 0 2px 0 2px; | ||
font-size: 0.8em; | ||
} | ||
.invoice-wrapper .totals table td:first-child{ | ||
padding-right: 10px; | ||
} | ||
|
||
.invoice-wrapper .totals table tr:last-child{ | ||
font-weight: bold; | ||
font-size: 1.2em; | ||
} | ||
|
||
.invoice-wrapper .closing .highlight{ | ||
font-weight: bold; | ||
} | ||
|
||
.invoice-wrapper .footer { | ||
display: flex; | ||
font-size: 0.6em; | ||
line-height: 1.2em; | ||
justify-content: space-around; | ||
border-top: 1px solid #ddd; | ||
padding-top: 15px; | ||
} | ||
|
||
.invoice-wrapper .footer span{ | ||
font-weight: bold; | ||
} | ||
|
||
@media print { | ||
.invoice-wrapper .footer{ | ||
position: fixed; | ||
bottom: 0; | ||
left: 0; | ||
width: 100%; | ||
} | ||
.pagebreak { | ||
page-break-before: always; | ||
} | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="invoice-wrapper"> | ||
<div class="top"> | ||
<div class="title"> | ||
<span class="name">${name}</span><br/> | ||
<span class="skills">${primary_skills}</span> | ||
</div> | ||
<div class="details"> | ||
<td>Invoice ${invoice_number}<br/>Due date: ${due_at_date}</td> | ||
</div> | ||
</div> | ||
<div class="addresses"> | ||
<div class="recipient"> | ||
<span class="sender-small">${name} | ${piped_address}</span><br/> | ||
${recipient_address} | ||
</div> | ||
<div class="sender"> | ||
${name}<br/> | ||
${linebreaked_address}<br/> | ||
${primary_contact} | ||
</div> | ||
</div> | ||
|
||
<div class="subject"> | ||
<span>Invoice</span> | ||
<span>${created_at_date}</span> | ||
</div> | ||
|
||
<div class="greetings"> | ||
${introduction}<br/> | ||
I appreciate your trust and would ask you to pay this invoice, without deductions, till the ${due_at_date}. | ||
</div> | ||
${invoice_items} | ||
<div class="totals"> | ||
<table> | ||
<tr><td>Net total:</td><td>${total_net}</td></tr> | ||
<tr><td>VAT ${tax_rate}:</td><td>${tax}</td></tr> | ||
<tr><td>Gross total:</td><td>${total_gross}</td></tr> | ||
</table> | ||
</div> | ||
<div class="closing"> | ||
<p>Please make the payment to:<br/> | ||
<span class="highlight">IBAN: ${iban}</span> at the <span class="highlight">${bank} (BIC: ${bic})</span><br/> | ||
with the reference <span class="highlight">Invoice ${invoice_number}</span>.</p> | ||
|
||
<p>Best Regards<br/>${name}</p> | ||
</div> | ||
<div class="footer"> | ||
<div class="left"> | ||
<span>${name}</span><br/>${all_skills} | ||
</div> | ||
<div class="center"> | ||
<span>Contact</span><br/> | ||
${linebreaked_address}<br/> | ||
${all_contact} | ||
</div> | ||
<div class="right"> | ||
<span>Bank details</span><br/> | ||
Bank: ${bank}<br/> | ||
IBAN: ${iban}<br/> | ||
BIC: ${bic}<br/> | ||
Tax number: ${tax_number} | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
Oops, something went wrong.