chellow 1757320031.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 -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 +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-1757320031.0.0.dist-info → chellow-1759155233.0.0.dist-info}/METADATA +2 -2
  72. {chellow-1757320031.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-1757320031.0.0.dist-info → chellow-1759155233.0.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,41 @@
1
+ {% extends "base.html" %}
2
+
3
+ {% block title %}
4
+ » DC Contracts » {{element.bill.batch.contract.name}} »
5
+ Batches » {{element.bill.batch.reference}} » {{element.bill.reference}} »
6
+ {{element.bill.reference}} » {{element.name}}
7
+ {% endblock %}
8
+
9
+ {% block nav %}
10
+ <a href="/e/dc_contracts">DC Contracts</a> &raquo;
11
+ <a href="/e/dc_contracts/{{element.bill.batch.contract.id}}">{{element.bill.batch.contract.name}}</a>
12
+ &raquo;
13
+ <a href="/e/dc_contracts/{{element.bill.batch.contract.id}}/batches">Batches</a> &raquo;
14
+ <a href="/e/dc_batches/{{element.bill.batch.id}}">{{element.bill.batch.reference}}</a> &raquo;
15
+ <a href="/e/dc_bills/{{element.bill.id}}">{{element.bill.reference}}</a> &raquo;
16
+ {{element.name}}</a> &raquo; [<a href="/e/dc_elements/{{element.id}}/edit">edit</a>]
17
+ {% endblock %}
18
+
19
+ {% block content %}
20
+ <table>
21
+ <caption>Element</caption>
22
+ <thead>
23
+ <tr>
24
+ <th>Name</th>
25
+ <th>Start Date</th>
26
+ <th>Finish Date</th>
27
+ <th>Net GBP</th>
28
+ <th>Breakdown</th>
29
+ </tr>
30
+ </thead>
31
+ <tbody>
32
+ <tr>
33
+ <td>{{element.name}}</td>
34
+ <td>{{element.start_date|hh_format }}</td>
35
+ <td>{{element.finish_date|hh_format }}</td>
36
+ <td>{{element.net}}</td>
37
+ <td><pre>{{element.breakdown}}</pre></td>
38
+ </tr>
39
+ </tbody>
40
+ </table>
41
+ {% endblock %}
@@ -0,0 +1,36 @@
1
+ {% extends "base.html" %}
2
+
3
+ {% block title %}
4
+ &raquo; DC Contracts &raquo; {{bill.batch.contract.name}} &raquo; Batches &raquo;
5
+ {{bill.batch.reference}} &raquo; {{bill.reference}} &raquo; Add Element
6
+ {% endblock %}
7
+
8
+ {% block nav %}
9
+ <a href="/e/dc_contracts">DC Contracts</a> &raquo;
10
+ <a href="/e/dc_contracts/{{bill.batch.contract.id}}">{{bill.batch.contract.name}}</a> &raquo;
11
+ <a href="/e/dc_contract/{{bill.batch.contract.id}}/batches">Batches</a> &raquo;
12
+ <a href="/e/dc_batches/{{bill.batch.id}}">{{bill.batch.reference}}</a> &raquo;
13
+ <a href="/e/dc_bills/{{bill.id}}">{{bill.reference}}</a> &raquo;
14
+ Add Element
15
+ {% endblock %}
16
+
17
+ {% block content %}
18
+ <form action="/e/dc_bills/{{bill.id}}/add_element" method="post">
19
+ <fieldset>
20
+ <legend>Add An Element</legend>
21
+
22
+ <label>Name</label> {{input_text('name')}}
23
+
24
+ <label>Start Date</label> {{input_date('start', start_date)}}
25
+
26
+ <label>Finish Date</label> {{input_date('finish')}}
27
+
28
+ <label>Net GBP</label> {{input_text('net', '0.00')}}
29
+
30
+ <label>Breakdown</label>
31
+ {{input_textarea('breakdown', '{}', 10, 80, show_pos=True)}}
32
+
33
+ <input type="submit" value="Add">
34
+ </fieldset>
35
+ </form>
36
+ {% endblock %}
@@ -0,0 +1,49 @@
1
+ {% extends "base.html" %}
2
+
3
+ {% block title %}
4
+ &raquo; DC Contracts &raquo; {{element.bill.batch.contract.name}} &raquo;
5
+ Batches &raquo; {{element.bill.batch.reference}} &raquo; Bills &raquo;
6
+ {{element.bill.reference}} &raquo; {{element.name}} &raquo; Edit
7
+ {% endblock %}
8
+
9
+ {% block nav %}
10
+ <a href="/e/dc_contracts">DC Contracts</a> &raquo;
11
+ <a href="/e/dc_contracts/{{element.bill.batch.contract.id}}">{{element.bill.batch.contract.name}}</a>
12
+ &raquo;
13
+ <a href="/e/dc_contracts/{{element.bill.batch.contract.id}}/batches">Batches</a> &raquo;
14
+ <a href="/e/dc_batches/{{element.bill.batch.id}}">{{element.bill.batch.reference}}</a> &raquo;
15
+ <a href="/e/dc_bills/{{element.bill.id}}">{{element.bill.reference}}</a> &raquo;
16
+ <a href="/e/dc_elements/{{element.id}}">{{element.name}}</a> &raquo;
17
+ Edit
18
+ {% endblock %}
19
+
20
+ {% block content %}
21
+
22
+ <form method="post" action="/e/dc_elements/{{element.id}}/edit">
23
+ <fieldset>
24
+ <legend>Update This Element</legend>
25
+ <label>Name</label> {{input_text('name', element.name)}}
26
+ <label>Start Date</label> {{input_date('start', element.start_date)}}
27
+ <label>Finish Date</label> {{input_date('finish', element.finish_date)}}
28
+ <label>Net GBP</label> {{input_text('net', element.net)}}
29
+ <label>Breakdown</label>
30
+ {{input_textarea('breakdown', element.breakdown, 10, 80, show_pos=True)}}
31
+ <input type="submit" name="update" value="Update">
32
+ </fieldset>
33
+ </form>
34
+
35
+ <h3>Example Breakdown</h3>
36
+
37
+ <pre>{
38
+ "nrg-kwh": 1000,
39
+ "nrg-rate": 0.1,
40
+ }</pre>
41
+
42
+ <form hx-delete="/e/dc_elements/{{element.id}}/edit"
43
+ hx-confirm="Are you sure you want to delete this element?">
44
+ <fieldset>
45
+ <legend>Delete This Element</legend>
46
+ <input type="submit" name="confirm_delete" value="Delete">
47
+ </fieldset>
48
+ </form>
49
+ {% endblock %}
@@ -16,51 +16,35 @@
16
16
 
17
17
  {% block content %}
18
18
 
19
- {% if request.method == 'GET' and request.values.delete %}
20
-
21
- <form action="/e/dc_rate_scripts/{{dc_rate_script.id}}/edit" method="post">
19
+ <form action="/e/dc_rate_scripts/{{dc_rate_script.id}}/edit" method="post">
20
+ <fieldset>
21
+ <legend>Update Rate Script</legend>
22
+ <label>Start date</label> {{ input_date('start', dc_rate_script.start_date) }}
22
23
  <fieldset>
23
- <legend>Are you sure you want to delete this rate script?</legend>
24
- <input type="submit" name="delete" value="Delete">
25
- <a href="/e/dc_rate_scripts/{{dc_rate_script.id}}/edit">Cancel</a>
24
+ <legend>Finish date</legend>
25
+ <label>Ended?</label>
26
+ {{input_checkbox('has_finished', dc_rate_script.finish_date != None)}}
27
+ </label>
28
+ {{ input_date('finish', dc_rate_script.finish_date) }}
26
29
  </fieldset>
27
- </form>
28
-
29
- {% else %}
30
-
31
- <form action="/e/dc_rate_scripts/{{dc_rate_script.id}}/edit" method="post">
32
- <fieldset>
33
- <legend>Update Rate Script</legend>
34
- <fieldset>
35
- <legend>Start date</legend>
36
- {{ input_date('start', dc_rate_script.start_date) }}
37
- </fieldset>
38
- <fieldset>
39
- <legend>Finish date</legend>
40
- <label>Ended?</label>
41
- {{input_checkbox('has_finished', dc_rate_script.finish_date != None)}}
42
- </label>
43
- {{ input_date('finish', dc_rate_script.finish_date) }}
44
- </fieldset>
45
- <label>Script</label>
46
- {{ input_textarea('script', dc_rate_script.script, 40, 80, show_pos=True) }}
47
- <input type="submit" value="Update">
48
- <input type="reset" value="Reset">
49
- </fieldset>
50
- </form>
51
-
52
- {% if rate_script_example %}
53
- <h4>Example</h4>
54
- <pre>{{rate_script_example}}</pre>
55
- {% endif %}
30
+ <label>Script</label>
31
+ {{ input_textarea('script', dc_rate_script.script, 40, 80, show_pos=True) }}
32
+ <input type="submit" value="Update">
33
+ <input type="reset" value="Reset">
34
+ </fieldset>
35
+ </form>
36
+
37
+ {% if rate_script_example %}
38
+ <h4>Example</h4>
39
+ <pre>{{rate_script_example}}</pre>
40
+ {% endif %}
56
41
 
57
- <form action="/e/dc_rate_scripts/{{dc_rate_script.id}}/edit">
58
- <fieldset>
59
- <legend>Delete this Rate Script</legend>
42
+ <form hx-delete="/e/dc_rate_scripts/{{dc_rate_script.id}}/edit"
43
+ hx-confirm="Are you sure you want to delete this rate script?">
44
+ <fieldset>
45
+ <legend>Delete this Rate Script</legend>
60
46
 
61
- <input type="submit" name="delete" value="Delete">
62
- </fieldset>
63
- </form>
64
-
65
- {% endif %}
47
+ <input type="submit" name="delete" value="Delete">
48
+ </fieldset>
49
+ </form>
66
50
  {% endblock %}
@@ -9,174 +9,127 @@
9
9
  <a href="/e/mop_contracts">MOP Contracts</a> &raquo;
10
10
  <a href="/e/mop_contracts/{{batch.contract.id}}">{{batch.contract.name}}</a>
11
11
  &raquo;
12
- <a href="/e/mop_batches?mop_contract_id={{batch.contract.id}}">Batches</a>
12
+ <a href="/e/mop_contracts/{{batch.contract.id}}/batches">Batches</a>
13
13
  &raquo; {{batch.reference}}
14
14
  [<a href="/e/mop_batches/{{batch.id}}/edit">edit</a>]
15
15
  {% endblock %}
16
16
 
17
17
  {% block content %}
18
- {% if request.method == 'GET' and request.values.confirm_delete_bills %}
19
18
 
20
- <form method="post" action="/mop_batches/{{batch_id}}">
21
- <fieldset>
22
- <legend>Are you sure you want to delete all the bills in this batch?</legend>
23
- <input type="submit" name="delete_bills" value="Delete">
24
- <a href="/e/mop_batches/{{batch_id}}">Cancel</a>
25
- </fieldset>
26
- </form>
27
-
28
- {% elif request.method == 'GET' and request.values.confirm_delete_import_bills %}
29
-
30
- <form method="post" action="/e/mop_batches/{{batch.id}}">
31
- <fieldset>
32
- <legend>
33
- Are you sure you want to delete all the bills in this batch and then
34
- re-import bills from the files?
35
- </legend>
36
- <input type="submit" name="delete_import_bills" value="Re-Import">
37
- <a href="/e/mop_batches/{{batch.id}}">Cancel</a>
38
- </fieldset>
39
- </form>
40
-
41
- {% elif request.method == 'GET' and request.values.confirm_import_bills %}
42
-
43
- <form method="post" action="/e/mop_batches/{{batch.id}}">
44
- <fieldset>
45
- <legend>
46
- Are you sure you want to import the bills from the files into this batch?
47
- </legend>
48
- <input type="submit" name="import_bills" value="Import">
49
- <a href="/e/mop_batches/{{batch.id}}">Cancel</a>
50
- </fieldset>
51
- </form>
52
-
53
- {% else %}
54
-
55
- <table>
56
- <caption>Batch</caption>
19
+ <table>
20
+ <caption>Batch</caption>
21
+ <tr>
22
+ <th>Reference</th>
23
+ <td>{{ batch.reference }}</td>
24
+ </tr>
25
+ <tr>
26
+ <th>Description</th>
27
+ <td>{{ batch.description }}</td>
28
+ </tr>
29
+ <tr>
30
+ <th>Number Of Bills</th>
31
+ <td>{{ bills|length }}</td>
32
+ </tr>
33
+ {% if batch_reports %}
57
34
  <tr>
58
- <th>Reference</th>
59
- <td>{{ batch.reference }}</td>
60
- </tr>
61
- <tr>
62
- <th>Description</th>
63
- <td>{{ batch.description }}</td>
35
+ <th>Custom Reports</th>
36
+ <td>
37
+ <ul>
38
+ {% for report in batch_reports %}
39
+ <li>
40
+ <a href="/local_reports/{{report.id}}/output?batch_id={{batch.id}}">{{report.name}}</a>
41
+ </li>
42
+ {% endfor %}
43
+ </ul>
44
+ </td>
64
45
  </tr>
46
+ {% endif %}
47
+ </table>
48
+
49
+ <table>
50
+ <caption>
51
+ Billing Files [<a href="/e/mop_batches/{{batch.id}}/upload_file">upload</a>]
52
+ </caption>
53
+ <thead>
65
54
  <tr>
66
- <th>Number Of Bills</th>
67
- <td>{{ bills|length }}</td>
55
+ <th>View</th>
56
+ <th>Filename</th>
57
+ <th>Upload Timestamp</th>
58
+ <th>Parser Name</th>
68
59
  </tr>
69
- {% if batch_reports %}
60
+ </thead>
61
+ <tbody>
62
+ {% for file in batch.files %}
70
63
  <tr>
71
- <th>Custom Reports</th>
72
- <td>
73
- <ul>
74
- {% for report in batch_reports %}
75
- <li>
76
- <a href="/local_reports/{{report.id}}/output?batch_id={{batch.id}}">{{report.name}}</a>
77
- </li>
78
- {% endfor %}
79
- </ul>
80
- </td>
64
+ <td><a href="/e/mop_batch_files/{{file.id}}"/>View</td>
65
+ <td>{{file.filename}}</td>
66
+ <td>{{file.upload_timestamp|hh_format}}</td>
67
+ <td>{{file.parser_name}}</td>
81
68
  </tr>
82
- {% endif %}
83
- </table>
84
-
85
- <table>
86
- <caption>
87
- Billing Files [<a href="/e/mop_batches/{{batch.id}}/upload_file">upload</a>]
88
- </caption>
89
- <thead>
69
+ {% endfor %}
70
+ </tbody>
71
+ </table>
72
+
73
+ <table>
74
+ <caption>Imports</caption>
75
+ <thead>
76
+ <th>View</th>
77
+ <th>Id</th>
78
+ </thead>
79
+ <tbody>
80
+ {% for id in importer_ids %}
90
81
  <tr>
91
- <th>View</th>
92
- <th>Filename</th>
93
- <th>Upload Timestamp</th>
94
- <th>Parser Name</th>
82
+ <td><a href="/e/mop_bill_imports/{{id}}">View</a></td>
83
+ <td>{{id}}</td>
95
84
  </tr>
96
- </thead>
97
- <tbody>
98
- {% for file in batch.files %}
99
- <tr>
100
- <td><a href="/e/mop_batch_files/{{file.id}}"/>View</td>
101
- <td>{{file.filename}}</td>
102
- <td>{{file.upload_timestamp|hh_format}}</td>
103
- <td>{{file.parser_name}}</td>
104
- </tr>
105
- {% endfor %}
106
- </tbody>
107
- </table>
108
-
109
- <table>
110
- <caption>Imports</caption>
111
- <thead>
85
+ {% endfor %}
86
+ </tbody>
87
+ </table>
88
+
89
+ <ul>
90
+ <li><a href="/reports/111?batch_id={{batch.id}}">Check Bills</a></li>
91
+ <li><a href="/e/mop_batches/{{batch.id}}/csv">CSV of Bills</a></li>
92
+ </ul>
93
+
94
+ <table class="sticky">
95
+ <caption>Bills [<a href="/e/mop_batches/{{batch.id}}/add_bill">add</a>]</caption>
96
+ <thead>
97
+ <tr>
112
98
  <th>View</th>
113
- <th>Id</th>
114
- </thead>
115
- <tbody>
116
- {% for id in importer_ids %}
117
- <tr>
118
- <td><a href="/e/mop_bill_imports/{{id}}">View</a></td>
119
- <td>{{id}}</td>
120
- </tr>
121
- {% endfor %}
122
- </tbody>
123
- </table>
124
-
125
- <form action="/e/mop_batches/{{batch.id}}">
126
- <fieldset>
127
- <legend>Actions</legend>
128
- <input name="confirm_import_bills" type="submit" value="Import Bills">
129
- <input name="confirm_delete_bills" type="submit" value="Delete Bills">
130
- <input name="confirm_delete_import_bills" type="submit" value="Re-Import Bills">
131
- </fieldset>
132
- </form>
133
-
134
- <ul>
135
- <li><a href="/reports/111?batch_id={{batch.id}}">Check Bills</a></li>
136
- <li><a href="/e/mop_batches/{{batch.id}}/csv">CSV of Bills</a></li>
137
- </ul>
138
-
139
- <table class="sticky">
140
- <caption>Bills [<a href="/e/mop_batches/{{batch.id}}/add_bill">add</a>]</caption>
141
- <thead>
99
+ <th>Reference</th>
100
+ <th>Supply</th>
101
+ <th>Account</th>
102
+ <th>Issue Date</th>
103
+ <th>From</th>
104
+ <th>To</th>
105
+ <th>kWh</th>
106
+ <th>Net</th>
107
+ <th>VAT</th>
108
+ <th>Gross</th>
109
+ <th>Type</th>
110
+ </tr>
111
+ </thead>
112
+ <tbody>
113
+ {% for bill in bills %}
142
114
  <tr>
143
- <th>View</th>
144
- <th>Reference</th>
145
- <th>Supply</th>
146
- <th>Account</th>
147
- <th>Issue Date</th>
148
- <th>From</th>
149
- <th>To</th>
150
- <th>kWh</th>
151
- <th>Net</th>
152
- <th>VAT</th>
153
- <th>Gross</th>
154
- <th>Type</th>
115
+ <td><a href="/e/mop_bills/{{bill.id}}">View</a></td>
116
+ <td>{{bill.reference}}</td>
117
+ <td><a href="/e/supplies/{{bill.supply.id}}">supply</a></td>
118
+ <td>{{ bill.account }}</td>
119
+ <td>{{ bill.issue_date|hh_format }}</td>
120
+ <td>{{ bill.start_date|hh_format }}</td>
121
+ <td>{{ bill.finish_date|hh_format }}</td>
122
+ <td>{{ bill.kwh }}</td>
123
+ <td>{{ bill.net }}</td>
124
+ <td>{{ bill.vat }}</td>
125
+ <td>{{ bill.gross }}</td>
126
+ <td>
127
+ <a href="/bill_types/{{bill.bill_type.id}}"
128
+ title="{{bill.bill_type.description}}">{{bill.bill_type.code}}</a>
129
+ </td>
155
130
  </tr>
156
- </thead>
157
- <tbody>
158
- {% for bill in bills %}
159
- <tr>
160
- <td><a href="/e/mop_bills/{{bill.id}}">View</a></td>
161
- <td>{{bill.reference}}</td>
162
- <td><a href="/e/supplies/{{bill.supply.id}}">supply</a></td>
163
- <td>{{ bill.account }}</td>
164
- <td>{{ bill.issue_date|hh_format }}</td>
165
- <td>{{ bill.start_date|hh_format }}</td>
166
- <td>{{ bill.finish_date|hh_format }}</td>
167
- <td>{{ bill.kwh }}</td>
168
- <td>{{ bill.net }}</td>
169
- <td>{{ bill.vat }}</td>
170
- <td>{{ bill.gross }}</td>
171
- <td>
172
- <a href="/bill_types/{{bill.bill_type.id}}"
173
- title="{{bill.bill_type.description}}">{{bill.bill_type.code}}</a>
174
- </td>
175
- </tr>
176
- {% endfor %}
177
- </tbody>
178
- </table>
179
-
180
- {% endif %}
131
+ {% endfor %}
132
+ </tbody>
133
+ </table>
181
134
 
182
135
  {% endblock %}
@@ -7,12 +7,11 @@
7
7
  {% block nav %}
8
8
  <a href="/e/mop_contracts">MOP Contracts</a> &raquo;
9
9
  <a href="/e/mop_contracts/{{contract.id}}">{{contract.name}}</a> &raquo;
10
- <a href="/e/mop_batches?mop_contract_id={{contract.id}}">Batches</a>
11
- &raquo; Add
10
+ <a href="/e/mop_contracts/{{contract.id}}/batches">Batches</a> &raquo; Add
12
11
  {% endblock %}
13
12
 
14
13
  {% block content %}
15
- <form action="/e/mop_contracts/{{contract.id}}/add_batch" method="post">
14
+ <form action="/e/mop_contracts/{{contract.id}}/batches/add" method="post">
16
15
  <fieldset>
17
16
  <legend>Add a batch</legend>
18
17
  <label>Reference</label>
@@ -7,60 +7,52 @@
7
7
 
8
8
  {% block nav %}
9
9
  <a href="/e/mop_contracts">MOP Contracts</a> &raquo;
10
- <a href="/e/mop_contracts/{{batch.contract.id}}">{{batch.contract.name}}</a>
11
- &raquo;
12
- <a href="/e/mop_batches?mop_contract_id={{batch.contract.id}}">Batches</a>
13
- &raquo;
14
- <a href="/e/mop_batches/{{batch.id}}">{{batch.reference}}</a>
15
- &raquo; Edit
10
+ <a href="/e/mop_contracts/{{batch.contract.id}}">{{batch.contract.name}}</a> &raquo;
11
+ <a href="/e/mop_contracts/{{batch.contract.id}}/batches">Batches</a> &raquo;
12
+ <a href="/e/mop_batches/{{batch.id}}">{{batch.reference}}</a> &raquo; Edit
16
13
  {% endblock %}
17
14
 
18
15
  {% block content %}
19
16
 
20
- {% if request.method == 'GET' and request.values.confirm_delete %}
17
+ <form action="/e/mop_batches/{{batch.id}}/edit" method="post">
18
+ <fieldset>
19
+ <legend>Update batch</legend>
20
+ <label>Reference</label> {{input_text('reference', batch.reference)}}
21
+ <label>Description</label> {{input_text('description', batch.description)}}
22
+ <input type="submit" name="update" value="Update">
23
+ </fieldset>
24
+ </form>
25
+
26
+ <form hx-post="/mop_batches/{{batch_id}}/edit"
27
+ hx-confirm="Are you sure you want to delete all the bills in this batch?">
28
+ <fieldset>
29
+ <legend>Delete All The Bills In This Batch</legend>
30
+ <input type="submit" name="delete_bills" value="Delete">
31
+ </fieldset>
32
+ </form>
33
+
34
+ <form hx-post="/e/mop_batches/{{batch.id}}/edit"
35
+ hx-confirm="Are you sure you want to import the bills from the files into this batch?">
36
+ <fieldset>
37
+ <legend>Import The Bills From The Files Into This Batch</legend>
38
+ <input type="submit" name="import_bills" value="Import">
39
+ </fieldset>
40
+ </form>
41
+
42
+ <form hx-post="/e/mop_batches/{{batch.id}}/edit"
43
+ hx-confirm="Are you sure you want to delete all the bills in this batch and then re-import bills from the files?">
44
+ <fieldset>
45
+ <legend>Delete All The Bills In This Batch And Then Re-Import Bills From The Files</legend>
46
+ <input type="submit" name="delete_import_bills" value="Re-Import">
47
+ </fieldset>
48
+ </form>
49
+
50
+ <form hx-delete="/e/mop_batches/{{batch.id}}/edit"
51
+ hx-confirm="Are you sure you want to delete this batch and all its bills?">
52
+ <fieldset>
53
+ <legend>Delete This Batch</legend>
54
+ <input type="submit" name="confirm_delete" value="Delete">
55
+ </fieldset>
56
+ </form>
21
57
 
22
- <form action="/e/mop_batches/{{batch.id}}/edit" method="post">
23
- <fieldset>
24
- <legend>Are you sure you want to delete this batch and all its bills?</legend>
25
- <input type="submit" name="delete" value="Delete">
26
- <a href="/mop_batches/{{batch.id}}/edit">Cancel</a>
27
- </fieldset>
28
- </form>
29
-
30
- {% elif request.method == 'GET' and request.values.confirm_delete_bills %}
31
-
32
- <form method="post" action="/e/mop_batches/{{batch.id}}/edit">
33
- <fieldset>
34
- <legend>Are you sure you want to delete all the bills in this batch?</legend>
35
- <input type="submit" name="delete_bills" value="Delete">
36
- <a href="/e/mop_batches/{{batch.id}}/edit">Cancel</a>
37
- </fieldset>
38
- </form>
39
-
40
- {% else %}
41
-
42
- <form action="/e/mop_batches/{{batch.id}}/edit" method="post">
43
- <fieldset>
44
- <legend>Update batch</legend>
45
- <label>Reference</label> {{input_text('reference', batch.reference)}}
46
- <label>Description</label> {{input_text('description', batch.description)}}
47
- <input type="submit" name="update" value="Update">
48
- </fieldset>
49
- </form>
50
-
51
- <form action="/e/mop_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 action="/e/mop_batches/{{batch.id}}/edit">
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
58
  {% endblock %}