finances/README.md

72 lines
12 KiB
Markdown

# pub.solar finances
This repository is used to track the finances of pub.solar transparently.
We use [hledger](https://hledger.org/) to create finance report in a minimalistic, terminal friendly
way.
### Finances report tables
<style>
td { padding:0 0.5em; }
td:nth-child(1) { white-space:nowrap; }
tr:nth-child(even) td { background-color:#eee; }
</style><link rel="stylesheet" href="hledger.css"><table><tr><th colspan="5" style="text-align:left"><h2>Income Statement 2023-01-01..2024-10-28</h2></th></tr><tr><th></th><th>Commodity</th><th>2023</th><th>2024</th><th>Total</th></tr><tr><td colspan="5">&nbsp;</td></tr><tr><th colspan="5" style="text-align:left">Revenues</th></tr><tr><td class="account" style="text-align:left">bank:interest</td><td class="amount" style="text-align:right"></td><td class="amount" style="text-align:right">0</td><td class="amount" style="text-align:right">1.20</td><td class="amount rowtotal" style="text-align:right">1.20</td></tr><tr><td class="account" style="text-align:left">donations:member</td><td class="amount" style="text-align:right"></td><td class="amount" style="text-align:right">415.00</td><td class="amount" style="text-align:right">1097.87</td><td class="amount rowtotal" style="text-align:right">1512.87</td></tr><tr><td class="account" style="text-align:left">donations:non-member</td><td class="amount" style="text-align:right"></td><td class="amount" style="text-align:right">87.00</td><td class="amount" style="text-align:right">313.43</td><td class="amount rowtotal" style="text-align:right">400.43</td></tr><tr><th style="text-align:left">total</th><th class="amount coltotal" style="text-align:right"></th><th class="amount coltotal" style="text-align:right">502.00</th><th class="amount coltotal" style="text-align:right">1412.50</th><th class="amount coltotal" style="text-align:right">1914.50</th></tr><tr><td colspan="5">&nbsp;</td></tr><tr><th colspan="5" style="text-align:left">Expenses</th></tr><tr><td class="account" style="text-align:left">infra:domain</td><td class="amount" style="text-align:right"></td><td class="amount" style="text-align:right">52.40</td><td class="amount" style="text-align:right">0</td><td class="amount rowtotal" style="text-align:right">52.40</td></tr><tr><td class="account" style="text-align:left">infra:file-storage</td><td class="amount" style="text-align:right"></td><td class="amount" style="text-align:right">26.02</td><td class="amount" style="text-align:right">48.24</td><td class="amount rowtotal" style="text-align:right">74.26</td></tr><tr><td class="account" style="text-align:left">infra:server</td><td class="amount" style="text-align:right"></td><td class="amount" style="text-align:right">124.47</td><td class="amount" style="text-align:right">460.54</td><td class="amount rowtotal" style="text-align:right">585.01</td></tr><tr><th style="text-align:left">total</th><th class="amount coltotal" style="text-align:right"></th><th class="amount coltotal" style="text-align:right">202.89</th><th class="amount coltotal" style="text-align:right">508.78</th><th class="amount coltotal" style="text-align:right">711.67</th></tr><tr><td colspan="5">&nbsp;</td></tr><tr><th style="text-align:left">Net:</th><th class="amount coltotal" style="text-align:right"></th><th class="amount coltotal" style="text-align:right">299.11</th><th class="amount coltotal" style="text-align:right">903.72</th><th class="amount coltotal" style="text-align:right">1202.83</th></tr></table>
Monthly income in 2023-01-01..2024-10-31:
<table><tr><td class="account">account</td><td class style>2023-01</td><td class style>2023-02</td><td class style>2023-03</td><td class style>2023-04</td><td class style>2023-05</td><td class style>2023-06</td><td class style>2023-07</td><td class style>2023-08</td><td class style>2023-09</td><td class style>2023-10</td><td class style>2023-11</td><td class style>2023-12</td><td class style>2024-01</td><td class style>2024-02</td><td class style>2024-03</td><td class style>2024-04</td><td class style>2024-05</td><td class style>2024-06</td><td class style>2024-07</td><td class style>2024-08</td><td class style>2024-09</td><td class style>2024-10</td></tr><tr><td class="account" style="text-align:left">income</td><td class="amount" style="text-align:right">€20.00</td><td class="amount" style="text-align:right">0</td><td class="amount" style="text-align:right">0</td><td class="amount" style="text-align:right">0</td><td class="amount" style="text-align:right">€12.00</td><td class="amount" style="text-align:right">0</td><td class="amount" style="text-align:right">€10.00</td><td class="amount" style="text-align:right">€55.00</td><td class="amount" style="text-align:right">€5.00</td><td class="amount" style="text-align:right">€205.00</td><td class="amount" style="text-align:right">€75.00</td><td class="amount" style="text-align:right">€120.00</td><td class="amount" style="text-align:right">€120.00</td><td class="amount" style="text-align:right">€110.00</td><td class="amount" style="text-align:right">€154.43</td><td class="amount" style="text-align:right">€97.36</td><td class="amount" style="text-align:right">€142.51</td><td class="amount" style="text-align:right">€114.61</td><td class="amount" style="text-align:right">€162.00</td><td class="amount" style="text-align:right">€105.39</td><td class="amount" style="text-align:right">€241.20</td><td class="amount" style="text-align:right">€165.00</td></tr><tr><th style="text-align:left">total</th><th class="amount coltotal" style="text-align:right">€20.00</th><th class="amount coltotal" style="text-align:right">0</th><th class="amount coltotal" style="text-align:right">0</th><th class="amount coltotal" style="text-align:right">0</th><th class="amount coltotal" style="text-align:right">€12.00</th><th class="amount coltotal" style="text-align:right">0</th><th class="amount coltotal" style="text-align:right">€10.00</th><th class="amount coltotal" style="text-align:right">€55.00</th><th class="amount coltotal" style="text-align:right">€5.00</th><th class="amount coltotal" style="text-align:right">€205.00</th><th class="amount coltotal" style="text-align:right">€75.00</th><th class="amount coltotal" style="text-align:right">€120.00</th><th class="amount coltotal" style="text-align:right">€120.00</th><th class="amount coltotal" style="text-align:right">€110.00</th><th class="amount coltotal" style="text-align:right">€154.43</th><th class="amount coltotal" style="text-align:right">€97.36</th><th class="amount coltotal" style="text-align:right">€142.51</th><th class="amount coltotal" style="text-align:right">€114.61</th><th class="amount coltotal" style="text-align:right">€162.00</th><th class="amount coltotal" style="text-align:right">€105.39</th><th class="amount coltotal" style="text-align:right">€241.20</th><th class="amount coltotal" style="text-align:right">€165.00</th></tr></table>
Monthly expenses in 2023-01-01..2024-10-31:
<table><tr><td class="account">account</td><td class style>2023-01</td><td class style>2023-02</td><td class style>2023-03</td><td class style>2023-04</td><td class style>2023-05</td><td class style>2023-06</td><td class style>2023-07</td><td class style>2023-08</td><td class style>2023-09</td><td class style>2023-10</td><td class style>2023-11</td><td class style>2023-12</td><td class style>2024-01</td><td class style>2024-02</td><td class style>2024-03</td><td class style>2024-04</td><td class style>2024-05</td><td class style>2024-06</td><td class style>2024-07</td><td class style>2024-08</td><td class style>2024-09</td><td class style>2024-10</td></tr><tr><td class="account" style="text-align:left">expenses</td><td class="amount" style="text-align:right">€-2.22</td><td class="amount" style="text-align:right">0</td><td class="amount" style="text-align:right">0</td><td class="amount" style="text-align:right">0</td><td class="amount" style="text-align:right">€-1.22</td><td class="amount" style="text-align:right">€-3.36</td><td class="amount" style="text-align:right">€-4.01</td><td class="amount" style="text-align:right">€-3.99</td><td class="amount" style="text-align:right">€-5.25</td><td class="amount" style="text-align:right">€-98.59</td><td class="amount" style="text-align:right">€-40.22</td><td class="amount" style="text-align:right">€-44.03</td><td class="amount" style="text-align:right">€-46.27</td><td class="amount" style="text-align:right">€-48.73</td><td class="amount" style="text-align:right">€-8.64</td><td class="amount" style="text-align:right">€-31.86</td><td class="amount" style="text-align:right">€-50.14</td><td class="amount" style="text-align:right">€-51.73</td><td class="amount" style="text-align:right">€-54.65</td><td class="amount" style="text-align:right">€-76.93</td><td class="amount" style="text-align:right">€-76.01</td><td class="amount" style="text-align:right">€-63.82</td></tr><tr><th style="text-align:left">total</th><th class="amount coltotal" style="text-align:right">€-2.22</th><th class="amount coltotal" style="text-align:right">0</th><th class="amount coltotal" style="text-align:right">0</th><th class="amount coltotal" style="text-align:right">0</th><th class="amount coltotal" style="text-align:right">€-1.22</th><th class="amount coltotal" style="text-align:right">€-3.36</th><th class="amount coltotal" style="text-align:right">€-4.01</th><th class="amount coltotal" style="text-align:right">€-3.99</th><th class="amount coltotal" style="text-align:right">€-5.25</th><th class="amount coltotal" style="text-align:right">€-98.59</th><th class="amount coltotal" style="text-align:right">€-40.22</th><th class="amount coltotal" style="text-align:right">€-44.03</th><th class="amount coltotal" style="text-align:right">€-46.27</th><th class="amount coltotal" style="text-align:right">€-48.73</th><th class="amount coltotal" style="text-align:right">€-8.64</th><th class="amount coltotal" style="text-align:right">€-31.86</th><th class="amount coltotal" style="text-align:right">€-50.14</th><th class="amount coltotal" style="text-align:right">€-51.73</th><th class="amount coltotal" style="text-align:right">€-54.65</th><th class="amount coltotal" style="text-align:right">€-76.93</th><th class="amount coltotal" style="text-align:right">€-76.01</th><th class="amount coltotal" style="text-align:right">€-63.82</th></tr></table>
### Import new statements
* place csv file into import directory
* rename to `expenses.csv` for expenses or
* rename to `donations-member.csv` for donations of members
* rename to `donations-non-member.csv` for donations of non-members
* execute `hledger import -f finances.hledger import/<csv-file>`
### Quick start how to use hledger
Installing hledger with [nix](https://nixos.org/download), the package manager.
```
git clone gitea@git.pub.solar:pub-solar/finances.git finances && cd $_
nix develop
```
or with [direnv](https://github.com/nix-community/nix-direnv).
```
git clone gitea@git.pub.solar:pub-solar/finances.git finances && cd $_
direnv allow
```
Creating a report without negative numbers
```
hledger incomestatement --file ./finances.hledger --layout bare --pretty --drop 1
```
Creating a web report, viewable in a browser
```
hledger-web --file ./finances.hledger
```
Writing a HTML table to the README
```
hledger incomestatement --file ./finances.hledger --layout bare --pretty --drop 1 --output-format html --yearly --row-total \
| sed 's|</table>|</table>\n|' \
| sed -i '/^<style>/,/^<\/style>/{
r /dev/stdin
d
}' README.md
```
Writing monthly tables to the README
```
hledger bal --depth=1 ^income --monthly --output-format html --invert -f ./finances.hledger
hledger bal --depth=1 ^expenses --monthly --output-format html --invert -f ./finances.hledger
```