Энергия НК (Отчеты)
This commit is contained in:
parent
3bbd976abe
commit
c865fcf786
@ -129,13 +129,13 @@
|
||||
<!-- info row -->
|
||||
<div class="row ">
|
||||
<div class="col-sm-2 invoice-col">
|
||||
<a href="/geoproc/report/j/"><strong>Журнал контроля</strong></a>
|
||||
<a href="{% url 'geoproc:report_j' sector.id %}"><strong>Журнал контроля</strong></a>
|
||||
<br>
|
||||
<p style="font-size:12px;fon">Журнал контроля за деформациями</p>
|
||||
|
||||
</div>
|
||||
<div class="col-sm-4 invoice-col">
|
||||
<a href="/geoproc/report/jc/"><strong>Открыть</strong></a>
|
||||
<a href="{% url 'geoproc:report_jc' sector.id %}"><strong>Открыть</strong></a>
|
||||
<br>
|
||||
<p style="font-size:12px;fon">Контроль ведения журналов </p>
|
||||
</div>
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="/geoproc/">Главная</a></li>
|
||||
<li class="breadcrumb-item"><a href="{% url 'geoproc:geoproc_main_with_arg' sector.id %}">Главная</a></li>
|
||||
<li class="breadcrumb-item active">Журнал контроля за деформациями</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="/geoproc/">Главная</a></li>
|
||||
<li class="breadcrumb-item"><a href="{% url 'geoproc:geoproc_main_with_arg' sector.id %}">Главная</a></li>
|
||||
<li class="breadcrumb-item active">Контроль ведения журналов</li>
|
||||
</ol>
|
||||
</div>
|
||||
@ -219,7 +219,7 @@
|
||||
|
||||
}
|
||||
function cancel() {
|
||||
document.location.href = "/geoproc/";
|
||||
document.location.href = "{% url 'geoproc:geoproc_main_with_arg' sector.id %}";
|
||||
}
|
||||
|
||||
function CallPrint(strid) {
|
||||
|
||||
@ -63,6 +63,6 @@ urlpatterns = [
|
||||
path('sector/<int:pk>/monitoring/journal_obs/save/', views_monitoring_obs.monitoring_journal_save, name='monitoring_journal_obs_save'),
|
||||
|
||||
# Отчеты
|
||||
path('report/j/', views_report.report_j, name='report_j'),
|
||||
path('report/jc/', views_report.report_jc, name='report_jc'),
|
||||
path('sector/<int:pk>/report/j/', views_report.report_j, name='report_j'),
|
||||
path('sector/<int:pk>/report/jc/', views_report.report_jc, name='report_jc'),
|
||||
]
|
||||
|
||||
@ -7,7 +7,7 @@ from datetime import datetime,timedelta
|
||||
from requests.auth import HTTPBasicAuth
|
||||
from django.conf import settings
|
||||
from django.db.models import Q
|
||||
from django.shortcuts import render
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from django.http import HttpResponse
|
||||
from django.conf import settings
|
||||
from django.shortcuts import redirect
|
||||
@ -26,11 +26,7 @@ from apps.geoproc.models.model_journalvisual_table import JournalVizualTable
|
||||
from apps.geoproc.models.model_journalvisual_table_m import JournalVizualTableM
|
||||
|
||||
from apps.geoproc.models.model_journalobs_table import JournalObsTable
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
from apps.geoproc.models.model_sector import Sector
|
||||
|
||||
from apps.util import generalmodule
|
||||
from sabron.util import logging
|
||||
@ -39,7 +35,7 @@ from sabron.util import logging
|
||||
|
||||
@login_required(login_url='/accounts/login/?next=')
|
||||
@never_cache
|
||||
def report_show(request):
|
||||
def report_show(request, sector):
|
||||
try:
|
||||
if request.method == "POST":
|
||||
dict_param=request.POST.dict()
|
||||
@ -84,8 +80,8 @@ def report_show(request):
|
||||
</thead>
|
||||
<tbody>
|
||||
"""
|
||||
point_indicators_start = PointIndicators.objects.filter(date_time=data_start).all()
|
||||
point_indicators_stop = PointIndicators.objects.filter(date_time=data_stop).all()
|
||||
point_indicators_start = PointIndicators.objects.filter(date_time=data_start, point__sector=sector).all()
|
||||
point_indicators_stop = PointIndicators.objects.filter(date_time=data_stop, point__sector=sector).all()
|
||||
context = {
|
||||
'point_indicators_start':point_indicators_start,
|
||||
'point_indicators_stop':point_indicators_stop,
|
||||
@ -139,7 +135,7 @@ def report_show(request):
|
||||
|
||||
@login_required(login_url='/accounts/login/?next=')
|
||||
@never_cache
|
||||
def report_jc_show_0(request):
|
||||
def report_jc_show_0(request, sector):
|
||||
try:
|
||||
if request.method == "POST":
|
||||
dict_param=request.POST.dict()
|
||||
@ -159,7 +155,7 @@ def report_jc_show_0(request):
|
||||
<tbody>
|
||||
"""
|
||||
myquery =Q()
|
||||
myquery &= Q(journal_vizual__date_time__range=[data_start,data_stop])
|
||||
myquery &= (Q(journal_vizual__date_time__range=[data_start,data_stop]) & Q(journal_vizual__sector=sector))
|
||||
journal_list = JournalVizualTable.objects.filter(myquery).prefetch_related("journal_vizual").all()
|
||||
for journal in journal_list:
|
||||
html=html+"""<tr align="center">"""
|
||||
@ -188,7 +184,7 @@ def report_jc_show_0(request):
|
||||
|
||||
@login_required(login_url='/accounts/login/?next=')
|
||||
@never_cache
|
||||
def report_jc_show_1(request):
|
||||
def report_jc_show_1(request, sector):
|
||||
try:
|
||||
if request.method == "POST":
|
||||
dict_param=request.POST.dict()
|
||||
@ -208,7 +204,7 @@ def report_jc_show_1(request):
|
||||
<tbody>
|
||||
"""
|
||||
myquery =Q()
|
||||
myquery &= Q(journal_vizual__date_time__range=[data_start,data_stop])
|
||||
myquery &= (Q(journal_vizual__date_time__range=[data_start,data_stop]) & Q(journal_vizual__sector=sector))
|
||||
journal_list = JournalVizualTableM.objects.filter(myquery).prefetch_related("journal_vizual").all()
|
||||
for journal in journal_list:
|
||||
html=html+"""<tr align="center">"""
|
||||
@ -238,7 +234,7 @@ def report_jc_show_1(request):
|
||||
|
||||
@login_required(login_url='/accounts/login/?next=')
|
||||
@never_cache
|
||||
def report_jc_show_2(request):
|
||||
def report_jc_show_2(request, sector):
|
||||
try:
|
||||
if request.method == "POST":
|
||||
dict_param=request.POST.dict()
|
||||
@ -258,7 +254,7 @@ def report_jc_show_2(request):
|
||||
<tbody>
|
||||
"""
|
||||
myquery =Q()
|
||||
myquery &= Q(journal_vizual__date_time__range=[data_start,data_stop])
|
||||
myquery &= (Q(journal_vizual__date_time__range=[data_start,data_stop]) & Q(journal_vizual__sector=sector))
|
||||
journal_list = JournalObsTable.objects.filter(myquery).prefetch_related("journal_vizual").all()
|
||||
for journal in journal_list:
|
||||
html=html+"""<tr align="center">"""
|
||||
@ -289,7 +285,7 @@ def report_jc_show_2(request):
|
||||
|
||||
@login_required(login_url='/accounts/login/?next=')
|
||||
@never_cache
|
||||
def report_jc_show_3(request):
|
||||
def report_jc_show_3(request, sector):
|
||||
try:
|
||||
if request.method == "POST":
|
||||
dict_param=request.POST.dict()
|
||||
@ -307,7 +303,7 @@ def report_jc_show_3(request):
|
||||
</thead>
|
||||
<tbody>
|
||||
"""
|
||||
myquery = Q(sign1=False) | Q(sign2=False)
|
||||
myquery = (Q(sign1=False) | Q(sign2=False)) & Q(journal_vizual__sector=sector)
|
||||
journal_list = JournalVizualTable.objects.filter(myquery).prefetch_related("journal_vizual").all()
|
||||
for journal in journal_list:
|
||||
html=html+"""
|
||||
@ -448,36 +444,38 @@ def report_jc_show_4(request):
|
||||
|
||||
@login_required(login_url='/accounts/login/?next=')
|
||||
@never_cache
|
||||
def report_j(request):
|
||||
def report_j(request, pk):
|
||||
try:
|
||||
sector = get_object_or_404(Sector, id=pk)
|
||||
if request.method == "GET":
|
||||
context = {
|
||||
}
|
||||
return render(request, 'report/report_j.html',context)
|
||||
context = generalmodule.get_context_template()
|
||||
context['sector'] = sector
|
||||
return render(request, 'report/report_j.html', context)
|
||||
else:
|
||||
return report_show(request)
|
||||
return report_show(request, sector=sector)
|
||||
except Exception as err:
|
||||
logging.error(traceback.format_exc())
|
||||
|
||||
|
||||
@login_required(login_url='/accounts/login/?next=')
|
||||
@never_cache
|
||||
def report_jc(request):
|
||||
def report_jc(request, pk):
|
||||
try:
|
||||
sector = get_object_or_404(Sector, id=pk)
|
||||
if request.method == "GET":
|
||||
context = {
|
||||
}
|
||||
context = generalmodule.get_context_template()
|
||||
context['sector'] = sector
|
||||
return render(request, 'report/report_jc.html',context)
|
||||
else:
|
||||
param = request.POST.dict()
|
||||
if param['variant'] == "0":
|
||||
return report_jc_show_0(request)
|
||||
return report_jc_show_0(request, sector)
|
||||
elif param['variant'] == "1":
|
||||
return report_jc_show_1(request)
|
||||
return report_jc_show_1(request, sector)
|
||||
elif param['variant'] == "2":
|
||||
return report_jc_show_2(request)
|
||||
return report_jc_show_2(request, sector)
|
||||
elif param['variant'] == "3":
|
||||
return report_jc_show_3(request)
|
||||
return report_jc_show_3(request, sector)
|
||||
|
||||
return report_show(request)
|
||||
except Exception as err:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user