chellow 1726664509.0.0__py3-none-any.whl → 1726820485.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/mm.py +15 -0
- chellow/gas/views.py +79 -39
- {chellow-1726664509.0.0.dist-info → chellow-1726820485.0.0.dist-info}/METADATA +1 -1
- {chellow-1726664509.0.0.dist-info → chellow-1726820485.0.0.dist-info}/RECORD +5 -5
- {chellow-1726664509.0.0.dist-info → chellow-1726820485.0.0.dist-info}/WHEEL +0 -0
chellow/e/bill_parsers/mm.py
CHANGED
|
@@ -278,6 +278,20 @@ def _handle_1500(headers, pre_record, record):
|
|
|
278
278
|
}
|
|
279
279
|
|
|
280
280
|
|
|
281
|
+
def _handle_1600(headers, pre_record, record):
|
|
282
|
+
parts = _chop_record(
|
|
283
|
+
record,
|
|
284
|
+
unknown_1=12,
|
|
285
|
+
unknown_2=12,
|
|
286
|
+
late_payment_fee=12,
|
|
287
|
+
late_payment_date=DATE_LENGTH,
|
|
288
|
+
description=50,
|
|
289
|
+
)
|
|
290
|
+
late_payment_gbp = Decimal(parts["late_payment_fee"]) / Decimal(100)
|
|
291
|
+
|
|
292
|
+
headers["breakdown"]["late_payment_gbp"] += late_payment_gbp
|
|
293
|
+
|
|
294
|
+
|
|
281
295
|
def _handle_1700(headers, pre_record, record):
|
|
282
296
|
pass
|
|
283
297
|
|
|
@@ -303,6 +317,7 @@ LINE_HANDLERS = {
|
|
|
303
317
|
"1455": _handle_1455,
|
|
304
318
|
"1460": _handle_1460,
|
|
305
319
|
"1500": _handle_1500,
|
|
320
|
+
"1600": _handle_1600,
|
|
306
321
|
"1700": _handle_1700,
|
|
307
322
|
"2000": _handle_2000,
|
|
308
323
|
"9999": _handle_9999,
|
chellow/gas/views.py
CHANGED
|
@@ -50,7 +50,6 @@ from chellow.models import (
|
|
|
50
50
|
from chellow.utils import (
|
|
51
51
|
HH,
|
|
52
52
|
csv_make_val,
|
|
53
|
-
hh_format,
|
|
54
53
|
req_bool,
|
|
55
54
|
req_date,
|
|
56
55
|
req_decimal,
|
|
@@ -1457,47 +1456,88 @@ def exit_zone_get(g_exit_zone_id):
|
|
|
1457
1456
|
@gas.route("/batches/<int:g_batch_id>/csv")
|
|
1458
1457
|
def batch_csv_get(g_batch_id):
|
|
1459
1458
|
g_batch = GBatch.get_by_id(g.sess, g_batch_id)
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
"Batch Reference",
|
|
1466
|
-
"Bill Reference",
|
|
1467
|
-
"Account",
|
|
1468
|
-
"Issued",
|
|
1469
|
-
"From",
|
|
1470
|
-
"To",
|
|
1471
|
-
"kWh",
|
|
1472
|
-
"Net",
|
|
1473
|
-
"VAT",
|
|
1474
|
-
"Gross",
|
|
1475
|
-
"Type",
|
|
1476
|
-
]
|
|
1477
|
-
)
|
|
1478
|
-
for g_bill in (
|
|
1479
|
-
g.sess.query(GBill)
|
|
1480
|
-
.filter(GBill.g_batch == g_batch)
|
|
1459
|
+
rows = []
|
|
1460
|
+
max_reads = 0
|
|
1461
|
+
for g_bill in g.sess.scalars(
|
|
1462
|
+
select(GBill)
|
|
1463
|
+
.where(GBill.g_batch == g_batch)
|
|
1481
1464
|
.order_by(GBill.reference, GBill.start_date)
|
|
1482
|
-
.options(
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
g_batch.reference,
|
|
1488
|
-
g_bill.reference,
|
|
1489
|
-
g_bill.account,
|
|
1490
|
-
hh_format(g_bill.issue_date),
|
|
1491
|
-
hh_format(g_bill.start_date),
|
|
1492
|
-
hh_format(g_bill.finish_date),
|
|
1493
|
-
str(g_bill.kwh),
|
|
1494
|
-
str(g_bill.net),
|
|
1495
|
-
str(g_bill.vat),
|
|
1496
|
-
str(g_bill.gross),
|
|
1497
|
-
g_bill.bill_type.code,
|
|
1498
|
-
]
|
|
1465
|
+
.options(
|
|
1466
|
+
joinedload(GBill.bill_type),
|
|
1467
|
+
joinedload(GBill.g_reads).joinedload(GRegisterRead.g_unit),
|
|
1468
|
+
joinedload(GBill.g_reads).joinedload(GRegisterRead.pres_type),
|
|
1469
|
+
joinedload(GBill.g_reads).joinedload(GRegisterRead.prev_type),
|
|
1499
1470
|
)
|
|
1471
|
+
).unique():
|
|
1472
|
+
row = [
|
|
1473
|
+
g_batch.g_contract.name,
|
|
1474
|
+
g_batch.reference,
|
|
1475
|
+
g_bill.reference,
|
|
1476
|
+
g_bill.account,
|
|
1477
|
+
g_bill.issue_date,
|
|
1478
|
+
g_bill.start_date,
|
|
1479
|
+
g_bill.finish_date,
|
|
1480
|
+
g_bill.kwh,
|
|
1481
|
+
g_bill.net,
|
|
1482
|
+
g_bill.vat,
|
|
1483
|
+
g_bill.gross,
|
|
1484
|
+
g_bill.bill_type.code,
|
|
1485
|
+
g_bill.breakdown,
|
|
1486
|
+
]
|
|
1487
|
+
g_reads = g_bill.g_reads
|
|
1488
|
+
max_reads = max(max_reads, len(g_reads))
|
|
1489
|
+
for g_read in g_reads:
|
|
1490
|
+
row.extend(
|
|
1491
|
+
[
|
|
1492
|
+
g_read.msn,
|
|
1493
|
+
g_read.g_unit.code,
|
|
1494
|
+
g_read.correction_factor,
|
|
1495
|
+
g_read.calorific_value,
|
|
1496
|
+
g_read.prev_date,
|
|
1497
|
+
g_read.prev_value,
|
|
1498
|
+
g_read.prev_type.code,
|
|
1499
|
+
g_read.pres_date,
|
|
1500
|
+
g_read.pres_value,
|
|
1501
|
+
g_read.pres_type.code,
|
|
1502
|
+
]
|
|
1503
|
+
)
|
|
1504
|
+
rows.append(row)
|
|
1500
1505
|
|
|
1506
|
+
si = StringIO()
|
|
1507
|
+
cw = csv.writer(si)
|
|
1508
|
+
read_titles = [
|
|
1509
|
+
"msn",
|
|
1510
|
+
"unit",
|
|
1511
|
+
"correction_factor",
|
|
1512
|
+
"calorific_value",
|
|
1513
|
+
"prev_date",
|
|
1514
|
+
"prev_value",
|
|
1515
|
+
"prev_type",
|
|
1516
|
+
"pres_date",
|
|
1517
|
+
"pres_value",
|
|
1518
|
+
"pres_type",
|
|
1519
|
+
]
|
|
1520
|
+
titles = [
|
|
1521
|
+
"Contract",
|
|
1522
|
+
"Batch Reference",
|
|
1523
|
+
"Bill Reference",
|
|
1524
|
+
"Account",
|
|
1525
|
+
"Issued",
|
|
1526
|
+
"From",
|
|
1527
|
+
"To",
|
|
1528
|
+
"kWh",
|
|
1529
|
+
"Net",
|
|
1530
|
+
"VAT",
|
|
1531
|
+
"Gross",
|
|
1532
|
+
"Type",
|
|
1533
|
+
"breakdown",
|
|
1534
|
+
]
|
|
1535
|
+
for i in range(max_reads):
|
|
1536
|
+
for rt in read_titles:
|
|
1537
|
+
titles.append(f"{i}_{rt}")
|
|
1538
|
+
cw.writerow(titles)
|
|
1539
|
+
for row in rows:
|
|
1540
|
+
cw.writerow(csv_make_val(v) for v in row)
|
|
1501
1541
|
disp = f'attachment; filename="g_batch_{g_batch.id}.csv"'
|
|
1502
1542
|
output = make_response(si.getvalue())
|
|
1503
1543
|
output.headers["Content-Disposition"] = disp
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: chellow
|
|
3
|
-
Version:
|
|
3
|
+
Version: 1726820485.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)
|
|
@@ -53,7 +53,7 @@ chellow/e/bill_parsers/gdf_csv.py,sha256=ZfK3Oc6oP28p_P9DIevLNB_zW2WLcEJ3Lvb1gL3
|
|
|
53
53
|
chellow/e/bill_parsers/haven_csv.py,sha256=0uENq8IgVNqdxfBQMBxLTSZWCOuDHXZC0xzk52SbfyE,13652
|
|
54
54
|
chellow/e/bill_parsers/haven_edi.py,sha256=YGPHRxPOhje9s32jqPHHELni2tooOYj3cMC_qaZVPq4,16107
|
|
55
55
|
chellow/e/bill_parsers/haven_edi_tprs.py,sha256=ZVX9CCqUybsot_Z0BEOJPvl9x5kSr7fEWyuJXvZDcz4,11841
|
|
56
|
-
chellow/e/bill_parsers/mm.py,sha256=
|
|
56
|
+
chellow/e/bill_parsers/mm.py,sha256=hlMglK7UvVJs0AgHe3uWxcOSPuVVjt-29Xhlj3CvN4E,9942
|
|
57
57
|
chellow/e/bill_parsers/nonsettlement_dc_stark_xlsx.py,sha256=yogXTuQHGRL7IiqvRWr2C9V24ez1j9Yx0128UygPE_k,4723
|
|
58
58
|
chellow/e/bill_parsers/settlement_dc_stark_xlsx.py,sha256=PlEqCZuJ9DfQXeeYQ64jtf3ML7sUt_tt61QOOTnkE5c,6380
|
|
59
59
|
chellow/e/bill_parsers/sse_edi.py,sha256=L85DOfNkqexeEIEr8pCBn_2sHJI-zEaw6cogpE3YyYM,15204
|
|
@@ -67,7 +67,7 @@ chellow/gas/cv.py,sha256=4cdYYQ8Qak6NeYdBCB4YaQ0jX8-UkaydIIdibCQuXxM,7344
|
|
|
67
67
|
chellow/gas/dn_rate_parser.py,sha256=Mq8rAcUEUxIQOks59bsCKl8GrefvoHbrTCHqon9N0z0,11340
|
|
68
68
|
chellow/gas/engine.py,sha256=jT7m6vddi5GnWd51wCYEVhBS-LZEn1T9ggZX7Y9HGK0,25263
|
|
69
69
|
chellow/gas/transportation.py,sha256=Bkg8TWOs-v0ES-4qqwbleiOhqbE_t2KauUx9JYMZELM,5300
|
|
70
|
-
chellow/gas/views.py,sha256=
|
|
70
|
+
chellow/gas/views.py,sha256=vwGz4Go2qcebH9Pm2_H0UtJbrtpUIMvxgn5JYc2Zn3g,59027
|
|
71
71
|
chellow/reports/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
72
72
|
chellow/reports/report_109.py,sha256=FmRWG8wQC97cj0nqQH7mrfbYesRIKWXQLh6ERHvtHrU,11212
|
|
73
73
|
chellow/reports/report_111.py,sha256=rgwoOPfvbfwIC_IjBqs2e8umF_YTtpyejLrX_uCgyHE,28145
|
|
@@ -366,6 +366,6 @@ chellow/templates/g/supply_note_edit.html,sha256=b8mB6_ucBwoljp03iy6AgVaZUhGw3-1
|
|
|
366
366
|
chellow/templates/g/supply_notes.html,sha256=6epNmZ3NKdXZz27fvmRUGeffg_oc1kmwuBeyRzQe3Rg,854
|
|
367
367
|
chellow/templates/g/unit.html,sha256=KouNVU0-i84afANkLQ_heJ0uDfJ9H5A05PuLqb8iCN8,438
|
|
368
368
|
chellow/templates/g/units.html,sha256=p5Nd-lAIboKPEOO6N451hx1bcKxMg4BDODnZ-43MmJc,441
|
|
369
|
-
chellow-
|
|
370
|
-
chellow-
|
|
371
|
-
chellow-
|
|
369
|
+
chellow-1726820485.0.0.dist-info/METADATA,sha256=j0nAcz-8hnKflBNKt3m-dhLdmRz6JKAGhoXo6yFiye8,12204
|
|
370
|
+
chellow-1726820485.0.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
371
|
+
chellow-1726820485.0.0.dist-info/RECORD,,
|
|
File without changes
|