aboutsummaryrefslogtreecommitdiffstats
path: root/tmpl/transactions_by_year.html
blob: 08e9c60ecfce1f9fc540c0acc0cd229b839b3d1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>[% config.sitename %]: Transactions for [% year %]</title>
        [% INCLUDE head_chart.html %]
    </head>
    <body>
        <h1>Mageia.Org accounts transactions for year [% year %]</h1>
        <h2>Summary</h2>
        <ul>
            <li>
            <b>Start balance</b>: [% transactions.by_year.$year.start_balance %] Euros
            </li>
            <li>
            <b>End balance</b>: [% transactions.by_year.$year.end_balance %] Euros
            </li>
            <li>
            <b>Revenues</b>: [% transactions.by_year.$year.revenues %] Euros
            </li>
            <li>
            <b>Expenses</b>: [% transactions.by_year.$year.expenses %] Euros
            </li>
        </ul>
        <h2>By category</h2>
        <ul>
            [% FOR ca IN transactions.by_year.$year.ca_balance.keys %]
            <li><b><a href="c_[% ca %].html">[% transactions.by_ca.$ca.c_name %]</a></b>: [% transactions.by_year.$year.ca_balance.$ca %] Euros</b></li>
            [%- END -%]
        </ul>
        <h2>Monthly reports</h2>

        <canvas id="accounts_history_bar_chart" height="250" width="[% 80 + transactions.by_year.$year.months.size * 65 %]"></canvas>

        <script>

                var barChartData = {
                        labels : ["[% transactions.by_year.$year.months.sort.join('","') %]"],
                        datasets : [
                                {
                                        fillColor : "#151f79",
                                        strokeColor : "#101333",
                                        data : [
                                        [%- FOR month IN transactions.by_year.$year.months.sort -%]
                                        [%- transactions.by_month.$month.revenues -%]
                                        [%- IF ! loop.last() -%],[%- END -%]
                                        [%- END %]]
                                },
                                {
                                        fillColor : "#e51b1b",
                                        strokeColor : "#f11111",
                                        data: [
                                        [%- FOR month IN transactions.by_year.$year.months.sort -%]
                                        [%- transactions.by_month.$month.expenses -%]
                                        [%- IF ! loop.last() -%],[%- END -%]
                                        [%- END %]]
                                }
                        ]
                        
                }

        var myLine = new Chart(document.getElementById("accounts_history_bar_chart").getContext("2d")).Bar(barChartData);
        
        </script>

        <ul>
        [%- FOR month IN transactions.by_month.keys.sort -%]
        [%- IF transactions.by_month.$month.year == year -%]
            <li><a href="m_[% month %].html">[% month %]</a></li>

        [%- END -%]
        [%- END -%]
        </ul>
        <h2>Details</h2>
        <table border="1">
            <tr>
                <th>Date</th>
                <th>Amount</th>
                <th>Account</th>
                <th>Who</th>
                <th>Notes</th>
                <th>Category</th>
            </tr>
            [%- USE date(format='%Y/%m/%d') -%]
            [% FOR tra IN transactions.by_year.$year.transactions.sort('date').reverse %]
            [%- INCLUDE tra_row.html %]
            [%- END -%]
        </table>
    </body>
</html>