chellow 1682692302.0.0__py3-none-any.whl → 1683187792.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_parsers/haven_edi_tprs.py +6 -2
- chellow/e/views.py +0 -50
- chellow/reports/report_bills.py +86 -0
- chellow/reports/report_ecoes_comparison.py +1 -1
- chellow/templates/e/supplier_batch.html +1 -1
- chellow/views.py +1 -1
- {chellow-1682692302.0.0.dist-info → chellow-1683187792.0.0.dist-info}/METADATA +2 -2
- {chellow-1682692302.0.0.dist-info → chellow-1683187792.0.0.dist-info}/RECORD +9 -9
- chellow/reports/report_155.py +0 -11
- {chellow-1682692302.0.0.dist-info → chellow-1683187792.0.0.dist-info}/WHEEL +0 -0
|
@@ -29,7 +29,6 @@ def _process_BCD(elements, headers):
|
|
|
29
29
|
invn = elements["INVN"]
|
|
30
30
|
reference = invn[0]
|
|
31
31
|
headers["reference"] = reference
|
|
32
|
-
headers["account"] = "SA" + reference[:9]
|
|
33
32
|
|
|
34
33
|
btcd = elements["BTCD"]
|
|
35
34
|
headers["bill_type_code"] = btcd[0]
|
|
@@ -248,6 +247,11 @@ def _process_CCD4(elements, headers):
|
|
|
248
247
|
breakdown["standing-gbp"] += to_decimal(ctot) / Decimal("100")
|
|
249
248
|
|
|
250
249
|
|
|
250
|
+
def _process_CLO(elements, headers):
|
|
251
|
+
cloc = elements["CLOC"]
|
|
252
|
+
headers["account"] = cloc[1]
|
|
253
|
+
|
|
254
|
+
|
|
251
255
|
def _process_MTR(elements, headers):
|
|
252
256
|
if headers["message_type"] == "UTLBIL":
|
|
253
257
|
if headers["mpan_core"] is None:
|
|
@@ -311,7 +315,7 @@ CODE_FUNCS = {
|
|
|
311
315
|
"CCD4": _process_CCD4,
|
|
312
316
|
"CDA": _process_NOOP,
|
|
313
317
|
"CDT": _process_NOOP,
|
|
314
|
-
"CLO":
|
|
318
|
+
"CLO": _process_CLO,
|
|
315
319
|
"DNA": _process_NOOP,
|
|
316
320
|
"END": _process_NOOP,
|
|
317
321
|
"FIL": _process_NOOP,
|
chellow/e/views.py
CHANGED
|
@@ -3963,56 +3963,6 @@ def supplier_batch_edit_post(batch_id):
|
|
|
3963
3963
|
)
|
|
3964
3964
|
|
|
3965
3965
|
|
|
3966
|
-
@e.route("/supplier_batches/<int:batch_id>/csv")
|
|
3967
|
-
def supplier_batch_csv_get(batch_id):
|
|
3968
|
-
batch = Batch.get_by_id(g.sess, batch_id)
|
|
3969
|
-
si = StringIO()
|
|
3970
|
-
cw = csv.writer(si)
|
|
3971
|
-
cw.writerow(
|
|
3972
|
-
[
|
|
3973
|
-
"Supplier Contract",
|
|
3974
|
-
"Batch Reference",
|
|
3975
|
-
"Bill Reference",
|
|
3976
|
-
"Account",
|
|
3977
|
-
"Issued",
|
|
3978
|
-
"From",
|
|
3979
|
-
"To",
|
|
3980
|
-
"kWh",
|
|
3981
|
-
"Net",
|
|
3982
|
-
"VAT",
|
|
3983
|
-
"Gross",
|
|
3984
|
-
"Type",
|
|
3985
|
-
]
|
|
3986
|
-
)
|
|
3987
|
-
for bill in (
|
|
3988
|
-
g.sess.query(Bill)
|
|
3989
|
-
.filter(Bill.batch == batch)
|
|
3990
|
-
.order_by(Bill.reference, Bill.start_date)
|
|
3991
|
-
.options(joinedload(Bill.bill_type))
|
|
3992
|
-
):
|
|
3993
|
-
cw.writerow(
|
|
3994
|
-
[
|
|
3995
|
-
batch.contract.name,
|
|
3996
|
-
batch.reference,
|
|
3997
|
-
bill.reference,
|
|
3998
|
-
bill.account,
|
|
3999
|
-
hh_format(bill.issue_date),
|
|
4000
|
-
hh_format(bill.start_date),
|
|
4001
|
-
hh_format(bill.finish_date),
|
|
4002
|
-
str(bill.kwh),
|
|
4003
|
-
str(bill.net),
|
|
4004
|
-
str(bill.vat),
|
|
4005
|
-
str(bill.gross),
|
|
4006
|
-
bill.bill_type.code,
|
|
4007
|
-
]
|
|
4008
|
-
)
|
|
4009
|
-
|
|
4010
|
-
output = make_response(si.getvalue())
|
|
4011
|
-
output.headers["Content-Disposition"] = 'attachment; filename="batch.csv"'
|
|
4012
|
-
output.headers["Content-type"] = "text/csv"
|
|
4013
|
-
return output
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
3966
|
@e.route("/supplier_batches/<int:batch_id>", methods=["POST"])
|
|
4017
3967
|
def supplier_batch_post(batch_id):
|
|
4018
3968
|
try:
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import csv
|
|
2
|
+
import os
|
|
3
|
+
import threading
|
|
4
|
+
import traceback
|
|
5
|
+
|
|
6
|
+
from flask import g
|
|
7
|
+
|
|
8
|
+
from sqlalchemy import select
|
|
9
|
+
from sqlalchemy.orm import joinedload
|
|
10
|
+
|
|
11
|
+
import chellow.dloads
|
|
12
|
+
from chellow.models import Batch, Bill, Session, User
|
|
13
|
+
from chellow.utils import csv_make_val, req_int
|
|
14
|
+
from chellow.views import chellow_redirect
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def content(user_id, batch_id):
|
|
18
|
+
sess = f = writer = None
|
|
19
|
+
try:
|
|
20
|
+
sess = Session()
|
|
21
|
+
user = User.get_by_id(sess, user_id)
|
|
22
|
+
running_name, finished_name = chellow.dloads.make_names(
|
|
23
|
+
f"bills_batch_{batch_id}.csv", user
|
|
24
|
+
)
|
|
25
|
+
f = open(running_name, mode="w", newline="")
|
|
26
|
+
writer = csv.writer(f, lineterminator="\n")
|
|
27
|
+
batch = Batch.get_by_id(sess, batch_id)
|
|
28
|
+
titles = [
|
|
29
|
+
"supplier_contract",
|
|
30
|
+
"batch_reference",
|
|
31
|
+
"bill_reference",
|
|
32
|
+
"imp_mpan_core",
|
|
33
|
+
"account",
|
|
34
|
+
"issued",
|
|
35
|
+
"from",
|
|
36
|
+
"to",
|
|
37
|
+
"kwh",
|
|
38
|
+
"net",
|
|
39
|
+
"vAT",
|
|
40
|
+
"gross",
|
|
41
|
+
"type",
|
|
42
|
+
]
|
|
43
|
+
writer.writerow(titles)
|
|
44
|
+
|
|
45
|
+
for bill in sess.execute(
|
|
46
|
+
select(Bill)
|
|
47
|
+
.where(Bill.batch == batch)
|
|
48
|
+
.order_by(Bill.reference, Bill.start_date)
|
|
49
|
+
.options(joinedload(Bill.bill_type), joinedload(Bill.supply))
|
|
50
|
+
).scalars():
|
|
51
|
+
era = bill.supply.find_era_at(sess, bill.start_date)
|
|
52
|
+
vals = [
|
|
53
|
+
batch.contract.name,
|
|
54
|
+
batch.reference,
|
|
55
|
+
bill.reference,
|
|
56
|
+
None if era is None else era.imp_mpan_core,
|
|
57
|
+
bill.account,
|
|
58
|
+
bill.issue_date,
|
|
59
|
+
bill.start_date,
|
|
60
|
+
bill.finish_date,
|
|
61
|
+
bill.kwh,
|
|
62
|
+
bill.net,
|
|
63
|
+
bill.vat,
|
|
64
|
+
bill.gross,
|
|
65
|
+
bill.bill_type.code,
|
|
66
|
+
]
|
|
67
|
+
writer.writerow(csv_make_val(v) for v in vals)
|
|
68
|
+
|
|
69
|
+
except BaseException:
|
|
70
|
+
msg = traceback.format_exc()
|
|
71
|
+
print(msg)
|
|
72
|
+
if f is not None:
|
|
73
|
+
f.write(msg)
|
|
74
|
+
finally:
|
|
75
|
+
if sess is not None:
|
|
76
|
+
sess.close()
|
|
77
|
+
if f is not None:
|
|
78
|
+
f.close()
|
|
79
|
+
os.rename(running_name, finished_name)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def do_get(sess):
|
|
83
|
+
batch_id = req_int("batch_id")
|
|
84
|
+
args = g.user.id, batch_id
|
|
85
|
+
threading.Thread(target=content, args=args).start()
|
|
86
|
+
return chellow_redirect("/downloads", 303)
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
<td>{{ "£{:,}".format(sum_vat_gbp) }}</td>
|
|
79
79
|
<td>{{ "£{:,}".format(sum_gross_gbp) }}</td>
|
|
80
80
|
<td>{{ "{:,}".format(sum_kwh) }}</td>
|
|
81
|
-
<td><a href="/
|
|
81
|
+
<td><a href="/reports/bills?batch_id={{batch.id}}" >Download</a></td>
|
|
82
82
|
<td>
|
|
83
83
|
{% if batch_reports %}
|
|
84
84
|
<ul>
|
chellow/views.py
CHANGED
|
@@ -127,7 +127,7 @@ from chellow.utils import (
|
|
|
127
127
|
utc_datetime_now,
|
|
128
128
|
)
|
|
129
129
|
|
|
130
|
-
home = Blueprint("", __name__, template_folder="templates")
|
|
130
|
+
home = Blueprint("home", __name__, url_prefix="", template_folder="templates")
|
|
131
131
|
|
|
132
132
|
|
|
133
133
|
def chellow_redirect(path, code=None):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: chellow
|
|
3
|
-
Version:
|
|
3
|
+
Version: 1683187792.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)
|
|
@@ -8,7 +8,7 @@ Classifier: Operating System :: OS Independent
|
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
9
|
Requires-Python: >=3.9
|
|
10
10
|
Requires-Dist: flask-restx==1.0.3
|
|
11
|
-
Requires-Dist: flask==2.
|
|
11
|
+
Requires-Dist: flask==2.3.2
|
|
12
12
|
Requires-Dist: odio==0.0.22
|
|
13
13
|
Requires-Dist: openpyxl==3.0.10
|
|
14
14
|
Requires-Dist: pep3143daemon==0.0.6
|
|
@@ -11,7 +11,7 @@ chellow/proxy.py,sha256=Mzssi9nTf6s_G4RSn8k5oAHqzVYIxMsfbudj1amYucI,1387
|
|
|
11
11
|
chellow/rate_server.py,sha256=xVk15pdSovcD8K8BWcOmjwo_L3a8LYry7L2Gvw56OEQ,5696
|
|
12
12
|
chellow/testing.py,sha256=1TvNEPjX_VRPDifJWRFJw_8gg0RCsEpYVHkspQ1diJw,3913
|
|
13
13
|
chellow/utils.py,sha256=IHC4Pcd_9CRbmJXAOlDvTyAcUoaWeLSH37zgjqVYYl4,18981
|
|
14
|
-
chellow/views.py,sha256=
|
|
14
|
+
chellow/views.py,sha256=luCwKmgvEk2AFaFC1deBG1nTw6YGXjSJtlwAq2yLJh8,83492
|
|
15
15
|
chellow/e/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
chellow/e/aahedc.py,sha256=DUrYAlrn4jzf6y6C2wivxlFosdVIibG69BWy_KMekGM,706
|
|
17
17
|
chellow/e/bill_importer.py,sha256=BHrQkcvlOh27k0KexHA8nWJGcHGGpewbkkpncmxbAc4,7183
|
|
@@ -34,7 +34,7 @@ chellow/e/scenario.py,sha256=IuyE494XaBLq3FW7NdJePD6J4cTzPogfACO6dThiY00,23239
|
|
|
34
34
|
chellow/e/system_price.py,sha256=IPBLSRPzGA3yca4tpR8PJemwPbgqVjn1WnljOMUyWnA,8145
|
|
35
35
|
chellow/e/tlms.py,sha256=gXBZTHXqGVcaTGHaYGVA5Ir5pzoBDqFC1Kl1mQ0IDqU,9549
|
|
36
36
|
chellow/e/tnuos.py,sha256=gFvNgibycspsyD3I8xxBWPjvyWJfkAiDRMbLenCpEgQ,18947
|
|
37
|
-
chellow/e/views.py,sha256=
|
|
37
|
+
chellow/e/views.py,sha256=21VRz7gS1liLxzG1ZOD5hkIbsDCTYhF8KU2wdCEKiHs,178868
|
|
38
38
|
chellow/e/bill_parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
39
39
|
chellow/e/bill_parsers/activity_mop_stark_xlsx.py,sha256=v1s4O8phVJVn9sOs9HKrKYcECAP0ApnUgqCaa2ARYiQ,4234
|
|
40
40
|
chellow/e/bill_parsers/annual_mop_stark_xlsx.py,sha256=4dAWjaxsDnnGBnRAjgFe7IZLxIcLMGiTuXh1uqNnnlQ,4382
|
|
@@ -45,7 +45,7 @@ chellow/e/bill_parsers/engie_xls.py,sha256=tk5EAZjv5cKuB1R7OVAcLUVvCZTWAs8IsoyGb
|
|
|
45
45
|
chellow/e/bill_parsers/gdf_csv.py,sha256=ZfK3Oc6oP28p_P9DIevLNB_zW2WLcEJ3Lvb1gL310YU,7382
|
|
46
46
|
chellow/e/bill_parsers/haven_csv.py,sha256=Ft81mqHTbCQl6dMLkLin777vAX2T999Q_4fkNwl-naM,13606
|
|
47
47
|
chellow/e/bill_parsers/haven_edi.py,sha256=eN40WL--JkX7TNIefgZohYv0BQ8vOm6AqkWlJSW5Mmk,16188
|
|
48
|
-
chellow/e/bill_parsers/haven_edi_tprs.py,sha256=
|
|
48
|
+
chellow/e/bill_parsers/haven_edi_tprs.py,sha256=e1zVw5sWyGPEO5Ua-vmyUvUO-STn2DSNOxp1s5F914I,10701
|
|
49
49
|
chellow/e/bill_parsers/mm.py,sha256=P4CdkskDrjmFMSDp0ehE_ichTBHGywbT_dckMxuAqQQ,1929
|
|
50
50
|
chellow/e/bill_parsers/nonsettlement_dc_stark_xlsx.py,sha256=MF74mh6gdBb0lqvPyPZIv_7vsqNu_zNXWpIzlNFtl1g,4576
|
|
51
51
|
chellow/e/bill_parsers/settlement_dc_stark_xlsx.py,sha256=4Dfq4N0ZOgD_x3ZJ9CnGzsLbwhS1-7aTJqFx00GCnU0,6007
|
|
@@ -63,7 +63,6 @@ chellow/gas/views.py,sha256=5xfNrKDi-lK7alkREu0P_3z7qgWz-fKW1zZ78NrBZh8,54937
|
|
|
63
63
|
chellow/reports/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
64
64
|
chellow/reports/report_109.py,sha256=oeoxRX8r8_XjFRCfBb4qN2OAwA_hI6SSRk8V6hKXQhA,10182
|
|
65
65
|
chellow/reports/report_111.py,sha256=ySqF9gYHVVI-CXjfSz6Kfelh7ncmvcUS4WsFE4XvTLk,28029
|
|
66
|
-
chellow/reports/report_155.py,sha256=ZXYEx8wi2FtA5ysjhX2rbMG8CQFjZQV4CrUz6pBBs0o,305
|
|
67
66
|
chellow/reports/report_169.py,sha256=-zSgfrX6NjgMQGwbKaUPvcPqPHbDQ8_pL3EL33u40yA,8331
|
|
68
67
|
chellow/reports/report_177.py,sha256=8-hfejbuwAohwFSbZC_VBtUUazi3hkdgA0oHvqA1St0,11499
|
|
69
68
|
chellow/reports/report_181.py,sha256=oehWcNMTcCUoSRq3eEGMwVraPgB5wucll6WlVj53xHM,5027
|
|
@@ -86,10 +85,11 @@ chellow/reports/report_81.py,sha256=xULQ6NDG8yvF7qnUXDgqv4Rv-XikAzJQnBgwpqyFFTc,
|
|
|
86
85
|
chellow/reports/report_87.py,sha256=0LIGY4gImnHOt7Dno7j4g933yid9NMW8l7WrCl5vR74,5768
|
|
87
86
|
chellow/reports/report_asset_comparison.py,sha256=ictRSzmpH9Z0i67s46SyMhALEg4bYvjr4WNMRaNCQnk,6111
|
|
88
87
|
chellow/reports/report_batches.py,sha256=PTLsWYZI4yJjTqUeZe0ovSDpzTOEU3zG54fkmvutm6Y,4571
|
|
88
|
+
chellow/reports/report_bills.py,sha256=UeKZMK2T-4s9Lj5Ef6M2P3eD4oHmXCjf2LGStYF5saA,2429
|
|
89
89
|
chellow/reports/report_csv_llfcs.py,sha256=d3CWJB7bVinkn6ytu9AvPbB9TMHGg2E7LLjabu3QS3E,1852
|
|
90
90
|
chellow/reports/report_csv_site_hh_data.py,sha256=u8c4n4YFdljsCF0wh_SAnkbTIVVEDhPnccJyCpCVfm8,4067
|
|
91
91
|
chellow/reports/report_csv_site_snags.py,sha256=U_zg4ppg9DRetKAuaxOnirkcwtMhz2iCE3Fbq-o7AVM,2591
|
|
92
|
-
chellow/reports/report_ecoes_comparison.py,sha256=
|
|
92
|
+
chellow/reports/report_ecoes_comparison.py,sha256=_8HisTy77misa2beYrlaC51Mp5kI6WaabPQaVjpGkbk,21197
|
|
93
93
|
chellow/reports/report_g_monthly_duration.py,sha256=lS12t4vAZIj-pD22aWPoO-n8EQBCIzzY2Qnx9SawhaQ,12217
|
|
94
94
|
chellow/reports/report_g_supplies_snapshot.py,sha256=wmXsi8EduWyAw4QtpAFH5ZWkcYggKNWO3pEoG63D0LU,4571
|
|
95
95
|
chellow/reports/report_g_supply_virtual_bill.py,sha256=6oRFV2ffryePM-jcabiXO5vo4fLt_wQZ2ejvlwIPa0g,3617
|
|
@@ -275,7 +275,7 @@ chellow/templates/e/source.html,sha256=6cLjZWKS2w9Zy1C4hzi1lTKXAdKKFQ8wSxbwAjhP3
|
|
|
275
275
|
chellow/templates/e/sources.html,sha256=AW_ysj5ZzArTLz0-FWappMsUEU1AO9gw7D4XSHbINu4,453
|
|
276
276
|
chellow/templates/e/ssc.html,sha256=NiTbn9yLYYG_DV4j9S73rnIVmzTAzTbyaXomverHNnI,811
|
|
277
277
|
chellow/templates/e/sscs.html,sha256=Ul0rW5Wa3romdSCV3JL54u3iSxY1J-8RE8yMxANiQAU,918
|
|
278
|
-
chellow/templates/e/supplier_batch.html,sha256=
|
|
278
|
+
chellow/templates/e/supplier_batch.html,sha256=jKJR8dKYCy6rA47GI02Sv4c1cuKytvma9_IRU4BtT7U,5647
|
|
279
279
|
chellow/templates/e/supplier_batch_add.html,sha256=RabJ20yLpsF_npSLL5aeLlPDa2tL99fENaIzDYZJy1w,1240
|
|
280
280
|
chellow/templates/e/supplier_batch_edit.html,sha256=imgRWTg4W0Db8BwqYnN8ZYno5SBZxRTj2Mkhi113HQg,1420
|
|
281
281
|
chellow/templates/e/supplier_batch_file.html,sha256=fohdthY3ibO9a_2BJsYWyJhZL369F0gaUV7McFzWhMQ,1226
|
|
@@ -350,6 +350,6 @@ chellow/templates/g/supply_note_edit.html,sha256=6UQf_qbhFDys3cVsTp-c7ABWZpggW9R
|
|
|
350
350
|
chellow/templates/g/supply_notes.html,sha256=WR3YwGh_qqTklSJ7JqWX6BKBc9rk_jMff4RiWZiF2CM,936
|
|
351
351
|
chellow/templates/g/unit.html,sha256=KouNVU0-i84afANkLQ_heJ0uDfJ9H5A05PuLqb8iCN8,438
|
|
352
352
|
chellow/templates/g/units.html,sha256=p5Nd-lAIboKPEOO6N451hx1bcKxMg4BDODnZ-43MmJc,441
|
|
353
|
-
chellow-
|
|
354
|
-
chellow-
|
|
355
|
-
chellow-
|
|
353
|
+
chellow-1683187792.0.0.dist-info/METADATA,sha256=i5MmNce3-lf5Na81v5kkUbwEtH8V1cDKKUbX7vQr1Ig,12160
|
|
354
|
+
chellow-1683187792.0.0.dist-info/WHEEL,sha256=9MIigYJ7D5sOqAPqr0-o6tSMY_nQ7c6kvtvyeUB99YQ,87
|
|
355
|
+
chellow-1683187792.0.0.dist-info/RECORD,,
|
chellow/reports/report_155.py
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
from datetime import datetime as Datetime
|
|
2
|
-
|
|
3
|
-
from dateutil.relativedelta import relativedelta
|
|
4
|
-
|
|
5
|
-
from flask import render_template
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def do_get(sess):
|
|
9
|
-
init = Datetime.utcnow()
|
|
10
|
-
init = Datetime(init.year, init.month, 1) - relativedelta(months=1)
|
|
11
|
-
return render_template("report_155.html", init=init)
|
|
File without changes
|