DevExpress.config({ editorStylingMode: "filled" }); var kot = ["dohromady", "B4", "B5", "B7"]; var kotle = [{"name":"B4"}, {"name":"B5"}, {"name":"B7"}]; var footer = ["průměr","minimum","maximum","suma"]; var footer2 = ["minimum","maximum","suma"]; var cas = ["měsíc", "3 měsíce", "rok", "vše"]; var typAV = ["vzorkovač pro K4", "vzorkovač pro K5", "vzorkovač pro K7"]; var SILO = ["SF4 - V14", "SF5 - V15", "SF7 - V17", "LP - V2"]; window.ShowChart60 = 0; window.ShowChart15 = 0; window.VLDateFrom = "*"; window.VLDateTo = "*"; window.DateFrom60 = "*"; window.DateTo60 = "*"; window.DateFrom15 = "*"; window.DateTo15 = "*"; window.JidelnicekMisto = 1; window.SILODateFrom = "*"; function LoadFrm($data) { console.log('LoadFrm: '+$data); if ($data=='El-60') { ElFrm();} else if ($data=='El-15') { El15Frm(); } else if ($data=='Gas') { GasFrm(); } else if ($data=='GasGrid') { GasGridFrm(); } else if ($data=='ElDiagramFrm') { ElDiagramFrm(); } else if ($data=='HomeTemperature') { TemperatureFrm(); } else if ($data=='HomePressure') { PressureFrm(); } else if ($data=='Lab') { AVFrm(); } else if ($data=='Lab-VP') { VPFrm(); } else if ($data=='Lab-NE') { NEFrm(); } else if ($data=='Lab-CH') { CHFrm(); } else if ($data=='Contacts') { ContactFrm(); } else if ($data=='KatalogKKS') { SignalyKKSFrm(); } else if ($data=='Jid-LOG') { JidLogFrm(); } else if ($data=='Jid-SOUHRN') { JidStatFrm(); } else if ($data=='Jid-JIDELNICEK') { JidJidelnicekFrm(); } else if ($data=='Jid-SEZNAM') { JidSeznamFrm(); } else if ($data=='Jid-OBJ') { JidObjednatFrm(); ObjednatReadData(); } else if ($data=='Papers') { VLFrm(); } else if ($data=='Papers-Pivot') { VLPivotFrm(); } else if ($data=='Remit') { ReFrm(); } else if ($data=='Coal') { CoalFrm(); } else if ($data=='Temperature') { TemperatureFrm(); } else if ($data=='FT') { FTFrm(); } else if ($data=='Temperature-Day') { TemperatureDayFrm(); } else if ($data=='Pressure') { PressureFrm(); } else if ($data=='Pressure-Day') { PressureDayFrm(); } else if ($data=='SILO') { SILOFrm(); } else if ($data=='HomeHelp') { } else if ($data=='HomeFiles') { } else if ($data=='Data-KKS-min') { DataKKSminFrm(); } else if ($data=='DRE-KKS') { DrevosrotFrm();} else if ($data=='DRE-SM-HO') { DrevosrotSMFrm();} else { HomeFrm(); } } function prepareMenuListener() { var $MainMenu = document.querySelector('#MainMenu'); console.log('prepareMenuListener'); $MainMenu.addEventListener('click', function(e){ if(e.target != e.currentTarget){ e.preventDefault(); var $data = e.target.getAttribute('data-name'), url = "/login/?p="+$data; history.pushState($data, null, url); document.title = "Teplárna Kladno | " + $data; console.log($data); LoadFrm($data); } e.stopPropagation(); }, false); } /* id: -1 */ var dateList = ["10/2025","9/2025","8/2025","7/2025","6/2025","5/2025","4/2025","3/2025","2/2025","1/2025","12/2024","11/2024"]; var yearList = ["2025","2024","2023","2022","2021","2020","2019","2018","2017","2016","2015","2014"]; var $loader ='
';
window.GetDate = 0;
var dateFrom = $("#dateFrom60Max").dxDateBox("instance");
var dateBoxValueFrom = new Date ( dateFrom.option('value') );
var dateTo = $("#dateTo60Max").dxDateBox("instance");
var dateBoxValueTo = new Date ( dateTo.option('value') );
var $Datum1 = dateBoxValueFrom.getDate()+'.'+(dateBoxValueFrom.getMonth()+1)+'.'+dateBoxValueFrom.getFullYear();
var $Datum2 = dateBoxValueTo.getDate()+'.'+(dateBoxValueTo.getMonth()+1)+'.'+dateBoxValueTo.getFullYear();
/* console.log(window.ElCombo); */
$.ajax({
url: "AjaxOdbElHmax.php?c="+window.ElCombo+"&t1="+$Datum1+"&t2="+$Datum2+"&m="+window.ElMista,
type: "POST",
data: { c: window.ElCombo, t1: $Datum1, t2: $Datum2, m: window.ElMista },
dataType: "text",
success: function(result) {
/* console.log(); */
document.getElementById("InfoElModalBody").innerHTML = result;
}
});
}
function ElPrepareSel($fullRefresh) {
window.GetDate = 0;
if ($fullRefresh == 1) {
document.getElementById("chart60mmt").classList.remove("hide");
document.getElementById("chart60").classList.add("hide");
}
var loadPanelOdbery60 = $("#LoadPanelOdbery").dxLoadPanel({
shadingColor: "rgba(0,0,0,0)",
position: { of: "#gridHodinoveOdbery" },
visible: false,
showIndicator: true,
showPane: true,
shading: true,
closeOnOutsideClick: true,
onShown: function(){ },
onHidden: function(){ }
}).dxLoadPanel("instance");
var loadPanelChart60 = $("#chart60mmt").dxLoadPanel({
shadingColor: "rgba(0,0,0,0)",
position: { of: "#chart60mmt" },
visible: false,
showIndicator: true,
showPane: true,
shading: true,
closeOnOutsideClick: true,
onShown: function(){ },
onHidden: function(){ }
}).dxLoadPanel("instance");
if ($fullRefresh == 1) { loadPanelChart60.show(); }
loadPanelOdbery60.show();
console.log('Prepare Sel');
var chgridDays = $("#ch-gridDays").dxCheckBox('instance');
var TagHours = $("#tag-gridHodinoveOdbery").dxTagBox('instance');
var dateFrom = $("#DateGrid60From").dxDateBox("instance");
var dateBoxValueFrom = new Date ( dateFrom.option('value') );
window.DateFrom60 = dateBoxValueFrom;
var dateTo = $("#DateGrid60To").dxDateBox("instance");
var dateBoxValueTo = new Date ( dateTo.option('value') );
window.DateTo60 = dateBoxValueTo;
var $Datum1 = dateBoxValueFrom.getDate()+'.'+(dateBoxValueFrom.getMonth()+1)+'.'+dateBoxValueFrom.getFullYear();
var $Datum2 = dateBoxValueTo.getDate()+'.'+(dateBoxValueTo.getMonth()+1)+'.'+dateBoxValueTo.getFullYear();
var $SoNeSv = ( chgridDays.option("value") );
var $TagHoursV = ( TagHours.option("value") );
/* console.log("AjaxOdbElH.php?c="+window.ElCombo+"&t1="+$Datum1+"&t2="+$Datum2+"&sns="+$SoNeSv+"&h="+$TagHoursV+"&m="+window.ElMista); */
$HourSerie = '';
for ($i=0;$i<$TagHoursV.length;$i++) { $HourSerie = $HourSerie + $TagHoursV[$i]+','; }
console.log($HourSerie);
$.ajax({
url: "AjaxOdbElH.php",
dataType: "script",
type: "POST",
data: { c: window.ElCombo, t1: $Datum1, t2: $Datum2, sns: $SoNeSv, ho:$HourSerie, m: window.ElMista },
success: function(result) {
console.log(result);
$("#gridHodinoveOdbery").dxDataGrid({ dataSource: HodinoveOdbery });
/* document.getElementById("TotalEquation").innerHTML = ElRovnice; */
/* if (ElRovnice !== '-') { document.getElementById("rowEquation").classList.remove("hide"); } */
/* else { document.getElementById("rowEquation").classList.add("hide"); } */
if (($fullRefresh == 1) && (window.ShowChart60 == 1)) {
document.getElementById("ContainerChart60").classList.remove("hide");
/* console.log("AjaxOdbElHChart.php?m="+window.ElMista+"&c="+window.ElCombo+"&t1="+$Datum1+"&t2="+$Datum2); */
$.ajax({
url: "AjaxOdbElHChart.php?m="+window.ElMista+"&c="+window.ElCombo+"&t1="+$Datum1+"&t2="+$Datum2,
dataType : "script",
success: function(result) {
console.log(result);
var states = {};
setTimeout(function(){
var zoomedChart60 = $("#chart60").dxChart({
size: { height: 400 },
palette: "Harmony Light",
title: { text: "Graf průběhu odběru" },
dataSource: DataChart60,
pointSelectionMode: "single",
"export": { enabled: true },
behavior: { callValueChanged: "onMoving" },
commonSeriesSettings: {
arumentField: "CAS",
type: "line",
point: { visible: false }
},
legend: {
verticalAlignment: "bottom",
horizontalAlignment: "center",
itemTextPosition: "bottom",
visible: true
},
tooltip: {
enabled: true,
customizeTooltip: function (arg) {
return { text: arg.valueText };
}
},
onPointClick: function(e) {
var point = e.target;
point.showTooltip();
},
onLegendClick: function(e) {
var series = e.target;
if(series.isVisible()) {
series.hide();
} else {
series.show();
}
},
series: [
{
argumentField: "CAS",
valueField: "ODBER",
name: "činný odběr"
},
{
argumentField: "CAS",
valueField: "JALOVY",
name: "jalový odběr"
},
{
argumentField: "CAS",
valueField: "JALOVA_DO",
name: "jalová dodávka"
}
],
scrollBar: { visible: false }
}).dxChart("instance");
$("#rangeSelector60").dxRangeSelector({
size: { height: 120 },
margin: { },
scale: { minorTickCount:1 },
dataSource: DataChart60,
chart: {
series: [
{
argumentField: "CAS",
valueField: "ODBER",
name: "činný odběr"
},
{
argumentField: "CAS",
valueField: "JALOVY",
name: "jalový odběr"
},
{
argumentField: "CAS",
valueField: "JALOVA_DO",
name: "jalová dodávka"
}
],
palette: "Harmony Light"
},
behavior: { callValueChanged: "onMoving" },
onValueChanged: function (e) {
var zoomedChart60 = $("#chart60").dxChart("instance");
zoomedChart60.getArgumentAxis().visualRange(e.value);
}
});
}, 1000);
loadPanelChart60.hide();
document.getElementById("chart60mmt").classList.add("hide");
document.getElementById("chart60").classList.remove("hide");
/* zoomedChart60.zoomArgument(300, 500); */
}
});
} // full refresh
loadPanelOdbery60.hide();
} // success
});
}
function ElRangeSel() {
var $d1 = new Date("2025/10/1");
var $d2 = new Date("2025/11/1");
console.log('2025, 10, 07 2025, 11, 1');
}
function ElGrid () {
window.ElCombo = 0;
var FiltrGroup = ["činný odběr [KWh]","jalový odběr [Kvarh]","jalová dodávka [Kvarh]"];
var TagHodiny = [{TagID:1, TagName: "1:00"},{TagID:2, TagName: "2:00"},{TagID:3, TagName: "3:00"},{TagID:4, TagName: "4:00"},{TagID:5, TagName: "5:00"},{TagID:6, TagName: "6:00"},{TagID:7, TagName: "7:00"},{TagID:8, TagName: "8:00"},{TagID:9, TagName: "9:00"},{TagID:10, TagName: "10:00"},{TagID:11, TagName: "11:00"},{TagID:12, TagName: "12:00"},{TagID:13, TagName: "13:00"},{TagID:14, TagName: "14:00"},{TagID:15, TagName: "15:00"},{TagID:16, TagName: "16:00"},{TagID:17, TagName: "17:00"},{TagID:18, TagName: "18:00"},{TagID:19, TagName: "19:00"},{TagID:20, TagName: "20:00"},{TagID:21, TagName: "21:00"},{TagID:22, TagName: "22:00"},{TagID:23, TagName: "23:00"},{TagID:24, TagName: "24:00"},{TagID:25, TagName: "25:00"}]; var now = new Date();
var d1 = now - (60*60*1000*24*7);
var d2 = now;
if (window.DateFrom60 !== '*') { d1 = window.DateFrom60; d2 = window.DateTo60; }
/*
$("#dateFrom60").dxDateBox({
type: "date",
displayFormat: "dd.MM.yyyy",
value: d1,
onValueChanged: function(e) {
ElPrepareSel(1);
}
});
$("#dateTo60").dxDateBox({
type: "date",
displayFormat: "dd.MM.yyyy",
value: d2,
onValueChanged: function(e) {
ElPrepareSel(1);
}
});
*/
$("#dateFrom60Max").dxDateBox({
type: "date",
displayFormat: "dd.MM.yyyy",
value: d1,
onValueChanged: function(e) {
Load60Max();
}
});
$("#dateTo60Max").dxDateBox({
type: "date",
displayFormat: "dd.MM.yyyy",
value: d2,
onValueChanged: function(e) {
Load60Max();
}
});
/*
$("#Btn60").dxButton({
text: "načíst data",
type: "default",
width: 120,
onClick: function(e) {
ElPrepareSel(1);
}
});
*/
$("#ch-gridDays").dxCheckBox({
value: true,
text: "zobrazovat Soboty + Neděle + Svátky",
onValueChanged: function(data) {
ElPrepareSel(0);
}
});
$("#tag-gridHodinoveOdbery").dxTagBox({
items: TagHodiny,
value: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25], displayExpr: "TagName",
valueExpr: "TagID",
showSelectionControls: true,
applyValueMode: "useButtons",
placeholder: "Hodiny...",
showClearButton: true,
multiline: true,
onValueChanged: function(data) {
ElPrepareSel(0);
}
});
$("#btnTagSet1").dxButton({
text: "0 - 8, 21 - 24 hod.",
type: "normal",
onClick: function(e) {
$("#tag-gridHodinoveOdbery").dxTagBox({ value: [1,2,3,4,5,6,7,8,21,22,23,24,25] });
$("#btnTagSet1").dxButton({ type: "default" });
$("#btnTagSet2").dxButton({ type: "normal" });
$("#btnTagSet3").dxButton({ type: "normal" });
}
});
$("#btnTagSet2").dxButton({
text: "9 - 20 hod.",
type: "normal",
onClick: function(e) {
$("#tag-gridHodinoveOdbery").dxTagBox({ value: [9,10,11,12,13,14,15,16,17,18,19,20] });
$("#btnTagSet1").dxButton({ type: "normal" });
$("#btnTagSet2").dxButton({ type: "default" });
$("#btnTagSet3").dxButton({ type: "normal" });
}
});
$("#btnTagSet3").dxButton({
text: "0 - 24 hod.",
type: "default",
onClick: function(e) {
$("#tag-gridHodinoveOdbery").dxTagBox({ value: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25] });
$("#btnTagSet1").dxButton({ type: "normal" });
$("#btnTagSet2").dxButton({ type: "normal" });
$("#btnTagSet3").dxButton({ type: "default" });
}
});
$.ajax({
url: "AjaxOdbElH.php",
dataType : "script",
success: function(result) {
console.log(result);
console.log('###');
/* document.getElementById("TotalEquation").innerHTML = ElRovnice; */
console.log( "Prepare grid odbery" );
indexOdbernaMista = OdbernaMista.indexOf(window.ListItem);
if ((!indexOdbernaMista)||(indexOdbernaMista< 0)) { indexOdbernaMista = 0;}
window.ElMista = OdbernaMista[indexOdbernaMista];
console.log('t:'+window.ElMista+'/'+indexOdbernaMista);
$("#gridHodinoveOdbery").dxDataGrid({
dataSource: HodinoveOdbery,
allowColumnResizing: true,
rowAlternationEnabled: true,
allowColumnReordering: true,
columnResizingMode: "widget",
showBorders: true,
showRowLines: true,
columnMinWidth: 30,
paging: { enabled: false },
columnFixing: { enabled: true },
filterPanel: { visible: true },
filterRow: { visible: false, applyFilter: "auto" },
headerFilter: { visible: true },
sorting: { mode: "multiple" },
scrolling: { mode: "virtual", useNative: true },
selection: { mode: "single" },
sorting: { mode: "multiple" },
export: { enabled: true, allowExportSelectedData: false, formats: ['xlsx'], },
onExporting(e) {
const workbook = new ExcelJS.Workbook();
const worksheet = workbook.addWorksheet('Companies');
DevExpress.excelExporter.exportDataGrid({
component: e.component,
worksheet,
autoFilterEnabled: true,
}).then(() => {
workbook.xlsx.writeBuffer().then((buffer) => {
saveAs(new Blob([buffer], { type: 'application/octet-stream' }), 'Odbery-60.xlsx');
});
});
},
onSelectionChanged: function (selectedItems) { window.GetDate = 0; },
toolbar: {
items: [
{
location: "before",
widget: "dxButton",
type: "danger",
options: {
icon: "clearformat",
type: "danger",
hint: "Zrušit filtrační podmínky ...",
onClick: function() {
DevExpress.ui.notify("ruším filtrační podmínky ...","info",500);
var dataGrid = $('#gridHodinoveOdbery').dxDataGrid('instance');
dataGrid.clearFilter();
dataGrid.clearSorting();
}
}
},
{
location: "after",
widget: "dxButton",
type: "default",
options: {
icon: "info",
type: "default",
text: "max",
visible: false,
hint: "rychlé určení maxima",
onClick: function() {
Load60Max();
$('#InfoElModal').modal({ show: true });
}
}
},
{
location: "after",
widget: "dxButton",
type: "default",
options: {
icon: "file",
type: "default",
text: ".CSV",
hint: "exportovat do .CSV",
onClick: function() {
ElPrepareExportCSV(0);
}
}
},
{
location: "after",
widget: "dxButton",
type: "default",
options: {
icon: "file",
type: "default",
text: ".CSV dohromady",
hint: "exportovat všechna místa do .CSV",
onClick: function() {
ElPrepareExportCSV(1);
}
}
},
{
location: "after",
widget: "dxButton",
type: "default",
options: {
icon: "far fa-chart-bar",
type: "default",
hint: "zobrazit / skrýt graf",
onClick: function() {
if (window.ShowChart60 == 1) { window.ShowChart60 = 0; } else { window.ShowChart60 = 1; }
if (window.ShowChart60 == 1) {
document.getElementById("ContainerChart60").classList.remove("hide");
ElPrepareSel(1);
} else {
document.getElementById("ContainerChart60").classList.add("hide");
}
}
}
},
{
location: "before",
widget: "dxSelectBox",
options: {
items: OdbernaMista,
acceptCustomValue: false,
width: 250,
label: "odběrné místo",
value: OdbernaMista[indexOdbernaMista],
name: "OdbernaMista",
onValueChanged: function(data) {
console.log(data.value);
window.ElMista = data.value;
window.ListItem = data.value;
ElPrepareSel(1);
}
}
},
{
location: "before",
widget: "dxSelectBox",
options: {
items: FiltrGroup,
acceptCustomValue: false,
width: 180,
value: FiltrGroup[0],
name: "FiltrGroup",
placeholder: "skupina ...",
onValueChanged: function(data) {
window.odeGridDate = data.value;
window.ElCombo = FiltrGroup.indexOf(data.value);
ElPrepareSel(0);
}
}
},
{
location: "before",
widget: "dxDateBox",
options: {
type: "date",
label: "od",
displayFormat: "dd.MM.yyyy",
value: d1,
elementAttr: { id: "DateGrid60From" },
onValueChanged: function(e) {
ElPrepareSel(1);
}
}
},
{
location: "before",
widget: "dxDateBox",
options: {
type: "date",
label: "do",
displayFormat: "dd.MM.yyyy",
value: d2,
elementAttr: { id: "DateGrid60To" },
onValueChanged: function(e) {
ElPrepareSel(1);
}
}
}, 'columnChooserButton', 'exportButton', 'searchPanel'
]
},
columnChooser: { enabled: true },
columns: [
{
dataField: "OID",
width: 30,
allowEditing : false,
visible: false
},
{
dataField: "DATUM",
caption: "datum",
width: 90,
allowEditing : false,
visible: true,
fixed: true,
cssClass: 'blue-1',
dataType: "date",
format: "dd.MM.yyyy"
},
{
dataField: "DEN",
caption: "den",
width: 70,
allowEditing : false,
visible: true,
fixed: true,
cssClass: 'purple-1'
},
{
dataField: "H1",
caption: "1:00",
width: 50,
allowEditing : false,
allowFiltering : false,
dataType: "number",
visible: true
},
{
dataField: "H2",
caption: "2:00",
width: 50,
allowEditing : false,
allowFiltering : false,
dataType: "number",
visible: true
},
{
dataField: "H3",
caption: "3:00",
width: 50,
allowEditing : false,
allowFiltering : false,
dataType: "number",
visible: true
},
{
dataField: "H4",
caption: "4:00",
width: 50,
allowEditing : false,
allowFiltering : false,
dataType: "number",
visible: true
},
{
dataField: "H5",
caption: "5:00",
width: 50,
allowEditing : false,
allowFiltering : false,
dataType: "number",
visible: true
},
{
dataField: "H6",
caption: "6:00",
width: 50,
allowEditing : false,
allowFiltering : false,
dataType: "number",
visible: true
},
{
dataField: "H7",
caption: "7:00",
width: 50,
allowEditing : false,
allowFiltering : false,
dataType: "number",
visible: true
},
{
dataField: "H8",
caption: "8:00",
width: 50,
allowEditing : false,
allowFiltering : false,
dataType: "number",
visible: true
},
{
dataField: "H9",
caption: "9:00",
width: 50,
allowEditing : false,
allowFiltering : false,
dataType: "number",
visible: true
},
{
dataField: "H10",
caption: "10:00",
width: 50,
allowEditing : false,
allowFiltering : false,
dataType: "number",
visible: true
},
{
dataField: "H11",
caption: "11:00",
width: 50,
allowEditing : false,
allowFiltering : false,
dataType: "number",
visible: true
},
{
dataField: "H12",
caption: "12:00",
width: 50,
allowEditing : false,
allowFiltering : false,
dataType: "number",
visible: true
},
{
dataField: "H13",
caption: "13:00",
width: 50,
allowEditing : false,
allowFiltering : false,
dataType: "number",
visible: true
},
{
dataField: "H14",
caption: "14:00",
width: 50,
allowEditing : false,
allowFiltering : false,
dataType: "number",
visible: true
},
{
dataField: "H15",
caption: "15:00",
width: 50,
allowEditing : false,
allowFiltering : false,
dataType: "number",
visible: true
},
{
dataField: "H16",
caption: "16:00",
width: 50,
allowEditing : false,
allowFiltering : false,
dataType: "number",
visible: true
},
{
dataField: "H17",
caption: "17:00",
width: 50,
allowEditing : false,
allowFiltering : false,
dataType: "number",
visible: true
},
{
dataField: "H18",
caption: "18:00",
width: 50,
allowEditing : false,
allowFiltering : false,
dataType: "number",
visible: true
},
{
dataField: "H19",
caption: "19:00",
width: 50,
allowEditing : false,
allowFiltering : false,
dataType: "number",
visible: true
},
{
dataField: "H20",
caption: "20:00",
width: 50,
allowEditing : false,
allowFiltering : false,
dataType: "number",
visible: true
},
{
dataField: "H21",
caption: "21:00",
width: 50,
allowEditing : false,
allowFiltering : false,
dataType: "number",
visible: true
},
{
dataField: "H22",
caption: "22:00",
width: 50,
allowEditing : false,
allowFiltering : false,
dataType: "number",
visible: true
},
{
dataField: "H23",
caption: "23:00",
width: 50,
allowEditing : false,
allowFiltering : false,
dataType: "number",
visible: true
},
{
dataField: "H24",
caption: "24:00",
width: 50,
allowEditing : false,
allowFiltering : false,
dataType: "number",
visible: true
},
{
dataField: "H25",
caption: "25:00",
width: 50,
allowEditing : false,
allowFiltering : false,
dataType: "number",
visible: true
},
{
dataField: "HSUM",
caption: "h. suma",
width: 85,
allowEditing : false,
visible: true,
cssClass: 'blue-1'
},
{
dataField: "HMIN",
caption: "h. min",
width: 85,
allowEditing : false,
visible: true,
cssClass: 'blue-2'
},
{
dataField: "HAVG",
caption: "h. prům.",
width: 85,
allowEditing : false,
visible: true,
cssClass: 'red-1'
},
{
dataField: "HMAX",
caption: "h. max",
width: 85,
allowEditing : false,
visible: true,
cssClass: 'purple-1',
fixed: true
}
],
summary: {
totalItems: [
{
displayFormat: "{0}", column: "H1", summaryType: "max", valueFormat: { type: "decimal", precision: 2 }
},
{
displayFormat: "{0}", column: "H2", summaryType: "max", valueFormat: { type: "decimal", precision: 2 }
},
{
displayFormat: "{0}", column: "H3", summaryType: "max", valueFormat: { type: "decimal", precision: 2 }
},
{
displayFormat: "{0}", column: "H4", summaryType: "max", valueFormat: { type: "decimal", precision: 2 }
},
{
displayFormat: "{0}", column: "H5", summaryType: "max", valueFormat: { type: "decimal", precision: 2 }
},
{
displayFormat: "{0}", column: "H6", summaryType: "max", valueFormat: { type: "decimal", precision: 2 }
},
{
displayFormat: "{0}", column: "H7", summaryType: "max", valueFormat: { type: "decimal", precision: 2 }
},
{
displayFormat: "{0}", column: "H8", summaryType: "max", valueFormat: { type: "decimal", precision: 2 }
},
{
displayFormat: "{0}", column: "H9", summaryType: "max", valueFormat: { type: "decimal", precision: 2 }
},
{
displayFormat: "{0}", column: "H10", summaryType: "max", valueFormat: { type: "decimal", precision: 2 }
},
{
displayFormat: "{0}", column: "H11", summaryType: "max", valueFormat: { type: "decimal", precision: 2 }
},
{
displayFormat: "{0}", column: "H12", summaryType: "max", valueFormat: { type: "decimal", precision: 2 }
},
{
displayFormat: "{0}", column: "H13", summaryType: "max", valueFormat: { type: "decimal", precision: 2 }
},
{
displayFormat: "{0}", column: "H14", summaryType: "max", valueFormat: { type: "decimal", precision: 2 }
},
{
displayFormat: "{0}", column: "H15", summaryType: "max", valueFormat: { type: "decimal", precision: 2 }
},
{
displayFormat: "{0}", column: "H16", summaryType: "max", valueFormat: { type: "decimal", precision: 2 }
},
{
displayFormat: "{0}", column: "H17", summaryType: "max", valueFormat: { type: "decimal", precision: 2 }
},
{
displayFormat: "{0}", column: "H18", summaryType: "max", valueFormat: { type: "decimal", precision: 2 }
},
{
displayFormat: "{0}", column: "H19", summaryType: "max", valueFormat: { type: "decimal", precision: 2 }
},
{
displayFormat: "{0}", column: "H20", summaryType: "max", valueFormat: { type: "decimal", precision: 2 }
},
{
displayFormat: "{0}", column: "H21", summaryType: "max", valueFormat: { type: "decimal", precision: 2 }
},
{
displayFormat: "{0}", column: "H22", summaryType: "max", valueFormat: { type: "decimal", precision: 2 }
},
{
displayFormat: "{0}", column: "H23", summaryType: "max", valueFormat: { type: "decimal", precision: 2 }
},
{
displayFormat: "{0}", column: "H24", summaryType: "max", valueFormat: { type: "decimal", precision: 2 }
},
{
displayFormat: "{0}", column: "H25", summaryType: "max", valueFormat: { type: "decimal", precision: 2 }
},
{ displayFormat: "{0}", column: "HSUM", summaryType: "max", valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "HAVG", summaryType: "max", valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "HMAX", summaryType: "max", valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "CMAX", summaryType: "max", valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "HMIN", summaryType: "max", valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "DATUM", summaryType: "count" }
]
}
});
$("#rg-gridHodinoveOdbery").dxRadioGroup({
items: footer,
value: footer[2],
layout: "horizontal",
onValueChanged: function(e){
var RGroup = $("#rg-gridHodinoveOdbery").dxRadioGroup("instance");
var R = footer.indexOf(RGroup.option('value'));
if (R == 0) { footerSum = 'avg'; }
else if (R == 1) { footerSum = 'min'; }
else if (R == 2) { footerSum = 'max'; }
else if (R == 3) { footerSum = 'sum'; }
$("#gridHodinoveOdbery").dxDataGrid({
dataSource: HodinoveOdbery,
summary: {
totalItems: [
{ displayFormat: "{0}", column: "H1", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "H2", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "H3", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "H4", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "H5", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "H6", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "H7", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "H8", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "H9", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "H10", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "H11", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "H12", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "H13", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "H14", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "H15", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "H16", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "H17", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "H18", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "H19", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "H20", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "H21", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "H22", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "H23", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "H24", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "H25", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "HSUM", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "HAVG", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "HMAX", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "CMAX", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "HMIN", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } }
]
}
});
}
});
ElPrepareSel(1);
// ----------------------
} // success
});
}
function ElFrm() {
window.GetDate = 0;
console.log('El Frm');
$.ajax({
url: "frm-el-60.php",
dataType : "html",
success: function(result) {
document.getElementById("MainPlace").innerHTML = result;
ElGrid();
document.getElementById("MenuDashboardSubmenu").innerHTML = 'Přehled odběrů, po hodině';
prepareMenuListener();
/*
DisableMenu();
$("#MenuOde").attr('class', 'active');
PrepareFormOde();
*/
}
}); // ajax end
};
var ElRovnice2 = '-';
function ElPrepareExport15CSV() {
window.GetDate = 0;
var dateFrom = $("#DateGrid15From").dxDateBox("instance");
var dateBoxValueFrom = new Date ( dateFrom.option('value') );
var dateTo = $("#DateGrid15To").dxDateBox("instance");
var dateBoxValueTo = new Date ( dateTo.option('value') );
var $Datum1 = dateBoxValueFrom.getDate()+'.'+(dateBoxValueFrom.getMonth()+1)+'.'+dateBoxValueFrom.getFullYear();
var $Datum2 = dateBoxValueTo.getDate()+'.'+(dateBoxValueTo.getMonth()+1)+'.'+dateBoxValueTo.getFullYear();
DevExpress.ui.notify("Exportuji 15 min. odečty do CSV ...","info",500);
window.open("ExpOdbEl15.php?m="+window.ElMista+"&c="+window.ElCombo+"&t1="+$Datum1+"&t2="+$Datum2,"_blank");
}
function Load15Max() {
document.getElementById("InfoElModalBody").innerHTML = '
';
window.GetDate = 0;
var dateFrom = $("#dateFrom15Max").dxDateBox("instance");
var dateBoxValueFrom = new Date ( dateFrom.option('value') );
var dateTo = $("#dateTo15Max").dxDateBox("instance");
var dateBoxValueTo = new Date ( dateTo.option('value') );
var $Datum1 = dateBoxValueFrom.getDate()+'.'+(dateBoxValueFrom.getMonth()+1)+'.'+dateBoxValueFrom.getFullYear();
var $Datum2 = dateBoxValueTo.getDate()+'.'+(dateBoxValueTo.getMonth()+1)+'.'+dateBoxValueTo.getFullYear();
console.log(window.ElCombo);
$.ajax({
url: "AjaxOdbEl15max.php?c="+window.ElCombo+"&t1="+$Datum1+"&t2="+$Datum2+"&m="+window.ElMista,
dataType: "text",
success: function(result) {
console.log();
document.getElementById("InfoElModalBody").innerHTML = result;
}
});
}
function El15PrepareSel() {
window.GetDate = 0;
document.getElementById("chart15mmt").classList.remove("hide");
document.getElementById("chart15").classList.add("hide");
var loadPanelOdbery15 = $("#LoadPanelOdbery15").dxLoadPanel({
shadingColor: "rgba(0,0,0,0)",
position: { of: "#grid15Odbery" },
visible: false,
showIndicator: true,
showPane: true,
shading: true,
closeOnOutsideClick: true,
onShown: function(){ },
onHidden: function(){ }
}).dxLoadPanel("instance");
var loadPanelChart15 = $("#chart15mmt").dxLoadPanel({
shadingColor: "rgba(0,0,0,0)",
position: { of: "#chart15mmt" },
visible: false,
showIndicator: true,
showPane: true,
shading: true,
closeOnOutsideClick: true,
onShown: function() { },
onHidden: function() { }
}).dxLoadPanel("instance");
loadPanelOdbery15.show();
console.log('Prepare Sel');
var dateFrom = $("#DateGrid15From").dxDateBox("instance");
var dateBoxValueFrom = new Date ( dateFrom.option('value') );
window.DateFrom15 = dateBoxValueFrom;
var dateTo = $("#DateGrid15To").dxDateBox("instance");
var dateBoxValueTo = new Date ( dateTo.option('value') );
window.DateTo15 = dateBoxValueTo;
var $Datum1 = dateBoxValueFrom.getDate()+'.'+(dateBoxValueFrom.getMonth()+1)+'.'+dateBoxValueFrom.getFullYear();
var $Datum2 = dateBoxValueTo.getDate()+'.'+(dateBoxValueTo.getMonth()+1)+'.'+dateBoxValueTo.getFullYear();
/* console.log("ajaxOdbEl15.php?m="+window.ElMista+"&c="+window.ElCombo+"&t1="+$Datum1+"&t2="+$Datum2); */
/* url: "ajaxOdbEl15.php?m="+window.ElMista+"&c="+window.ElCombo+"&t1="+$Datum1+"&t2="+$Datum2, */
$.ajax({
url: "AjaxOdbEl15.php",
dataType: "script",
type: "POST",
dataType: "script",
data: { c: window.ElCombo, t1: $Datum1, t2: $Datum2, ho:$HourSerie, m: window.ElMista },
success: function(result) {
console.log(result);
$("#grid15Odbery").dxDataGrid({ dataSource: CtvrtOdbery });
loadPanelOdbery15.hide();
document.getElementById("TotalEquation2").innerHTML = ElRovnice2;
if (ElRovnice2 !== '-') { document.getElementById("rowEquation2").classList.remove("hide"); }
else { document.getElementById("rowEquation2").classList.add("hide"); }
if (window.ShowChart15 == 1) {
document.getElementById("ContainerChart15").classList.remove("hide");
loadPanelChart15.show();
/* console.log("ajaxOdbEl15Chart.php?m="+window.ElMista+"&c="+window.ElCombo+"&t1="+$Datum1+"&t2="+$Datum2); */
$.ajax({
url: "ajaxOdbEl15Chart.php?m="+window.ElMista+"&c="+window.ElCombo+"&t1="+$Datum1+"&t2="+$Datum2,
dataType : "script",
success: function(result) {
// console.log(result);
setTimeout(function(){
var zoomedChart15 = $("#chart15").dxChart({
size: { height: 400 },
palette: "Harmony Light",
title: { text: "Graf průběhu odběru" },
dataSource: DataChart15,
"export": { enabled: true },
commonSeriesSettings: {
arumentField: "CAS",
type: "line",
point: { visible: false }
},
legend: {
verticalAlignment: "bottom",
horizontalAlignment: "center",
itemTextPosition: "bottom",
visible: true
},
tooltip: {
enabled: true,
customizeTooltip: function (arg) {
return { text: arg.valueText };
}
},
onLegendClick: function(e) {
var series = e.target;
if(series.isVisible()) {
series.hide();
} else {
series.show();
}
},
series: [
{
argumentField: "CAS",
valueField: "ODBER",
name: "činný odběr"
},
{
argumentField: "CAS",
valueField: "JALOVY",
name: "jalový odběr"
},
{
argumentField: "CAS",
valueField: "JALOVA_DO",
name: "jalová dodávka"
}
],
scrollBar: { visible: false }
}).dxChart("instance");
$("#rangeSelector15").dxRangeSelector({
size: { height: 120 },
margin: { },
scale: { minorTickCount:1 },
dataSource: DataChart15,
chart: {
series: [
{
argumentField: "CAS",
valueField: "ODBER",
name: "činný odběr"
},
{
argumentField: "CAS",
valueField: "JALOVY",
name: "jalový odběr"
},
{
argumentField: "CAS",
valueField: "JALOVA_DO",
name: "jalová dodávka"
}
],
palette: "Harmony Light"
},
behavior: { callValueChanged: "onMoving" },
onValueChanged: function (e) {
var zoomedChart15 = $("#chart15").dxChart("instance");
zoomedChart15.getArgumentAxis().visualRange(e.value);
}
});
}, 1000);
loadPanelChart15.hide();
document.getElementById("chart15").classList.remove("hide");
} // success
});
} // show chart
loadPanelOdbery15.hide();
} // success
});
}
function El15RangeSel() {
var $d1 = new Date("2025/10/24");
var $d2 = new Date("2025/10/27");
console.log('2025, 10, 24 2025, 10, 27');
}
function El15Grid () {
window.ElCombo = 0;
var FiltrGroup = ["činný odběr [KWh]","jalový odběr [Kvarh]","jalová dodávka [Kvarh]"];
var now = new Date();
var d1 = now - (60*60*1000*24*7);
var d2 = now;
if (window.DateFrom15 !== '*') { d1 = window.DateFrom15; d2 = window.DateTo15; }
$("#dateFrom15Max").dxDateBox({
type: "date",
displayFormat: "dd.MM.yyyy",
value: d1,
onValueChanged: function(e) {
Load15Max();
}
});
$("#dateTo15Max").dxDateBox({
type: "date",
displayFormat: "dd.MM.yyyy",
value: d2,
onValueChanged: function(e) {
Load15Max();
}
});
$("#Btn15").dxButton({
text: "načíst data",
type: "default",
width: 120,
onClick: function(e) {
El15PrepareSel(1);
}
});
$.ajax({
url: "ajaxOdbEl15.php",
dataType : "script",
success: function(result) {
console.log( "Prepare grid odbery" );
/* console.log( result ); */
indexOdbernaMista = OdbernaMista.indexOf(window.ListItem);
if ((!indexOdbernaMista)||(indexOdbernaMista< 0)) { indexOdbernaMista = 0;}
window.ElMista = OdbernaMista[indexOdbernaMista];
$("#grid15Odbery").dxDataGrid({
dataSource: CtvrtOdbery,
allowColumnResizing: true,
rowAlternationEnabled: true,
allowColumnReordering: true,
columnResizingMode: "widget",
showBorders: true,
showRowLines: true,
columnMinWidth: 30,
paging: { enabled: false },
columnFixing: { enabled: true },
filterPanel: { visible: true },
filterRow: { visible: false, applyFilter: "auto" },
headerFilter: { visible: true },
sorting: { mode: "multiple" },
scrolling: { mode: "virtual", useNative: true },
selection: { mode: "single" },
sorting: { mode: "multiple" },
export: { enabled: true, allowExportSelectedData: false, formats: ['xlsx'], },
onExporting(e) {
const workbook = new ExcelJS.Workbook();
const worksheet = workbook.addWorksheet('Companies');
DevExpress.excelExporter.exportDataGrid({
component: e.component,
worksheet,
autoFilterEnabled: true,
}).then(() => {
workbook.xlsx.writeBuffer().then((buffer) => {
saveAs(new Blob([buffer], { type: 'application/octet-stream' }), 'Odbery-15.xlsx');
});
});
},
onSelectionChanged: function (selectedItems) { window.GetDate = 0; },
toolbar: {
items: [
{
location: "before",
widget: "dxButton",
type: "danger",
options: {
icon: "clearformat",
type: "danger",
hint: "Zrušit filtrační podmínky ...",
onClick: function() {
DevExpress.ui.notify("ruším filtrační podmínky ...","info",500);
var dataGrid = $('#grid15Odbery').dxDataGrid('instance');
dataGrid.clearFilter();
dataGrid.clearSorting();
}
}
},
{
location: "after",
widget: "dxButton",
type: "default",
options: {
icon: "info",
type: "default",
text: "max",
visible: false,
hint: "rychlé určení maxima",
onClick: function() {
Load15Max();
$('#InfoElModal').modal({ show: true });
}
}
},
{
location: "after",
widget: "dxButton",
type: "default",
options: {
icon: "file",
type: "default",
text: ".CSV",
hint: "exportovat do .CSV",
onClick: function() {
ElPrepareExport15CSV();
}
}
},
{
location: "after",
widget: "dxButton",
type: "default",
options: {
icon: "far fa-chart-bar",
type: "default",
hint: "zobrazit / skrýt graf",
onClick: function() {
if (window.ShowChart15 == 1) { window.ShowChart15 = 0; } else { window.ShowChart15 = 1; }
if (window.ShowChart15 == 1) {
document.getElementById("ContainerChart15").classList.remove("hide");
El15PrepareSel();
} else {
document.getElementById("ContainerChart15").classList.add("hide");
}
}
}
},
{
location: "before",
widget: "dxSelectBox",
options: {
items: OdbernaMista,
acceptCustomValue: false,
width: 250,
label: "odběrné místo",
value: OdbernaMista[indexOdbernaMista],
name: "OdbernaMista",
onValueChanged: function(data) {
window.ElMista = data.value;
window.ListItem = data.value;
El15PrepareSel();
}
}
},
{
location: "before",
widget: "dxDateBox",
options: {
type: "date",
label: "od",
displayFormat: "dd.MM.yyyy",
value: d1,
elementAttr: { id: "DateGrid15From" },
onValueChanged: function(e) {
El15PrepareSel(1);
}
}
},
{
location: "before",
widget: "dxDateBox",
options: {
type: "date",
label: "do",
displayFormat: "dd.MM.yyyy",
value: d2,
elementAttr: { id: "DateGrid15To" },
onValueChanged: function(e) {
El15PrepareSel(1);
}
}
}, 'columnChooserButton', 'exportButton', 'searchPanel'
]
},
columnChooser: { enabled: true },
columns: [
{
dataField: "DATUM",
caption: "datum",
width: 85,
allowEditing : false,
visible: true,
fixed: true,
cssClass: 'blue-1',
dataType: "date",
format: "dd.MM.yyyy"
},
{
dataField: "HODINA",
caption: "hodina",
width: 70,
allowEditing : false,
visible: true,
fixed: true,
cssClass: 'purple-1 text-center'
},
{
caption: "0-15 min.",
columns: [{
dataField: "X0",
caption: "činný",
width: 65,
allowEditing : false,
allowFiltering : false,
visible: true
},
{
dataField: "Y0",
caption: "jalový",
width: 65,
allowEditing : false,
allowFiltering : false,
visible: true
},
{
dataField: "Z0",
caption: "jal. dod.",
width: 65,
allowEditing : false,
allowFiltering : false,
visible: true
}], },
{
caption: "15-30 min.",
columns: [{
dataField: "X1",
caption: "činný",
width: 65,
allowEditing : false,
allowFiltering : false,
visible: true
},
{
dataField: "Y1",
caption: "jalový",
width: 65,
allowEditing : false,
allowFiltering : false,
visible: true
},
{
dataField: "Z1",
caption: "jal. dod.",
width: 65,
allowEditing : false,
allowFiltering : false,
visible: true
}], },
{
caption: "30-45 min.",
columns: [{
dataField: "X2",
caption: "činný",
width: 65,
allowEditing : false,
allowFiltering : false,
visible: true
},
{
dataField: "Y2",
caption: "jalový",
width: 65,
allowEditing : false,
allowFiltering : false,
visible: true
},
{
dataField: "Z2",
caption: "jal. dod.",
width: 65,
allowEditing : false,
allowFiltering : false,
visible: true
}], },
{
caption: "45-60 min.",
columns: [{
dataField: "X3",
caption: "činný",
width: 65,
allowEditing : false,
allowFiltering : false,
visible: true
},
{
dataField: "Y3",
caption: "jalový",
width: 65,
allowEditing : false,
allowFiltering : false,
visible: true
},
{
dataField: "Z3",
caption: "jal. dod.",
width: 65,
allowEditing : false,
allowFiltering : false,
visible: true
}], },
{ caption: "průměry",
columns: [{
dataField: "AX",
caption: "činný",
width: 70,
allowEditing : false,
allowFiltering : false,
visible: true,
cssClass: 'red-1'
},
{
dataField: "AY",
caption: "jalový",
width: 70,
allowEditing : false,
allowFiltering : false,
visible: true,
cssClass: 'red-1'
},
{
dataField: "AZ",
caption: "jal. dod.",
width: 70,
allowEditing : false,
allowFiltering : false,
visible: true,
cssClass: 'red-1'
}]},
{ caption: "maxima",
columns: [{
dataField: "MX",
caption: "činný",
width: 70,
allowEditing : false,
allowFiltering : false,
visible: true,
cssClass: 'purple-1'
},
{
dataField: "MY",
caption: "jalový",
width:70,
allowEditing : false,
allowFiltering : false,
visible: true,
cssClass: 'purple-1'
},
{
dataField: "MZ",
caption: "jal. dod.",
width: 70,
allowEditing : false,
allowFiltering : false,
visible: true,
cssClass: 'purple-1'
}]}
],
summary: {
totalItems: [
{ displayFormat: "{0}", column: "X0", summaryType: 'max', valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "Y0", summaryType: 'max', valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "Z0", summaryType: 'max', valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "X1", summaryType: 'max', valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "Y1", summaryType: 'max', valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "Z1", summaryType: 'max', valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "X2", summaryType: 'max', valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "Y2", summaryType: 'max', valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "Z2", summaryType: 'max', valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "X3", summaryType: 'max', valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "Y3", summaryType: 'max', valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "Z3", summaryType: 'max', valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "AX", summaryType: "max", valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "AY", summaryType: "max", valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "AZ", summaryType: "max", valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "MX", summaryType: "max", valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "MY", summaryType: "max", valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "MZ", summaryType: "max", valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "DATUM", summaryType: "count" }
]
}
});
El15PrepareSel();
$("#rg-grid15Odbery").dxRadioGroup({
items: footer,
value: footer[2],
layout: "horizontal",
onValueChanged: function(e){
var RGroup = $("#rg-grid15Odbery").dxRadioGroup("instance");
var R = footer.indexOf(RGroup.option('value'));
if (R == 0) { footerSum = 'avg'; }
else if (R == 1) { footerSum = 'min'; }
else if (R == 2) { footerSum = 'max'; }
else if (R == 3) { footerSum = 'sum'; }
$("#grid15Odbery").dxDataGrid({
dataSource: CtvrtOdbery,
summary: {
totalItems: [
{ displayFormat: "{0}", column: "X0", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "Y0", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "Z0", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "X1", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "Y1", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "Z1", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "X2", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "Y2", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "Z2", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "X3", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "Y3", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "Z3", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "AX", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "AY", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "AZ", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "MX", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "MY", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "MZ", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } }
]
}
});
}
});
} // success
});
}
function El15Frm() {
window.GetDate = 0;
console.log('El15 Frm');
$.ajax({
url: "frm-el-15.php",
dataType : "html",
success: function(result) {
document.getElementById("MainPlace").innerHTML = result;
El15Grid();
document.getElementById("MenuDashboardSubmenu").innerHTML = 'Přehled odběrů, po 15. minutách';
prepareMenuListener();
/*
DisableMenu();
$("#MenuOde").attr('class', 'active');
PrepareFormOde();
*/
}
}); // ajax end
};
function LoadOdbDiagram($strOM, $strKOD, $strMR) {
$strRP = 0;
$strRRK = 0;
$strMRK = 0;
$strCM = 0;
$strPCOS = 0;
$strPOZN = '';
console.log("AjaxOdbLoad.php?om="+$strOM+"&mr="+$strMR+"&kod="+$strKOD);
$.ajax({
url: "AjaxOdbLoad.php",
dataType : "script",
type:"POST",
data: { om:$strOM, mr:$strMR, kod:$strKOD },
success: function(result) {
console.log(result);
$("#DiagramRP").dxNumberBox({ value:$strRP });
$("#DiagramRRK").dxNumberBox({ value:$strRRK });
$("#DiagramMRK").dxNumberBox({ value:$strMRK });
$("#DiagramCM").dxNumberBox({ value:$strCM });
$("#DiagramPCOS").dxNumberBox({ value:$strPCOS });
$("#DiagramPOZN").dxTextArea({ value:$strPOZN });
DevExpress.ui.notify("OK. Načteno ... ","info",250);
}
});
}
function PrepareElDiagramFrm() {
var DiagramData = [{"DEN":1,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":2,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":3,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":4,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":5,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":6,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":7,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":8,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":9,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":10,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":11,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":12,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":13,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":14,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":15,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":16,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":17,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":18,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":19,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":20,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":21,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":22,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":23,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":24,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":25,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":26,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":27,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":28,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":29,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":30,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""},
{"DEN":31,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":"","11":"","12":"","13":"","14":"","15":"","16":"","17":"","18":"","19":"","20":"","21":"","22":"","23":"","24":"","25":""}];
var DiagramMesicRok = ["12/2025","11/2025","10/2025","09/2025","08/2025","07/2025","06/2025","05/2025","04/2025","03/2025","02/2025","01/2025","12/2024","11/2024","10/2024","09/2024","08/2024","07/2024","06/2024","05/2024","04/2024","03/2024","02/2024","01/2024","12/2023"];
window.DiagramMesicRok = DiagramMesicRok[0];
$("#DiagramBtnPDF").dxButton({
icon: "exportpdf",
type: "normal",
text: "PDF",
onClick: function(e) {
var strMR = window.DiagramMesicRok;
console.log("PDFdiagram.php?cas="+strMR);
window.open("PDFdiagram.php?cas="+strMR, '_blank');
}
});
$("#DiagramBtnClear").dxButton({
icon: "fa fa-eraser",
type: "danger",
text: "Smazat údaje",
onClick: function(e) {
$("#DiagramRP").dxNumberBox({ value:0 });
$("#DiagramRRK").dxNumberBox({ value:0 });
$("#DiagramMRK").dxNumberBox({ value:0 });
$("#DiagramCM").dxNumberBox({ value:0 });
$("#DiagramPCOS").dxNumberBox({ value:0 });
$("#DiagramPOZN").dxTextArea({ value:"" });
}
});
$("#DiagramBtnOK").dxButton({
icon: "check",
type: "default",
text: "Uložit",
onClick: function(e) {
window.GetDate = 0;
/* DevExpress.ui.notify("Stisknuto ... " + window.DiagramMesicRok); */
var strMR = window.DiagramMesicRok;
var strOM = window.DiagramOM;
strOM = strOM.replace(" / ", "*");
strMR = strMR.replace("/", "*");
var strRP = $("#DiagramRP").dxNumberBox('option', 'value');
var strRRK = $("#DiagramRRK").dxNumberBox('option', 'value');
var strMRK = $("#DiagramMRK").dxNumberBox('option', 'value');
var strCM = $("#DiagramCM").dxNumberBox('option', 'value');
var strPCOS = $("#DiagramPCOS").dxNumberBox('option', 'value');
var strPOZN = $("#DiagramPOZN").dxTextArea('option', 'value');
/* console.log("AjaxOdbSave.php?ek_id="+window.oc+"&om="+strOM+"&mr="+strMR+"&rp="+strRP+"&rrk="+strRRK+"&mrk="+strMRK+"&cm="+strCM+"&pcos="+strPCOS+"&pozn="+strPOZN); */
$.ajax({
url: "AjaxOdbSave.php?ek_id="+window.oc+"&om="+strOM+"&mr="+strMR+"&rp="+strRP+"&rrk="+strRRK+"&mrk="+strMRK+"&cm="+strCM+"&pcos="+strPCOS+"&pozn="+strPOZN,
dataType : "html",
success: function(result) {
DevExpress.ui.notify("OK. Uloženo ... ", "success", 250);
}
});
}
});
$("#DiagramRP").dxNumberBox({
placeholder: "...",
min: 0, max: 1000,
disabled: true
});
$("#DiagramRRK").dxNumberBox({
placeholder: "...",
min: 0, max: 1000,
disabled: true
});
$("#DiagramMRK").dxNumberBox({
placeholder: "...",
min: 0, max: 1000
});
$("#DiagramCM").dxNumberBox({
placeholder: "...",
min: 0, max: 1000
});
$("#DiagramPCOS").dxNumberBox({
placeholder: "...",
min: 0, max: 1000
});
$("#DiagramPOZN").dxTextArea({
height: 90
});
$("#DiagramMR").dxSelectBox({
items: DiagramMesicRok,
value: DiagramMesicRok[0],
onValueChanged: function(e) {
/* console.log(e.value); */
window.GetDate = 0;
window.DiagramMesicRok = e.value;
var $denD = Number(20);
var $mesicD = Number(11);
var $rokD = Number(2025);
var $res = e.value.split("/");
$mesic = Number($res[0]);
$rok = Number($res[1]);
if ( ( ( $mesicD < $mesic ) && ($rokD == $rok) ) || ($rokD < $rok)) { $nastav = false; }
else if ( ( $mesicD == $mesic ) && ($rokD == $rok) ) { $nastav = false; }
else { $nastav = true; }
$("#DiagramBtnOK").dxButton({ disabled: $nastav });
$("#DiagramBtnClear").dxButton({ disabled: $nastav });
var $strMR = window.DiagramMesicRok;
var $strOM = window.DiagramOM;
var $strKOD = window.DiagramKOD;
$strMR = $strMR.replace("/", "*");
console.log("AjaxOdbLoad.php?om="+$strOM+"&mr="+$strMR);
LoadOdbDiagram($strOM, $strKOD, $strMR);
}
});
$.ajax({
url: "AjaxOdbElH.php",
dataType : "script",
success: function(result) {
console.log(result);
$foo = OdbernaMista[0].substring(1,OdbernaMista[0].indexOf(')'));
window.DiagramOM = $foo.trim();
$foo = OdbernaMista[0].substring(OdbernaMista[0].indexOf(')')+1,255);
window.DiagramKOD = $foo.trim();
$("#DiagramOM").dxSelectBox({
items: OdbernaMista,
value: OdbernaMista[0],
onValueChanged: function(e) {
console.log(e.value);
$foo = e.value;
$foo2 = $foo.substring(1,$foo.indexOf(')'));
window.DiagramOM = $foo2.trim();
$foo3 = $foo.substring($foo.indexOf(')')+1,255);
window.DiagramKOD = $foo3.trim();
var $strMR = window.DiagramMesicRok;
var $strOM = window.DiagramOM;
var $strKOD = window.DiagramKOD;
$strMR = $strMR.replace("/", "*");
LoadOdbDiagram($strOM, $strKOD, $strMR);
}
});
var $strMR = window.DiagramMesicRok;
var $strOM = window.DiagramOM;
var $strKOD = window.DiagramKOD;
$strMR = $strMR.replace("/", "*");
LoadOdbDiagram($strOM, $strKOD, $strMR);
}
});
$("#gridDiagram").dxDataGrid({
dataSource: DiagramData,
allowColumnResizing: false,
rowAlternationEnabled: true,
columnFixing: { enabled: false },
allowColumnReordering: false,
columnChooser: { enabled: false },
editing: { mode: "batch", allowUpdating: true },
export: { enabled: true, allowExportSelectedData: false, formats: ['xlsx'], },
onExporting(e) {
const workbook = new ExcelJS.Workbook();
const worksheet = workbook.addWorksheet('Companies');
DevExpress.excelExporter.exportDataGrid({
component: e.component,
worksheet,
autoFilterEnabled: true,
}).then(() => {
workbook.xlsx.writeBuffer().then((buffer) => {
saveAs(new Blob([buffer], { type: 'application/octet-stream' }), 'Odberovy-diagram.xlsx');
});
});
},
scrolling: { mode: "virtual", useNative: true },
showBorders: true,
columns: [
{
dataField: "DEN",
caption: "d. / h.",
width: 55,
allowEditing : false,
visible: true,
fixed: true,
cssClass: 'blue-1'
},
{ dataField: "1", caption: "1", width: 47, dataType: "number", format: { type: "fixedPoint", precision: 3 } },{ dataField: "2", caption: "2", width: 47, dataType: "number", format: { type: "fixedPoint", precision: 3 } },{ dataField: "3", caption: "3", width: 47, dataType: "number", format: { type: "fixedPoint", precision: 3 } },{ dataField: "4", caption: "4", width: 47, dataType: "number", format: { type: "fixedPoint", precision: 3 } },{ dataField: "5", caption: "5", width: 47, dataType: "number", format: { type: "fixedPoint", precision: 3 } },{ dataField: "6", caption: "6", width: 47, dataType: "number", format: { type: "fixedPoint", precision: 3 } },{ dataField: "7", caption: "7", width: 47, dataType: "number", format: { type: "fixedPoint", precision: 3 } },{ dataField: "8", caption: "8", width: 47, dataType: "number", format: { type: "fixedPoint", precision: 3 } },{ dataField: "9", caption: "9", width: 47, dataType: "number", format: { type: "fixedPoint", precision: 3 } },{ dataField: "10", caption: "10", width: 47, dataType: "number", format: { type: "fixedPoint", precision: 3 } },{ dataField: "11", caption: "11", width: 47, dataType: "number", format: { type: "fixedPoint", precision: 3 } },{ dataField: "12", caption: "12", width: 47, dataType: "number", format: { type: "fixedPoint", precision: 3 } },{ dataField: "13", caption: "13", width: 47, dataType: "number", format: { type: "fixedPoint", precision: 3 } },{ dataField: "14", caption: "14", width: 47, dataType: "number", format: { type: "fixedPoint", precision: 3 } },{ dataField: "15", caption: "15", width: 47, dataType: "number", format: { type: "fixedPoint", precision: 3 } },{ dataField: "16", caption: "16", width: 47, dataType: "number", format: { type: "fixedPoint", precision: 3 } },{ dataField: "17", caption: "17", width: 47, dataType: "number", format: { type: "fixedPoint", precision: 3 } },{ dataField: "18", caption: "18", width: 47, dataType: "number", format: { type: "fixedPoint", precision: 3 } },{ dataField: "19", caption: "19", width: 47, dataType: "number", format: { type: "fixedPoint", precision: 3 } },{ dataField: "20", caption: "20", width: 47, dataType: "number", format: { type: "fixedPoint", precision: 3 } },{ dataField: "21", caption: "21", width: 47, dataType: "number", format: { type: "fixedPoint", precision: 3 } },{ dataField: "22", caption: "22", width: 47, dataType: "number", format: { type: "fixedPoint", precision: 3 } },{ dataField: "23", caption: "23", width: 47, dataType: "number", format: { type: "fixedPoint", precision: 3 } },{ dataField: "24", caption: "24", width: 47, dataType: "number", format: { type: "fixedPoint", precision: 3 } },{ dataField: "25", caption: "25", width: 47, dataType: "number", format: { type: "fixedPoint", precision: 3 } } ]
});
}
function ElDiagramFrm() {
window.GetDate = 0;
console.log('El Diagram Frm');
$.ajax({
url: "frm-el-diagram.php",
dataType : "html",
success: function(result) {
document.getElementById("MainPlace").innerHTML = result;
PrepareElDiagramFrm();
document.getElementById("MenuDashboardSubmenu").innerHTML = 'Odběrový diagram';
}
}); // ajax end
};
function PrepareDateSelector(typ) {
window.GetDate = 0;
console.log('Prepare Range Selector '+typ);
$("#date-selector").dxRangeSelector({
selectedRangeColor:"#3F51B5",
margin: {
top: 0
},
size: {
height: 180
},
scale: {
valueType: 'datetime',
startValue: new Date(2024, 10, 1),
endValue: new Date(2025, 10, 1),
minorTickInterval: "day",
tickInterval: { month: 1 },
minRange: "day",
maxRange: "year",
minorTick: {
visible: false,
}
},
sliderMarker: {
format: "monthAndDay"
},
value: [new Date (2025, 08, 1), new Date (2025, 11, 1)],
title: "Datum od - do",
onValueChanged: function (data) {
if (typ == 1) { DataRange(); }
else
if (typ == 2) { DataRange2(); }
else
if (typ == 3) { DataRange3(); }
}
});
console.log('2025, 08, 23 2025, 11, 11');
}
function DataRange2 () {
window.GetDate = 0;
console.log('DataRange2');
DevExpress.ui.notify('Moment ...', 'info', 200);
/*
var rangeSelector = $("#date-selector").dxRangeSelector('instance');
var selRange = rangeSelector.getValue();
*/
var dateFrom = $("#AVDateFrom").dxDateBox("instance");
var dateBoxValueFrom = new Date ( dateFrom.option('value') );
var dateTo = $("#AVDateTo").dxDateBox("instance");
var dateBoxValueTo = new Date ( dateTo.option('value') );
var Datum1 = (dateBoxValueFrom.getFullYear()+'-'+(dateBoxValueFrom.getMonth()+1)+'-'+dateBoxValueFrom.getDate());
var Datum2 = (dateBoxValueTo.getFullYear()+'-'+(dateBoxValueTo.getMonth()+1)+'-'+dateBoxValueTo.getDate());
var RGroup1 = $("#radio-group-typAV").dxRadioGroup("instance");
var R1 = typAV.indexOf(RGroup1.option('value'));
/* console.log ("ajaxChAV.php?autor="+window.OC+"&prop="+window.CPY+"&typ="+R1+"&t1="+Datum1+"&t2="+Datum2); */
$.ajax({
url: "ajaxChAV.php?autor="+window.OC+"&prop="+window.CPY+"&typ="+R1+"&t1="+Datum1+"&t2="+Datum2,
dataType : "script",
success: function(result) {
$("#gridAV").dxDataGrid({ dataSource: dataAV });
/*
if (strJmeno !== '') { document.getElementById("login-user").innerHTML = strJmeno; }
elseif if (strAdmin!== '') { document.getElementById("login-user").innerHTML = strAdmin; }
document.getElementById("MenuDashboardCompany").innerHTML = strFirma;
*/
DevExpress.ui.notify("OK, provedeno ...", "info", 500);
} });
}
function PrepareFormAV() {
window.GetDate = 0;
console.log('PrepareAV');
window.CPY = true;
footerSum = 'avg';
var now = new Date();
$("#popupClean").dxPopup({
width: 400,
height: 180,
shading: true,
shadingColor: "rgba(0, 0, 0, 0)",
showTitle: true,
title: "Vyčistit tabulku ...",
onShown: function () {
var rangeSelector = $("#date-selector").dxRangeSelector('instance');
var selRange = rangeSelector.getValue();
var Datum1 = (selRange[0].getDate()+'.'+(selRange[0].getMonth()+1)+'.'+selRange[0].getFullYear());
var Datum2 = (selRange[1].getDate()+'.'+(selRange[1].getMonth()+1)+'.'+selRange[1].getFullYear());
$("#popupCleanInterval").text(Datum1+' - '+Datum2);
var RGroup1 = $("#radio-group-typAV").dxRadioGroup("instance");
var R1 = typAV.indexOf(RGroup1.option('value'));
switch (R1) {
case 0: foo = 'K4'; break;
case 1: foo = 'K5'; break;
case 2: foo = 'K7'; break;
}
console.log(R1);
$("#popupCleanKotel").text(foo);
$("#BtnOK").dxButton({
text: "ANO",
type: "danger",
onClick: function (e) {
console.log('Clean');
// var RGroup1 = $("#radio-group-kotel").dxRadioGroup("instance");
// var R1 = kot.indexOf(RGroup1.option('value'));
DataRange2('d=2');
$("#popupClean").dxPopup("hide");
}
});
$("#BtnCancel").dxButton({
text: "NE",
onClick: function (e) {
$("#popupClean").dxPopup("hide");
}
});
}
});
$.ajax({
url: "ajaxChAV.php?autor=" +window.OC+"&typ=4&cas=0&t1=2025-08-01&t2=2025-11-01",
dataType : "script",
success: function(result) {
console.log("ajaxChAV.php?autor=&typ=4&cas=0&t1=2025-08-01&t2=2025-11-01"); /* PrepareDateSelector (2);*/
/* DataRange2 ('d=1'); */
console.log( "Prepare grid AV" );
$("#gridAV").dxDataGrid({
dataSource: dataAV,
rowAlternationEnabled: false,
allowColumnResizing: true,
columnResizingMode: "nextColumn",
showBorders: true,
showRowLines: true,
columnAutoWidth: false,
columnMinWidth: 30,
scrolling: { mode: "virtual",
onInitialized: function(e) { e.component._attachNativeScrollbarsCustomizationCss = function() {}; },
useNative: true
},
paging: {
enabled: false
},
filterRow: {
visible: false,
applyFilter: "auto"
},
headerFilter: {
visible: true
},
export: { enabled: true, allowExportSelectedData: false, formats: ['xlsx'], },
onExporting(e) {
const workbook = new ExcelJS.Workbook();
const worksheet = workbook.addWorksheet('Companies');
DevExpress.excelExporter.exportDataGrid({
component: e.component,
worksheet,
autoFilterEnabled: true,
}).then(() => {
workbook.xlsx.writeBuffer().then((buffer) => {
saveAs(new Blob([buffer], { type: 'application/octet-stream' }), 'Automaticky-Vzorkovac.xlsx');
});
});
},
searchPanel: {
visible: true,
width: 200,
placeholder: "Hledat..."
},
selection: {
mode: "single"
},
sorting: {
mode: "multiple"
},
columnChooser: {
enabled: true
},
toolbar: {
items: [
{
location: "before",
widget: "dxButton",
type: "danger",
options: {
icon: "clearformat",
type: "danger",
hint: "Zrušit filtrační podmínky ...",
onClick: function() {
DevExpress.ui.notify("ruším filtrační podmínky ...","warning",1500);
var dataGrid = $('#gridAV').dxDataGrid('instance');
dataGrid.clearFilter();
dataGrid.clearSorting();
}
}
},
{
location: "before",
widget: "dxSelectBox",
options: {
items: typAV,
width: 200,
acceptCustomValue: false,
value: typAV[0],
onValueChanged: function(data) {
DevExpress.ui.notify("moment ...","info",500);
var selectedValue = data.value;
$("#radio-group-typAV").dxRadioGroup("instance").option('value',selectedValue);
DataRange2();
}
}
},
{
location: "before",
widget: "dxDateBox",
options: {
type: "date",
label: "od",
displayFormat: "dd.MM.yyyy",
value: now - (60*60*1000*24*60),
elementAttr: { id: "AVDateFrom" },
onValueChanged: function(e) {
DataRange2();
}
}
},
{
location: "before",
widget: "dxDateBox",
options: {
type: "date",
label: "do",
displayFormat: "dd.MM.yyyy",
value: now,
elementAttr: { id: "AVDateTo" },
onValueChanged: function(e) {
DataRange2();
}
}
}, 'columnChooserButton', 'exportButton', 'searchPanel'
] //onToolbarPreparing:end
},
columns: [
{ dataField: "ID", width: 30, visible: false, dataType: "number" },
{ dataField: "DATUM", dataType: "date", format: "dd.MM.yyyy" },
{ dataField: "DEN", width: 85, visible: true },
{ dataField: "TYP", width: 50 },
{ dataField: "D", width: 85, cssClass: 'blue-2 text-center' },
{ dataField: "MESIC", width: 85, visible: false },
{ dataField: "WTR", caption: "Wtr [%]", width: 85, dataType: "number", format: { type: "fixedPoint", precision: 2 } },
{ dataField: "AR", caption: "Ar %", width: 85, dataType: "number", format: { type: "fixedPoint", precision: 2 } },
{ dataField: "AD", caption: "Ad [%]", width: 85, cssClass: 'purple-1', dataType: "number", format: { type: "fixedPoint", precision: 2 } },
{ dataField: "QIR", caption: "Qir [MJ/kg]", width: 85, dataType: "number", format: { type: "fixedPoint", precision: 2 } },
{ dataField: "QSR", caption: "Qsr [MJ/kg]", width: 85, dataType: "number", format: { type: "fixedPoint", precision: 2 } },
{ dataField: "ND", caption: "Nd [%]", width: 85, cssClass: 'text-red-3', dataType: "number", format: { type: "fixedPoint", precision: 2 } },
{ dataField: "CD", caption: "Cd [%]", width: 85, cssClass: 'text-red-3', dataType: "number", format: { type: "fixedPoint", precision: 2 } },
{ dataField: "HD", caption: "Hd [%]", width: 85, cssClass: 'text-red-3', dataType: "number", format: { type: "fixedPoint", precision: 2 } },
{ dataField: "SR", caption: "Sr [%]", width: 85, dataType: "number", format: { type: "fixedPoint", precision: 2 } },
{ dataField: "SD", caption: "Sd [%]", width: 85, dataType: "number", format: { type: "fixedPoint", precision: 2 } },
{ dataField: "SMR", caption: "Smr [g/MJ]", width: 85, cssClass: 'purple-1', dataType: "number", format: { type: "fixedPoint", precision: 2 } },
{ dataField: "AMR", caption: "Amr [g/MJ]", width: 85, visible: true, dataType: "number", format: { type: "fixedPoint", precision: 2 } }
],
summary: {
totalItems: [
{
column: "AR",
displayFormat: "{0}",
summaryType: footerSum,
valueFormat: { type: "decimal", precision: 2 }
},
{
column: "WTR",
displayFormat: "{0}",
summaryType: footerSum,
valueFormat: { type: "decimal", precision: 2 }
},
{
column: "SD",
displayFormat: "{0}",
summaryType: footerSum,
valueFormat: { type: "decimal", precision: 2 }
},
{
column: "AD",
displayFormat: "{0}",
summaryType: footerSum,
valueFormat: { type: "decimal", precision: 2 }
},
{
column: "QIR",
displayFormat: "{0}",
summaryType: footerSum,
valueFormat: { type: "decimal", precision: 2 }
},
{
column: "QSR",
displayFormat: "{0}",
summaryType: footerSum,
valueFormat: { type: "decimal", precision: 2 }
},
{
column: "ND",
displayFormat: "{0}",
summaryType: footerSum,
valueFormat: { type: "decimal", precision: 2 }
},
{
column: "CD",
displayFormat: "{0}",
summaryType: footerSum,
valueFormat: { type: "decimal", precision: 2 }
},
{
column: "HD",
displayFormat: "{0}",
summaryType: footerSum,
valueFormat: { type: "decimal", precision: 2 }
},
{
column: "SR",
displayFormat: "{0}",
summaryType: footerSum,
valueFormat: { type: "decimal", precision: 2 }
},
{
column: "SMR",
displayFormat: "{0}",
summaryType: footerSum,
valueFormat: { type: "decimal", precision: 2 }
},
{
column: "AMR",
displayFormat: "{0}",
summaryType: footerSum,
valueFormat: { type: "decimal", precision: 2 }
}
]
} // end summary
}); // end grid
} // end ajax success
});
console.log('Prepare grid AV finished');
$("#radio-group-typAV").dxRadioGroup({
items: typAV,
value: typAV[0],
layout: "horizontal",
visible: false,
onValueChanged: function(e){
DataRange2 ();
}
});
$("#radio-group-footerAV").dxRadioGroup({
items: footer,
value: footer[0],
layout: "horizontal",
onValueChanged: function(e){
/* DevExpress.ui.notify('Moment ...', 'info', 600); */
var RGroup = $("#radio-group-footerAV").dxRadioGroup("instance");
var R = footer.indexOf(RGroup.option('value'));
if (R == 0) { footerSum = 'avg'; }
else if (R == 1) { footerSum = 'min'; }
else if (R == 2) { footerSum = 'max'; }
else if (R == 3) { footerSum = 'sum'; }
$("#gridAV").dxDataGrid({
dataSource: dataAV,
summary: {
totalItems: [
{ displayFormat: "{0}", column: "WTR", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "AR", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "SD", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "AD", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "QIR", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "QSR", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "ND", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "CD", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "HD", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "SR", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "SMR", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } },
{ displayFormat: "{0}", column: "AMR", summaryType: footerSum, valueFormat: { type: "decimal", precision: 2 } }
]
}
});
}
});
console.log('Prepare Radio finished');
}
function AVFrm() {
window.GetDate = 0;
$.ajax({
url: "frm-ch-av.php",
dataType : "html",
success: function(result) {
document.getElementById("MainPlace").innerHTML = result;
PrepareFormAV();
document.getElementById("MenuDashboardSubmenu").innerHTML = 'Laboratoř';
prepareMenuListener();
}
}); // ajax end
};function DataRange3 (parametr) {
window.GetDate = 0;
DevExpress.ui.notify('Moment ...', 'info', 200);
/*
var rangeSelector = $("#date-selector").dxRangeSelector('instance');
var selRange = rangeSelector.getValue();
var Datum1 = (selRange[0].getFullYear()+'-'+(selRange[0].getMonth()+1)+'-'+selRange[0].getDate());
var Datum2 = (selRange[1].getFullYear()+'-'+(selRange[1].getMonth()+1)+'-'+selRange[1].getDate());
*/
var dateFrom = $("#VPDateFrom").dxDateBox("instance");
var dateBoxValueFrom = new Date ( dateFrom.option('value') );
var dateTo = $("#VPDateTo").dxDateBox("instance");
var dateBoxValueTo = new Date ( dateTo.option('value') );
var Datum1 = (dateBoxValueFrom.getFullYear()+'-'+(dateBoxValueFrom.getMonth()+1)+'-'+dateBoxValueFrom.getDate());
var Datum2 = (dateBoxValueTo.getFullYear()+'-'+(dateBoxValueTo.getMonth()+1)+'-'+dateBoxValueTo.getDate());
var RGroup1 = $("#radio-group-SILO").dxRadioGroup("instance");
var R1 = SILO.indexOf(RGroup1.option('value'));
console.log ('(3)'+Datum1+' / '+Datum2);
$.ajax({
url: "ajaxChVP.php?typ="+R1+"&t1="+Datum1+"&t2="+Datum2+"&"+parametr,
dataType : "script",
success: function(result) {
$("#gridVP").dxDataGrid({ dataSource: dataVP });
DevExpress.ui.notify("OK, provedeno ...", "info", 500);
} });
}
function PrepareFormVP() {
var now = new Date();
$.ajax({
url: "ajaxChVP.php?typ=0&cas=0&t1=2025-08-01&t2=2025-11-01", dataType : "script",
success: function(result) {
console.log( "Prepare grid" );
$("#gridVP").dxDataGrid({
dataSource: dataVP,
rowAlternationEnabled: false,
allowColumnResizing: true,
columnResizingMode: "nextColumn",
showBorders: true,
showRowLines: true,
columnAutoWidth: true,
columnMinWidth: 30,
scrolling: { mode: "virtual",
onInitialized: function(e) { e.component._attachNativeScrollbarsCustomizationCss = function() {}; },
useNative: true
},
paging: {
enabled: false
},
filterRow: {
visible: false,
applyFilter: "auto"
},
headerFilter: {
visible: true
},
export: { enabled: true, allowExportSelectedData: false, formats: ['xlsx'], },
onExporting(e) {
const workbook = new ExcelJS.Workbook();
const worksheet = workbook.addWorksheet('Companies');
DevExpress.excelExporter.exportDataGrid({
component: e.component,
worksheet,
autoFilterEnabled: true,
}).then(() => {
workbook.xlsx.writeBuffer().then((buffer) => {
saveAs(new Blob([buffer], { type: 'application/octet-stream' }), 'Vzorky-popelovin.xlsx');
});
});
},
searchPanel: {
visible: true,
width: 200,
placeholder: "Hledat..."
},
onRowUpdated: function (e) {
DevExpress.ui.notify("aktualizuji data ...","info",500);
var RTYPGroup = $("#radio-group-SILO").dxRadioGroup("instance");
var RTYP = SILO.indexOf(RTYPGroup.option('value'));
var datagrid = $("#gridVP").dxDataGrid('instance');
row = datagrid.getSelectedRowKeys();
// key, data, component, element
var output = '';
for (var property in e.key) { output += property + ': ' + e.key[property]+'; '; }
console.log ("ajaxChVPSave.php?r=upd&typ="+RTYP+"&in="+output);
$.ajax({
url: "ajaxChVPSave.php?r=upd&typ="+RTYP+"&in="+output,
dataType : "script",
success: function(result) {
DevExpress.ui.notify("ok ...","success",500);
}
});
},
selection: {
mode: "single"
},
sorting: {
mode: "multiple"
},
columnChooser: {
enabled: true
},
toolbar: {
items: [
{
location: "before",
widget: "dxButton",
type: "danger",
options: {
icon: "clearformat",
type: "danger",
hint: "Zrušit filtrační podmínky ...",
onClick: function() {
DevExpress.ui.notify("ruším filtrační podmínky ...","warning",500);
var dataGrid = $('#gridVP').dxDataGrid('instance');
dataGrid.clearFilter();
dataGrid.clearSorting();
}
}
},
{
location: "before",
widget: "dxSelectBox",
options: {
items: SILO,
acceptCustomValue: false,
value: SILO[0],
onValueChanged: function(data) {
DevExpress.ui.notify("moment ...","info",500);
var selectedValue = data.value;
console.log(selectedValue);
$("#radio-group-SILO").dxRadioGroup("instance").option('value',selectedValue);
DataRange3();
}
}
},
{
location: "before",
widget: "dxDateBox",
options: {
type: "date",
label: "od",
displayFormat: "dd.MM.yyyy",
value: now - (60*60*1000*24*60),
elementAttr: { id: "VPDateFrom" },
onValueChanged: function(e) {
DataRange3();
}
}
},
{
location: "before",
widget: "dxDateBox",
options: {
type: "date",
label: "do",
displayFormat: "dd.MM.yyyy",
value: now,
elementAttr: { id: "VPDateTo" },
onValueChanged: function(e) {
DataRange3();
}
}
}, 'columnChooserButton', 'exportButton', 'searchPanel'
]
},
/*
customizeColumns(columns) {
columns.forEach(element => {
if(element.caption)
element.headerCellTemplate = element.caption.replace(" ", "