| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639 | 
							- BemsWebApplication.ViewOperatingExpensesByFacility = function (params, viewInfo) {
 
-     var endpointSelector = "";
 
-     if (BemsWebApplication.config.mode == "production") {
 
-         endpointSelector = new DevExpress.EndpointSelector(BemsWebApplication.config.endpoints).config.db.production;
 
-     } else {
 
-         endpointSelector = new DevExpress.EndpointSelector(BemsWebApplication.config.endpoints).config.db.local;
 
-     }
 
-     var time_data = [
 
-         { time: 0 }, { time: 1 }, { time: 2 }, { time: 3 }, { time: 4 }, { time: 5 }, { time: 6 }, { time: 7 }, { time: 8 }, { time: 9 },
 
-         { time: 10 }, { time: 11 }, { time: 12 }, { time: 13 }, { time: 14 }, { time: 15 }, { time: 16 }, { time: 17 }, { time: 18 }, { time: 19 },
 
-         { time: 20 }, { time: 21 }, { time: 22 }, { time: 23 }
 
-     ];
 
-     var PowerMeta = [];
 
-     var GasMeta = [];
 
-     var facility_type_data = [
 
-       {
 
-           id: 999,
 
-           text: ""
 
-       },
 
-       {
 
-           id: 999,
 
-           text: ""
 
-       }
 
-     ];
 
-     var facility_id_data = [{
 
-         FacilityTypeId: 999,
 
-         FacilityCode: 999,
 
-         Name: ""
 
-     }];
 
-     var mode_data = [
 
-         {
 
-             id: 1,
 
-             text: "병렬운전"
 
-         },
 
-         {
 
-             id: 2,
 
-             text: "냉단운전"
 
-         },
 
-         {
 
-             id: 3,
 
-             text: "제빙운전"
 
-         }
 
-     ];
 
-     var TodayAdd = new Date();
 
-     TodayAdd.setDate(TodayAdd.getDate() + 1);
 
-     var MainPowerConsumption = 0, MainGasConsumption = 0, MainGasHeatQuantity = 0, MainPowerPriceTypeId = 99, MainGasPriceTypeId = 99, starthour = 99, endhour = 99;
 
-     var MainFacilityType = 0, MainFacilityCode = 0, MainMode = 0, MainStartTime = 0, MainEndTime = 0;
 
-     var REFRIGERATOR = 2, BOILER = 8;
 
-     function initfacilityid() {
 
-         facility_id_data = [{
 
-             FacilityTypeId: 999,
 
-             FacilityCode: 999,
 
-             Name: ""
 
-         }];
 
-     }
 
-     function getFacilityTypeId() {
 
-         var dataSource1 = new DevExpress.data.DataSource({
 
-             store: {
 
-                 type: "odata",
 
-                 url: endpointSelector + "/BemsFacilityType",
 
-             },
 
-             requireTotalCount: true,
 
-             pageSize: 100
 
-         });
 
-         dataSource1.filter([
 
-                    ["FacilityTypeId", "=", REFRIGERATOR],
 
-                    "or",
 
-                    ["FacilityTypeId", "=", BOILER]
 
-         ]);
 
-         dataSource1.sort({ getter: "FacilityTypeId", asc: true });
 
-         dataSource1.load()
 
-         .done(function (result1) {
 
-             if (result1.length != 0) {
 
-                 for (var i = 0; i < result1.length; i++) {
 
-                     facility_type_data[i].id = result1[i].FacilityTypeId;
 
-                     facility_type_data[i].text = result1[i].Name;
 
-                 }
 
-             }
 
-             else {
 
-                 utils.toast.show('[BemsFacilityType] 데이터가 없습니다.');
 
-             }
 
-         })
 
-         .fail(function (error) {
 
-             utils.toast.show(error);
 
-         });
 
-     }
 
-     function handleViewShowing() {
 
-         getFacilityTypeId();
 
-     }
 
-     function facilityidSourceAdd(cnt) { // 설비 개수만큼 추가 
 
-         for (var i = 0; i < cnt ; i++) {
 
-             facility_id_data.push({
 
-                 FacilityTypeId: 999,
 
-                 FacilityCode: 999,
 
-                 Name: ""
 
-             });
 
-         }
 
-     }
 
-     function GetGridData() {
 
-         var gridData = new Array();
 
-         var tempMainStartTime = MainStartTime;
 
-         var tempMainEndTime = MainEndTime;
 
-         var DateTime;
 
-         if (tempMainStartTime.getDate() == MainEndTime.getDate()) //같은 날짜
 
-         {
 
-             var TotalPowerPrice = 0, TotalGasPrice = 0;
 
-             for (var i = tempMainStartTime.getHours() ; i <= MainEndTime.getHours() ; i++) {
 
-                 DateTime = new Date(tempMainStartTime.getFullYear(), tempMainStartTime.getMonth(), tempMainStartTime.getDate(), i, 0, 0);
 
-                 if (MainFacilityType == REFRIGERATOR) {
 
-                     var tempMonth = DateTime.getMonth();
 
-                     var tempHour = DateTime.getHours();
 
-                     var tempPowerBasic = PowerMeta[tempMonth][tempHour];
 
-                     var setData = {
 
-                         "DateTime": DateTime,
 
-                         "PowerBasic": tempPowerBasic,
 
-                         "PowerPrice": tempPowerBasic * MainPowerConsumption,
 
-                         "GasBasic": '-',
 
-                         "GasPrice": '-',
 
-                         "TotalPrice": Math.round(tempPowerBasic * MainPowerConsumption)
 
-                     };
 
-                     TotalPowerPrice += Math.round(setData.PowerPrice);
 
-                 }
 
-                 else {
 
-                     var tempMonth = DateTime.getMonth();
 
-                     var tempHour = DateTime.getHours();
 
-                     var tempPowerBasic = PowerMeta[tempMonth][tempHour];
 
-                     var tempGasBasic = GasMeta[tempMonth][0];
 
-                     var setData = {
 
-                         "DateTime": DateTime,
 
-                         "PowerBasic": tempPowerBasic,
 
-                         "PowerPrice": tempPowerBasic * MainPowerConsumption,
 
-                         "GasBasic": tempGasBasic,
 
-                         "GasPrice": tempGasBasic * MainGasConsumption * MainGasHeatQuantity,
 
-                         "TotalPrice": Math.round(tempPowerBasic * MainPowerConsumption) + Math.round(tempGasBasic * MainGasConsumption * MainGasHeatQuantity)
 
-                     };
 
-                     TotalPowerPrice += Math.round(setData.PowerPrice);
 
-                     TotalGasPrice += Math.round(setData.GasPrice);
 
-                 }
 
-                 gridData.push(setData);
 
-             }
 
-         }
 
-         else { //다른날짜
 
-             var TotalPowerPrice = 0, TotalGasPrice = 0;
 
-             for (var i = tempMainStartTime.getHours() ; i < 24; i++) {
 
-                 DateTime = new Date(tempMainStartTime.getFullYear(), tempMainStartTime.getMonth(), tempMainStartTime.getDate(), i, 0, 0);
 
-                 if (MainFacilityType == REFRIGERATOR) {
 
-                     var tempMonth = DateTime.getMonth();
 
-                     var tempHour = DateTime.getHours();
 
-                     var tempPowerBasic = PowerMeta[tempMonth][tempHour];
 
-                     var setData = {
 
-                         "DateTime": DateTime,
 
-                         "PowerBasic": tempPowerBasic,
 
-                         "PowerPrice": tempPowerBasic * MainPowerConsumption,
 
-                         "GasBasic": '-',
 
-                         "GasPrice": '-',
 
-                         "TotalPrice": Math.round(tempPowerBasic * MainPowerConsumption)
 
-                     };
 
-                     TotalPowerPrice += Math.round(setData.PowerPrice);
 
-                 }
 
-                 else {
 
-                     var tempMonth = DateTime.getMonth();
 
-                     var tempHour = DateTime.getHours();
 
-                     var tempPowerBasic = PowerMeta[tempMonth][tempHour];
 
-                     var tempGasBasic = GasMeta[tempMonth][0];
 
-                     var setData = {
 
-                         "DateTime": DateTime,
 
-                         "PowerBasic": tempPowerBasic,
 
-                         "PowerPrice": tempPowerBasic * MainPowerConsumption,
 
-                         "GasBasic": tempGasBasic,
 
-                         "GasPrice": tempGasBasic * MainGasConsumption * MainGasHeatQuantity,
 
-                         "TotalPrice": Math.round(tempPowerBasic * MainPowerConsumption) + Math.round(tempGasBasic * MainGasConsumption * MainGasHeatQuantity)
 
-                     };
 
-                     TotalPowerPrice += Math.round(setData.PowerPrice);
 
-                     TotalGasPrice += Math.round(setData.GasPrice);
 
-                 }
 
-                 gridData.push(setData);
 
-             }
 
-             for (var i = 1; i <= 7; i++) //일주일치만 검색가능하니깐
 
-             {
 
-                 tempMainStartTime = new Date(tempMainStartTime.getFullYear(), tempMainStartTime.getMonth(), tempMainStartTime.getDate() + 1, tempMainStartTime.getHours(), tempMainStartTime.getMinutes());
 
-                 if (tempMainStartTime.getDate() < tempMainEndTime.getDate()) {
 
-                     for (var j = 0; j < 24; j++) {
 
-                         DateTime = new Date(tempMainStartTime.getFullYear(), tempMainStartTime.getMonth(), tempMainStartTime.getDate(), j, 0, 0);
 
-                         if (MainFacilityType == REFRIGERATOR) {
 
-                             var tempMonth = DateTime.getMonth();
 
-                             var tempHour = DateTime.getHours();
 
-                             var tempPowerBasic = PowerMeta[tempMonth][tempHour];
 
-                             var setData = {
 
-                                 "DateTime": DateTime,
 
-                                 "PowerBasic": tempPowerBasic,
 
-                                 "PowerPrice": tempPowerBasic * MainPowerConsumption,
 
-                                 "GasBasic": '-',
 
-                                 "GasPrice": '-',
 
-                                 "TotalPrice": Math.round(tempPowerBasic * MainPowerConsumption)
 
-                             };
 
-                             TotalPowerPrice += Math.round(setData.PowerPrice);
 
-                         }
 
-                         else {
 
-                             var tempMonth = DateTime.getMonth();
 
-                             var tempHour = DateTime.getHours();
 
-                             var tempPowerBasic = PowerMeta[tempMonth][tempHour];
 
-                             var tempGasBasic = GasMeta[tempMonth][0];
 
-                             var setData = {
 
-                                 "DateTime": DateTime,
 
-                                 "PowerBasic": tempPowerBasic,
 
-                                 "PowerPrice": tempPowerBasic * MainPowerConsumption,
 
-                                 "GasBasic": tempGasBasic,
 
-                                 "GasPrice": tempGasBasic * MainGasConsumption * MainGasHeatQuantity,
 
-                                 "TotalPrice": Math.round(tempPowerBasic * MainPowerConsumption) + Math.round(tempGasBasic * MainGasConsumption * MainGasHeatQuantity)
 
-                             };
 
-                             TotalPowerPrice += Math.round(setData.PowerPrice);
 
-                             TotalGasPrice += Math.round(setData.GasPrice);
 
-                         }
 
-                         gridData.push(setData);
 
-                     }
 
-                 }
 
-                 else {
 
-                     for (var k = 0; k <= tempMainEndTime.getHours() ; k++) {
 
-                         DateTime = new Date(tempMainStartTime.getFullYear(), tempMainStartTime.getMonth(), tempMainStartTime.getDate(), k, 0, 0);
 
-                         if (MainFacilityType == REFRIGERATOR) {
 
-                             var tempMonth = DateTime.getMonth();
 
-                             var tempHour = DateTime.getHours();
 
-                             var tempPowerBasic = PowerMeta[tempMonth][tempHour];
 
-                             var setData = {
 
-                                 "DateTime": DateTime,
 
-                                 "PowerBasic": tempPowerBasic,
 
-                                 "PowerPrice": tempPowerBasic * MainPowerConsumption,
 
-                                 "GasBasic": '-',
 
-                                 "GasPrice": '-',
 
-                                 "TotalPrice": Math.round(tempPowerBasic * MainPowerConsumption)
 
-                             };
 
-                             TotalPowerPrice += Math.round(setData.PowerPrice);
 
-                         }
 
-                         else {
 
-                             var tempMonth = DateTime.getMonth();
 
-                             var tempHour = DateTime.getHours();
 
-                             var tempPowerBasic = PowerMeta[tempMonth][tempHour];
 
-                             var tempGasBasic = GasMeta[tempMonth][0];
 
-                             var setData = {
 
-                                 "DateTime": DateTime,
 
-                                 "PowerBasic": tempPowerBasic,
 
-                                 "PowerPrice": tempPowerBasic * MainPowerConsumption,
 
-                                 "GasBasic": tempGasBasic,
 
-                                 "GasPrice": tempGasBasic * MainGasConsumption * MainGasHeatQuantity,
 
-                                 "TotalPrice": Math.round(tempPowerBasic * MainPowerConsumption) + Math.round(tempGasBasic * MainGasConsumption * MainGasHeatQuantity)
 
-                             };
 
-                             TotalPowerPrice += Math.round(setData.PowerPrice);
 
-                             TotalGasPrice += Math.round(setData.GasPrice);
 
-                         }
 
-                         gridData.push(setData);
 
-                     }
 
-                     break;
 
-                 }
 
-             }
 
-         }
 
-         $("#dataGrid").dxDataGrid("instance").option('dataSource', gridData);
 
-         $("#Gas").dxTextBox('instance').option('value', numberWithCommas(TotalGasPrice) + '원');
 
-         $("#Power").dxTextBox('instance').option('value', numberWithCommas(TotalPowerPrice) + '원');
 
-         $("#Total").dxTextBox('instance').option('value', numberWithCommas(TotalGasPrice + TotalPowerPrice) + '원');
 
-         var dg = $("#dataGrid").dxDataGrid("instance");
 
-         dg.refresh();
 
-     }
 
-     function numberWithCommas(x) {
 
-         return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
 
-     }
 
-     function getPowerPriceMeta(PowerPriceTypeId) {
 
-         PowerMeta = new Array(13);
 
-         for (var i = 1; i < 13; i++) {
 
-             PowerMeta[i] = new Array(24);
 
-         }
 
-         var dataSource = new DevExpress.data.DataSource({
 
-             store: new DevExpress.data.ODataStore({
 
-                 url: endpointSelector + "/BemsPriceMeta"
 
-             }),
 
-             requireTotalCount: true,
 
-             pageSize: 1
 
-         });
 
-         dataSource.filter([
 
-                 ["PriceTypeId", "=", PowerPriceTypeId]
 
-         ]);
 
-         dataSource.sort({ getter: "PublishDate", desc: true });
 
-         dataSource.load()
 
-         .done(function (result) {
 
-             if (result.length != 0) {
 
-                 PriceMeta = result[0];
 
-                 PowerMeta[1][0] = PriceMeta.C01_00; PowerMeta[1][1] = PriceMeta.C01_01; PowerMeta[1][2] = PriceMeta.C01_02; PowerMeta[1][3] = PriceMeta.C01_03; PowerMeta[1][4] = PriceMeta.C01_04; PowerMeta[1][5] = PriceMeta.C01_05; PowerMeta[1][6] = PriceMeta.C01_06; PowerMeta[1][7] = PriceMeta.C01_07; PowerMeta[1][8] = PriceMeta.C01_08; PowerMeta[1][9] = PriceMeta.C01_09; PowerMeta[1][10] = PriceMeta.C01_10; PowerMeta[1][11] = PriceMeta.C01_11; PowerMeta[1][12] = PriceMeta.C01_12; PowerMeta[1][13] = PriceMeta.C01_13; PowerMeta[1][14] = PriceMeta.C01_14; PowerMeta[1][15] = PriceMeta.C01_15; PowerMeta[1][16] = PriceMeta.C01_16; PowerMeta[1][17] = PriceMeta.C01_17; PowerMeta[1][18] = PriceMeta.C01_18; PowerMeta[1][19] = PriceMeta.C01_19; PowerMeta[1][20] = PriceMeta.C01_20; PowerMeta[1][21] = PriceMeta.C01_21; PowerMeta[1][22] = PriceMeta.C01_22; PowerMeta[1][23] = PriceMeta.C01_23;
 
-                 PowerMeta[2][0] = PriceMeta.C02_00; PowerMeta[2][1] = PriceMeta.C02_01; PowerMeta[2][2] = PriceMeta.C02_02; PowerMeta[2][3] = PriceMeta.C02_03; PowerMeta[2][4] = PriceMeta.C02_04; PowerMeta[2][5] = PriceMeta.C02_05; PowerMeta[2][6] = PriceMeta.C02_06; PowerMeta[2][7] = PriceMeta.C02_07; PowerMeta[2][8] = PriceMeta.C02_08; PowerMeta[2][9] = PriceMeta.C02_09; PowerMeta[2][10] = PriceMeta.C02_10; PowerMeta[2][11] = PriceMeta.C02_11; PowerMeta[2][12] = PriceMeta.C02_12; PowerMeta[2][13] = PriceMeta.C02_13; PowerMeta[2][14] = PriceMeta.C02_14; PowerMeta[2][15] = PriceMeta.C02_15; PowerMeta[2][16] = PriceMeta.C02_16; PowerMeta[2][17] = PriceMeta.C02_17; PowerMeta[2][18] = PriceMeta.C02_18; PowerMeta[2][19] = PriceMeta.C02_19; PowerMeta[2][20] = PriceMeta.C02_20; PowerMeta[2][21] = PriceMeta.C02_21; PowerMeta[2][22] = PriceMeta.C02_22; PowerMeta[2][23] = PriceMeta.C02_23;
 
-                 PowerMeta[3][0] = PriceMeta.C03_00; PowerMeta[3][1] = PriceMeta.C03_01; PowerMeta[3][2] = PriceMeta.C03_02; PowerMeta[3][3] = PriceMeta.C03_03; PowerMeta[3][4] = PriceMeta.C03_04; PowerMeta[3][5] = PriceMeta.C03_05; PowerMeta[3][6] = PriceMeta.C03_06; PowerMeta[3][7] = PriceMeta.C03_07; PowerMeta[3][8] = PriceMeta.C03_08; PowerMeta[3][9] = PriceMeta.C03_09; PowerMeta[3][10] = PriceMeta.C03_10; PowerMeta[3][11] = PriceMeta.C03_11; PowerMeta[3][12] = PriceMeta.C03_12; PowerMeta[3][13] = PriceMeta.C03_13; PowerMeta[3][14] = PriceMeta.C03_14; PowerMeta[3][15] = PriceMeta.C03_15; PowerMeta[3][16] = PriceMeta.C03_16; PowerMeta[3][17] = PriceMeta.C03_17; PowerMeta[3][18] = PriceMeta.C03_18; PowerMeta[3][19] = PriceMeta.C03_19; PowerMeta[3][20] = PriceMeta.C03_20; PowerMeta[3][21] = PriceMeta.C03_21; PowerMeta[3][22] = PriceMeta.C03_22; PowerMeta[3][23] = PriceMeta.C03_23;
 
-                 PowerMeta[4][0] = PriceMeta.C04_00; PowerMeta[4][1] = PriceMeta.C04_01; PowerMeta[4][2] = PriceMeta.C04_02; PowerMeta[4][3] = PriceMeta.C04_03; PowerMeta[4][4] = PriceMeta.C04_04; PowerMeta[4][5] = PriceMeta.C04_05; PowerMeta[4][6] = PriceMeta.C04_06; PowerMeta[4][7] = PriceMeta.C04_07; PowerMeta[4][8] = PriceMeta.C04_08; PowerMeta[4][9] = PriceMeta.C04_09; PowerMeta[4][10] = PriceMeta.C04_10; PowerMeta[4][11] = PriceMeta.C04_11; PowerMeta[4][12] = PriceMeta.C04_12; PowerMeta[4][13] = PriceMeta.C04_13; PowerMeta[4][14] = PriceMeta.C04_14; PowerMeta[4][15] = PriceMeta.C04_15; PowerMeta[4][16] = PriceMeta.C04_16; PowerMeta[4][17] = PriceMeta.C04_17; PowerMeta[4][18] = PriceMeta.C04_18; PowerMeta[4][19] = PriceMeta.C04_19; PowerMeta[4][20] = PriceMeta.C04_20; PowerMeta[4][21] = PriceMeta.C04_21; PowerMeta[4][22] = PriceMeta.C04_22; PowerMeta[4][23] = PriceMeta.C04_23;
 
-                 PowerMeta[5][0] = PriceMeta.C05_00; PowerMeta[5][1] = PriceMeta.C05_01; PowerMeta[5][2] = PriceMeta.C05_02; PowerMeta[5][3] = PriceMeta.C05_03; PowerMeta[5][4] = PriceMeta.C05_04; PowerMeta[5][5] = PriceMeta.C05_05; PowerMeta[5][6] = PriceMeta.C05_06; PowerMeta[5][7] = PriceMeta.C05_07; PowerMeta[5][8] = PriceMeta.C05_08; PowerMeta[5][9] = PriceMeta.C05_09; PowerMeta[5][10] = PriceMeta.C05_10; PowerMeta[5][11] = PriceMeta.C05_11; PowerMeta[5][12] = PriceMeta.C05_12; PowerMeta[5][13] = PriceMeta.C05_13; PowerMeta[5][14] = PriceMeta.C05_14; PowerMeta[5][15] = PriceMeta.C05_15; PowerMeta[5][16] = PriceMeta.C05_16; PowerMeta[5][17] = PriceMeta.C05_17; PowerMeta[5][18] = PriceMeta.C05_18; PowerMeta[5][19] = PriceMeta.C05_19; PowerMeta[5][20] = PriceMeta.C05_20; PowerMeta[5][21] = PriceMeta.C05_21; PowerMeta[5][22] = PriceMeta.C05_22; PowerMeta[5][23] = PriceMeta.C05_23;
 
-                 PowerMeta[6][0] = PriceMeta.C06_00; PowerMeta[6][1] = PriceMeta.C06_01; PowerMeta[6][2] = PriceMeta.C06_02; PowerMeta[6][3] = PriceMeta.C06_03; PowerMeta[6][4] = PriceMeta.C06_04; PowerMeta[6][5] = PriceMeta.C06_05; PowerMeta[6][6] = PriceMeta.C06_06; PowerMeta[6][7] = PriceMeta.C06_07; PowerMeta[6][8] = PriceMeta.C06_08; PowerMeta[6][9] = PriceMeta.C06_09; PowerMeta[6][10] = PriceMeta.C06_10; PowerMeta[6][11] = PriceMeta.C06_11; PowerMeta[6][12] = PriceMeta.C06_12; PowerMeta[6][13] = PriceMeta.C06_13; PowerMeta[6][14] = PriceMeta.C06_14; PowerMeta[6][15] = PriceMeta.C06_15; PowerMeta[6][16] = PriceMeta.C06_16; PowerMeta[6][17] = PriceMeta.C06_17; PowerMeta[6][18] = PriceMeta.C06_18; PowerMeta[6][19] = PriceMeta.C06_19; PowerMeta[6][20] = PriceMeta.C06_20; PowerMeta[6][21] = PriceMeta.C06_21; PowerMeta[6][22] = PriceMeta.C06_22; PowerMeta[6][23] = PriceMeta.C06_23;
 
-                 PowerMeta[7][0] = PriceMeta.C07_00; PowerMeta[7][1] = PriceMeta.C07_01; PowerMeta[7][2] = PriceMeta.C07_02; PowerMeta[7][3] = PriceMeta.C07_03; PowerMeta[7][4] = PriceMeta.C07_04; PowerMeta[7][5] = PriceMeta.C07_05; PowerMeta[7][6] = PriceMeta.C07_06; PowerMeta[7][7] = PriceMeta.C07_07; PowerMeta[7][8] = PriceMeta.C07_08; PowerMeta[7][9] = PriceMeta.C07_09; PowerMeta[7][10] = PriceMeta.C07_10; PowerMeta[7][11] = PriceMeta.C07_11; PowerMeta[7][12] = PriceMeta.C07_12; PowerMeta[7][13] = PriceMeta.C07_13; PowerMeta[7][14] = PriceMeta.C07_14; PowerMeta[7][15] = PriceMeta.C07_15; PowerMeta[7][16] = PriceMeta.C07_16; PowerMeta[7][17] = PriceMeta.C07_17; PowerMeta[7][18] = PriceMeta.C07_18; PowerMeta[7][19] = PriceMeta.C07_19; PowerMeta[7][20] = PriceMeta.C07_20; PowerMeta[7][21] = PriceMeta.C07_21; PowerMeta[7][22] = PriceMeta.C07_22; PowerMeta[7][23] = PriceMeta.C07_23;
 
-                 PowerMeta[8][0] = PriceMeta.C08_00; PowerMeta[8][1] = PriceMeta.C08_01; PowerMeta[8][2] = PriceMeta.C08_02; PowerMeta[8][3] = PriceMeta.C08_03; PowerMeta[8][4] = PriceMeta.C08_04; PowerMeta[8][5] = PriceMeta.C08_05; PowerMeta[8][6] = PriceMeta.C08_06; PowerMeta[8][7] = PriceMeta.C08_07; PowerMeta[8][8] = PriceMeta.C08_08; PowerMeta[8][9] = PriceMeta.C08_09; PowerMeta[8][10] = PriceMeta.C08_10; PowerMeta[8][11] = PriceMeta.C08_11; PowerMeta[8][12] = PriceMeta.C08_12; PowerMeta[8][13] = PriceMeta.C08_13; PowerMeta[8][14] = PriceMeta.C08_14; PowerMeta[8][15] = PriceMeta.C08_15; PowerMeta[8][16] = PriceMeta.C08_16; PowerMeta[8][17] = PriceMeta.C08_17; PowerMeta[8][18] = PriceMeta.C08_18; PowerMeta[8][19] = PriceMeta.C08_19; PowerMeta[8][20] = PriceMeta.C08_20; PowerMeta[8][21] = PriceMeta.C08_21; PowerMeta[8][22] = PriceMeta.C08_22; PowerMeta[8][23] = PriceMeta.C08_23;
 
-                 PowerMeta[9][0] = PriceMeta.C09_00; PowerMeta[9][1] = PriceMeta.C09_01; PowerMeta[9][2] = PriceMeta.C09_02; PowerMeta[9][3] = PriceMeta.C09_03; PowerMeta[9][4] = PriceMeta.C09_04; PowerMeta[9][5] = PriceMeta.C09_05; PowerMeta[9][6] = PriceMeta.C09_06; PowerMeta[9][7] = PriceMeta.C09_07; PowerMeta[9][8] = PriceMeta.C09_08; PowerMeta[9][9] = PriceMeta.C09_09; PowerMeta[9][10] = PriceMeta.C09_10; PowerMeta[9][11] = PriceMeta.C09_11; PowerMeta[9][12] = PriceMeta.C09_12; PowerMeta[9][13] = PriceMeta.C09_13; PowerMeta[9][14] = PriceMeta.C09_14; PowerMeta[9][15] = PriceMeta.C09_15; PowerMeta[9][16] = PriceMeta.C09_16; PowerMeta[9][17] = PriceMeta.C09_17; PowerMeta[9][18] = PriceMeta.C09_18; PowerMeta[9][19] = PriceMeta.C09_19; PowerMeta[9][20] = PriceMeta.C09_20; PowerMeta[9][21] = PriceMeta.C09_21; PowerMeta[9][22] = PriceMeta.C09_22; PowerMeta[9][23] = PriceMeta.C09_23;
 
-                 PowerMeta[10][0] = PriceMeta.C10_00; PowerMeta[10][1] = PriceMeta.C10_01; PowerMeta[10][2] = PriceMeta.C10_02; PowerMeta[10][3] = PriceMeta.C10_03; PowerMeta[10][4] = PriceMeta.C10_04; PowerMeta[10][5] = PriceMeta.C10_05; PowerMeta[10][6] = PriceMeta.C10_06; PowerMeta[10][7] = PriceMeta.C10_07; PowerMeta[10][8] = PriceMeta.C10_08; PowerMeta[10][9] = PriceMeta.C10_09; PowerMeta[10][10] = PriceMeta.C10_10; PowerMeta[10][11] = PriceMeta.C10_11; PowerMeta[10][12] = PriceMeta.C10_12; PowerMeta[10][13] = PriceMeta.C10_13; PowerMeta[10][14] = PriceMeta.C10_14; PowerMeta[10][15] = PriceMeta.C10_15; PowerMeta[10][16] = PriceMeta.C10_16; PowerMeta[10][17] = PriceMeta.C10_17; PowerMeta[10][18] = PriceMeta.C10_18; PowerMeta[10][19] = PriceMeta.C10_19; PowerMeta[10][20] = PriceMeta.C10_20; PowerMeta[10][21] = PriceMeta.C10_21; PowerMeta[10][22] = PriceMeta.C10_22; PowerMeta[10][23] = PriceMeta.C10_23;
 
-                 PowerMeta[11][0] = PriceMeta.C11_00; PowerMeta[11][1] = PriceMeta.C11_01; PowerMeta[11][2] = PriceMeta.C11_02; PowerMeta[11][3] = PriceMeta.C11_03; PowerMeta[11][4] = PriceMeta.C11_04; PowerMeta[11][5] = PriceMeta.C11_05; PowerMeta[11][6] = PriceMeta.C11_06; PowerMeta[11][7] = PriceMeta.C11_07; PowerMeta[11][8] = PriceMeta.C11_08; PowerMeta[11][9] = PriceMeta.C11_09; PowerMeta[11][10] = PriceMeta.C11_10; PowerMeta[11][11] = PriceMeta.C11_11; PowerMeta[11][12] = PriceMeta.C11_12; PowerMeta[11][13] = PriceMeta.C11_13; PowerMeta[11][14] = PriceMeta.C11_14; PowerMeta[11][15] = PriceMeta.C11_15; PowerMeta[11][16] = PriceMeta.C11_16; PowerMeta[11][17] = PriceMeta.C11_17; PowerMeta[11][18] = PriceMeta.C11_18; PowerMeta[11][19] = PriceMeta.C11_19; PowerMeta[11][20] = PriceMeta.C11_20; PowerMeta[11][21] = PriceMeta.C11_21; PowerMeta[11][22] = PriceMeta.C11_22; PowerMeta[11][23] = PriceMeta.C11_23;
 
-                 PowerMeta[12][0] = PriceMeta.C12_00; PowerMeta[12][1] = PriceMeta.C12_01; PowerMeta[12][2] = PriceMeta.C12_02; PowerMeta[12][3] = PriceMeta.C12_03; PowerMeta[12][4] = PriceMeta.C12_04; PowerMeta[12][5] = PriceMeta.C12_05; PowerMeta[12][6] = PriceMeta.C12_06; PowerMeta[12][7] = PriceMeta.C12_07; PowerMeta[12][8] = PriceMeta.C12_08; PowerMeta[12][9] = PriceMeta.C12_09; PowerMeta[12][10] = PriceMeta.C12_10; PowerMeta[12][11] = PriceMeta.C12_11; PowerMeta[12][12] = PriceMeta.C12_12; PowerMeta[12][13] = PriceMeta.C12_13; PowerMeta[12][14] = PriceMeta.C12_14; PowerMeta[12][15] = PriceMeta.C12_15; PowerMeta[12][16] = PriceMeta.C12_16; PowerMeta[12][17] = PriceMeta.C12_17; PowerMeta[12][18] = PriceMeta.C12_18; PowerMeta[12][19] = PriceMeta.C12_19; PowerMeta[12][20] = PriceMeta.C12_20; PowerMeta[12][21] = PriceMeta.C12_21; PowerMeta[12][22] = PriceMeta.C12_22; PowerMeta[12][23] = PriceMeta.C12_23;
 
-                 GetGridData();
 
-             }
 
-             else {
 
-                 PowerMeta = 0;
 
-                 utils.toast.show('[BemsPriceMeta-Power] 해당하는 데이터가 없습니다.');
 
-                 return;
 
-             }
 
-         })
 
-         .fail(function (error) {
 
-             alert(error);
 
-         });
 
-     }
 
-     function getGasPriceMeta(PowerPriceTypeId, GasPriceTypeId) {
 
-         GasMeta = new Array(13);
 
-         for (var i = 1; i < 13; i++) {
 
-             GasMeta[i] = new Array(24);
 
-         }
 
-         var dataSource = new DevExpress.data.DataSource({
 
-             store: new DevExpress.data.ODataStore({
 
-                 url: endpointSelector + "/BemsPriceMeta"
 
-             }),
 
-             requireTotalCount: true,
 
-             pageSize: 1
 
-         });
 
-         dataSource.filter([
 
-                 ["PriceTypeId", "=", PowerPriceTypeId]
 
-         ]);
 
-         dataSource.sort({ getter: "PublishDate", desc: true });
 
-         dataSource.load()
 
-         .done(function (result) {
 
-             if (result.length != 0) {
 
-                 PriceMeta = result[0];
 
-                 GasMeta[1][0] = PriceMeta.C01_00; GasMeta[2][0] = PriceMeta.C02_00; GasMeta[3][0] = PriceMeta.C03_00; GasMeta[4][0] = PriceMeta.C04_00;
 
-                 GasMeta[5][0] = PriceMeta.C05_00; GasMeta[6][0] = PriceMeta.C06_00; GasMeta[7][0] = PriceMeta.C07_00; GasMeta[8][0] = PriceMeta.C08_00;
 
-                 GasMeta[9][0] = PriceMeta.C09_00; GasMeta[10][0] = PriceMeta.C10_00; GasMeta[11][0] = PriceMeta.C11_00; GasMeta[12][0] = PriceMeta.C12_00;
 
-                 getPowerPriceMeta(GasPriceTypeId)
 
-             }
 
-             else {
 
-                 GasMeta = 0;
 
-                 utils.toast.show('[BemsPriceMeta-Gas] 해당하는 데이터가 없습니다.');
 
-                 return;
 
-             }
 
-         })
 
-         .fail(function (error) {
 
-             alert(error);
 
-         });
 
-     }
 
-     function handleViewShown() {
 
-         $("#Facility_Type_Id").dxSelectBox({
 
-             placeholder: "설비 타입",
 
-             dataSource: facility_type_data,
 
-             displayExpr: "text",
 
-             valueExpr: "id",
 
-             onValueChanged: function () {
 
-                 initfacilityid();
 
-                 var FacilityTypeId = $("#Facility_Type_Id").dxSelectBox('instance').option('value');
 
-                 switch (FacilityTypeId) {
 
-                     case REFRIGERATOR:
 
-                         $("#Mode").dxSelectBox('instance').option('disabled', false);
 
-                         break;
 
-                     case BOILER:
 
-                         $("#Mode").dxSelectBox('instance').option('disabled', true);
 
-                         $("#Mode").dxSelectBox('instance').option('value', null);
 
-                         break;
 
-                     case KITCHEN:
 
-                         $("#Mode").dxSelectBox('instance').option('disabled', true);
 
-                         $("#Mode").dxSelectBox('instance').option('value', null);
 
-                         break;
 
-                 }
 
-                 var dataSource2 = new DevExpress.data.DataSource({
 
-                     store: {
 
-                         type: "odata",
 
-                         url: endpointSelector + "/CmFacility",
 
-                     },
 
-                     requireTotalCount: true,
 
-                     pageSize: 5000
 
-                 });
 
-                 dataSource2.filter([
 
-                     ["SiteId", "=", BWA.UserInfo.SiteId()],
 
-                     "and",
 
-                     ["FacilityTypeId", "=", FacilityTypeId],
 
-                 ]);
 
-                 dataSource2.sort({ getter: "Name", asc: true });
 
-                 dataSource2.load()
 
-                 .done(function (result2) {
 
-                     var cnt = result2.length;
 
-                     if (cnt != 0) {
 
-                         if (cnt > 1) {
 
-                             if (FacilityTypeId != 99) //주방은 1개만
 
-                                 facilityidSourceAdd(cnt - 1);
 
-                         }
 
-                         for (var i = 0; i < result2.length; i++) {
 
-                             facility_id_data[i].FacilityTypeId = result2[i].FacilityTypeId;
 
-                             facility_id_data[i].FacilityCode = result2[i].FacilityCode
 
-                             facility_id_data[i].Name = result2[i].Name;
 
-                         }
 
-                         $("#Facility_Id").dxSelectBox({
 
-                             dataSource: facility_id_data,
 
-                             displayExpr: "Name",
 
-                             valueExpr: "FacilityCode"
 
-                         });
 
-                     }
 
-                     else {
 
-                         utils.toast.show('[CmFacility] 데이터가 없습니다.');
 
-                     }
 
-                 })
 
-                 .fail(function (error) {
 
-                     utils.toast.show(error);
 
-                 });
 
-             }
 
-         });
 
-         $("#Facility_Id").dxSelectBox({
 
-             placeholder: "설비명칭"
 
-         });
 
-         $("#Mode").dxSelectBox({
 
-             placeholder: "운전모드",
 
-             dataSource: mode_data,
 
-             displayExpr: "text",
 
-             valueExpr: "id",
 
-             disabled: true
 
-         });
 
-         $("#Search_Btn").dxButton({
 
-             text: "조회",
 
-             onClick: function () {
 
-                 MainFacilityType = 0, MainFacilityCode = 0, MainMode = 0, MainStartTime = 0, MainEndTime = 0;
 
-                 MainFacilityType = $("#Facility_Type_Id").dxSelectBox('instance').option('value');
 
-                 MainFacilityCode = $("#Facility_Id").dxSelectBox('instance').option('value');
 
-                 if (MainFacilityCode == null) {
 
-                     utils.toast.show('설비 명칭을 선택해야합니다.');
 
-                     return;
 
-                 }
 
-                 MainMode = $("#Mode").dxSelectBox('instance').option('value');
 
-                 if (MainFacilityType == REFRIGERATOR) {
 
-                     if (MainMode == null) {
 
-                         utils.toast.show('운전 모드를 선택해야합니다.');
 
-                         return;
 
-                     }
 
-                 }
 
-                 var MainStartDay = $("#Start_Day").dxDateBox('instance').option('value');
 
-                 var MainStartHour = $("#Start_Hour").dxSelectBox('instance').option('value');
 
-                 if (MainStartHour == null) {
 
-                     utils.toast.show('시작 시간을 선택해야합니다.');
 
-                     return;
 
-                 }
 
-                 var MainEndDay = $("#End_Day").dxDateBox('instance').option('value');
 
-                 var MainEndHour = $("#End_Hour").dxSelectBox('instance').option('value');
 
-                 if (MainEndHour == null) {
 
-                     utils.toast.show('종료 시간을 선택해야합니다.');
 
-                     return;
 
-                 }
 
-                 MainStartTime = new Date(MainStartDay.getFullYear(), MainStartDay.getMonth(), MainStartDay.getDate(), MainStartHour, 0, 0);
 
-                 MainEndTime = new Date(MainEndDay.getFullYear(), MainEndDay.getMonth(), MainEndDay.getDate(), MainEndHour, 59, 0);
 
-                 if (MainStartTime > MainEndTime) {
 
-                     utils.toast.show('시간 설정이 잘못 되었습니다.');
 
-                     return;
 
-                 }
 
-                 if (MainStartTime < new Date()) {
 
-                     utils.toast.show('시작 시간이 현재 시간보다 커야합니다.');
 
-                     return;
 
-                 }
 
-                 var MainStartTimeAddSeven = MainStartTime;
 
-                 MainStartTimeAddSeven.setDate(MainStartTimeAddSeven.getDate() + 7);
 
-                 if (MainStartTimeAddSeven <= MainEndTime) {
 
-                     utils.toast.show('일주일 이상 조회할수 없습니다.');
 
-                     return;
 
-                 }
 
-                 MainStartTimeAddSeven.setDate(MainStartTimeAddSeven.getDate() - 7);
 
-                 //초기화
 
-                 MainPowerConsumption = 0;
 
-                 MainGasConsumption = 0;
 
-                 MainGasHeatQuantity = 0;
 
-                 MainPowerPriceTypeId = 99;
 
-                 MainGasPriceTypeId = 99;
 
-                 var dataSource3 = new DevExpress.data.DataSource({
 
-                     store: {
 
-                         type: "odata",
 
-                         url: endpointSelector + "/BemsEnergyCost",
 
-                     },
 
-                     requireTotalCount: true,
 
-                     pageSize: 1,
 
-                 });
 
-                 dataSource3.filter([
 
-                     ["SiteId", "=", BWA.UserInfo.SiteId()],
 
-                     "and",
 
-                     ["FacilityTypeId", "=", MainFacilityType],
 
-                     "and",
 
-                     ["FacilityCode", "=", MainFacilityCode],
 
-                     "and",
 
-                     ["IsUse", "=", true],
 
-                 ]);
 
-                 dataSource3.load()
 
-                 .done(function (result3) {
 
-                     if (result3.length != 0) {
 
-                         if (MainFacilityType == REFRIGERATOR) {
 
-                             if (MainMode == 3) { //제빙 운전
 
-                                 MainPowerConsumption = result3[0].PowerConsumption2;
 
-                             }
 
-                             else {
 
-                                 MainPowerConsumption = result3[0].PowerConsumption1;
 
-                             }
 
-                             var MainPowerPriceTypeId = result3[0].PowerPriceTypeId;
 
-                             getPowerPriceMeta(MainPowerPriceTypeId);
 
-                         }
 
-                         else {
 
-                             MainPowerConsumption = result3[0].PowerConsumption1;
 
-                             MainGasConsumption = result3[0].GasConsumption;
 
-                             MainGasHeatQuantity = result3[0].GasHeatQuantity;
 
-                             MainPowerPriceTypeId = result3[0].PowerPriceTypeId;
 
-                             MainGasPriceTypeId = result3[0].GasPriceTypeId;
 
-                             getGasPriceMeta(MainGasPriceTypeId, MainPowerPriceTypeId);
 
-                         }
 
-                     }
 
-                     else {
 
-                         utils.toast.show('[BemsEnergyCost] 해당하는 데이터가 없습니다.');
 
-                         return;
 
-                     }
 
-                 })
 
-                 .fail(function (error) {
 
-                     utils.toast.show(error);
 
-                 });
 
-             }
 
-         });
 
-         $("#Start_Day").dxDateBox({
 
-             value: TodayAdd
 
-         });
 
-         $("#Start_Hour").dxSelectBox({
 
-             dataSource: time_data,
 
-             displayExpr: "time",
 
-             valueExpr: "time",
 
-             onValueChanged: function () {
 
-                 starthour = $("#Start_Hour").dxSelectBox('instance').option('value');
 
-             }
 
-         });
 
-         $("#End_Day").dxDateBox({
 
-             value: TodayAdd
 
-         });
 
-         $("#End_Hour").dxSelectBox({
 
-             dataSource: time_data,
 
-             displayExpr: "time",
 
-             valueExpr: "time",
 
-             onValueChanged: function () {
 
-                 endhour = $("#End_Hour").dxSelectBox('instance').option('value');
 
-             }
 
-         });
 
-         $("#Power").dxTextBox({
 
-             placeholder: "전력비용",
 
-             disabled: true
 
-         });
 
-         $("#Gas").dxTextBox({
 
-             placeholder: "가스비용",
 
-             disabled: true
 
-         });
 
-         $("#Total").dxTextBox({
 
-             placeholder: "합계",
 
-             disabled: true
 
-         });
 
-         $("#LoadPanel").dxLoadPanel({
 
-             message: '로딩 중...',
 
-             showIndicator: true,
 
-             visible: false
 
-         });
 
-         $("#dataGrid").dxDataGrid({
 
-             paging: {
 
-                 pageSize: 16
 
-             }
 
-         });
 
-     }
 
-     var searchViewOptions = {
 
-     };
 
-     function handleSearchInSearchView() {
 
-     }
 
-     var viewModel = $.extend(BWA.CommonView.create(params, viewInfo, searchViewOptions, ko.observable(null), handleViewShown, null, handleSearchInSearchView),
 
-         {
 
-             viewShowing: handleViewShowing,
 
-             dataGrid: utils.datagrid.defaultOptions({
 
-                 width: 1200,
 
-                 height: 600,
 
-                 columns: [
 
-                     {
 
-                         dataField: 'DateTime',
 
-                         width: '18%',
 
-                         caption: "날짜",
 
-                         alignment: 'center',
 
-                         dataType: 'date',
 
-                         format: 'yyyy-MM-dd HH:mm:ss',
 
-                         sortOrder: 'asc',
 
-                     },
 
-                     {
 
-                         dataField: 'PowerBasic',
 
-                         width: '16%',
 
-                         caption: "전력 단가(원)",
 
-                         alignment: 'center'
 
-                     },
 
-                     {
 
-                         dataField: 'PowerPrice',
 
-                         width: '16%',
 
-                         caption: "전력 요금(원)",
 
-                         alignment: 'center',
 
-                         format: "currency"
 
-                     },
 
-                     {
 
-                         dataField: 'GasBasic',
 
-                         width: '16%',
 
-                         caption: "가스 단가(원)",
 
-                         alignment: 'center'
 
-                     },
 
-                     {
 
-                         dataField: 'GasPrice',
 
-                         width: '16%',
 
-                         caption: "가스 요금(원)",
 
-                         alignment: 'center',
 
-                         format: "currency"
 
-                     },
 
-                     {
 
-                         dataField: 'TotalPrice',
 
-                         width: '18%',
 
-                         caption: "요금합산",
 
-                         alignment: 'center',
 
-                         format: "currency"
 
-                     }
 
-                 ]
 
-             })
 
-         });
 
-     return viewModel;
 
- };
 
 
  |