chellow 1757320031.0.0__py3-none-any.whl → 1759411815.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 +514 -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 +187 -179
- chellow/views.py +57 -64
- {chellow-1757320031.0.0.dist-info → chellow-1759411815.0.0.dist-info}/METADATA +2 -2
- {chellow-1757320031.0.0.dist-info → chellow-1759411815.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-1759411815.0.0.dist-info}/WHEEL +0 -0
|
@@ -11,147 +11,116 @@
|
|
|
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
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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>
|
|
112
|
+
<details>
|
|
113
|
+
<summary>Breakdown</summary>
|
|
114
|
+
<pre>{{bill.breakdown}}</pre>
|
|
115
|
+
</details>
|
|
116
|
+
</td>
|
|
117
|
+
</tr>
|
|
118
|
+
{% endfor %}
|
|
151
119
|
</tbody>
|
|
152
120
|
</table>
|
|
153
121
|
|
|
154
122
|
<section class="elements">
|
|
123
|
+
<!--
|
|
155
124
|
<table>
|
|
156
125
|
<caption>GBP</caption>
|
|
157
126
|
<thead>
|
|
@@ -166,130 +135,169 @@
|
|
|
166
135
|
<tr>
|
|
167
136
|
<td>gross</td>
|
|
168
137
|
<td>
|
|
169
|
-
{% if 'covered-gross-gbp' in
|
|
170
|
-
{{"{:0,.2f}".format(
|
|
138
|
+
{% if 'covered-gross-gbp' in data and data['covered-gross-gbp'] is number %}
|
|
139
|
+
{{"{:0,.2f}".format(data['covered-gross-gbp'])}}
|
|
171
140
|
{% endif %}
|
|
172
141
|
</td>
|
|
173
142
|
<td>
|
|
174
|
-
{% if 'virtual-gross-gbp' in
|
|
175
|
-
{{"{:0,.2f}".format(
|
|
143
|
+
{% if 'virtual-gross-gbp' in data and data['virtual-gross-gbp'] is number %}
|
|
144
|
+
{{"{:0,.2f}".format(data['virtual-gross-gbp'])}}
|
|
176
145
|
{% endif %}
|
|
177
146
|
</td>
|
|
178
147
|
<td>
|
|
179
|
-
{% if 'difference-gross-gbp' in
|
|
180
|
-
{{"{:0,.2f}".format(
|
|
148
|
+
{% if 'difference-gross-gbp' in data and data['difference-gross-gbp'] is number %}
|
|
149
|
+
{{"{:0,.2f}".format(data['difference-gross-gbp'])}}
|
|
181
150
|
{% endif %}
|
|
182
151
|
</td>
|
|
183
152
|
</tr>
|
|
184
153
|
<tr>
|
|
185
154
|
<td>net</td>
|
|
186
155
|
<td>
|
|
187
|
-
{% if 'covered-net-gbp' in
|
|
188
|
-
{{"{:0,.2f}".format(
|
|
156
|
+
{% if 'covered-net-gbp' in data and data['covered-net-gbp'] is number %}
|
|
157
|
+
{{"{:0,.2f}".format(data['covered-net-gbp'])}}</td>
|
|
189
158
|
{% endif %}
|
|
190
159
|
<td>
|
|
191
|
-
{% if 'virtual-net-gbp' in
|
|
192
|
-
{{"{:0,.2f}".format(
|
|
160
|
+
{% if 'virtual-net-gbp' in data and data['virtual-net-gbp'] is number %}
|
|
161
|
+
{{"{:0,.2f}".format(data['virtual-net-gbp'])}}</td>
|
|
193
162
|
{% endif %}
|
|
194
163
|
<td>
|
|
195
|
-
{% if 'difference-net-gbp' in
|
|
196
|
-
{{"{:0,.2f}".format(
|
|
164
|
+
{% if 'difference-net-gbp' in data and data['difference-net-gbp'] is number %}
|
|
165
|
+
{{"{:0,.2f}".format(data['difference-net-gbp'])}}</td>
|
|
197
166
|
{% endif %}
|
|
198
167
|
</tr>
|
|
199
168
|
<tr>
|
|
200
169
|
<td>vat</td>
|
|
201
170
|
<td>
|
|
202
|
-
{% if 'covered-vat-gbp' in
|
|
203
|
-
{{"{:0,.2f}".format(
|
|
171
|
+
{% if 'covered-vat-gbp' in data and data['covered-vat-gbp'] is number %}
|
|
172
|
+
{{"{:0,.2f}".format(data['covered-vat-gbp'])}}</td>
|
|
204
173
|
{% endif %}
|
|
205
174
|
<td>
|
|
206
|
-
{% if 'virtual-vat-gbp' in
|
|
207
|
-
{{"{:0,.2f}".format(
|
|
175
|
+
{% if 'virtual-vat-gbp' in data and data['virtual-vat-gbp'] is number %}
|
|
176
|
+
{{"{:0,.2f}".format(data['virtual-vat-gbp'])}}</td>
|
|
208
177
|
{% endif %}
|
|
209
178
|
<td>
|
|
210
|
-
{% if 'difference-vat-gbp' in
|
|
211
|
-
{{"{:0,.2f}".format(
|
|
179
|
+
{% if 'difference-vat-gbp' in data and data['difference-vat-gbp'] is number %}
|
|
180
|
+
{{"{:0,.2f}".format(data['difference-vat-gbp'])}}</td>
|
|
212
181
|
{% endif %}
|
|
213
182
|
</tr>
|
|
214
183
|
<tr>
|
|
215
184
|
<td>vat-rate</td>
|
|
216
185
|
<td>
|
|
217
|
-
{{
|
|
218
|
-
<td>{{
|
|
186
|
+
{{data['covered-vat-rate']}}</td>
|
|
187
|
+
<td>{{data['virtual-vat-rate']}}</td>
|
|
219
188
|
<td>
|
|
220
|
-
{% if
|
|
221
|
-
{{"{:0,.2f}".format(
|
|
189
|
+
{% if data['difference-vat-rate'] is number %}
|
|
190
|
+
{{"{:0,.2f}".format(data['difference-vat-rate'])}}
|
|
222
191
|
{% endif %}
|
|
223
192
|
</td>
|
|
224
193
|
</tr>
|
|
225
194
|
</tbody>
|
|
226
195
|
</table>
|
|
196
|
+
-->
|
|
227
197
|
|
|
228
198
|
{% 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 %}
|
|
199
|
+
{% set element = data['elements'][table] %}
|
|
200
|
+
{% set parts = element['parts'] %}
|
|
201
|
+
|
|
202
|
+
<div style="display: flex; gap: 4rem;">
|
|
203
|
+
<table>
|
|
204
|
+
<caption>{{table}}</caption>
|
|
205
|
+
<thead>
|
|
260
206
|
<tr>
|
|
261
|
-
<
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
207
|
+
<th>Part</th>
|
|
208
|
+
<th>Actual</th>
|
|
209
|
+
<th>Virtual</th>
|
|
210
|
+
<th>Difference</th>
|
|
211
|
+
</tr>
|
|
212
|
+
</thead>
|
|
213
|
+
<tbody>
|
|
214
|
+
<tr>
|
|
215
|
+
<td>gbp</td>
|
|
216
|
+
{% for k in ('actual', 'virtual', 'difference') %}
|
|
217
|
+
<td style="text-align: right;">
|
|
218
|
+
{% set part = parts['gbp'] %}
|
|
219
|
+
{% if k in part %}
|
|
220
|
+
{% set val = part[k] %}
|
|
267
221
|
{% else %}
|
|
268
222
|
{% set val = '' %}
|
|
269
223
|
{% endif %}
|
|
270
224
|
{% if val is none %}
|
|
271
225
|
{% elif val is number %}
|
|
272
226
|
{{"{:0,.2f}".format(val)}}
|
|
273
|
-
{% elif (val is string) or (val is boolean) %}
|
|
274
|
-
{{val}}
|
|
275
227
|
{% 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 %}
|
|
228
|
+
{{val}}
|
|
286
229
|
{% endif %}
|
|
287
230
|
</td>
|
|
288
231
|
{% endfor %}
|
|
289
232
|
</tr>
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
233
|
+
{% for part_name, part in parts.items()|sort %}
|
|
234
|
+
{% if part_name != 'gbp' %}
|
|
235
|
+
<tr>
|
|
236
|
+
<td>{{part_name}}</td>
|
|
237
|
+
{% for k in ('actual', 'virtual', 'difference') %}
|
|
238
|
+
<td style="text-align: right;">
|
|
239
|
+
{% if k in part %}
|
|
240
|
+
{% set val = part[k] %}
|
|
241
|
+
{% else %}
|
|
242
|
+
{% set val = '' %}
|
|
243
|
+
{% endif %}
|
|
244
|
+
{% if val is none %}
|
|
245
|
+
{% elif val is number %}
|
|
246
|
+
{{"{:0,.2f}".format(val)}}
|
|
247
|
+
{% elif (val is string) or (val is boolean) %}
|
|
248
|
+
{{val}}
|
|
249
|
+
{% else %}
|
|
250
|
+
{% for v in val %}
|
|
251
|
+
{% if v is number %}
|
|
252
|
+
{{"{:0,.2f}".format(v)}}
|
|
253
|
+
{% else %}
|
|
254
|
+
{{v}}
|
|
255
|
+
{% endif %}
|
|
256
|
+
{% if not loop.last %}
|
|
257
|
+
|
|
|
258
|
+
{% endif %}
|
|
259
|
+
{% endfor %}
|
|
260
|
+
{% endif %}
|
|
261
|
+
</td>
|
|
262
|
+
{% endfor %}
|
|
263
|
+
</tr>
|
|
264
|
+
{% endif %}
|
|
265
|
+
{% endfor %}
|
|
266
|
+
</tbody>
|
|
267
|
+
</table>
|
|
268
|
+
|
|
269
|
+
<table>
|
|
270
|
+
<caption>Actual {{table}} Elements</caption>
|
|
271
|
+
<thead>
|
|
272
|
+
<tr>
|
|
273
|
+
<th>View</th>
|
|
274
|
+
<th>Batch</th>
|
|
275
|
+
<th>Bill</th>
|
|
276
|
+
<th>Start Date</th>
|
|
277
|
+
<th>Finish Date</th>
|
|
278
|
+
<th>Net GBP</th>
|
|
279
|
+
<th>Breakdown</th>
|
|
280
|
+
</tr>
|
|
281
|
+
</thead>
|
|
282
|
+
<tbody>
|
|
283
|
+
{% for el in element['actual_elements'] %}
|
|
284
|
+
<tr>
|
|
285
|
+
<td><a href="/e/{{contract_type}}_elements/{{el.id}}">View</a></td>
|
|
286
|
+
<td>
|
|
287
|
+
<a href="/e/{{contract_type}}_batches/{{el.bill.batch.id}}"
|
|
288
|
+
>{{el.bill.batch.reference}}</a>
|
|
289
|
+
</td>
|
|
290
|
+
<td><a href="/e/{{contract_type}}_bills/{{el.bill.id}}">View</a></td>
|
|
291
|
+
<td>{{el.start_date}}</td>
|
|
292
|
+
<td>{{el.finish_date}}</td>
|
|
293
|
+
<td>{{"{:0,.2f}".format(el.net)}}</td>
|
|
294
|
+
<td>{{el.breakdown}}</td>
|
|
295
|
+
</tr>
|
|
296
|
+
{% endfor %}
|
|
297
|
+
</tbody>
|
|
298
|
+
</table>
|
|
299
|
+
|
|
300
|
+
</div>
|
|
293
301
|
{% endfor %}
|
|
294
302
|
|
|
295
303
|
</section>
|
chellow/views.py
CHANGED
|
@@ -1368,48 +1368,72 @@ 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
|
-
|
|
1379
|
-
g.sess.
|
|
1380
|
-
|
|
1392
|
+
if len(diff_selects) > 0:
|
|
1393
|
+
sum_diffs = g.sess.execute(
|
|
1394
|
+
select(*diff_selects).where(ReportRunRow.report_run == run)
|
|
1395
|
+
).one()
|
|
1381
1396
|
|
|
1382
|
-
|
|
1383
|
-
elem = t[11:-4]
|
|
1384
|
-
if elem == "net":
|
|
1385
|
-
summary["sum_difference"] = sum_diff
|
|
1386
|
-
else:
|
|
1397
|
+
for elem, sum_diff in zip(element_names, sum_diffs):
|
|
1387
1398
|
elements.append((elem, sum_diff))
|
|
1388
1399
|
|
|
1389
|
-
|
|
1390
|
-
|
|
1400
|
+
elements.sort(
|
|
1401
|
+
key=lambda x: 0 if x[1] is None else abs(x[1]), reverse=True
|
|
1402
|
+
)
|
|
1391
1403
|
|
|
1392
1404
|
if "element" in request.values:
|
|
1393
1405
|
element = req_str("element")
|
|
1394
1406
|
else:
|
|
1395
|
-
element = "
|
|
1407
|
+
element = "problem"
|
|
1396
1408
|
|
|
1397
1409
|
hide_checked = req_bool("hide_checked")
|
|
1398
1410
|
|
|
1399
|
-
|
|
1400
|
-
q =
|
|
1411
|
+
ROW_LIMIT = 200
|
|
1412
|
+
q = select(ReportRunRow).where(ReportRunRow.report_run == run).limit(ROW_LIMIT)
|
|
1401
1413
|
if hide_checked:
|
|
1402
|
-
q = q.
|
|
1414
|
+
q = q.where(
|
|
1403
1415
|
ReportRunRow.data["properties"]["is_checked"].as_boolean() == false()
|
|
1404
1416
|
)
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
func.abs(
|
|
1417
|
+
if element == "problem":
|
|
1418
|
+
order_by = (
|
|
1419
|
+
ReportRunRow.data["data"]["problem"].as_string(),
|
|
1420
|
+
func.abs(
|
|
1421
|
+
func.coalesce(
|
|
1422
|
+
ReportRunRow.data["data"]["difference_net_gbp"].as_float(), 0
|
|
1423
|
+
)
|
|
1424
|
+
).desc(),
|
|
1409
1425
|
)
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1426
|
+
else:
|
|
1427
|
+
if element == "net":
|
|
1428
|
+
ob = ReportRunRow.data["data"]["difference_net_gbp"]
|
|
1429
|
+
else:
|
|
1430
|
+
ob = ReportRunRow.data["data"]["elements"][element]["parts"]["gbp"][
|
|
1431
|
+
"difference"
|
|
1432
|
+
]
|
|
1433
|
+
order_by = (func.abs(func.coalesce(ob.as_float(), 0)).desc(),)
|
|
1434
|
+
q = q.order_by(*order_by)
|
|
1435
|
+
|
|
1436
|
+
rows = g.sess.scalars(q).all()
|
|
1413
1437
|
return render_template(
|
|
1414
1438
|
"report_run_bill_check.html",
|
|
1415
1439
|
run=run,
|
|
@@ -1654,44 +1678,13 @@ def report_run_row_get(row_id):
|
|
|
1654
1678
|
tables = []
|
|
1655
1679
|
|
|
1656
1680
|
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)
|
|
1681
|
+
elements = row.data["data"]["elements"]
|
|
1682
|
+
for el_name, _ in sorted(
|
|
1683
|
+
list(elements.items()),
|
|
1684
|
+
key=lambda x: abs(x[1]["parts"]["gbp"]["difference"]),
|
|
1685
|
+
reverse=True,
|
|
1686
|
+
):
|
|
1687
|
+
tables.append(el_name)
|
|
1695
1688
|
return render_template(
|
|
1696
1689
|
"report_run_row_bill_check.html", row=row, raw_data=raw_data, tables=tables
|
|
1697
1690
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: chellow
|
|
3
|
-
Version:
|
|
3
|
+
Version: 1759411815.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
|