#26 Annual conservation report
* finishes intervention analysis report for cases before 16.06.2018 (LKompVzVo)
This commit is contained in:
parent
647d087efe
commit
b9b1d64278
12
analysis/settings.py
Normal file
12
analysis/settings.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
"""
|
||||||
|
Author: Michel Peltriaux
|
||||||
|
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
|
||||||
|
Contact: michel.peltriaux@sgdnord.rlp.de
|
||||||
|
Created on: 19.10.21
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
# Defines the date of the legal publishing of the LKompVzVo
|
||||||
|
LKOMPVZVO_PUBLISH_DATE = datetime.date.fromisoformat("2018-06-16")
|
@ -12,6 +12,6 @@
|
|||||||
{% include 'analysis/reports/includes/intervention/card_intervention.html' %}
|
{% include 'analysis/reports/includes/intervention/card_intervention.html' %}
|
||||||
{% include 'analysis/reports/includes/compensation/card_compensation.html' %}
|
{% include 'analysis/reports/includes/compensation/card_compensation.html' %}
|
||||||
{% include 'analysis/reports/includes/card_eco_account.html' %}
|
{% include 'analysis/reports/includes/card_eco_account.html' %}
|
||||||
{% include 'analysis/reports/includes/card_old_interventions.html' %}
|
{% include 'analysis/reports/includes/old_intervention/card_old_interventions.html' %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -0,0 +1,30 @@
|
|||||||
|
{% load i18n fontawesome_5 ksp_filters %}
|
||||||
|
|
||||||
|
<h3>{% trans 'Amount' %}</h3>
|
||||||
|
<strong>
|
||||||
|
{% blocktrans %}
|
||||||
|
Checked = Has been checked by the registration office according to LKompVzVo
|
||||||
|
{% endblocktrans %}
|
||||||
|
<br>
|
||||||
|
{% blocktrans %}
|
||||||
|
Recorded = Has been checked and published by the conservation office
|
||||||
|
{% endblocktrans %}
|
||||||
|
</strong>
|
||||||
|
<div class="table-container">
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">{% fa5_icon 'star' %} {% trans 'Checked' %}</th>
|
||||||
|
<th scope="col">{% fa5_icon 'bookmark' %} {% trans 'Recorded' %}</th>
|
||||||
|
<th scope="col" class="w-25">{% trans 'Total' %}</th>
|
||||||
|
</tr>
|
||||||
|
</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>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
@ -16,7 +16,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="oldInterventionBody" class="collapse" aria-labelledby="oldIntervention">
|
<div id="oldInterventionBody" class="collapse" aria-labelledby="oldIntervention">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
{% include 'form/table/generic_table_form_body.html' %}
|
{% include 'analysis/reports/includes/old_intervention/amount.html' %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@ -8,6 +8,7 @@ Created on: 18.10.21
|
|||||||
from django.contrib.gis.db.models.functions import NumGeometries
|
from django.contrib.gis.db.models.functions import NumGeometries
|
||||||
from django.db.models import Count, Sum, Q
|
from django.db.models import Count, Sum, Q
|
||||||
|
|
||||||
|
from analysis.settings import LKOMPVZVO_PUBLISH_DATE
|
||||||
from codelist.models import KonovaCode
|
from codelist.models import KonovaCode
|
||||||
from codelist.settings import CODELIST_LAW_ID
|
from codelist.settings import CODELIST_LAW_ID
|
||||||
from compensation.models import Compensation, Payment, EcoAccountDeduction
|
from compensation.models import Compensation, Payment, EcoAccountDeduction
|
||||||
@ -23,6 +24,7 @@ class TimespanReport:
|
|||||||
queryset_checked = Intervention.objects.none()
|
queryset_checked = Intervention.objects.none()
|
||||||
queryset_recorded = Intervention.objects.none()
|
queryset_recorded = Intervention.objects.none()
|
||||||
|
|
||||||
|
|
||||||
# Law related
|
# Law related
|
||||||
law_sum = -1
|
law_sum = -1
|
||||||
law_sum_checked = -1
|
law_sum_checked = -1
|
||||||
@ -43,6 +45,7 @@ class TimespanReport:
|
|||||||
def __init__(self, id: str):
|
def __init__(self, id: str):
|
||||||
self.queryset = Intervention.objects.filter(
|
self.queryset = Intervention.objects.filter(
|
||||||
responsible__conservation_office__id=id,
|
responsible__conservation_office__id=id,
|
||||||
|
legal__registration_date__gt=LKOMPVZVO_PUBLISH_DATE,
|
||||||
deleted=None,
|
deleted=None,
|
||||||
)
|
)
|
||||||
self.queryset_checked = self.queryset.filter(
|
self.queryset_checked = self.queryset.filter(
|
||||||
@ -157,6 +160,7 @@ class TimespanReport:
|
|||||||
def __init__(self, id: str):
|
def __init__(self, id: str):
|
||||||
self.queryset = Compensation.objects.filter(
|
self.queryset = Compensation.objects.filter(
|
||||||
intervention__responsible__conservation_office__id=id,
|
intervention__responsible__conservation_office__id=id,
|
||||||
|
intervention__legal__registration_date__gt=LKOMPVZVO_PUBLISH_DATE,
|
||||||
deleted=None,
|
deleted=None,
|
||||||
)
|
)
|
||||||
self.queryset_checked = self.queryset.filter(
|
self.queryset_checked = self.queryset.filter(
|
||||||
@ -261,7 +265,26 @@ class TimespanReport:
|
|||||||
intervention__checked__isnull=False,
|
intervention__checked__isnull=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
class OldInterventionReport:
|
||||||
|
queryset = Compensation.objects.none()
|
||||||
|
queryset_checked = Compensation.objects.none()
|
||||||
|
queryset_recorded = Compensation.objects.none()
|
||||||
|
|
||||||
|
def __init__(self, id: str):
|
||||||
|
self.queryset = Intervention.objects.filter(
|
||||||
|
legal__registration_date__lte=LKOMPVZVO_PUBLISH_DATE,
|
||||||
|
responsible__conservation_office__id=id,
|
||||||
|
deleted=None,
|
||||||
|
)
|
||||||
|
self.queryset_checked = self.queryset.filter(
|
||||||
|
checked__isnull=False
|
||||||
|
)
|
||||||
|
self.queryset_recorded = self.queryset.filter(
|
||||||
|
recorded__isnull=False
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, office_id: str):
|
def __init__(self, office_id: str):
|
||||||
self.office_id = office_id
|
self.office_id = office_id
|
||||||
self.intervention_report = self.InterventionReport(self.office_id)
|
self.intervention_report = self.InterventionReport(self.office_id)
|
||||||
self.compensation_report = self.CompensationReport(self.office_id)
|
self.compensation_report = self.CompensationReport(self.office_id)
|
||||||
|
self.old_intervention_report = self.OldInterventionReport(self.office_id)
|
||||||
|
@ -31,23 +31,19 @@ def index_reports_view(request: HttpRequest):
|
|||||||
|
|
||||||
|
|
||||||
def detail_report_view(request: HttpRequest, id: str):
|
def detail_report_view(request: HttpRequest, id: str):
|
||||||
|
""" Renders the detailed report for a conservation office
|
||||||
|
|
||||||
|
Args:
|
||||||
|
request (HttpRequest): The incoming request
|
||||||
|
id (str): The conservation_office KonovaCode id
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
cons_office = get_object_or_404(
|
cons_office = get_object_or_404(
|
||||||
KonovaCode,
|
KonovaCode,
|
||||||
id=id,
|
id=id,
|
||||||
)
|
)
|
||||||
cons_interventions = Intervention.objects.filter(
|
|
||||||
responsible__conservation_office__id=id,
|
|
||||||
deleted=None,
|
|
||||||
)
|
|
||||||
cons_comps = Compensation.objects.filter(
|
|
||||||
intervention__in=cons_interventions,
|
|
||||||
deleted=None,
|
|
||||||
)
|
|
||||||
cons_eco_account = EcoAccount.objects.filter(
|
|
||||||
responsible__conservation_office__id=id,
|
|
||||||
deleted=None,
|
|
||||||
)
|
|
||||||
|
|
||||||
report = TimespanReport(id)
|
report = TimespanReport(id)
|
||||||
|
|
||||||
template = "analysis/reports/detail.html"
|
template = "analysis/reports/detail.html"
|
||||||
|
Loading…
Reference in New Issue
Block a user