chellow 1757320031.0.0__py3-none-any.whl → 1759155233.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of chellow might be problematic. Click here for more details.
- chellow/e/bill_importer.py +136 -80
- chellow/e/bill_parsers/activity_mop_stark_xlsx.py +99 -86
- chellow/e/bill_parsers/annual_mop_stark_xlsx.py +78 -61
- chellow/e/bill_parsers/csv.py +139 -101
- chellow/e/bill_parsers/drax_edi.py +65 -89
- chellow/e/bill_parsers/engie_edi.py +187 -255
- chellow/e/bill_parsers/engie_xls.py +153 -167
- chellow/e/bill_parsers/haven_edi.py +189 -228
- chellow/e/bill_parsers/haven_edi_tprs.py +67 -67
- chellow/e/bill_parsers/nonsettlement_dc_stark_xlsx.py +75 -66
- chellow/e/bill_parsers/settlement_dc_stark_xlsx.py +229 -126
- chellow/e/bill_parsers/sse_edi.py +107 -75
- chellow/e/bill_parsers/sww_xls.py +78 -91
- chellow/e/computer.py +1 -1
- chellow/e/views.py +626 -281
- chellow/edi_lib.py +4 -27
- chellow/models.py +92 -3
- chellow/reports/report_111.py +478 -616
- chellow/reports/report_247.py +96 -137
- chellow/templates/e/dc_batch.html +110 -157
- chellow/templates/e/dc_batch_add.html +2 -3
- chellow/templates/e/dc_batch_edit.html +42 -46
- chellow/templates/e/dc_batch_file.html +2 -3
- chellow/templates/e/dc_batch_file_edit.html +28 -40
- chellow/templates/e/dc_batch_upload_file.html +68 -0
- chellow/templates/e/dc_batches.html +2 -1
- chellow/templates/e/dc_batches_edit.html +26 -0
- chellow/templates/e/dc_bill.html +27 -5
- chellow/templates/e/dc_bill_add.html +4 -4
- chellow/templates/e/dc_bill_edit.html +43 -63
- chellow/templates/e/dc_bill_import.html +1 -1
- chellow/templates/e/dc_bill_import_contract.html +130 -0
- chellow/templates/e/dc_contract.html +1 -1
- chellow/templates/e/dc_element.html +41 -0
- chellow/templates/e/dc_element_add.html +36 -0
- chellow/templates/e/dc_element_edit.html +49 -0
- chellow/templates/e/dc_rate_script_edit.html +27 -43
- chellow/templates/e/mop_batch.html +105 -152
- chellow/templates/e/mop_batch_add.html +2 -3
- chellow/templates/e/mop_batch_edit.html +43 -51
- chellow/templates/e/mop_batch_upload_file.html +71 -5
- chellow/templates/e/mop_batches.html +2 -1
- chellow/templates/e/mop_batches_edit.html +26 -0
- chellow/templates/e/mop_bill.html +31 -8
- chellow/templates/e/mop_bill_add.html +7 -27
- chellow/templates/e/mop_bill_import.html +1 -1
- chellow/templates/e/mop_bill_import_contract.html +130 -0
- chellow/templates/e/mop_contract.html +4 -5
- chellow/templates/e/mop_element.html +41 -0
- chellow/templates/e/mop_element_add.html +36 -0
- chellow/templates/e/mop_element_edit.html +49 -0
- chellow/templates/e/supplier_batch.html +3 -7
- chellow/templates/e/supplier_batch_add.html +2 -2
- chellow/templates/e/supplier_batch_edit.html +1 -1
- chellow/templates/e/supplier_batch_file.html +3 -5
- chellow/templates/e/supplier_batch_file_add.html +18 -11
- chellow/templates/e/supplier_batch_upload_file.html +83 -9
- chellow/templates/e/supplier_batches.html +4 -4
- chellow/templates/e/supplier_batches_edit.html +26 -0
- chellow/templates/e/supplier_bill.html +29 -6
- chellow/templates/e/supplier_bill_add.html +3 -3
- chellow/templates/e/supplier_bill_import.html +1 -1
- chellow/templates/e/supplier_bill_import_contract.html +118 -0
- chellow/templates/e/supplier_contract.html +1 -1
- chellow/templates/e/supplier_element.html +45 -0
- chellow/templates/e/supplier_element_add.html +36 -0
- chellow/templates/e/supplier_element_edit.html +51 -0
- chellow/templates/report_run_bill_check.html +137 -179
- chellow/templates/report_run_row_bill_check.html +182 -179
- chellow/views.py +55 -65
- {chellow-1757320031.0.0.dist-info → chellow-1759155233.0.0.dist-info}/METADATA +2 -2
- {chellow-1757320031.0.0.dist-info → chellow-1759155233.0.0.dist-info}/RECORD +73 -60
- chellow/e/bill_parsers/drax_element_edi.py +0 -459
- chellow/templates/e/supplier_bill_imports.html +0 -421
- {chellow-1757320031.0.0.dist-info → chellow-1759155233.0.0.dist-info}/WHEEL +0 -0
|
@@ -11,147 +11,111 @@
|
|
|
11
11
|
{% endblock %}
|
|
12
12
|
|
|
13
13
|
{% block content %}
|
|
14
|
-
{% set
|
|
14
|
+
{% set data = row.data['data'] %}
|
|
15
15
|
{% set properties = row.data.get('properties', {}) %}
|
|
16
|
+
{% set market_role_code = data['market_role_code'] %}
|
|
17
|
+
{% if market_role_code == 'X' %}
|
|
18
|
+
{% set contract_type = 'supplier' %}
|
|
19
|
+
{% elif market_role_code == 'C' %}
|
|
20
|
+
{% set contract_type = 'dc' %}
|
|
21
|
+
{% elif market_role_code == 'M' %}
|
|
22
|
+
{% set contract_type = 'mop' %}
|
|
23
|
+
{% endif %}
|
|
24
|
+
|
|
16
25
|
<table>
|
|
17
|
-
<caption>Bill Check</caption>
|
|
26
|
+
<caption>Bill Check</caption>
|
|
18
27
|
<thead>
|
|
19
28
|
<tr>
|
|
20
|
-
<th
|
|
21
|
-
<th
|
|
22
|
-
<th
|
|
23
|
-
<th
|
|
24
|
-
<th
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<th>
|
|
28
|
-
<th>
|
|
29
|
-
<th>
|
|
30
|
-
<th>
|
|
31
|
-
<th>VAT GBP</th>
|
|
32
|
-
<th>Gross GBP</th>
|
|
33
|
-
<th>Start</th>
|
|
34
|
-
<th>Finish</th>
|
|
35
|
-
<th>Import</th>
|
|
36
|
-
<th>Export</th>
|
|
37
|
-
<th>Code</th>
|
|
38
|
-
<th>Name</th>
|
|
29
|
+
<th>Contract</th>
|
|
30
|
+
<th>Supply</th>
|
|
31
|
+
<th>Import MPAN Core</th>
|
|
32
|
+
<th>Export MPAN Core</th>
|
|
33
|
+
<th>Site</th>
|
|
34
|
+
<th>From</th>
|
|
35
|
+
<th>To</th>
|
|
36
|
+
<th>Actual Net GBP</th>
|
|
37
|
+
<th>Virtual Net GBP</th>
|
|
38
|
+
<th>Difference Net GBP</th>
|
|
39
|
+
<th>Problem</th>
|
|
39
40
|
</tr>
|
|
40
41
|
</thead>
|
|
41
42
|
<tbody>
|
|
42
43
|
<tr>
|
|
43
44
|
<td>
|
|
44
|
-
{% if
|
|
45
|
-
|
|
45
|
+
{% if data.contract_id is not none %}
|
|
46
|
+
<a href="/e/{{contract_type}}_contracts/{{data.contract_id}}">{{data['contract_name']}}</a>
|
|
46
47
|
{% endif %}
|
|
47
48
|
</td>
|
|
48
49
|
<td>
|
|
49
|
-
{% if
|
|
50
|
-
<a href="/e/
|
|
51
|
-
values['bill-reference']}}</a>
|
|
50
|
+
{% if data.supply_id != None %}
|
|
51
|
+
<a href="/e/supplies/{{data.supply_id}}">view</a>
|
|
52
52
|
{% endif %}
|
|
53
53
|
</td>
|
|
54
|
-
<td>{{
|
|
55
|
-
<td>{{values['bill-kwh']}}</td>
|
|
56
|
-
<td>{{values['bill-net-gbp']}}</td>
|
|
57
|
-
<td>{{values['bill-vat-gbp']}}</td>
|
|
58
|
-
<td>{{values['bill-gross-gbp']}}</td>
|
|
59
|
-
<td>{{values['bill-start-date']}}</td>
|
|
60
|
-
<td>{{values['bill-finish-date']}}</td>
|
|
54
|
+
<td>{{data['imp_mpan_core']}}</td>
|
|
61
55
|
<td>
|
|
62
|
-
{% if
|
|
63
|
-
|
|
64
|
-
values['imp-mpan-core']}}</a>
|
|
56
|
+
{% if data['exp_mpan_core'] is not none %}
|
|
57
|
+
{{data['exp_mpan_core']}}
|
|
65
58
|
{% endif %}
|
|
66
59
|
</td>
|
|
67
60
|
<td>
|
|
68
|
-
{% if
|
|
69
|
-
|
|
70
|
-
values['exp-mpan-core']}}</a>
|
|
61
|
+
{% if data.site_id is not none %}
|
|
62
|
+
<a href="/sites/{{data['site_id']}}">{{data['site_code']}} {{data['site_name']}}</a>
|
|
71
63
|
{% endif %}
|
|
72
64
|
</td>
|
|
73
|
-
<td>
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
</td>
|
|
79
|
-
<td>{{values['site-name']}}</td>
|
|
80
|
-
<td>
|
|
81
|
-
<form action="/report_run_rows/{{row.id}}" method="post">
|
|
82
|
-
<fieldset>
|
|
83
|
-
{{input_textarea(
|
|
84
|
-
'note', properties.note, 5, 40,
|
|
85
|
-
placeholder='Notes on checking go here...')}}
|
|
86
|
-
<br>
|
|
87
|
-
<br>
|
|
88
|
-
<label>Checked?
|
|
89
|
-
{{input_checkbox('is_checked', properties.is_checked)}}
|
|
90
|
-
</label>
|
|
91
|
-
<input type="submit" name="update" value="Update">
|
|
92
|
-
</fieldset>
|
|
93
|
-
</form>
|
|
94
|
-
</td>
|
|
65
|
+
<td>{{data['period_start']}}</td>
|
|
66
|
+
<td>{{data['period_finish']}}</td>
|
|
67
|
+
<td>{{"{:0,.2f}".format(data['actual_net_gbp'])}}</td>
|
|
68
|
+
<td>{{"{:0,.2f}".format(data['virtual_net_gbp'])}}</td>
|
|
69
|
+
<td>{{"{:0,.2f}".format(data['difference_net_gbp'])}}</td>
|
|
70
|
+
<td>{{data['problem']}}</td>
|
|
95
71
|
</tr>
|
|
96
72
|
</tbody>
|
|
97
73
|
</table>
|
|
98
74
|
|
|
99
75
|
<table>
|
|
100
|
-
<caption>
|
|
76
|
+
<caption>Actual Bills</caption>
|
|
101
77
|
<thead>
|
|
102
78
|
<tr>
|
|
103
|
-
<th>
|
|
104
|
-
<th>
|
|
105
|
-
<th>
|
|
106
|
-
<th>
|
|
79
|
+
<th>Batch</th>
|
|
80
|
+
<th>View</th>
|
|
81
|
+
<th>Start Date</th>
|
|
82
|
+
<th>Finish Date</th>
|
|
107
83
|
<th>Net GBP</th>
|
|
108
|
-
<th>
|
|
109
|
-
<th>
|
|
84
|
+
<th>Vat GBP</th>
|
|
85
|
+
<th>Gross GBP</th>
|
|
110
86
|
<th>Problem</th>
|
|
111
|
-
<th>
|
|
87
|
+
<th>Breakdown</th>
|
|
112
88
|
</tr>
|
|
113
89
|
</thead>
|
|
114
90
|
<tbody>
|
|
115
|
-
|
|
116
|
-
<
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
{
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
{
|
|
136
|
-
</
|
|
137
|
-
|
|
138
|
-
<td>
|
|
139
|
-
{% if values['virtual-net-gbp'] != None %}
|
|
140
|
-
{{"%.2f"|format(values['virtual-net-gbp'])}}
|
|
141
|
-
{% endif %}
|
|
142
|
-
</td>
|
|
143
|
-
<td>
|
|
144
|
-
{% if values['difference-net-gbp'] != None %}
|
|
145
|
-
{{"%.2f"|format(values['difference-net-gbp'])}}
|
|
146
|
-
{% endif %}
|
|
147
|
-
</td>
|
|
148
|
-
<td>{{values['covered-problem']}}</td>
|
|
149
|
-
<td>{{values['virtual-problem']}}</td>
|
|
150
|
-
</tr>
|
|
91
|
+
{% for bill in data.actual_bills %}
|
|
92
|
+
<tr>
|
|
93
|
+
<td>
|
|
94
|
+
{% if data.contract_id is not none %}
|
|
95
|
+
<a href="/e/{{contract_type}}_batches/{{bill.batch_id}}">{{bill.batch_reference}}</a>
|
|
96
|
+
{% endif %}
|
|
97
|
+
</td>
|
|
98
|
+
<td>
|
|
99
|
+
{% if data.contract_id is not none %}
|
|
100
|
+
<a href="/e/{{contract_type}}_bills/{{bill.id}}">view</a>
|
|
101
|
+
{% endif %}
|
|
102
|
+
</td>
|
|
103
|
+
<td>{{bill.start_date}}</td>
|
|
104
|
+
<td>{{bill.finish_date}}</td>
|
|
105
|
+
<td>{{bill.net}}</td>
|
|
106
|
+
<td>{{bill.vat}}</td>
|
|
107
|
+
<td>{{bill.gross}}</td>
|
|
108
|
+
<td>
|
|
109
|
+
<strong style="color: red">{{bill.problem}}</strong>
|
|
110
|
+
</td>
|
|
111
|
+
<td>{{bill.breakdown}}</td>
|
|
112
|
+
</tr>
|
|
113
|
+
{% endfor %}
|
|
151
114
|
</tbody>
|
|
152
115
|
</table>
|
|
153
116
|
|
|
154
117
|
<section class="elements">
|
|
118
|
+
<!--
|
|
155
119
|
<table>
|
|
156
120
|
<caption>GBP</caption>
|
|
157
121
|
<thead>
|
|
@@ -166,130 +130,169 @@
|
|
|
166
130
|
<tr>
|
|
167
131
|
<td>gross</td>
|
|
168
132
|
<td>
|
|
169
|
-
{% if 'covered-gross-gbp' in
|
|
170
|
-
{{"{:0,.2f}".format(
|
|
133
|
+
{% if 'covered-gross-gbp' in data and data['covered-gross-gbp'] is number %}
|
|
134
|
+
{{"{:0,.2f}".format(data['covered-gross-gbp'])}}
|
|
171
135
|
{% endif %}
|
|
172
136
|
</td>
|
|
173
137
|
<td>
|
|
174
|
-
{% if 'virtual-gross-gbp' in
|
|
175
|
-
{{"{:0,.2f}".format(
|
|
138
|
+
{% if 'virtual-gross-gbp' in data and data['virtual-gross-gbp'] is number %}
|
|
139
|
+
{{"{:0,.2f}".format(data['virtual-gross-gbp'])}}
|
|
176
140
|
{% endif %}
|
|
177
141
|
</td>
|
|
178
142
|
<td>
|
|
179
|
-
{% if 'difference-gross-gbp' in
|
|
180
|
-
{{"{:0,.2f}".format(
|
|
143
|
+
{% if 'difference-gross-gbp' in data and data['difference-gross-gbp'] is number %}
|
|
144
|
+
{{"{:0,.2f}".format(data['difference-gross-gbp'])}}
|
|
181
145
|
{% endif %}
|
|
182
146
|
</td>
|
|
183
147
|
</tr>
|
|
184
148
|
<tr>
|
|
185
149
|
<td>net</td>
|
|
186
150
|
<td>
|
|
187
|
-
{% if 'covered-net-gbp' in
|
|
188
|
-
{{"{:0,.2f}".format(
|
|
151
|
+
{% if 'covered-net-gbp' in data and data['covered-net-gbp'] is number %}
|
|
152
|
+
{{"{:0,.2f}".format(data['covered-net-gbp'])}}</td>
|
|
189
153
|
{% endif %}
|
|
190
154
|
<td>
|
|
191
|
-
{% if 'virtual-net-gbp' in
|
|
192
|
-
{{"{:0,.2f}".format(
|
|
155
|
+
{% if 'virtual-net-gbp' in data and data['virtual-net-gbp'] is number %}
|
|
156
|
+
{{"{:0,.2f}".format(data['virtual-net-gbp'])}}</td>
|
|
193
157
|
{% endif %}
|
|
194
158
|
<td>
|
|
195
|
-
{% if 'difference-net-gbp' in
|
|
196
|
-
{{"{:0,.2f}".format(
|
|
159
|
+
{% if 'difference-net-gbp' in data and data['difference-net-gbp'] is number %}
|
|
160
|
+
{{"{:0,.2f}".format(data['difference-net-gbp'])}}</td>
|
|
197
161
|
{% endif %}
|
|
198
162
|
</tr>
|
|
199
163
|
<tr>
|
|
200
164
|
<td>vat</td>
|
|
201
165
|
<td>
|
|
202
|
-
{% if 'covered-vat-gbp' in
|
|
203
|
-
{{"{:0,.2f}".format(
|
|
166
|
+
{% if 'covered-vat-gbp' in data and data['covered-vat-gbp'] is number %}
|
|
167
|
+
{{"{:0,.2f}".format(data['covered-vat-gbp'])}}</td>
|
|
204
168
|
{% endif %}
|
|
205
169
|
<td>
|
|
206
|
-
{% if 'virtual-vat-gbp' in
|
|
207
|
-
{{"{:0,.2f}".format(
|
|
170
|
+
{% if 'virtual-vat-gbp' in data and data['virtual-vat-gbp'] is number %}
|
|
171
|
+
{{"{:0,.2f}".format(data['virtual-vat-gbp'])}}</td>
|
|
208
172
|
{% endif %}
|
|
209
173
|
<td>
|
|
210
|
-
{% if 'difference-vat-gbp' in
|
|
211
|
-
{{"{:0,.2f}".format(
|
|
174
|
+
{% if 'difference-vat-gbp' in data and data['difference-vat-gbp'] is number %}
|
|
175
|
+
{{"{:0,.2f}".format(data['difference-vat-gbp'])}}</td>
|
|
212
176
|
{% endif %}
|
|
213
177
|
</tr>
|
|
214
178
|
<tr>
|
|
215
179
|
<td>vat-rate</td>
|
|
216
180
|
<td>
|
|
217
|
-
{{
|
|
218
|
-
<td>{{
|
|
181
|
+
{{data['covered-vat-rate']}}</td>
|
|
182
|
+
<td>{{data['virtual-vat-rate']}}</td>
|
|
219
183
|
<td>
|
|
220
|
-
{% if
|
|
221
|
-
{{"{:0,.2f}".format(
|
|
184
|
+
{% if data['difference-vat-rate'] is number %}
|
|
185
|
+
{{"{:0,.2f}".format(data['difference-vat-rate'])}}
|
|
222
186
|
{% endif %}
|
|
223
187
|
</td>
|
|
224
188
|
</tr>
|
|
225
189
|
</tbody>
|
|
226
190
|
</table>
|
|
191
|
+
-->
|
|
227
192
|
|
|
228
193
|
{% for table in tables %}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
<th>Difference</th>
|
|
237
|
-
</tr>
|
|
238
|
-
</thead>
|
|
239
|
-
<tbody>
|
|
240
|
-
<tr>
|
|
241
|
-
<td>gbp</td>
|
|
242
|
-
{% for pref in ('covered-', 'virtual-', 'difference-') %}
|
|
243
|
-
<td>
|
|
244
|
-
{% set k = pref + table.name + "-gbp" %}
|
|
245
|
-
{% if k in values %}
|
|
246
|
-
{% set val = values[k] %}
|
|
247
|
-
{% else %}
|
|
248
|
-
{% set val = '' %}
|
|
249
|
-
{% endif %}
|
|
250
|
-
{% if val is none %}
|
|
251
|
-
{% elif val is number %}
|
|
252
|
-
{{"{:0,.2f}".format(val)}}
|
|
253
|
-
{% else %}
|
|
254
|
-
{{val}}
|
|
255
|
-
{% endif %}
|
|
256
|
-
</td>
|
|
257
|
-
{% endfor %}
|
|
258
|
-
</tr>
|
|
259
|
-
{% for part in table['parts']|sort %}
|
|
194
|
+
{% set element = data['elements'][table] %}
|
|
195
|
+
{% set parts = element['parts'] %}
|
|
196
|
+
|
|
197
|
+
<div style="display: flex; gap: 4rem;">
|
|
198
|
+
<table>
|
|
199
|
+
<caption>{{table}}</caption>
|
|
200
|
+
<thead>
|
|
260
201
|
<tr>
|
|
261
|
-
<
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
202
|
+
<th>Part</th>
|
|
203
|
+
<th>Actual</th>
|
|
204
|
+
<th>Virtual</th>
|
|
205
|
+
<th>Difference</th>
|
|
206
|
+
</tr>
|
|
207
|
+
</thead>
|
|
208
|
+
<tbody>
|
|
209
|
+
<tr>
|
|
210
|
+
<td>gbp</td>
|
|
211
|
+
{% for k in ('actual', 'virtual', 'difference') %}
|
|
212
|
+
<td style="text-align: right;">
|
|
213
|
+
{% set part = parts['gbp'] %}
|
|
214
|
+
{% if k in part %}
|
|
215
|
+
{% set val = part[k] %}
|
|
267
216
|
{% else %}
|
|
268
217
|
{% set val = '' %}
|
|
269
218
|
{% endif %}
|
|
270
219
|
{% if val is none %}
|
|
271
220
|
{% elif val is number %}
|
|
272
221
|
{{"{:0,.2f}".format(val)}}
|
|
273
|
-
{% elif (val is string) or (val is boolean) %}
|
|
274
|
-
{{val}}
|
|
275
222
|
{% else %}
|
|
276
|
-
{
|
|
277
|
-
{% if v is number %}
|
|
278
|
-
{{"{:0,.2f}".format(v)}}
|
|
279
|
-
{% else %}
|
|
280
|
-
{{v}}
|
|
281
|
-
{% endif %}
|
|
282
|
-
{% if not loop.last %}
|
|
283
|
-
|
|
|
284
|
-
{% endif %}
|
|
285
|
-
{% endfor %}
|
|
223
|
+
{{val}}
|
|
286
224
|
{% endif %}
|
|
287
225
|
</td>
|
|
288
226
|
{% endfor %}
|
|
289
227
|
</tr>
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
228
|
+
{% for part_name, part in parts.items()|sort %}
|
|
229
|
+
{% if part_name != 'gbp' %}
|
|
230
|
+
<tr>
|
|
231
|
+
<td>{{part_name}}</td>
|
|
232
|
+
{% for k in ('actual', 'virtual', 'difference') %}
|
|
233
|
+
<td style="text-align: right;">
|
|
234
|
+
{% if k in part %}
|
|
235
|
+
{% set val = part[k] %}
|
|
236
|
+
{% else %}
|
|
237
|
+
{% set val = '' %}
|
|
238
|
+
{% endif %}
|
|
239
|
+
{% if val is none %}
|
|
240
|
+
{% elif val is number %}
|
|
241
|
+
{{"{:0,.2f}".format(val)}}
|
|
242
|
+
{% elif (val is string) or (val is boolean) %}
|
|
243
|
+
{{val}}
|
|
244
|
+
{% else %}
|
|
245
|
+
{% for v in val %}
|
|
246
|
+
{% if v is number %}
|
|
247
|
+
{{"{:0,.2f}".format(v)}}
|
|
248
|
+
{% else %}
|
|
249
|
+
{{v}}
|
|
250
|
+
{% endif %}
|
|
251
|
+
{% if not loop.last %}
|
|
252
|
+
|
|
|
253
|
+
{% endif %}
|
|
254
|
+
{% endfor %}
|
|
255
|
+
{% endif %}
|
|
256
|
+
</td>
|
|
257
|
+
{% endfor %}
|
|
258
|
+
</tr>
|
|
259
|
+
{% endif %}
|
|
260
|
+
{% endfor %}
|
|
261
|
+
</tbody>
|
|
262
|
+
</table>
|
|
263
|
+
|
|
264
|
+
<table>
|
|
265
|
+
<caption>Actual {{table}} Elements</caption>
|
|
266
|
+
<thead>
|
|
267
|
+
<tr>
|
|
268
|
+
<th>View</th>
|
|
269
|
+
<th>Batch</th>
|
|
270
|
+
<th>Bill</th>
|
|
271
|
+
<th>Start Date</th>
|
|
272
|
+
<th>Finish Date</th>
|
|
273
|
+
<th>Net GBP</th>
|
|
274
|
+
<th>Breakdown</th>
|
|
275
|
+
</tr>
|
|
276
|
+
</thead>
|
|
277
|
+
<tbody>
|
|
278
|
+
{% for el in element['actual_elements'] %}
|
|
279
|
+
<tr>
|
|
280
|
+
<td><a href="/e/{{contract_type}}_elements/{{el.id}}">View</a></td>
|
|
281
|
+
<td>
|
|
282
|
+
<a href="/e/{{contract_type}}_batches/{{el.bill.batch.id}}"
|
|
283
|
+
>{{el.bill.batch.reference}}</a>
|
|
284
|
+
</td>
|
|
285
|
+
<td><a href="/e/{{contract_type}}_bills/{{el.bill.id}}">View</a></td>
|
|
286
|
+
<td>{{el.start_date}}</td>
|
|
287
|
+
<td>{{el.finish_date}}</td>
|
|
288
|
+
<td>{{"{:0,.2f}".format(el.net)}}</td>
|
|
289
|
+
<td>{{el.breakdown}}</td>
|
|
290
|
+
</tr>
|
|
291
|
+
{% endfor %}
|
|
292
|
+
</tbody>
|
|
293
|
+
</table>
|
|
294
|
+
|
|
295
|
+
</div>
|
|
293
296
|
{% endfor %}
|
|
294
297
|
|
|
295
298
|
</section>
|
chellow/views.py
CHANGED
|
@@ -1368,48 +1368,69 @@ def report_run_get(run_id):
|
|
|
1368
1368
|
pass
|
|
1369
1369
|
|
|
1370
1370
|
else:
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1371
|
+
summary["sum_difference"] = g.sess.scalar(
|
|
1372
|
+
select(
|
|
1373
|
+
func.sum(ReportRunRow.data["data"]["difference_net_gbp"].as_float())
|
|
1374
|
+
).where(ReportRunRow.report_run == run)
|
|
1375
|
+
)
|
|
1376
|
+
element_names = g.sess.scalars(
|
|
1377
|
+
select(func.jsonb_object_keys(ReportRunRow.data["data"]["elements"]))
|
|
1378
|
+
.where(ReportRunRow.report_run == run)
|
|
1379
|
+
.distinct()
|
|
1380
|
+
).all()
|
|
1375
1381
|
diff_selects = [
|
|
1376
|
-
func.sum(
|
|
1382
|
+
func.sum(
|
|
1383
|
+
func.coalesce(
|
|
1384
|
+
ReportRunRow.data["data"]["elements"][n]["parts"]["gbp"][
|
|
1385
|
+
"difference"
|
|
1386
|
+
].as_float(),
|
|
1387
|
+
0,
|
|
1388
|
+
)
|
|
1389
|
+
)
|
|
1390
|
+
for n in element_names
|
|
1377
1391
|
]
|
|
1378
|
-
sum_diffs = (
|
|
1379
|
-
|
|
1380
|
-
)
|
|
1392
|
+
sum_diffs = g.sess.execute(
|
|
1393
|
+
select(*diff_selects).where(ReportRunRow.report_run == run)
|
|
1394
|
+
).one()
|
|
1381
1395
|
|
|
1382
|
-
for
|
|
1383
|
-
elem
|
|
1384
|
-
if elem == "net":
|
|
1385
|
-
summary["sum_difference"] = sum_diff
|
|
1386
|
-
else:
|
|
1387
|
-
elements.append((elem, sum_diff))
|
|
1396
|
+
for elem, sum_diff in zip(element_names, sum_diffs):
|
|
1397
|
+
elements.append((elem, sum_diff))
|
|
1388
1398
|
|
|
1389
|
-
elements.sort(key=lambda x: abs(x[1]), reverse=True)
|
|
1390
|
-
elements.insert(0, ("net", summary["sum_difference"]))
|
|
1399
|
+
elements.sort(key=lambda x: 0 if x[1] is None else abs(x[1]), reverse=True)
|
|
1391
1400
|
|
|
1392
1401
|
if "element" in request.values:
|
|
1393
1402
|
element = req_str("element")
|
|
1394
1403
|
else:
|
|
1395
|
-
element = "
|
|
1404
|
+
element = "problem"
|
|
1396
1405
|
|
|
1397
1406
|
hide_checked = req_bool("hide_checked")
|
|
1398
1407
|
|
|
1399
|
-
|
|
1400
|
-
q =
|
|
1408
|
+
ROW_LIMIT = 200
|
|
1409
|
+
q = select(ReportRunRow).where(ReportRunRow.report_run == run).limit(ROW_LIMIT)
|
|
1401
1410
|
if hide_checked:
|
|
1402
|
-
q = q.
|
|
1411
|
+
q = q.where(
|
|
1403
1412
|
ReportRunRow.data["properties"]["is_checked"].as_boolean() == false()
|
|
1404
1413
|
)
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
func.abs(
|
|
1414
|
+
if element == "problem":
|
|
1415
|
+
order_by = (
|
|
1416
|
+
ReportRunRow.data["data"]["problem"].as_string(),
|
|
1417
|
+
func.abs(
|
|
1418
|
+
func.coalesce(
|
|
1419
|
+
ReportRunRow.data["data"]["difference_net_gbp"].as_float(), 0
|
|
1420
|
+
)
|
|
1421
|
+
).desc(),
|
|
1409
1422
|
)
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1423
|
+
else:
|
|
1424
|
+
if element == "net":
|
|
1425
|
+
ob = ReportRunRow.data["data"]["difference_net_gbp"]
|
|
1426
|
+
else:
|
|
1427
|
+
ob = ReportRunRow.data["data"]["elements"][element]["parts"]["gbp"][
|
|
1428
|
+
"difference"
|
|
1429
|
+
]
|
|
1430
|
+
order_by = (func.abs(func.coalesce(ob.as_float(), 0)).desc(),)
|
|
1431
|
+
q = q.order_by(*order_by)
|
|
1432
|
+
|
|
1433
|
+
rows = g.sess.scalars(q).all()
|
|
1413
1434
|
return render_template(
|
|
1414
1435
|
"report_run_bill_check.html",
|
|
1415
1436
|
run=run,
|
|
@@ -1654,44 +1675,13 @@ def report_run_row_get(row_id):
|
|
|
1654
1675
|
tables = []
|
|
1655
1676
|
|
|
1656
1677
|
if row.report_run.name == "bill_check":
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
or t.startswith("difference-")
|
|
1665
|
-
) and t.endswith("-gbp"):
|
|
1666
|
-
toks = t.split("-")
|
|
1667
|
-
name = "-".join(toks[1:-1])
|
|
1668
|
-
if name in ("vat", "gross", "net", "tpr"):
|
|
1669
|
-
continue
|
|
1670
|
-
try:
|
|
1671
|
-
table = elements[name]
|
|
1672
|
-
except KeyError:
|
|
1673
|
-
table = elements[name] = {"order": 0, "name": name, "parts": set()}
|
|
1674
|
-
tables.append(table)
|
|
1675
|
-
|
|
1676
|
-
if t.startswith("difference-"):
|
|
1677
|
-
table["order"] = abs(values[t])
|
|
1678
|
-
|
|
1679
|
-
for t in values.keys():
|
|
1680
|
-
|
|
1681
|
-
toks = t.split("-")
|
|
1682
|
-
if toks[0] in ("covered", "virtual", "difference"):
|
|
1683
|
-
tail = "-".join(toks[1:])
|
|
1684
|
-
for element in sorted(elements.keys(), key=len, reverse=True):
|
|
1685
|
-
|
|
1686
|
-
table = elements[element]
|
|
1687
|
-
elstr = f"{element}-"
|
|
1688
|
-
if tail.startswith(elstr):
|
|
1689
|
-
part = tail[len(elstr) :]
|
|
1690
|
-
if part != "gbp":
|
|
1691
|
-
table["parts"].add(part)
|
|
1692
|
-
break
|
|
1693
|
-
|
|
1694
|
-
tables.sort(key=lambda t: t["order"], reverse=True)
|
|
1678
|
+
elements = row.data["data"]["elements"]
|
|
1679
|
+
for el_name, _ in sorted(
|
|
1680
|
+
list(elements.items()),
|
|
1681
|
+
key=lambda x: abs(x[1]["parts"]["gbp"]["difference"]),
|
|
1682
|
+
reverse=True,
|
|
1683
|
+
):
|
|
1684
|
+
tables.append(el_name)
|
|
1695
1685
|
return render_template(
|
|
1696
1686
|
"report_run_row_bill_check.html", row=row, raw_data=raw_data, tables=tables
|
|
1697
1687
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: chellow
|
|
3
|
-
Version:
|
|
3
|
+
Version: 1759155233.0.0
|
|
4
4
|
Summary: Web Application for checking UK energy bills.
|
|
5
5
|
Project-URL: Homepage, https://github.com/WessexWater/chellow
|
|
6
6
|
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
@@ -18,7 +18,7 @@ Requires-Dist: pg8000==1.31.1
|
|
|
18
18
|
Requires-Dist: pip>=9.0.1
|
|
19
19
|
Requires-Dist: psutil==5.9.5
|
|
20
20
|
Requires-Dist: pympler==1.0.1
|
|
21
|
-
Requires-Dist: pypdf==
|
|
21
|
+
Requires-Dist: pypdf==6.0.0
|
|
22
22
|
Requires-Dist: python-dateutil==2.8.2
|
|
23
23
|
Requires-Dist: pytz==2022.6
|
|
24
24
|
Requires-Dist: requests==2.32.4
|