chellow 1753175604.0.0__py3-none-any.whl → 1753182209.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/views.py +17 -20
- chellow/gas/bill_parser_bgs_xlsx.py +16 -11
- {chellow-1753175604.0.0.dist-info → chellow-1753182209.0.0.dist-info}/METADATA +1 -1
- {chellow-1753175604.0.0.dist-info → chellow-1753182209.0.0.dist-info}/RECORD +5 -5
- {chellow-1753175604.0.0.dist-info → chellow-1753182209.0.0.dist-info}/WHEEL +0 -0
chellow/e/views.py
CHANGED
|
@@ -5714,31 +5714,28 @@ def supply_post(supply_id):
|
|
|
5714
5714
|
start_date_str = req_str("start_date")
|
|
5715
5715
|
start_date = parse_hh_start(start_date_str)
|
|
5716
5716
|
if start_date is None:
|
|
5717
|
-
raise BadRequest("The
|
|
5717
|
+
raise BadRequest("The date of the MSN change is blank.")
|
|
5718
5718
|
|
|
5719
5719
|
msn = req_str("msn")
|
|
5720
5720
|
msg = ""
|
|
5721
5721
|
era = supply.find_era_at(g.sess, start_date)
|
|
5722
|
-
if era is None:
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
)
|
|
5734
|
-
else:
|
|
5735
|
-
era.msn = msn
|
|
5722
|
+
if era is not None and era.start_date != start_date:
|
|
5723
|
+
era = supply.insert_era_at(g.sess, start_date)
|
|
5724
|
+
g.sess.commit()
|
|
5725
|
+
for era in supply.find_eras(g.sess, start_date, None):
|
|
5726
|
+
if era.msn == msn:
|
|
5727
|
+
msg += (
|
|
5728
|
+
f"The era at {hh_format(era.start_date)} already has the "
|
|
5729
|
+
f"MSN {msn}. "
|
|
5730
|
+
)
|
|
5731
|
+
else:
|
|
5732
|
+
era.msn = msn
|
|
5736
5733
|
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5734
|
+
g.sess.commit()
|
|
5735
|
+
msg += (
|
|
5736
|
+
f"The era at {hh_format(era.start_date)} has been "
|
|
5737
|
+
f"successfully updated with the MSN {msn}. "
|
|
5738
|
+
)
|
|
5742
5739
|
flash(msg)
|
|
5743
5740
|
return render_template("supply_post.html")
|
|
5744
5741
|
|
|
@@ -5,12 +5,13 @@ from decimal import Decimal, InvalidOperation
|
|
|
5
5
|
from enum import Enum, auto
|
|
6
6
|
from io import BytesIO
|
|
7
7
|
|
|
8
|
+
from dateutil.relativedelta import relativedelta
|
|
8
9
|
|
|
9
10
|
from openpyxl import load_workbook
|
|
10
11
|
|
|
11
12
|
from werkzeug.exceptions import BadRequest
|
|
12
13
|
|
|
13
|
-
from chellow.utils import
|
|
14
|
+
from chellow.utils import to_ct, to_utc
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
class Title(Enum):
|
|
@@ -151,13 +152,13 @@ def _parse_row(bills, sheet, row, title_row):
|
|
|
151
152
|
column_map = make_column_map(title_row)
|
|
152
153
|
mprn_raw = get_value(sheet, row, column_map[Title.MPRN])
|
|
153
154
|
mprn = str(mprn_raw)
|
|
154
|
-
reference = get_value(sheet, row, column_map[Title.BILL])
|
|
155
|
+
reference = str(get_value(sheet, row, column_map[Title.BILL]))
|
|
155
156
|
account = get_value(sheet, row, column_map[Title.ACCOUNT])
|
|
156
157
|
issue_date = get_date(sheet, row, column_map[Title.BILL_DATE])
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
)
|
|
158
|
+
charge_period_from = get_date(sheet, row, column_map[Title.CHARGE_PERIOD_FROM])
|
|
159
|
+
charge_period_end_naive = get_date_naive(
|
|
160
|
+
sheet, row, column_map[Title.CHARGE_PERIOD_END]
|
|
161
|
+
)
|
|
161
162
|
|
|
162
163
|
try:
|
|
163
164
|
mprn_values = bills[mprn]
|
|
@@ -165,16 +166,18 @@ def _parse_row(bills, sheet, row, title_row):
|
|
|
165
166
|
mprn_values = bills[mprn] = {}
|
|
166
167
|
|
|
167
168
|
try:
|
|
168
|
-
bill = mprn_values[
|
|
169
|
+
bill = mprn_values[reference]
|
|
169
170
|
except KeyError:
|
|
170
|
-
bill = mprn_values[
|
|
171
|
-
"bill_type_code": "N",
|
|
171
|
+
bill = mprn_values[reference] = {
|
|
172
|
+
"bill_type_code": "W" if reference.startswith("CR") else "N",
|
|
172
173
|
"mprn": mprn,
|
|
173
174
|
"reference": reference,
|
|
174
175
|
"account": account,
|
|
175
176
|
"issue_date": issue_date,
|
|
176
|
-
"start_date":
|
|
177
|
-
"finish_date":
|
|
177
|
+
"start_date": charge_period_from,
|
|
178
|
+
"finish_date": to_utc(
|
|
179
|
+
to_ct(charge_period_end_naive) + relativedelta(hours=23, minutes=30)
|
|
180
|
+
),
|
|
178
181
|
"kwh": Decimal("0"),
|
|
179
182
|
"breakdown": defaultdict(int, {}),
|
|
180
183
|
"net_gbp": Decimal("0.00"),
|
|
@@ -190,6 +193,8 @@ def _parse_row(bills, sheet, row, title_row):
|
|
|
190
193
|
qunit = get_value(sheet, row, column_map[Title.QUNIT])
|
|
191
194
|
charge = get_dec(sheet, row, column_map[Title.CHARGE]) / Decimal("100")
|
|
192
195
|
total = get_dec(sheet, row, column_map[Title.TOTAL])
|
|
196
|
+
if bill["bill_type_code"] == "W":
|
|
197
|
+
quantity = quantity * -1
|
|
193
198
|
if element_desc == "VAT":
|
|
194
199
|
bill["net_gbp"] += quantity
|
|
195
200
|
bill["vat_gbp"] += total
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: chellow
|
|
3
|
-
Version:
|
|
3
|
+
Version: 1753182209.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)
|
|
@@ -44,7 +44,7 @@ chellow/e/system_price.py,sha256=6w5J7bzwFAZubE2zdOFRiS8IIrVP8hkoIOaG2yCt-Ic,623
|
|
|
44
44
|
chellow/e/tlms.py,sha256=K2n-dF6qNW7VQp4m_sVK1HWnXarmAIzpotWXYqWQacY,9363
|
|
45
45
|
chellow/e/tnuos.py,sha256=NBmc-f3oezrl4gviAKobljHfICTpBKxxxEGBGJi_lRk,4927
|
|
46
46
|
chellow/e/triad.py,sha256=uQIngSrz8irBXQ0Rp_s8nAUzu-y2Ms7aj4B38_Ff8y8,13720
|
|
47
|
-
chellow/e/views.py,sha256=
|
|
47
|
+
chellow/e/views.py,sha256=7nvH0D3Q1Q1bmTtPTzHKmMt8uNnhhF9GYHWRxZIBWT0,220622
|
|
48
48
|
chellow/e/bill_parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
49
49
|
chellow/e/bill_parsers/activity_mop_stark_xlsx.py,sha256=opjXRrqrgBTbSKzL0JfTLP0fnz3DL3oRZZ4P0DifQ3I,4119
|
|
50
50
|
chellow/e/bill_parsers/annual_mop_stark_xlsx.py,sha256=-HMoIfa_utXYKA44RuC0Xqv3vd2HLeQU_4P0iBUd3WA,4219
|
|
@@ -67,7 +67,7 @@ chellow/e/bill_parsers/settlement_dc_stark_xlsx.py,sha256=osCpUYUdLcPtlo7ngXWGw0
|
|
|
67
67
|
chellow/e/bill_parsers/sse_edi.py,sha256=L85DOfNkqexeEIEr8pCBn_2sHJI-zEaw6cogpE3YyYM,15204
|
|
68
68
|
chellow/e/bill_parsers/sww_xls.py,sha256=QEjiuvwvr5FuWCfqqVw8LaA_vZyAKsvRAS5fw3xtFhM,7533
|
|
69
69
|
chellow/gas/bill_import.py,sha256=w0lPgK_Drzh8rtnEBQe3qFuxrgzZ6qQSgpaGrrGznMU,6549
|
|
70
|
-
chellow/gas/bill_parser_bgs_xlsx.py,sha256=
|
|
70
|
+
chellow/gas/bill_parser_bgs_xlsx.py,sha256=ZuLts8Y31gxtCQoXJq2CQRRMMpYbAWqsbfMB1S6fPqU,7757
|
|
71
71
|
chellow/gas/bill_parser_csv.py,sha256=Ecdy-apFT-mWAxddAsM4k1s-9-FpIaOfjP0oFc0rdQg,5557
|
|
72
72
|
chellow/gas/bill_parser_engie_edi.py,sha256=Ko0vZP-QdVQ1uuhS_5cdrii60_cM4b_LFJMoY0pZqnk,8950
|
|
73
73
|
chellow/gas/bill_parser_total_edi.py,sha256=8HZH5Le24bVNFDc7vaKbauMaYR-n9P6u0ZG7gDdqbIA,11325
|
|
@@ -385,6 +385,6 @@ chellow/templates/g/supply_note_edit.html,sha256=b8mB6_ucBwoljp03iy6AgVaZUhGw3-1
|
|
|
385
385
|
chellow/templates/g/supply_notes.html,sha256=6epNmZ3NKdXZz27fvmRUGeffg_oc1kmwuBeyRzQe3Rg,854
|
|
386
386
|
chellow/templates/g/unit.html,sha256=KouNVU0-i84afANkLQ_heJ0uDfJ9H5A05PuLqb8iCN8,438
|
|
387
387
|
chellow/templates/g/units.html,sha256=p5Nd-lAIboKPEOO6N451hx1bcKxMg4BDODnZ-43MmJc,441
|
|
388
|
-
chellow-
|
|
389
|
-
chellow-
|
|
390
|
-
chellow-
|
|
388
|
+
chellow-1753182209.0.0.dist-info/METADATA,sha256=7anKRCEEZQ42bSqtEd4uozS1hdVluvK83SWQvDymD1M,12585
|
|
389
|
+
chellow-1753182209.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
390
|
+
chellow-1753182209.0.0.dist-info/RECORD,,
|
|
File without changes
|