chellow 1755614564.0.0__py3-none-any.whl → 1759155233.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 -88
  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 +478 -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 +182 -179
  70. chellow/views.py +55 -65
  71. {chellow-1755614564.0.0.dist-info → chellow-1759155233.0.0.dist-info}/METADATA +2 -2
  72. {chellow-1755614564.0.0.dist-info → chellow-1759155233.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-1755614564.0.0.dist-info → chellow-1759155233.0.0.dist-info}/WHEEL +0 -0
@@ -9,58 +9,54 @@
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>
11
11
  &raquo;
12
- <a href="/e/dc_batches?dc_contract_id={{batch.contract.id}}">Batches</a>
12
+ <a href="/e/dc_contracts/{{batch.contract.id}}/batches">Batches</a>
13
13
  &raquo;
14
14
  <a href="/e/dc_batches/{{batch.id}}">{{batch.reference}}</a> &raquo; Edit
15
15
  {% endblock %}
16
16
 
17
17
  {% block content %}
18
18
 
19
- {% if request.method == 'GET' and request.values.confirm_delete %}
20
19
 
21
- <form method="post">
22
- <fieldset>
23
- <legend>Are you sure you want to delete this batch and all its bills?</legend>
24
- <input type="submit" name="delete" value="Delete">
25
- <a href="/e/dc_batches/{{batch.id}}/edit">Cancel</a>
26
- </fieldset>
27
- </form>
28
-
29
- {% elif request.method == 'GET' and request.values.confirm_delete_bills %}
20
+ <form method="post">
21
+ <fieldset>
22
+ <legend>Update batch</legend>
23
+ <label>Reference</label> {{input_text('reference', batch.reference)}}
24
+ <label>Description</label> {{input_text('description', batch.description)}}
25
+ <input type="submit" name="update" value="Update">
26
+ </fieldset>
27
+ </form>
28
+
29
+ <form hx-post="/e/dc_batches/{{batch.id}}/edit"
30
+ hx-confirm="Are you sure you want to delete all the bills in this batch?">
31
+ <fieldset>
32
+ <legend>Delete All The Bills In This Batch</legend>
33
+ <input type="submit" name="delete_bills" value="Delete">
34
+ </fieldset>
35
+ </form>
36
+
37
+ <form hx-post="/e/dc_batches/{{batch.id}}/edit"
38
+ hx-confirm="Are you sure you want to delete all the bills in this batch and then re-import bills from the files?">
39
+ <fieldset>
40
+ <legend>Delete All The Bills In This Batch And Then Re-Import From The Files</legend>
41
+ <input type="submit" name="delete_import_bills" value="Re-Import">
42
+ </fieldset>
43
+ </form>
44
+
45
+ <form hx-post="/e/dc_batches/{{batch.id}}/edit" hx-confirm="Are you sure you want to import the bills from the files into this batch?">
46
+ <fieldset>
47
+ <legend>
48
+ Import The Bills From The Files Into This Batch
49
+ </legend>
50
+ <input type="submit" name="import_bills" value="Import">
51
+ </fieldset>
52
+ </form>
53
+
54
+ <form>
55
+ <fieldset hx-delete="/e/dc_batches/{{batch.id}}/edit"
56
+ hx-confirm="Are you sure you want to delete this batch and all its bills?">
57
+ <legend>Delete this batch</legend>
58
+ <input type="submit" name="delete" value="Delete">
59
+ </fieldset>
60
+ </form>
30
61
 
31
- <form method="post" action="/e/dc_batches/{{batch.id}}/edit">
32
- <fieldset>
33
- <legend>Are you sure you want to delete all the bills in this batch?</legend>
34
- <input type="submit" name="delete_bills" value="Delete">
35
- <a href="/e/dc_batches/{{batch.id}}/edit">Cancel</a>
36
- </fieldset>
37
- </form>
38
-
39
- {% else %}
40
-
41
- <form method="post">
42
- <fieldset>
43
- <legend>Update batch</legend>
44
- <label>Reference</label> {{input_text('reference', batch.reference)}}
45
- <label>Description</label>
46
- {{input_text('description', batch.description)}}
47
- <input type="submit" name="update" value="Update">
48
- </fieldset>
49
- </form>
50
-
51
- <form action="/e/dc_batches/{{batch.id}}/edit">
52
- <fieldset>
53
- <legend>Delete all the bills in this batch</legend>
54
- <input type="submit" name="confirm_delete_bills" value="Delete">
55
- </fieldset>
56
- </form>
57
-
58
- <form>
59
- <fieldset>
60
- <legend>Delete this batch</legend>
61
- <input type="submit" name="confirm_delete" value="Delete">
62
- </fieldset>
63
- </form>
64
-
65
- {% endif %}
66
62
  {% endblock %}
@@ -7,10 +7,9 @@
7
7
 
8
8
  {% block nav %}
9
9
  <a href="/e/dc_contracts">DC Contracts</a> &raquo;
10
- <a href="/e/dc_contracts/{{batch_file.batch.contract.id}}"
11
- >{{batch_file.batch.contract.name}}</a> &raquo;
12
- <a href="/e/dc_batches?dc_contract_id={{batch_file.batch.contract.id}}">Batches</a>
10
+ <a href="/e/dc_contracts/{{batch_file.batch.contract.id}}">{{batch_file.batch.contract.name}}</a>
13
11
  &raquo;
12
+ <a href="/e/dc_contracts/{{batch_file.batch.contract.id}}/batches">Batches</a> &raquo;
14
13
  <a href="/e/dc_batches/{{batch_file.batch.id}}">{{batch_file.batch.reference}}</a>
15
14
  &raquo; {{batch_file.filename}}
16
15
  [<a href="/e/dc_batch_files/{{batch_file.id}}/edit">edit</a>]
@@ -19,46 +19,34 @@
19
19
  {% endblock %}
20
20
 
21
21
  {% block content %}
22
- {% if request.values.confirm_delete %}
23
22
 
24
- <form method="post" action="/e/dc_batch_files/{{batch_file.id}}/edit">
25
- <fieldset>
26
- <legend>Are you sure you want to delete this file?</legend>
27
- <input type="submit" name="delete" value="Delete">
28
- <a href="/e/dc_batch_files/{{batch_file.id}}">Cancel</a>
29
- </fieldset>
30
- </form>
31
-
32
- {% else %}
33
-
34
- <ul>
35
- <li>Filename: {{batch_file.filename}}</li>
36
- <li>
37
- Upload Timestamp:
38
- {{batch_file.upload_timestamp|hh_format}}
39
- </li>
40
- </ul>
41
-
42
- <form action="/e/dc_batch_files/{{batch_file.id}}/edit" method="post">
43
- <fieldset>
44
- <legend>Update This Batch File</legend>
45
- <label>Parser</label>
46
- <select name="parser_name">
47
- {% for parser_name in parser_names %}
48
- {{input_option('bill_parser_name', parser_name, parser_name)}}
49
- {% endfor %}
50
- </select>
51
- <input type="submit" name="update" value="Update">
52
- </fieldset>
53
- </form>
54
-
55
- <form action="/e/dc_batch_files/{{batch_file.id}}/edit">
56
- <fieldset>
57
- <legend>Delete This Batch File</legend>
58
- <input type="submit" name="confirm_delete" value="Delete">
59
- </fieldset>
60
- </form>
61
-
62
- {% endif %}
23
+ <ul>
24
+ <li>Filename: {{batch_file.filename}}</li>
25
+ <li>
26
+ Upload Timestamp:
27
+ {{batch_file.upload_timestamp|hh_format}}
28
+ </li>
29
+ </ul>
30
+
31
+ <form action="/e/dc_batch_files/{{batch_file.id}}/edit" method="post">
32
+ <fieldset>
33
+ <legend>Update This Batch File</legend>
34
+ <label>Parser</label>
35
+ <select name="parser_name">
36
+ {% for parser_name in parser_names %}
37
+ {{input_option('bill_parser_name', parser_name, parser_name)}}
38
+ {% endfor %}
39
+ </select>
40
+ <input type="submit" name="update" value="Update">
41
+ </fieldset>
42
+ </form>
43
+
44
+ <form hx-delete="/e/dc_batch_files/{{batch_file.id}}/edit"
45
+ hx-confirm="Are you sure you want to delete this file?">
46
+ <fieldset>
47
+ <legend>Delete This Batch File</legend>
48
+ <input type="submit" value="Delete">
49
+ </fieldset>
50
+ </form>
63
51
 
64
52
  {% endblock %}
@@ -47,8 +47,76 @@
47
47
  <td>VAT</td>
48
48
  <td>Gross</td>
49
49
  <td>Breakdown</td>
50
+ <td>element</td>
51
+ <td>Name</td>
52
+ <td>Start Date (YYY-mm-dd HH:MM)</td>
53
+ <td>Finish Date (YYY-mm-dd HH:MM)</td>
54
+ <td>Net</td>
55
+ <td>Breakdown</td>
50
56
  </tr>
51
57
  </tbody>
52
58
  </table>
53
59
 
60
+ <p>
61
+ The columns after 'element' can be repeated for each element, or can be left out
62
+ entirely if the bill doesn't have any elements associated with it. Here's an example:
63
+ </p>
64
+
65
+ <table>
66
+ <caption>Example CSV File</caption>
67
+ <tbody>
68
+ <tr>
69
+ <td>N</td>
70
+ <td>JJih988</td>
71
+ <td>22 7338 1192 184</td>
72
+ <td>jhl449</td>
73
+ <td>2025-07-13 03:26</td>
74
+ <td>2025-06-01 00:00</td>
75
+ <td>2025-06-30 23:30</td>
76
+ <td>288</td>
77
+ <td>13.76</td>
78
+ <td>1.56</td>
79
+ <td>15.82</td>
80
+ <td>{}</td>
81
+ <td>element</td>
82
+ <td>nrg</td>
83
+ <td>2025-06-01 00:00</td>
84
+ <td>2025-06-30 23:30</td>
85
+ <td>5.88</td>
86
+ <td>{"kwh": 55, 'rate': 0.05}</td>
87
+ <td>element</td>
88
+ <td>ccl</td>
89
+ <td>2025-06-01 00:00</td>
90
+ <td>2025-06-30 23:30</td>
91
+ <td>0.92</td>
92
+ <td>{"kwh": 55, 'rate': 0.075}</td>
93
+ </tr>
94
+ <tr>
95
+ <td>N</td>
96
+ <td>jhgjfj8i</td>
97
+ <td>22 9981 4881 118</td>
98
+ <td>khghl</td>
99
+ <td>2025-07-13 03:26</td>
100
+ <td>2025-06-01 00:00</td>
101
+ <td>2025-06-30 23:30</td>
102
+ <td>8892</td>
103
+ <td>885.71</td>
104
+ <td>32.87</td>
105
+ <td>15.82</td>
106
+ <td>{}</td>
107
+ <td>element</td>
108
+ <td>day</td>
109
+ <td>2025-06-01 00:00</td>
110
+ <td>2025-06-30 23:30</td>
111
+ <td>881.77</td>
112
+ <td>{"kwh": 81, 'rate': 0.12}</td>
113
+ <td>element</td>
114
+ <td>aahedc</td>
115
+ <td>2025-06-01 00:00</td>
116
+ <td>2025-06-30 23:30</td>
117
+ <td>88</td>
118
+ <td>{"kwh": 7754, 'rate': 0.0511}</td>
119
+ </tr>
120
+ </tbody>
121
+ </table>
54
122
  {% endblock %}
@@ -7,12 +7,13 @@
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
- Batches [<a href="/e/dc_contracts/{{contract.id}}/add_batch">add</a>]
10
+ Batches [<a href="/e/dc_contracts/{{contract.id}}/batches/edit">edit</a>]
11
11
  {% endblock %}
12
12
 
13
13
  {% block content %}
14
14
 
15
15
  <table class="sticky">
16
+ <caption>Batches [<a href="/e/dc_contracts/{{contract.id}}/batches/add">add</a>]
16
17
  <thead>
17
18
  <tr>
18
19
  <th>Reference</th>
@@ -0,0 +1,26 @@
1
+ {% extends "base.html" %}
2
+
3
+ {% block title %}
4
+ &raquo; DC Contracts &raquo; {{contract.name}} &raquo; Batches
5
+ {% endblock %}
6
+
7
+ {% block nav %}
8
+ <a href="/e/dc_contracts">DC Contracts</a> &raquo;
9
+ <a href="/e/dc_contracts/{{contract.id}}">{{contract.name}}</a> &raquo;
10
+ <a href="/e/dc_contracts/{{contract.id}}/batches">Batches</a> &raquo;
11
+ Edit
12
+ {% endblock %}
13
+
14
+ {% block content %}
15
+ <form hx-post="/e/dc_contracts/{{contract.id}}/batches/edit"
16
+ hx-confirm="Are you sure you want to delete all the bills then re-import bills from the files for all batches in the contract that have batch files?"
17
+ >
18
+ <fieldset>
19
+ <legend>
20
+ For All Batches With At Least One Batch File, Delete All The Bills And Then Re-import Rrom The
21
+ Files
22
+ </legend>
23
+ <button name="delete_import_bills">Re-Import Bills</button>
24
+ </fieldset>
25
+ </form>
26
+ {% endblock %}
@@ -7,11 +7,8 @@
7
7
 
8
8
  {% block nav %}
9
9
  <a href="/e/dc_contracts">DC Contracts</a> &raquo;
10
- <a
11
- href="/e/dc_contracts/{{bill.batch.contract.id}}"
12
- >{{bill.batch.contract.name}}</a> &raquo;
13
- <a href="/e/dc_batches?dc_contract_id={{bill.batch.contract.id}}">Batches</a>
14
- &raquo;
10
+ <a href="/e/dc_contracts/{{bill.batch.contract.id}}">{{bill.batch.contract.name}}</a> &raquo;
11
+ <a href="/e/dc_contracts/{{bill.batch.contract.id}}/batches">Batches</a> &raquo;
15
12
  <a href="/e/dc_batches/{{bill.batch.id}}">{{bill.batch.reference}}</a> &raquo;
16
13
  Bill {{bill.id}} [<a href="/e/dc_bills/{{bill.id}}/edit">edit</a>]
17
14
  {% endblock %}
@@ -57,6 +54,31 @@
57
54
  </tbody>
58
55
  </table>
59
56
 
57
+ <table>
58
+ <caption>Elements [<a href="/e/dc_bills/{{bill.id}}/add_element">add]</caption>
59
+ <thead>
60
+ <tr>
61
+ <th>Name</th>
62
+ <th>Start Date</th>
63
+ <th>Finish Date</th>
64
+ <th>Net</th>
65
+ <th>Breakdown</th>
66
+ </tr>
67
+ </thead>
68
+ <tbody>
69
+ {% for element in bill.elements %}
70
+ <tr>
71
+ <td>{{element.name}}</td>
72
+ <td>{{element.start_date|hh_format}}</td>
73
+ <td>{{element.finish_date|hh_format}}</td>
74
+ <td>{{element.net}}</td>
75
+ <td><pre>{{element.breakdown}}</pre></td>
76
+ </tr>
77
+ {% endfor %}
78
+ </tbody>
79
+ </table>
80
+
81
+
60
82
  <h2>Breakdown</h2>
61
83
 
62
84
  <pre>{%- for line in raw_lines -%}
@@ -8,7 +8,7 @@
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
  <a href="/e/dc_batches/{{batch.id}}">{{batch.reference}}</a>
13
13
  &raquo; Add Bill
14
14
  {% endblock %}
@@ -35,9 +35,9 @@
35
35
  </fieldset>
36
36
 
37
37
  <label>kWh</label> {{input_text('kwh', '0')}}
38
- <label>Net</label> {{input_text('net', '0')}}
39
- <label>VAT</label> {{input_text('vat', '0')}}
40
- <label>Gross</label> {{input_text('gross', '0')}}
38
+ <label>Net</label> {{input_text('net', '0.00')}}
39
+ <label>VAT</label> {{input_text('vat', '0.00')}}
40
+ <label>Gross</label> {{input_text('gross', '0.00')}}
41
41
  <label>Account</label> {{input_text('account', '0')}}
42
42
  <label>Type</label>
43
43
  <select name="bill_type_id">
@@ -7,66 +7,47 @@
7
7
 
8
8
  {% block nav %}
9
9
  <a href="/e/dc_contracts">DC Contracts</a> &raquo;
10
- <a
11
- href="/e/dc_contracts/{{bill.batch.contract.id}}"
12
- >{{bill.batch.contract.name}}</a> &raquo;
13
- <a
14
- href="/e/dc_batches?dc_contract_id={{bill.batch.contract.id}}"
15
- >Batches</a> &raquo;
16
- <a
17
- href="/e/dc_batches/{{bill.batch.id}}"
18
- >{{bill.batch.reference}}</a> &raquo;
19
-
10
+ <a href="/e/dc_contracts/{{bill.batch.contract.id}}">{{bill.batch.contract.name}}</a> &raquo;
11
+ <a href="/e/dc_contracts/{{bill.batch.contract.id}}/batches">Batches</a> &raquo;
12
+ <a href="/e/dc_batches/{{bill.batch.id}}">{{bill.batch.reference}}</a> &raquo;
20
13
  <a href="/e/dc_bills/{{bill.id}}">Bill {{bill.id}}</a> &raquo; Edit
21
14
  {% endblock %}
22
15
 
23
16
  {% block content %}
24
17
 
25
- {% if 'confirm_delete' in request.values %}
18
+ <p><a href="/e/supplies/{{bill.supply.id}}">Supply</a></p>
26
19
 
27
- <form method="post">
20
+ <form action="/e/dc_bills/{{bill.id}}/edit" method="post">
21
+ <fieldset>
22
+ <legend>Update This Bill</legend>
23
+ <label>Reference</label> {{input_text('reference', bill.reference)}}
24
+ <label>Account</label> {{input_text('account', bill.account)}}
28
25
  <fieldset>
29
- <legend>Are you sure you want to delete this bill?</legend>
30
- <input type="submit" name="delete" value="Delete">
31
- <a href="/e/dc_bills/{{bill.id}}/edit">Cancel</a>
26
+ <legend>Issue Date</legend> {{input_date('issue', bill.issue_date)}}
32
27
  </fieldset>
33
- </form>
34
-
35
- {% else %}
36
-
37
- <p><a href="/e/supplies/{{bill.supply.id}}">Supply</a></p>
38
-
39
- <form action="/e/dc_bills/{{bill.id}}/edit" method="post">
28
+
29
+ <fieldset>
30
+ <legend>Start Date</legend> {{input_date('start', bill.start_date)}}
31
+ </fieldset>
32
+
40
33
  <fieldset>
41
- <legend>Update This Bill</legend>
42
- <label>Reference</label> {{input_text('reference', bill.reference)}}
43
- <label>Account</label> {{input_text('account', bill.account)}}
44
- <fieldset>
45
- <legend>Issue Date</legend> {{input_date('issue', bill.issue_date)}}
46
- </fieldset>
47
-
48
- <fieldset>
49
- <legend>Start Date</legend> {{input_date('start', bill.start_date)}}
50
- </fieldset>
51
-
52
- <fieldset>
53
- <legend>Finish Date</legend> {{input_date('finish', bill.finish_date)}}
54
- </fieldset>
55
-
56
- <label>kWh</label> {{input_text('kwh', '' ~ bill.kwh)}}
57
- <label>Net</label> {{input_text('net', '' ~ bill.net)}}
58
- <label>VAT</label> {{input_text('vat', '' ~ bill.vat)}}
59
- <label>Gross</label> {{input_text('gross', '' ~ bill.gross)}}
60
- <label>Type</label>
61
- <select name="bill_type_id">
62
- {% for type in bill_types %}
63
- {{input_option('type_id', type.id, type.code + ' ' + type.description, initial=bill.bill_type.id)}}
64
- {% endfor %}
65
- </select>
66
- <label>Breakdown</label>
67
- {{input_textarea('breakdown', bill.breakdown, 10, 80)}}
68
- <label>Example Breakdown</label>
69
- <pre>
34
+ <legend>Finish Date</legend> {{input_date('finish', bill.finish_date)}}
35
+ </fieldset>
36
+
37
+ <label>kWh</label> {{input_text('kwh', '' ~ bill.kwh)}}
38
+ <label>Net</label> {{input_text('net', '' ~ bill.net)}}
39
+ <label>VAT</label> {{input_text('vat', '' ~ bill.vat)}}
40
+ <label>Gross</label> {{input_text('gross', '' ~ bill.gross)}}
41
+ <label>Type</label>
42
+ <select name="bill_type_id">
43
+ {% for type in bill_types %}
44
+ {{input_option('type_id', type.id, type.code + ' ' + type.description, initial=bill.bill_type.id)}}
45
+ {% endfor %}
46
+ </select>
47
+ <label>Breakdown</label>
48
+ {{input_textarea('breakdown', bill.breakdown, 10, 80)}}
49
+ <label>Example Breakdown</label>
50
+ <pre>
70
51
  {
71
52
  "raw_lines": [
72
53
  "'net-gbp', 'unrestricted-kwh', 'unrestricted-rate', 'unrestricted-gbp'",
@@ -74,17 +55,16 @@
74
55
  "unrestricted-kwh": 1000,
75
56
  "unrestricted-rate": 0.1,
76
57
  "unrestricted-gbp": 100}
77
- </pre>
78
- <input type="submit" name="update" value="Update">
79
- </fieldset>
80
- </form>
81
-
82
- <form>
83
- <fieldset>
84
- <legend>Delete This Bill</legend>
85
- <input type="submit" name="confirm_delete" value="Delete">
86
- </fieldset>
87
- </form>
58
+ </pre>
59
+ <input type="submit" name="update" value="Update">
60
+ </fieldset>
61
+ </form>
88
62
 
89
- {% endif %}
63
+ <form hx-delete="/e/dc_bills/{{bill.id}}/edit"
64
+ hx-confirm="Are you sure you want to delete this bill?">
65
+ <fieldset>
66
+ <input type="submit" name="delete" value="Delete">
67
+ </fieldset>
68
+ </form>
69
+
90
70
  {% endblock %}
@@ -10,7 +10,7 @@
10
10
  <a href="/e/dc_contracts">DC Contracts</a> &raquo;
11
11
  <a href="/e/dc_contracts/{{batch.contract.id}}">{{batch.contract.name}}</a>
12
12
  &raquo;
13
- <a href="/e/dc_batches?dc_contract_id={{batch.contract.id}}">Batches</a> &raquo;
13
+ <a href="/e/dc_contracts/{{batch.contract.id}}/batches">Batches</a> &raquo;
14
14
  <a href="/e/dc_batches/{{batch.id}}">{{batch.reference}}</a> &raquo;
15
15
  {{importer_id}}
16
16
  {% endblock %}
@@ -0,0 +1,130 @@
1
+ {% extends "base.html" %}
2
+
3
+ {% block title %}
4
+ &raquo; DC Contracts &raquo; {{contract.name}} &raquo; Batches &raquo; {{importer_id}}
5
+ {% endblock %}
6
+
7
+ {% block nav %}
8
+ <a href="/e/dc_contracts">DC Contracts</a> &raquo;
9
+ <a href="/e/dc_contracts/{{contract.id}}">{{contract.name}}</a> &raquo;
10
+ <a href="/e/dc_contracts/{{contract.id}}/batches">Batches</a> &raquo;
11
+ {{importer_id}}
12
+ {% endblock %}
13
+
14
+ {% block content %}
15
+ <h2>Bill Import</h2>
16
+
17
+ {% if is_alive %}
18
+ <p>Still running. Refresh the page to see latest progress.</p>
19
+ {% endif %}
20
+
21
+ {% if status %}
22
+ <p>{{status}}</p>
23
+ {% endif %}
24
+
25
+ <ul>
26
+ {% for msg in log %}
27
+ <li>{{msg}}</li>
28
+ {% endfor %}
29
+ </ul>
30
+
31
+ {% if failed_bills|length > 0 %}
32
+ <table class="sticky">
33
+ <caption>Failed Bills</caption>
34
+ <thead>
35
+ <tr>
36
+ <th>Error</th>
37
+ <th>MPAN Core</th>
38
+ <th>Account</th>
39
+ <th>Reference</th>
40
+ <th>Bill Type Code</th>
41
+ <th>Issue Date</th>
42
+ <th>Start Date</th>
43
+ <th>Finish Date</th>
44
+ <th>kWh</th>
45
+ <th>Net</th>
46
+ <th>VAT</th>
47
+ <th>Gross</th>
48
+ <th>Breakdown</th>
49
+ </tr>
50
+ </thead>
51
+ <tbody>
52
+ {% for bill in failed_bills %}
53
+ <tr>
54
+ <td>{{bill.error}}</td>
55
+ <td>
56
+ <a href="/supplies?search_pattern={{bill.mpan_core}}"
57
+ >{{bill.mpan_core}}</a>
58
+ </td>
59
+ <td>{{bill.account}}</td>
60
+ <td>{{bill.reference}}</td>
61
+ <td>{{bill.bill_type_code}}</td>
62
+ <td>
63
+ {% if 'issue_date' in bill %}
64
+ {{bill.issue_date|hh_format}}
65
+ {% endif %}
66
+ </td>
67
+ <td>
68
+ {% if 'start_date' in bill %}
69
+ {{bill.start_date|hh_format}}
70
+ {% endif %}
71
+ </td>
72
+ <td>
73
+ {% if 'finish_date' in bill %}
74
+ {{bill.finish_date|hh_format}}</td>
75
+ {% endif %}
76
+ <td>{{bill.kwh}}</td>
77
+ <td>{{bill.net}}</td>
78
+ <td>{{bill.vat}}</td>
79
+ <td>{{bill.gross}}</td>
80
+ <td>
81
+ {% if 'breakdown' in bill %}
82
+ <pre>{{bill.breakdown|dumps}}</pre>
83
+ {% endif %}
84
+ </td>
85
+ </tr>
86
+ {% endfor %}
87
+ </tbody>
88
+ </table>
89
+ {% endif %}
90
+
91
+ {% if successful_bills|length > 0 %}
92
+ <table class="sticky">
93
+ <caption>Successful Bills</caption>
94
+ <thead>
95
+ <tr>
96
+ <th>Reference</th>
97
+ <th>Account</th>
98
+ <th>Bill Type</th>
99
+ <th>MPAN Core</th>
100
+ <th>Issue Date</th>
101
+ <th>Start Date</th>
102
+ <th>Finish Date</th>
103
+ <th>kWh</th>
104
+ <th>Net</th>
105
+ <th>VAT</th>
106
+ <th>Gross</th>
107
+ <th>Breakdown</th>
108
+ </tr>
109
+ </thead>
110
+ <tbody>
111
+ {% for bill in successful_bills %}
112
+ <tr>
113
+ <td>{{bill.reference}}</td>
114
+ <td>{{bill.account}}</td>
115
+ <td>{{bill.bill_type_code}}</td>
116
+ <td>{{bill.mpan_core}}</td>
117
+ <td>{{bill.issue_date|hh_format}}</td>
118
+ <td>{{bill.start_date|hh_format}}</td>
119
+ <td>{{bill.finish_date|hh_format}}</td>
120
+ <td>{{bill.kwh}}</td>
121
+ <td>{{bill.net}}</td>
122
+ <td>{{bill.vat}}</td>
123
+ <td>{{bill.gross}}</td>
124
+ <td><pre>{{bill.breakdown|dumps}}</pre></td>
125
+ </tr>
126
+ {% endfor %}
127
+ </tbody>
128
+ </table>
129
+ {% endif %}
130
+ {% endblock %}
@@ -70,7 +70,7 @@
70
70
  <a href="/e/dc_contracts/{{dc_contract.id}}/properties">Properties</a>
71
71
  </li>
72
72
  <li>
73
- <a href="/e/dc_batches?dc_contract_id={{dc_contract.id}}">Batches</a>
73
+ <a href="/e/dc_contracts/{{dc_contract.id}}/batches">Batches</a>
74
74
  </li>
75
75
  <li>
76
76
  <a href="/e/channel_snags?dc_contract_id={{dc_contract.id}}&amp;days_hidden=5"