Энергия НК (Галка "По всем участкам")
This commit is contained in:
parent
c865fcf786
commit
e913ca2124
@ -67,6 +67,16 @@
|
||||
</div>
|
||||
</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" checked="">
|
||||
<label for="AllSectors">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<a type="button" onclick="reportshow()" class="btn btn-success">Сформировать</a>
|
||||
@ -152,6 +162,13 @@
|
||||
function reportshow() {
|
||||
var DataStart = $("#id_datestart").val();
|
||||
var DataStop = $("#id_datestop").val();
|
||||
const checkbox = document.getElementById('AllSectors');
|
||||
let AllSectors = false
|
||||
// Проверяем состояние чекбокса
|
||||
if (checkbox.checked) {
|
||||
AllSectors = true
|
||||
}
|
||||
console.log(AllSectors)
|
||||
if (DataStart.trim() == "") {
|
||||
$("#id_datestart").css('border', "3px solid #80bdff").focus();
|
||||
return false;
|
||||
@ -174,6 +191,7 @@
|
||||
"DataStart": DataStart,
|
||||
"DataStop": DataStop,
|
||||
"metod": 'create',
|
||||
"AllSectors": AllSectors
|
||||
},
|
||||
success: function (data) {
|
||||
$('#card_param').CardWidget('collapse')
|
||||
|
||||
@ -39,6 +39,7 @@ def report_show(request, sector):
|
||||
try:
|
||||
if request.method == "POST":
|
||||
dict_param=request.POST.dict()
|
||||
by_all_sectors = True if dict_param['AllSectors'] == 'true' else False
|
||||
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")
|
||||
delta = data_stop - data_start
|
||||
@ -80,12 +81,13 @@ def report_show(request, sector):
|
||||
</thead>
|
||||
<tbody>
|
||||
"""
|
||||
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,
|
||||
}
|
||||
if by_all_sectors:
|
||||
point_indicators_start = PointIndicators.objects.filter(date_time=data_start).all()
|
||||
point_indicators_stop = PointIndicators.objects.filter(date_time=data_stop).all()
|
||||
else:
|
||||
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()
|
||||
|
||||
count_day = delta.days+1
|
||||
for point_indicators_s in point_indicators_start:
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user