Энергия НК (Галка по всем участкам на втором отчете)
This commit is contained in:
parent
e913ca2124
commit
f65ff60cb2
@ -71,7 +71,7 @@
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">По всем участкам:</label>
|
||||
<div class="icheck-primary d-inline" style="margin-left: 10px;">
|
||||
<input type="checkbox" id="AllSectors" name="AllSectors" checked="">
|
||||
<input type="checkbox" id="AllSectors" name="AllSectors">
|
||||
<label for="AllSectors">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@ -78,7 +78,16 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if geoproc_many_sectors == "1" %}
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">По всем участкам:</label>
|
||||
<div class="icheck-primary d-inline" style="margin-left: 10px;">
|
||||
<input type="checkbox" id="AllSectors" name="AllSectors">
|
||||
<label for="AllSectors">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<a type="button" onclick="reportshow()" class="btn btn-success">Сформировать</a>
|
||||
@ -162,6 +171,12 @@
|
||||
});
|
||||
|
||||
function reportshow() {
|
||||
const checkbox = document.getElementById('AllSectors');
|
||||
let AllSectors = false
|
||||
// Проверяем состояние чекбокса
|
||||
if (checkbox.checked) {
|
||||
AllSectors = true
|
||||
}
|
||||
var DataStart = $("#id_datestart").val();
|
||||
var DataStop = $("#id_datestop").val();
|
||||
var variant = $("#id_variant").val();
|
||||
@ -188,6 +203,7 @@
|
||||
"DataStop": DataStop,
|
||||
"metod": 'create',
|
||||
'variant':variant,
|
||||
"AllSectors": AllSectors
|
||||
},
|
||||
success: function (data) {
|
||||
$('#card_param').CardWidget('collapse')
|
||||
|
||||
@ -143,6 +143,7 @@ def report_jc_show_0(request, sector):
|
||||
dict_param=request.POST.dict()
|
||||
data_start=datetime.strptime(dict_param['DataStart']+' 00:00:00', "%d.%m.%Y %H:%M:%S")
|
||||
data_stop=datetime.strptime(dict_param['DataStop']+' 23:59:59', "%d.%m.%Y %H:%M:%S")
|
||||
by_all_sectors = True if dict_param['AllSectors'] == 'true' else False
|
||||
delta = data_stop - data_start
|
||||
html="""
|
||||
<table align="center" id = 'id_table' class='table table-bordered table-striped'>
|
||||
@ -157,7 +158,10 @@ def report_jc_show_0(request, sector):
|
||||
<tbody>
|
||||
"""
|
||||
myquery =Q()
|
||||
myquery &= (Q(journal_vizual__date_time__range=[data_start,data_stop]) & Q(journal_vizual__sector=sector))
|
||||
if by_all_sectors:
|
||||
myquery = Q(journal_vizual__date_time__range=[data_start,data_stop])
|
||||
else:
|
||||
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">"""
|
||||
@ -192,6 +196,7 @@ def report_jc_show_1(request, sector):
|
||||
dict_param=request.POST.dict()
|
||||
data_start=datetime.strptime(dict_param['DataStart']+' 00:00:00', "%d.%m.%Y %H:%M:%S")
|
||||
data_stop=datetime.strptime(dict_param['DataStop']+' 23:59:59', "%d.%m.%Y %H:%M:%S")
|
||||
by_all_sectors = True if dict_param['AllSectors'] == 'true' else False
|
||||
delta = data_stop - data_start
|
||||
html="""
|
||||
<table align="center" id = 'id_table' class='table table-bordered table-striped'>
|
||||
@ -206,7 +211,10 @@ def report_jc_show_1(request, sector):
|
||||
<tbody>
|
||||
"""
|
||||
myquery =Q()
|
||||
myquery &= (Q(journal_vizual__date_time__range=[data_start,data_stop]) & Q(journal_vizual__sector=sector))
|
||||
if by_all_sectors:
|
||||
myquery &= Q(journal_vizual__date_time__range=[data_start,data_stop])
|
||||
else:
|
||||
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">"""
|
||||
@ -242,6 +250,7 @@ def report_jc_show_2(request, sector):
|
||||
dict_param=request.POST.dict()
|
||||
data_start=datetime.strptime(dict_param['DataStart']+' 00:00:00', "%d.%m.%Y %H:%M:%S")
|
||||
data_stop=datetime.strptime(dict_param['DataStop']+' 23:59:59', "%d.%m.%Y %H:%M:%S")
|
||||
by_all_sectors = True if dict_param['AllSectors'] == 'true' else False
|
||||
delta = data_stop - data_start
|
||||
html="""
|
||||
<table align="center" id = 'id_table' class='table table-bordered table-striped'>
|
||||
@ -256,7 +265,11 @@ def report_jc_show_2(request, sector):
|
||||
<tbody>
|
||||
"""
|
||||
myquery =Q()
|
||||
myquery &= (Q(journal_vizual__date_time__range=[data_start,data_stop]) & Q(journal_vizual__sector=sector))
|
||||
|
||||
if by_all_sectors:
|
||||
myquery &= Q(journal_vizual__date_time__range=[data_start, data_stop])
|
||||
else:
|
||||
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">"""
|
||||
@ -293,6 +306,7 @@ def report_jc_show_3(request, sector):
|
||||
dict_param=request.POST.dict()
|
||||
data_start=datetime.strptime(dict_param['DataStart']+' 00:00:00', "%d.%m.%Y %H:%M:%S")
|
||||
data_stop=datetime.strptime(dict_param['DataStop']+' 23:59:59', "%d.%m.%Y %H:%M:%S")
|
||||
by_all_sectors = True if dict_param['AllSectors'] == 'true' else False
|
||||
delta = data_stop - data_start
|
||||
html="""
|
||||
<table align="center" id = 'id_table' class='table table-bordered table-striped'>
|
||||
@ -305,7 +319,10 @@ def report_jc_show_3(request, sector):
|
||||
</thead>
|
||||
<tbody>
|
||||
"""
|
||||
myquery = (Q(sign1=False) | Q(sign2=False)) & Q(journal_vizual__sector=sector)
|
||||
if by_all_sectors:
|
||||
myquery = Q(sign1=False) | Q(sign2=False)
|
||||
else:
|
||||
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+"""
|
||||
|
||||
@ -44,7 +44,7 @@ urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
settingsmodule.settings_install()
|
||||
|
||||
tasks.load_earthquake()
|
||||
tasks.load_navigation()
|
||||
# tasks.load_earthquake()
|
||||
# tasks.load_navigation()
|
||||
|
||||
Update().ready()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user