#26 Annual conservation report

* Adds download as excel sheet
* improves db access performance
This commit is contained in:
2021-10-21 14:58:54 +02:00
parent 419a48cff1
commit 4e89fd9678
10 changed files with 238 additions and 43 deletions

View File

@@ -9,13 +9,13 @@
</div>
<div class="col-sm-12 col-md-12 col-lg-6">
<div class="d-flex justify-content-end">
<div class=" menu-elem dropdown">
<div class="dropdown">
<div class="btn btn" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<button class="btn btn-default" title="{% trans 'Download' %}">
{% fa5_icon 'download' %}
</button>
</div>
<div class="dropdown-menu">
<div class="dropdown-menu dropdown-menu-right">
<a href="{{request.url}}?format=excel&{{request.GET.urlencode}}">
<button class="dropdown-item" title="Excel">
{% fa5_icon 'file-excel' %} Excel

View File

@@ -24,31 +24,31 @@
<tbody>
<tr>
<td>{% trans 'Conservation office by law' %}</td>
<td>{{report.compensation_report.queryset_registration_office_unb_checked.count|default_if_zero:"-"}}</td>
<td>{{report.compensation_report.queryset_registration_office_unb_recorded.count|default_if_zero:"-"}}</td>
<td>{{report.compensation_report.queryset_registration_office_unb_checked_count|default_if_zero:"-"}}</td>
<td>{{report.compensation_report.queryset_registration_office_unb_recorded_count|default_if_zero:"-"}}</td>
<td>{{report.compensation_report.num_single_surfaces_total_unb|default_if_zero:"-"}}</td>
<td>{{report.compensation_report.queryset_registration_office_unb.count|default_if_zero:"-"}}</td>
<td>{{report.compensation_report.queryset_registration_office_unb_count|default_if_zero:"-"}}</td>
</tr>
<tr>
<td>{% trans 'Land-use planning' %}</td>
<td>{{report.compensation_report.queryset_registration_office_tbp_checked.count|default_if_zero:"-"}}</td>
<td>{{report.compensation_report.queryset_registration_office_tbp_recorded.count|default_if_zero:"-"}}</td>
<td>{{report.compensation_report.queryset_registration_office_tbp_checked_count|default_if_zero:"-"}}</td>
<td>{{report.compensation_report.queryset_registration_office_tbp_recorded_count|default_if_zero:"-"}}</td>
<td>{{report.compensation_report.num_single_surfaces_total_tbp|default_if_zero:"-"}}</td>
<td>{{report.compensation_report.queryset_registration_office_tbp.count|default_if_zero:"-"}}</td>
<td>{{report.compensation_report.queryset_registration_office_tbp_count|default_if_zero:"-"}}</td>
</tr>
<tr>
<td>{% trans 'Other registration office' %}</td>
<td>{{report.compensation_report.queryset_registration_office_other_checked.count|default_if_zero:"-"}}</td>
<td>{{report.compensation_report.queryset_registration_office_other_recorded.count|default_if_zero:"-"}}</td>
<td>{{report.compensation_report.queryset_registration_office_other_checked_count|default_if_zero:"-"}}</td>
<td>{{report.compensation_report.queryset_registration_office_other_recorded_count|default_if_zero:"-"}}</td>
<td>{{report.compensation_report.num_single_surfaces_total_other|default_if_zero:"-"}}</td>
<td>{{report.compensation_report.queryset_registration_office_other.count|default_if_zero:"-"}}</td>
<td>{{report.compensation_report.queryset_registration_office_other_count|default_if_zero:"-"}}</td>
</tr>
<tr>
<td><strong>{% trans 'Total' %}</strong></td>
<td><strong>{{report.compensation_report.queryset_checked.count|default_if_zero:"-"}}</strong></td>
<td><strong>{{report.compensation_report.queryset_recorded.count|default_if_zero:"-"}}</strong></td>
<td><strong>{{report.compensation_report.queryset_checked_count|default_if_zero:"-"}}</strong></td>
<td><strong>{{report.compensation_report.queryset_recorded_count|default_if_zero:"-"}}</strong></td>
<td><strong>{{report.compensation_report.num_single_surfaces_total|default_if_zero:"-"}}</strong></td>
<td><strong>{{report.compensation_report.queryset.count|default_if_zero:"-"}}</strong></td>
<td><strong>{{report.compensation_report.queryset_count|default_if_zero:"-"}}</strong></td>
</tr>
</tbody>
</table>

View File

@@ -22,10 +22,10 @@
</thead>
<tbody>
<tr>
<td>{{report.eco_account_report.queryset_old.count|default_if_zero:"-"}}</td>
<td>{{report.eco_account_report.queryset.count|default_if_zero:"-"}}</td>
<td>{{report.eco_account_report.queryset_recorded.count|default_if_zero:"-"}}</td>
<td>{{report.eco_account_report.queryset_total.count|default_if_zero:"-"}}</td>
<td>{{report.eco_account_report.queryset_old_count|default_if_zero:"-"}}</td>
<td>{{report.eco_account_report.queryset_count|default_if_zero:"-"}}</td>
<td>{{report.eco_account_report.queryset_recorded_count|default_if_zero:"-"}}</td>
<td>{{report.eco_account_report.queryset_total_count|default_if_zero:"-"}}</td>
</tr>
</tbody>
</table>

View File

@@ -13,9 +13,9 @@
</thead>
<tbody>
<tr>
<td>{{report.eco_account_report.queryset_deductions_recorded.count|default_if_zero:"-"}}</td>
<td>{{report.eco_account_report.queryset_deductions_recorded_count|default_if_zero:"-"}}</td>
<td>{{report.eco_account_report.recorded_deductions_sq_m|default_if_zero:"-"}}m²</td>
<td>{{report.eco_account_report.queryset_deductions_recorded.count|default_if_zero:"-"}}</td>
<td>{{report.eco_account_report.queryset_deductions_count|default_if_zero:"-"}}</td>
<td>{{report.eco_account_report.deductions_sq_m|default_if_zero:"-"}}m²</td>
</tr>
</tbody>

View File

@@ -21,9 +21,9 @@
</thead>
<tbody>
<tr>
<td>{{report.intervention_report.queryset_checked.count|default_if_zero:"-"}}</td>
<td>{{report.intervention_report.queryset_recorded.count|default_if_zero:"-"}}</td>
<td>{{report.intervention_report.queryset.count|default_if_zero:"-"}}</td>
<td>{{report.intervention_report.queryset_checked_count|default_if_zero:"-"}}</td>
<td>{{report.intervention_report.queryset_recorded_count|default_if_zero:"-"}}</td>
<td>{{report.intervention_report.queryset_count|default_if_zero:"-"}}</td>
</tr>
</tbody>
</table>

View File

@@ -21,9 +21,9 @@
</thead>
<tbody>
<tr>
<td>{{report.old_intervention_report.queryset_checked.count|default_if_zero:"-"}}</td>
<td>{{report.old_intervention_report.queryset_recorded.count|default_if_zero:"-"}}</td>
<td>{{report.old_intervention_report.queryset.count|default_if_zero:"-"}}</td>
<td>{{report.old_intervention_report.queryset_checked_count|default_if_zero:"-"}}</td>
<td>{{report.old_intervention_report.queryset_recorded_count|default_if_zero:"-"}}</td>
<td>{{report.old_intervention_report.queryset_count|default_if_zero:"-"}}</td>
</tr>
</tbody>
</table>