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.

Files changed (75) hide show
  1. chellow/e/bill_importer.py +136 -80
  2. chellow/e/bill_parsers/activity_mop_stark_xlsx.py +99 -86
  3. chellow/e/bill_parsers/annual_mop_stark_xlsx.py +78 -61
  4. chellow/e/bill_parsers/csv.py +139 -101
  5. chellow/e/bill_parsers/drax_edi.py +65 -89
  6. chellow/e/bill_parsers/engie_edi.py +187 -255
  7. chellow/e/bill_parsers/engie_xls.py +153 -167
  8. chellow/e/bill_parsers/haven_edi.py +189 -228
  9. chellow/e/bill_parsers/haven_edi_tprs.py +67 -67
  10. chellow/e/bill_parsers/nonsettlement_dc_stark_xlsx.py +75 -66
  11. chellow/e/bill_parsers/settlement_dc_stark_xlsx.py +229 -126
  12. chellow/e/bill_parsers/sse_edi.py +107 -75
  13. chellow/e/bill_parsers/sww_xls.py +78 -91
  14. chellow/e/computer.py +1 -1
  15. chellow/e/views.py +626 -281
  16. chellow/edi_lib.py +4 -27
  17. chellow/models.py +92 -3
  18. chellow/reports/report_111.py +514 -616
  19. chellow/reports/report_247.py +96 -137
  20. chellow/templates/e/dc_batch.html +110 -157
  21. chellow/templates/e/dc_batch_add.html +2 -3
  22. chellow/templates/e/dc_batch_edit.html +42 -46
  23. chellow/templates/e/dc_batch_file.html +2 -3
  24. chellow/templates/e/dc_batch_file_edit.html +28 -40
  25. chellow/templates/e/dc_batch_upload_file.html +68 -0
  26. chellow/templates/e/dc_batches.html +2 -1
  27. chellow/templates/e/dc_batches_edit.html +26 -0
  28. chellow/templates/e/dc_bill.html +27 -5
  29. chellow/templates/e/dc_bill_add.html +4 -4
  30. chellow/templates/e/dc_bill_edit.html +43 -63
  31. chellow/templates/e/dc_bill_import.html +1 -1
  32. chellow/templates/e/dc_bill_import_contract.html +130 -0
  33. chellow/templates/e/dc_contract.html +1 -1
  34. chellow/templates/e/dc_element.html +41 -0
  35. chellow/templates/e/dc_element_add.html +36 -0
  36. chellow/templates/e/dc_element_edit.html +49 -0
  37. chellow/templates/e/dc_rate_script_edit.html +27 -43
  38. chellow/templates/e/mop_batch.html +105 -152
  39. chellow/templates/e/mop_batch_add.html +2 -3
  40. chellow/templates/e/mop_batch_edit.html +43 -51
  41. chellow/templates/e/mop_batch_upload_file.html +71 -5
  42. chellow/templates/e/mop_batches.html +2 -1
  43. chellow/templates/e/mop_batches_edit.html +26 -0
  44. chellow/templates/e/mop_bill.html +31 -8
  45. chellow/templates/e/mop_bill_add.html +7 -27
  46. chellow/templates/e/mop_bill_import.html +1 -1
  47. chellow/templates/e/mop_bill_import_contract.html +130 -0
  48. chellow/templates/e/mop_contract.html +4 -5
  49. chellow/templates/e/mop_element.html +41 -0
  50. chellow/templates/e/mop_element_add.html +36 -0
  51. chellow/templates/e/mop_element_edit.html +49 -0
  52. chellow/templates/e/supplier_batch.html +3 -7
  53. chellow/templates/e/supplier_batch_add.html +2 -2
  54. chellow/templates/e/supplier_batch_edit.html +1 -1
  55. chellow/templates/e/supplier_batch_file.html +3 -5
  56. chellow/templates/e/supplier_batch_file_add.html +18 -11
  57. chellow/templates/e/supplier_batch_upload_file.html +83 -9
  58. chellow/templates/e/supplier_batches.html +4 -4
  59. chellow/templates/e/supplier_batches_edit.html +26 -0
  60. chellow/templates/e/supplier_bill.html +29 -6
  61. chellow/templates/e/supplier_bill_add.html +3 -3
  62. chellow/templates/e/supplier_bill_import.html +1 -1
  63. chellow/templates/e/supplier_bill_import_contract.html +118 -0
  64. chellow/templates/e/supplier_contract.html +1 -1
  65. chellow/templates/e/supplier_element.html +45 -0
  66. chellow/templates/e/supplier_element_add.html +36 -0
  67. chellow/templates/e/supplier_element_edit.html +51 -0
  68. chellow/templates/report_run_bill_check.html +137 -179
  69. chellow/templates/report_run_row_bill_check.html +187 -179
  70. chellow/views.py +57 -64
  71. {chellow-1757320031.0.0.dist-info → chellow-1759411815.0.0.dist-info}/METADATA +2 -2
  72. {chellow-1757320031.0.0.dist-info → chellow-1759411815.0.0.dist-info}/RECORD +73 -60
  73. chellow/e/bill_parsers/drax_element_edi.py +0 -459
  74. chellow/templates/e/supplier_bill_imports.html +0 -421
  75. {chellow-1757320031.0.0.dist-info → chellow-1759411815.0.0.dist-info}/WHEEL +0 -0
@@ -21,6 +21,7 @@ from chellow.e.scenario import make_calcs, make_site_deltas, scenario_fill_cache
21
21
  from chellow.models import (
22
22
  Bill,
23
23
  Contract,
24
+ Element,
24
25
  Era,
25
26
  MeasurementRequirement,
26
27
  RSession,
@@ -73,8 +74,17 @@ def make_bill_row(titles, bill):
73
74
  return [bill.get(t) for t in titles]
74
75
 
75
76
 
76
- def _add_bills(month_data, era, bills, chunk_start, chunk_finish):
77
- for bill in bills:
77
+ def _add_bills(sess, era, chunk_start, chunk_finish):
78
+ bill_data = defaultdict(int)
79
+ num = 0
80
+ for bill in sess.scalars(
81
+ select(Bill).where(
82
+ Bill.supply == era.supply,
83
+ Bill.start_date <= chunk_finish,
84
+ Bill.finish_date >= chunk_start,
85
+ )
86
+ ):
87
+ num += 1
78
88
  contract = bill.batch.contract
79
89
  bill_role_code = contract.market_role.code
80
90
  bill_start = bill.start_date
@@ -85,7 +95,6 @@ def _add_bills(month_data, era, bills, chunk_start, chunk_finish):
85
95
  ).total_seconds() + (30 * 60)
86
96
  proportion = overlap_duration / bill_duration
87
97
  bill_prop_kwh = proportion * float(bill.kwh)
88
- bill_prop_net_gbp = proportion * float(bill.net)
89
98
  bill_prop_vat_gbp = proportion * float(bill.vat)
90
99
  bill_prop_gross_gbp = proportion * float(bill.gross)
91
100
  if bill_role_code == "X":
@@ -100,13 +109,74 @@ def _add_bills(month_data, era, bills, chunk_start, chunk_finish):
100
109
  else:
101
110
  raise BadRequest("Role code not recognized.")
102
111
 
103
- month_data[f"billed-{polarity}-kwh"] += bill_prop_kwh
104
- month_data[f"billed-{polarity}-net-gbp"] += bill_prop_net_gbp
105
- month_data[f"billed-{polarity}-vat-gbp"] += bill_prop_vat_gbp
106
- month_data[f"billed-{polarity}-gross-gbp"] += bill_prop_gross_gbp
107
- month_data[f"billed-{role_name}-{polarity}-net-gbp"] += bill_prop_net_gbp
108
- month_data[f"billed-{role_name}-{polarity}-vat-gbp"] += bill_prop_vat_gbp
109
- month_data[f"billed-{role_name}-{polarity}-gross-gbp"] += bill_prop_gross_gbp
112
+ bill_data[f"billed-{polarity}-kwh"] += bill_prop_kwh
113
+ bill_data[f"billed-{polarity}-vat-gbp"] += bill_prop_vat_gbp
114
+ bill_data[f"billed-{polarity}-gross-gbp"] += bill_prop_gross_gbp
115
+ bill_data[f"billed-{role_name}-{polarity}-vat-gbp"] += bill_prop_vat_gbp
116
+ bill_data[f"billed-{role_name}-{polarity}-gross-gbp"] += bill_prop_gross_gbp
117
+
118
+ for element in sess.scalars(
119
+ select(Element)
120
+ .join(Bill)
121
+ .where(
122
+ Bill.supply == era.supply,
123
+ Element.start_date <= chunk_finish,
124
+ Element.finish_date >= chunk_start,
125
+ )
126
+ ):
127
+ num += 1
128
+ contract = element.bill.batch.contract
129
+ bill_role_code = contract.market_role.code
130
+ element_start = element.start_date
131
+ element_finish = element.finish_date
132
+ element_duration = (element_finish - element_start).total_seconds() + (30 * 60)
133
+ overlap_duration = (
134
+ min(element_finish, chunk_finish) - max(element_start, chunk_start)
135
+ ).total_seconds() + (30 * 60)
136
+ proportion = overlap_duration / element_duration
137
+ element_prop_net_gbp = proportion * float(element.net)
138
+ if bill_role_code == "X":
139
+ role_name = "supplier"
140
+ polarity = "export" if contract == era.exp_supplier_contract else "import"
141
+ elif bill_role_code == "C":
142
+ role_name = "dc"
143
+ polarity = "import"
144
+ elif bill_role_code == "M":
145
+ role_name = "mop"
146
+ polarity = "import"
147
+ else:
148
+ raise BadRequest("Role code not recognized.")
149
+
150
+ bill_data[f"billed-{polarity}-net-gbp"] += element_prop_net_gbp
151
+ bill_data[f"billed-{role_name}-{polarity}-net-gbp"] += element_prop_net_gbp
152
+ return num, bill_data
153
+
154
+
155
+ def _create_month_data():
156
+ month_data = {}
157
+ for sname in (
158
+ "import-gen",
159
+ "export-gen",
160
+ "import-3rd-party",
161
+ "export-3rd-party",
162
+ "used",
163
+ "displaced",
164
+ "used-3rd-party",
165
+ "billed-export",
166
+ ):
167
+ for xname in ("kwh", "net-gbp"):
168
+ month_data[f"{sname}-{xname}"] = 0
169
+ for polarity in ("import", "export"):
170
+ month_data[f"billed-{polarity}-kwh"] = 0
171
+ month_data[f"{polarity}-grid-kwh"] = 0
172
+ for suf in ("net-gbp", "vat-gbp", "gross-gbp"):
173
+ month_data[f"{polarity}-grid-{suf}"] = 0
174
+ month_data[f"billed-{polarity}-{suf}"] = 0
175
+ month_data[f"billed-supplier-{polarity}-{suf}"] = 0
176
+ month_data[f"billed-dc-{polarity}-{suf}"] = 0
177
+ month_data[f"billed-mop-{polarity}-{suf}"] = 0
178
+ month_data[f"billed-export-{suf}"] = 0
179
+ return month_data
110
180
 
111
181
 
112
182
  def _process_site(
@@ -153,30 +223,7 @@ def _process_site(
153
223
  sorted(calcs, key=str)
154
224
  ):
155
225
  if imp_mpan_core == "displaced":
156
- month_data = {}
157
- for sname in (
158
- "import-gen",
159
- "export-gen",
160
- "import-3rd-party",
161
- "export-3rd-party",
162
- "msp",
163
- "used",
164
- "used-3rd-party",
165
- "billed-export",
166
- ):
167
- for xname in ("kwh", "net-gbp"):
168
- month_data[f"{sname}-{xname}"] = 0
169
- month_data["billed-import-kwh"] = 0
170
- month_data["import-grid-kwh"] = 0
171
- month_data["export-grid-kwh"] = 0
172
- for suf in ("net-gbp", "vat-gbp", "gross-gbp"):
173
- month_data[f"import-grid-{suf}"] = 0
174
- month_data[f"export-grid-{suf}"] = 0
175
- month_data[f"billed-import-{suf}"] = 0
176
- month_data[f"billed-supplier-import-{suf}"] = None
177
- month_data[f"billed-dc-import-{suf}"] = None
178
- month_data[f"billed-mop-import-{suf}"] = None
179
- month_data[f"billed-export-{suf}"] = 0
226
+ month_data = _create_month_data()
180
227
 
181
228
  month_data["used-kwh"] = month_data["displaced-kwh"] = sum(
182
229
  hh["msp-kwh"] for hh in imp_ss.hh_data
@@ -240,28 +287,7 @@ def _process_site(
240
287
  supply = imp_ss.supply
241
288
 
242
289
  site_sources.add(source_code)
243
- month_data = {}
244
- for name in (
245
- "import-gen",
246
- "export-gen",
247
- "import-3rd-party",
248
- "export-3rd-party",
249
- "displaced",
250
- "used",
251
- "used-3rd-party",
252
- "billed-export",
253
- ):
254
- for sname in ("kwh", "net-gbp"):
255
- month_data[f"{name}-{sname}"] = 0
256
- for polarity in ("import", "export"):
257
- month_data[f"billed-{polarity}-kwh"] = 0
258
- month_data[f"{polarity}-grid-kwh"] = 0
259
- for suf in ("net-gbp", "vat-gbp", "gross-gbp"):
260
- month_data[f"{polarity}-grid-{suf}"] = 0
261
- month_data[f"billed-{polarity}-{suf}"] = 0
262
- month_data[f"billed-supplier-{polarity}-{suf}"] = 0
263
- month_data[f"billed-dc-{polarity}-{suf}"] = 0
264
- month_data[f"billed-mop-{polarity}-{suf}"] = 0
290
+ month_data = _create_month_data()
265
291
 
266
292
  if imp_ss is not None:
267
293
  imp_supplier_contract = imp_ss.supplier_contract
@@ -377,14 +403,10 @@ def _process_site(
377
403
  era_associates = {
378
404
  s.site.code for s in sss.era.site_eras if not s.is_physical
379
405
  }
380
- bills = sess.scalars(
381
- select(Bill).where(
382
- Bill.supply == supply,
383
- Bill.start_date <= sss.finish_date,
384
- Bill.finish_date >= sss.start_date,
385
- )
386
- ).all()
387
- _add_bills(month_data, sss.era, bills, sss.start_date, sss.finish_date)
406
+ num_bills, bill_dict = _add_bills(
407
+ sess, sss.era, sss.start_date, sss.finish_date
408
+ )
409
+ month_data.update(bill_dict)
388
410
 
389
411
  if imp_ss is None:
390
412
  imp_supplier_contract_name = imp_voltage_level_code = None
@@ -488,43 +510,12 @@ def _process_site(
488
510
  if site_era is not None:
489
511
  chunk_start = max(start_date, last_era.finish_date + HH)
490
512
  chunk_finish = finish_date
491
- bills = (
492
- sess.execute(
493
- select(Bill).where(
494
- Bill.supply == supply,
495
- Bill.start_date <= chunk_finish,
496
- Bill.finish_date >= chunk_start,
497
- )
498
- )
499
- .scalars()
500
- .all()
513
+ num_bills, bill_dict = _add_bills(
514
+ sess, last_era, chunk_start, chunk_finish
501
515
  )
502
- if len(bills) > 0:
503
- month_data = {}
504
- for name in (
505
- "import-gen",
506
- "export-gen",
507
- "import-3rd-party",
508
- "export-3rd-party",
509
- "displaced",
510
- "used",
511
- "used-3rd-party",
512
- "billed-export",
513
- ):
514
- for sname in ("kwh", "net-gbp"):
515
- month_data[f"{name}-{sname}"] = 0
516
- month_data["billed-import-kwh"] = 0
517
- month_data["import-grid-kwh"] = 0
518
- month_data["export-grid-kwh"] = 0
519
- for suf in ("net-gbp", "vat-gbp", "gross-gbp"):
520
- month_data[f"import-grid-{suf}"] = 0
521
- month_data[f"export-grid-{suf}"] = 0
522
- month_data[f"billed-import-{suf}"] = 0
523
- month_data[f"billed-supplier-import-{suf}"] = 0
524
- month_data[f"billed-dc-import-{suf}"] = 0
525
- month_data[f"billed-mop-import-{suf}"] = 0
526
-
527
- _add_bills(month_data, last_era, bills, chunk_start, chunk_finish)
516
+ if num_bills > 0:
517
+ month_data = _create_month_data()
518
+ month_data.update(bill_dict)
528
519
 
529
520
  imp_supplier_contract = last_era.imp_supplier_contract
530
521
  imp_llfc = last_era.imp_llfc
@@ -607,44 +598,12 @@ def _process_site(
607
598
  if site_era is not None:
608
599
  chunk_start = start_date
609
600
  chunk_finish = hh_min(finish_date, first_era.start_date - HH)
610
- bills = (
611
- sess.execute(
612
- select(Bill).where(
613
- Bill.supply == supply,
614
- Bill.start_date <= chunk_finish,
615
- Bill.finish_date >= chunk_start,
616
- )
617
- )
618
- .scalars()
619
- .all()
601
+ num_bills, bill_dict = _add_bills(
602
+ sess, first_era, chunk_start, chunk_finish
620
603
  )
621
- if len(bills) > 0:
622
- month_data = {}
623
- for name in (
624
- "import-gen",
625
- "export-gen",
626
- "import-3rd-party",
627
- "export-3rd-party",
628
- "displaced",
629
- "used",
630
- "used-3rd-party",
631
- ):
632
- for sname in ("kwh", "net-gbp"):
633
- month_data[f"{name}-{sname}"] = 0
634
- month_data["billed-import-kwh"] = 0
635
- month_data["billed-export-kwh"] = 0
636
- month_data["import-grid-kwh"] = 0
637
- month_data["export-grid-kwh"] = 0
638
- for suf in ("net-gbp", "vat-gbp", "gross-gbp"):
639
- month_data[f"billed-import-{suf}"] = 0
640
- month_data[f"billed-export-{suf}"] = 0
641
- month_data[f"import-grid-{suf}"] = 0
642
- month_data[f"export-grid-{suf}"] = 0
643
- month_data[f"billed-supplier-import-{suf}"] = 0
644
- month_data[f"billed-supplier-export-{suf}"] = 0
645
- month_data[f"billed-dc-import-{suf}"] = 0
646
- month_data[f"billed-mop-import-{suf}"] = 0
647
- _add_bills(month_data, first_era, bills, chunk_start, chunk_finish)
604
+ if num_bills > 0:
605
+ month_data = _create_month_data()
606
+ month_data.update(bill_dict)
648
607
 
649
608
  imp_supplier_contract = first_era.imp_supplier_contract
650
609
  imp_llfc = last_era.imp_llfc
@@ -8,178 +8,131 @@
8
8
  {% block nav %}
9
9
  <a href="/e/dc_contracts">DC Contracts</a> &raquo;
10
10
  <a href="/e/dc_contracts/{{batch.contract.id}}">{{batch.contract.name}}</a> &raquo;
11
- <a href="/e/dc_batches?dc_contract_id={{batch.contract.id}}">Batches</a> &raquo;
11
+ <a href="/e/dc_contracts/{{batch.contract.id}}/batches">Batches</a> &raquo;
12
12
  {{batch.reference}} [<a href="/e/dc_batches/{{batch.id}}/edit">edit</a>]
13
13
  {% endblock %}
14
14
 
15
15
  {% block content %}
16
16
 
17
- {% if request.method == 'GET' and request.values.confirm_delete_bills %}
18
-
19
- <form method="post" action="/e/dc_batches/{{batch.id}}">
20
- <fieldset>
21
- <legend>Are you sure you want to delete all the bills in this batch?</legend>
22
- <input type="submit" name="delete_bills" value="Delete">
23
- <a href="/e/dc_batches/{{batch_id}}">Cancel</a>
24
- </fieldset>
25
- </form>
26
-
27
- {% elif request.method == 'GET' and request.values.confirm_delete_import_bills %}
28
-
29
- <form method="post" action="/e/dc_batches/{{batch.id}}">
30
- <fieldset>
31
- <h2>
32
- Are you sure you want to delete all the bills in this batch and then
33
- re-import bills from the files?
34
- </h2>
35
- <input type="submit" name="delete_import_bills" value="Re-Import">
36
- <a href="/e/dc_batches/{{batch.id}}">Cancel</a>
37
- </fieldset>
38
- </form>
39
-
40
- {% elif request.method == 'GET' and request.values.confirm_import_bills %}
41
-
42
- <form method="post" action="/e/dc_batches/{{batch.id}}">
43
- <fieldset>
44
- <legend>
45
- Are you sure you want to import the bills from the files into this batch?
46
- </legend>
47
- <input type="submit" name="import_bills" value="Import">
48
- <a href="/e/dc_batches/{{batch.id}}">Cancel</a>
49
- </fieldset>
50
- </form>
51
-
52
- {% else %}
53
-
54
- <table>
55
- <tr>
56
- <th>Reference</th>
57
- <td>{{ batch.reference }}</td>
58
- </tr>
17
+ <table>
18
+ <tr>
19
+ <th>Reference</th>
20
+ <td>{{ batch.reference }}</td>
21
+ </tr>
22
+ <tr>
23
+ <th>Description</th>
24
+ <td>{{ batch.description }}</td>
25
+ </tr>
26
+ <tr>
27
+ <th>Number Of Bills</th>
28
+ <td>{{ bills|length }}</td>
29
+ </tr>
30
+ {% if batch_reports %}
59
31
  <tr>
60
- <th>Description</th>
61
- <td>{{ batch.description }}</td>
32
+ <th>Custom Reports</th>
33
+ <td>
34
+ <ul>
35
+ {% for report in batch_reports %}
36
+ <li>
37
+ <a href="/local_reports/{{report.id}}/output?batch_id={{batch.id}}">{{report.name}}</a>
38
+ </li>
39
+ {% endfor %}
40
+ </ul>
41
+ </td>
62
42
  </tr>
43
+ {% endif %}
44
+ </table>
45
+
46
+ <table>
47
+ <caption>
48
+ Billing Files [<a href="/e/dc_batches/{{batch.id}}/upload_file">upload</a>]
49
+ </caption>
50
+ <thead>
63
51
  <tr>
64
- <th>Number Of Bills</th>
65
- <td>{{ bills|length }}</td>
52
+ <th>View</th>
53
+ <th>Filename</th>
54
+ <th>Upload Timestamp</th>
55
+ <th>Parser Name</th>
66
56
  </tr>
67
- {% if batch_reports %}
57
+ </thead>
58
+ <tbody>
59
+ {% for file in batch.files %}
68
60
  <tr>
69
- <th>Custom Reports</th>
70
- <td>
71
- <ul>
72
- {% for report in batch_reports %}
73
- <li>
74
- <a href="/local_reports/{{report.id}}/output?batch_id={{batch.id}}">{{report.name}}</a>
75
- </li>
76
- {% endfor %}
77
- </ul>
78
- </td>
61
+ <td><a href="/e/dc_batch_files/{{file.id}}"/>View</td>
62
+ <td>{{file.filename}}</td>
63
+ <td>{{file.upload_timestamp|hh_format}}</td>
64
+ <td>{{file.parser_name}}</td>
79
65
  </tr>
80
- {% endif %}
81
- </table>
82
-
83
- <table>
84
- <caption>
85
- Billing Files [<a href="/e/dc_batches/{{batch.id}}/upload_file">upload</a>]
86
- </caption>
87
- <thead>
66
+ {% endfor %}
67
+ </tbody>
68
+ </table>
69
+
70
+ <table>
71
+ <caption>Imports</caption>
72
+ <thead>
73
+ <th>View</th>
74
+ <th>Id</th>
75
+ </thead>
76
+ <tbody>
77
+ {% for id in importer_ids %}
88
78
  <tr>
89
- <th>View</th>
90
- <th>Filename</th>
91
- <th>Upload Timestamp</th>
92
- <th>Parser Name</th>
79
+ <td><a href="/e/dc_bill_imports/{{id}}">View</a></td>
80
+ <td>{{id}}</td>
93
81
  </tr>
94
- </thead>
95
- <tbody>
96
- {% for file in batch.files %}
97
- <tr>
98
- <td><a href="/e/dc_batch_files/{{file.id}}"/>View</td>
99
- <td>{{file.filename}}</td>
100
- <td>{{file.upload_timestamp|hh_format}}</td>
101
- <td>{{file.parser_name}}</td>
102
- </tr>
103
- {% endfor %}
104
- </tbody>
105
- </table>
106
-
107
- <table>
108
- <caption>Imports</caption>
109
- <thead>
82
+ {% endfor %}
83
+ </tbody>
84
+ </table>
85
+
86
+ <ul>
87
+ <li>
88
+ <a href="/reports/111?batch_id={{batch.id}}">Check Bills</a>
89
+ </li>
90
+ <li>
91
+ <a href="/e/dc_batches/{{batch.id}}/csv">CSV of Bills</a>
92
+ </li>
93
+ </ul>
94
+
95
+ <table class="sticky">
96
+ <caption>
97
+ Bills [<a href="/e/dc_batches/{{batch.id}}/add_bill">add</a>]
98
+ </caption>
99
+ <thead>
100
+ <tr>
110
101
  <th>View</th>
111
- <th>Id</th>
112
- </thead>
113
- <tbody>
114
- {% for id in importer_ids %}
115
- <tr>
116
- <td><a href="/e/dc_bill_imports/{{id}}">View</a></td>
117
- <td>{{id}}</td>
118
- </tr>
119
- {% endfor %}
120
- </tbody>
121
- </table>
122
-
123
- <form action="/e/dc_batches/{{batch.id}}">
124
- <fieldset>
125
- <legend>Actions</legend>
126
- <input name="confirm_import_bills" type="submit" value="Import Bills">
127
- <input name="confirm_delete_bills" type="submit" value="Delete Bills">
128
- <input name="confirm_delete_import_bills" type="submit" value="Re-Import Bills">
129
- </fieldset>
130
- </form>
131
-
132
- <ul>
133
- <li>
134
- <a href="/reports/111?batch_id={{batch.id}}">Check Bills</a>
135
- </li>
136
- <li>
137
- <a href="/e/dc_batches/{{batch.id}}/csv">CSV of Bills</a>
138
- </li>
139
- </ul>
140
-
141
- <table class="sticky">
142
- <caption>
143
- Bills [<a href="/e/dc_batches/{{batch.id}}/add_bill">add</a>]
144
- </caption>
145
- <thead>
102
+ <th>Reference</th>
103
+ <th>Supply</th>
104
+ <th>Account</th>
105
+ <th>Issue Date</th>
106
+ <th>From</th>
107
+ <th>To</th>
108
+ <th>kWh</th>
109
+ <th>Net</th>
110
+ <th>VAT</th>
111
+ <th>Gross</th>
112
+ <th>Type</th>
113
+ </tr>
114
+ </thead>
115
+ <tbody>
116
+ {% for bill in bills %}
146
117
  <tr>
147
- <th>View</th>
148
- <th>Reference</th>
149
- <th>Supply</th>
150
- <th>Account</th>
151
- <th>Issue Date</th>
152
- <th>From</th>
153
- <th>To</th>
154
- <th>kWh</th>
155
- <th>Net</th>
156
- <th>VAT</th>
157
- <th>Gross</th>
158
- <th>Type</th>
118
+ <td><a href="/e/dc_bills/{{bill.id}}">View</a></td>
119
+ <td>{{ bill.reference }}</td>
120
+ <td><a href="/e/supplies/{{bill.supply.id}}">supply</a></td>
121
+ <td>{{ bill.account }}</td>
122
+ <td>{{ bill.issue_date|hh_format }}</td>
123
+ <td>{{ bill.start_date|hh_format }}</td>
124
+ <td>{{ bill.finish_date|hh_format }}</td>
125
+ <td>{{ bill.kwh }}</td>
126
+ <td>{{ bill.net }}</td>
127
+ <td>{{ bill.vat }}</td>
128
+ <td>{{ bill.gross }}</td>
129
+ <td>
130
+ <a href="/bill_types/{{bill.bill_type.id}}"
131
+ title="{{bill.bill_type.description}}">{{bill.bill_type.code}}</a>
132
+ </td>
159
133
  </tr>
160
- </thead>
161
- <tbody>
162
- {% for bill in bills %}
163
- <tr>
164
- <td><a href="/e/dc_bills/{{bill.id}}">View</a></td>
165
- <td>{{ bill.reference }}</td>
166
- <td><a href="/e/supplies/{{bill.supply.id}}">supply</a></td>
167
- <td>{{ bill.account }}</td>
168
- <td>{{ bill.issue_date|hh_format }}</td>
169
- <td>{{ bill.start_date|hh_format }}</td>
170
- <td>{{ bill.finish_date|hh_format }}</td>
171
- <td>{{ bill.kwh }}</td>
172
- <td>{{ bill.net }}</td>
173
- <td>{{ bill.vat }}</td>
174
- <td>{{ bill.gross }}</td>
175
- <td>
176
- <a href="/bill_types/{{bill.bill_type.id}}"
177
- title="{{bill.bill_type.description}}">{{bill.bill_type.code}}</a>
178
- </td>
179
- </tr>
180
- {% endfor %}
181
- </tbody>
182
- </table>
134
+ {% endfor %}
135
+ </tbody>
136
+ </table>
183
137
 
184
- {% endif %}
185
138
  {% endblock %}
@@ -7,13 +7,12 @@
7
7
  {% block nav %}
8
8
  <a href="/e/dc_contracts">DC Contracts</a> &raquo;
9
9
  <a href="/e/dc_contracts/{{contract.id}}">{{contract.name}}</a> &raquo;
10
- <a href="/e/dc_batches?dc_contract_id={{contract.id}}">Batches</a> &raquo;
11
- Add
10
+ <a href="/e/dc_contracts/{{contract.id}}/batches">Batches</a> &raquo; Add
12
11
  {% endblock %}
13
12
 
14
13
  {% block content %}
15
14
 
16
- <form action="/e/dc_contracts/{{contract.id}}/add_batch" method="post">
15
+ <form action="/e/dc_contracts/{{contract.id}}/batches/add" method="post">
17
16
  <fieldset class="grid">
18
17
  <legend>Add a batch</legend>
19
18
  <label>Reference</label>