| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578 | 
							- BemsWebApplication.PlanEstablishment = function (params, viewInfo) {
 
-     "use strict";
 
-     //로딩 팝업 visible초기화 false
 
-     var visiblePopup = ko.observable(false);
 
-     //에너지원 선택 초기화 통합
 
-     var energySelectButton = "all";
 
-     //캘린더 선택 초기화 월
 
-     var yearSelectButton = "month";
 
-     var m3calValue;
 
-     var temppowerFacilityCode, tempgasFacilityCode, tempwaterFacilityCode;
 
-     var SITEID = BWA.UserInfo.SiteId();
 
-     var FuelTypeIdtemp;
 
-     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;
 
-     }
 
-     //각 에너지원 메인 차트 데이터 소스 Array
 
-     //월,목표값,실적값으로 구성, 캘런더 년기준 선택시 월->년단위로 변경
 
-     var dataSource = [{
 
-         dateTime: "1",  //월
 
-         Prediction: 0,  //목표값
 
-         Perform: 0,     //실적값
 
-         Goal: 0
 
-     }, {
 
-         dateTime: "2",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "3",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "4",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "5",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "6",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "7",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "8",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "9",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "10",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "11",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "12",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "13",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "14",
 
-         Prediction: 0,
 
-         Perform: 0
 
-        , Goal: 0
 
-     }, {
 
-         dateTime: "15",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "16",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "17",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "18",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "19",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "20",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "21",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "22",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "23",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "24",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "25",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "26",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "27",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "28",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "29",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }, {
 
-         dateTime: "30",
 
-         Prediction: 0,
 
-         Perform: 0,
 
-         Goal: 0
 
-     }, {
 
-         dateTime: "31",
 
-         Prediction: 0,
 
-         Perform: 0
 
-         , Goal: 0
 
-     }];
 
-     //각 에너지원 메인 차트 데이터 소스 Array
 
-     var allDataSource = [{
 
-         dateTime: "1",      //날짜
 
-         PredictionPower: 0, //전력목표값
 
-         PredictionGas: 0,   //가스목표값
 
-         PerformPower: 0,    //전력실적값
 
-         PerformGas: 0       //가스실적값
 
-     }, {
 
-         dateTime: "2",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "3",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "4",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "5",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "6",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "7",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "8",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "9",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "10",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "11",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "12",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "13",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "14",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "15",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "16",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "17",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "18",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "19",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "20",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "21",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "22",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "23",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "24",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "25",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "26",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "27",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "28",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "29",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "30",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }, {
 
-         dateTime: "31",
 
-         PredictionPower: 0,
 
-         PredictionGas: 0,
 
-         PerformPower: 0,
 
-         PerformGas: 0
 
-     }];
 
-     var goalDataSource = {
 
-     };
 
-     function handleViewShowing() {
 
-         var getCmFacilitypowerDataSource = new DevExpress.data.DataSource({
 
-             store: {
 
-                 type: "odata",
 
-                 url: endpointSelector + "/CmFacility"
 
-             },
 
-             requireTotalCount: true,
 
-             pageSize: 3
 
-         });
 
-         getCmFacilitypowerDataSource.filter([
 
-                 ["SiteId", "=", SITEID],
 
-                 "and",
 
-                 ["FacilityTypeId", "=", $Code.FacilityType.ELECTRICITY]
 
-         ]);
 
-         getCmFacilitypowerDataSource.load()
 
-         .done(function (Result) {
 
-             if (Result.length != 0) {
 
-                 temppowerFacilityCode = Result[0].FacilityCode;
 
-             }
 
-             else {
 
-                 utils.toast.show("[CmFacility] 전력 데이터가 없습니다.");
 
-             }
 
-         })
 
-         .fail(function (error) {
 
-             utils.toast.show("[CmFacility] 전력 데이터를 불러오는데 실패 하였습니다.");
 
-         });
 
-         var getCmFacilitygasDataSource = new DevExpress.data.DataSource({
 
-             store: {
 
-                 type: "odata",
 
-                 url: endpointSelector + "/CmFacility"
 
-             },
 
-             requireTotalCount: true,
 
-             pageSize: 3
 
-         });
 
-         getCmFacilitygasDataSource.filter([
 
-                 ["SiteId", "=", SITEID],
 
-                 "and",
 
-                 ["FacilityTypeId", "=", $Code.FacilityType.GAS]
 
-         ]);
 
-         getCmFacilitygasDataSource.load()
 
-         .done(function (Result) {
 
-             if (Result.length != 0) {
 
-                 tempgasFacilityCode = Result[0].FacilityCode;
 
-             }
 
-             else {
 
-                 utils.toast.show("[CmFacility] 가스 데이터가 없습니다.");
 
-             }
 
-         })
 
-         .fail(function (error) {
 
-             utils.toast.show("[CmFacility] 가스 데이터를 불러오는데 실패 하였습니다.");
 
-         });
 
-         var getCmFacilitywaterDataSource = new DevExpress.data.DataSource({
 
-             store: {
 
-                 type: "odata",
 
-                 url: endpointSelector + "/CmFacility"
 
-             },
 
-             requireTotalCount: true,
 
-             pageSize: 3
 
-         });
 
-         getCmFacilitywaterDataSource.filter([
 
-                 ["SiteId", "=", SITEID],
 
-                 "and",
 
-                 ["FacilityTypeId", "=", $Code.FacilityType.WATER]
 
-         ]);
 
-         getCmFacilitywaterDataSource.load()
 
-         .done(function (Result) {
 
-             if (Result.length != 0) {
 
-                 tempwaterFacilityCode = Result[0].FacilityCode;
 
-             }
 
-             else {
 
-                 utils.toast.show("[CmFacility] 수도 데이터가 없습니다.");
 
-             }
 
-         })
 
-         .fail(function (error) {
 
-             utils.toast.show("[CmFacility] 수도 데이터를 불러오는데 실패 하였습니다.");
 
-         });
 
-         var getTOEDataSource = new DevExpress.data.DataSource({
 
-             store: {
 
-                 type: "odata",
 
-                 url: endpointSelector + "/BemsFactorToe"
 
-             },
 
-             requireTotalCount: true,
 
-             pageSize: 3
 
-         });
 
-         getTOEDataSource.load()
 
-         .done(function (Result) {
 
-             var powertoe, gastoe;
 
-             if (Result.length != 0) {
 
-                 for (var i = 0; i < Result.length; i++) {
 
-                     if (Result[i].FuelTypeId == 1) {
 
-                         powertoe = Result[i].TotalFactor;
 
-                     }
 
-                     if (Result[i].FuelTypeId == 2) {
 
-                         gastoe = Result[i].TotalFactor;
 
-                     }
 
-                 }
 
-                 if (powertoe != null && gastoe != null)
 
-                     m3calValue = gastoe / powertoe;
 
-             }
 
-             else {
 
-                 utils.toast.show("[BemsFactorToe] 데이터가 없습니다.");
 
-             }
 
-         })
 
-         .fail(function (error) {
 
-             utils.toast.show("[BemsFactorToe] 데이터를 불러오는데 실패 하였습니다.");
 
-         });
 
-     }
 
-     //재귀합산을 위한 전력 메타데이터카운트
 
-     var powerMetaResultCnt = 0;
 
-     //재귀합산을 위한 가스 메타데이터카운트
 
-     var gasMetaResultCnt = 0;
 
-     var powerMetaResultArray;
 
-     var gasMetaResultArray;
 
-     function getAllData2(SiteId) {
 
-         var sumPrediction = 0;
 
-         var sumPerform = 0;
 
-         var compareValue = 0;
 
-         var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
 
-         var endDay = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
 
-         $("#sideBarChart").dxChart("instance").option('commonSeriesSettings').type = "stackedBar";
 
-         var opt = [
 
-                 { valueField: "PredictionPower", name: "목표 전력", stack: "prediction", color: '#007994' },
 
-                 { valueField: "PredictionGas", name: "목표 가스", stack: "prediction", color: '#03C700' },
 
-                 { valueField: "PerformPower", name: "전력 사용량", stack: "perform", color: '#5F8B95' },
 
-                 { valueField: "PerformGas", name: "가스 사용량", stack: "perform", color: '#7CC77B' },
 
-         ];
 
-         $("#sideBarChart").dxChart("instance").option('series', opt);
 
-         for (var i = 0; i < allDataSource.length; i++) {
 
-             allDataSource[i].dateTime = i + 1;
 
-             allDataSource[i].PredictionPower = 0;
 
-             allDataSource[i].PredictionGas = 0;
 
-             allDataSource[i].PerformPower = 0;
 
-             allDataSource[i].PerformGas = 0;
 
-         }
 
-         $("#sideBarChart").dxChart("instance").option('dataSource', allDataSource);
 
-         var powerMetaDataSource = new DevExpress.data.DataSource({
 
-             store: {
 
-                 type: "odata",
 
-                 url: endpointSelector + "/BemsFormulaParameter"
 
-             },
 
-             map: function (itemData) {
 
-                 return {
 
-                     SiteId: itemData.SiteId,
 
-                     FacilityTypeId: itemData.FacilityTypeId,
 
-                     FormulaId: itemData.FormulaId,
 
-                     ParameterFacilityCode: itemData.ParameterFacilityCode,
 
-                     ParameterPropertyId: itemData.ParameterPropertyId
 
-                 }
 
-             },
 
-             requireTotalCount: true,
 
-             pageSize: 20
 
-         });
 
-         powerMetaDataSource.filter([
 
-                 ["SiteId", "=", SiteId],
 
-                 "and",
 
-                 ["FacilityCode", "=", temppowerFacilityCode],  //전력 시설ID
 
-                 "and",
 
-                 ["FormulaId", "=", 1]
 
-         ]);
 
-         powerMetaDataSource.sort({ getter: "ParameterPropertyId", asc: true });
 
-         powerMetaDataSource.load()
 
-         .done(function (powerMetaResult) {
 
-             powerMetaResultArray = new Array(powerMetaResult.length);
 
-             for (var t in powerMetaResult) {
 
-                 powerMetaResultArray[t] = new Array(5);
 
-             }
 
-             for (var i in powerMetaResult) {
 
-                 powerMetaResultArray[i][0] = powerMetaResult[i].SiteId;
 
-                 powerMetaResultArray[i][1] = powerMetaResult[i].FacilityTypeId;
 
-                 powerMetaResultArray[i][2] = powerMetaResult[i].FormulaId;
 
-                 powerMetaResultArray[i][3] = powerMetaResult[i].ParameterFacilityCode;
 
-                 powerMetaResultArray[i][4] = powerMetaResult[i].ParameterPropertyId;
 
-             }
 
-             getAllPredictionData(SiteId, 1, powerMetaResultArray[powerMetaResultCnt], powerMetaResultArray.length);
 
-             powerMetaResultCnt = 0;
 
-         })
 
-         .fail(function (error) {
 
-             utils.toast.show("데이터를 불러오는데 실패 하였습니다.");
 
-             $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
 
-         });
 
-     }
 
-     function getAllPredictionData(SiteId, FuelTypeId, metaResultArrayElement, recursiveCnt) {
 
-         var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
 
-         var endDay = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
 
-         var predictionDataSource = new DevExpress.data.DataSource({
 
-             store: {
 
-                 type: "odata",
 
-                 url: endpointSelector + "/BemsEnergyDaily"
 
-             },
 
-             map: function (itemData) {
 
-                 return {
 
-                     dateTime: itemData.CreatedDate,
 
-                     Prediction: itemData.Goal,
 
-                 }
 
-             },
 
-             requireTotalCount: true,
 
-             pageSize: 366
 
-         });
 
-         if (yearSelectButton == "year") {
 
-             predictionDataSource.filter([
 
-                     ["SiteId", "=", SiteId],
 
-                     "and",
 
-                     ["FuelTypeId", "=", FuelTypeId],
 
-                     "and",
 
-                     ["CreatedDate", ">=", new Date(tmpDate.getFullYear(), 0, 1)],
 
-                     "and",
 
-                     ["CreatedDate", "<", new Date(tmpDate.getFullYear(), 12, 31)]
 
-             ]);
 
-         } else if (yearSelectButton == "month") {
 
-             predictionDataSource.filter([
 
-                ["SiteId", "=", SiteId],
 
-                "and",
 
-                ["FuelTypeId", "=", FuelTypeId],
 
-                "and",
 
-                ["CreatedDate", ">=", new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 1)],//tmpDate.getMonth()
 
-                "and",
 
-                ["CreatedDate", "<", new Date(tmpDate.getFullYear(), tmpDate.getMonth() + 1, 1)] //new Date(tmpDate.getFullYear(), tmpDate.getMonth(), endDay)]
 
-             ]);
 
-         } else {
 
-             utils.toast.show("년월 선택이 되지 않았습니다.");
 
-         }
 
-         predictionDataSource.sort({ getter: "CreatedDate", asc: true });
 
-         predictionDataSource.load()
 
-         .done(function (predictionResult) {
 
-             for (var i in predictionResult) {
 
-                 if (yearSelectButton == "year") {
 
-                     allDataSource[(predictionResult[i].dateTime.getMonth()).toString()].dateTime = (predictionResult[i].dateTime.getMonth() + 1).toString();
 
-                     if (energySelectButton == "gaskwh") {//가스m3변환
 
-                         if (FuelTypeId == 1) {
 
-                             allDataSource[(predictionResult[i].dateTime.getMonth()).toString()].PredictionPower = allDataSource[(predictionResult[i].dateTime.getMonth()).toString()].PredictionPower + predictionResult[i].Prediction;//1kWh당 10430kcal
 
-                         } else if (FuelTypeId == 2) {
 
-                             allDataSource[(predictionResult[i].dateTime.getMonth()).toString()].PredictionGas = allDataSource[(predictionResult[i].dateTime.getMonth()).toString()].PredictionGas + predictionResult[i].Prediction;//1kWh당 10430kcal
 
-                         } else {
 
-                             utils.toast.show("에너지원 선택이 없습니다.");
 
-                         }
 
-                         sumPrediction = parseFloat(sumPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
 
-                         if (tmpDate.getFullYear() == new Date().getFullYear()) {
 
-                             if (YearToDay() - 1 >= i) {
 
-                                 sumCurPrediction = parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
 
-                             }
 
-                         } else {
 
-                             sumCurPrediction = parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
 
-                         }
 
-                     } else {
 
-                         if (FuelTypeId == 1) {
 
-                             allDataSource[(predictionResult[i].dateTime.getMonth()).toString()].PredictionPower = allDataSource[(predictionResult[i].dateTime.getMonth()).toString()].PredictionPower + predictionResult[i].Prediction;
 
-                         } else if (FuelTypeId == 2) {
 
-                             allDataSource[(predictionResult[i].dateTime.getMonth()).toString()].PredictionGas = allDataSource[(predictionResult[i].dateTime.getMonth()).toString()].PredictionGas + predictionResult[i].Prediction;
 
-                         } else {
 
-                             utils.toast.show("에너지원 선택이 없습니다.");
 
-                         }
 
-                         sumPrediction = parseFloat(sumPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
 
-                         if (tmpDate.getFullYear() == new Date().getFullYear()) {
 
-                             if (YearToDay() - 1 >= i) {
 
-                                 sumCurPrediction = parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
 
-                             }
 
-                         } else {
 
-                             sumCurPrediction = parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
 
-                         }
 
-                     }
 
-                 } else if (yearSelectButton == "month") {
 
-                     allDataSource[i].dateTime = (parseInt(i) + 1).toString();
 
-                     if (energySelectButton == "gaskwh") {//가스m3변환    
 
-                         if (FuelTypeId == 1) {
 
-                             allDataSource[i].PredictionPower = predictionResult[i].Prediction;
 
-                         } else if (FuelTypeId == 2) {
 
-                             allDataSource[i].PredictionGas = predictionResult[i].Prediction;
 
-                         } else {
 
-                             utils.toast.show("에너지원 선택이 없습니다.");
 
-                         }
 
-                         sumPrediction = parseFloat(sumPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
 
-                         if (tmpDate.getFullYear() == new Date().getFullYear() && tmpDate.getMonth() == new Date().getMonth()) {
 
-                             if ((new Date().getDate() - 1) >= i) {
 
-                                 sumCurPrediction = parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
 
-                             }
 
-                         } else {
 
-                             sumCurPrediction = parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
 
-                         }
 
-                     } else {
 
-                         if (FuelTypeId == 1) {
 
-                             allDataSource[i].PredictionPower = predictionResult[i].Prediction;
 
-                         } else if (FuelTypeId == 2) {
 
-                             allDataSource[i].PredictionGas = predictionResult[i].Prediction;
 
-                         } else {
 
-                             utils.toast.show("에너지원 선택이 없습니다.");
 
-                         }
 
-                         sumPrediction = parseFloat(sumPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
 
-                         if (tmpDate.getFullYear() == new Date().getFullYear() && tmpDate.getMonth() == new Date().getMonth()) {
 
-                             if ((new Date().getDate() - 1) >= i) {
 
-                                 sumCurPrediction = parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
 
-                             }
 
-                         }
 
-                         else {
 
-                             sumCurPrediction = parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
 
-                         }
 
-                     }
 
-                 }
 
-             }
 
-             GetAllPerformData(metaResultArrayElement, recursiveCnt, FuelTypeId);
 
-         })
 
-         .fail(function (error) {
 
-             utils.toast.show("데이터를 불러오는데 실패 하였습니다.");
 
-             $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
 
-         });
 
-     }
 
-     function GetAllPerformData(metaResultArrayElement, recursiveCnt, FuelTypeId) {
 
-         if (metaResultArrayElement == null) {
 
-             $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
 
-             utils.toast.show("데이터가 존재하지 않습니다..");
 
-             return;
 
-         }
 
-         var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
 
-         var endDay = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
 
-         var getPerformDataSource = new DevExpress.data.DataSource({
 
-             store: {
 
-                 type: "odata",
 
-                 url: endpointSelector + "/BemsMonitoringPointHistoryDaily"
 
-             },
 
-             map: function (itemData) {
 
-                 return {
 
-                     dateTime: itemData.CreatedDateTime,
 
-                     Perform: itemData.DailyValue
 
-                 }
 
-             },
 
-             requireTotalCount: true,
 
-             pageSize: 366
 
-         });
 
-         if (yearSelectButton == "year") {
 
-             getPerformDataSource.filter([
 
-                 ["SiteId", "=", metaResultArrayElement[0]],
 
-                 "and",
 
-                 ["FacilityCode", "=", metaResultArrayElement[3]],
 
-                 "and",
 
-                 ["PropertyId", "=", metaResultArrayElement[4]],
 
-                 "and",
 
-                 ["CreatedDateTime", ">=", new Date(tmpDate.getFullYear(), 0, 1)],
 
-                 "and",
 
-                 ["CreatedDateTime", "<", new Date(tmpDate.getFullYear(), 12, 31)]
 
-             ]);
 
-         } else if (yearSelectButton == "month") {
 
-             getPerformDataSource.filter([
 
-                 ["SiteId", "=", metaResultArrayElement[0]],
 
-                 "and",
 
-                 ["FacilityCode", "=", metaResultArrayElement[3]],
 
-                 "and",
 
-                 ["PropertyId", "=", metaResultArrayElement[4]],
 
-                 "and",
 
-                 ["CreatedDateTime", ">=", new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 1)],// tmpDate.getMonth()
 
-                 "and",
 
-                 ["CreatedDateTime", "<", new Date(tmpDate.getFullYear(), tmpDate.getMonth() + 1, 1)]
 
-             ]);
 
-         } else {
 
-             utils.toast.show("년/월 선택이 되지 않았습니다.");
 
-         }
 
-         getPerformDataSource.sort({ getter: "CreatedDateTime", asc: true });
 
-         getPerformDataSource.load()
 
-         .done(function (result) {
 
-             for (var i in result) {
 
-                 if (yearSelectButton == "year") {
 
-                     if (energySelectButton == "gaskwh" || energySelectButton == "all") {//가스m3변환
 
-                         if (FuelTypeId == 1) {
 
-                             allDataSource[(result[i].dateTime.getMonth()).toString()].PerformPower = allDataSource[(result[i].dateTime.getMonth()).toString()].PerformPower + result[i].Perform;
 
-                         } else if (FuelTypeId == 2) {
 
-                             allDataSource[(result[i].dateTime.getMonth()).toString()].PerformGas = allDataSource[(result[i].dateTime.getMonth()).toString()].PerformGas + result[i].Perform * m3calValue;
 
-                         } else {
 
-                             utils.toast.show("에너지원 선택이 없습니다.");
 
-                         }
 
-                         if (FuelTypeId == 2) {
 
-                             totalPerform = parseFloat(totalPerform.toString()) + parseFloat(result[i].Perform.toString()) * m3calValue;
 
-                         }
 
-                         else {
 
-                             totalPerform = parseFloat(totalPerform.toString()) + parseFloat(result[i].Perform.toString());
 
-                         }
 
-                     } else {
 
-                         if (FuelTypeId == 1) {
 
-                             allDataSource[(result[i].dateTime.getMonth()).toString()].PerformPower = allDataSource[(result[i].dateTime.getMonth()).toString()].PerformPower + result[i].Perform;
 
-                         } else if (FuelTypeId == 2) {
 
-                             allDataSource[(result[i].dateTime.getMonth()).toString()].PerformGas = allDataSource[(result[i].dateTime.getMonth()).toString()].PerformGas + result[i].Perform;
 
-                         } else {
 
-                             utils.toast.show("에너지원 선택이 없습니다.");
 
-                         }
 
-                         totalPerform = parseFloat(totalPerform.toString()) + parseFloat(result[i].Perform.toString());
 
-                     }
 
-                     performLength++;
 
-                 } else if (yearSelectButton == "month") {
 
-                     var GetDate = result[i].dateTime.getDate() - 1;
 
-                     //목표데이터와 실측데이터 병합
 
-                     if (energySelectButton == "gaskwh" || energySelectButton == "all") {//가스m3변환
 
-                         if (FuelTypeId == 1) {
 
-                             allDataSource[GetDate].PerformPower = allDataSource[GetDate].PerformPower + result[i].Perform;        //kgpark
 
-                         } else if (FuelTypeId == 2) {
 
-                             allDataSource[GetDate].PerformGas = allDataSource[GetDate].PerformGas + result[i].Perform * m3calValue;
 
-                         } else {
 
-                             utils.toast.show("에너지원 선택이 없습니다.");
 
-                         }
 
-                         if (FuelTypeId == 2) {
 
-                             totalPerform = parseFloat(totalPerform.toString()) + parseFloat(result[i].Perform.toString()) * m3calValue;
 
-                         }
 
-                         else {
 
-                             totalPerform = parseFloat(totalPerform.toString()) + parseFloat(result[i].Perform.toString());
 
-                         }
 
-                     } else {
 
-                         if (FuelTypeId == 1) {
 
-                             allDataSource[GetDate].PerformPower = allDataSource[GetDate].PerformPower + result[i].Perform;
 
-                         } else if (FuelTypeId == 2) {
 
-                             allDataSource[GetDate].PerformGas = allDataSource[GetDate].PerformGas + result[i].Perform;
 
-                         } else {
 
-                             utils.toast.show("에너지원 선택이 없습니다.");
 
-                         }
 
-                         totalPerform = parseFloat(totalPerform.toString()) + parseFloat(result[i].Perform.toString());
 
-                     }
 
-                     performLength++;
 
-                 } else {
 
-                     utils.toast.show("년/월 선택이 되지 않았습니다.");
 
-                 }
 
-             }
 
-             recursiveCnt--;
 
-             if (recursiveCnt >= 1) {
 
-                 if (FuelTypeId == 1) {
 
-                     powerMetaResultCnt++;
 
-                     GetAllPerformData(powerMetaResultArray[powerMetaResultCnt], recursiveCnt, FuelTypeId);
 
-                 } else if (FuelTypeId == 2) {
 
-                     gasMetaResultCnt++;
 
-                     GetAllPerformData(gasMetaResultArray[gasMetaResultCnt], recursiveCnt, FuelTypeId);
 
-                 }
 
-             } else {
 
-                 if (FuelTypeId == 2) {
 
-                     SetEnergyResult();
 
-                 } else if (FuelTypeId == 1) {
 
-                     //가스 메타 조회
 
-                     var gasMetaDataSource = new DevExpress.data.DataSource({
 
-                         store: {
 
-                             type: "odata",
 
-                             url: endpointSelector + "/BemsFormulaParameter"
 
-                         },
 
-                         map: function (itemData) {
 
-                             return {
 
-                                 SiteId: itemData.SiteId,
 
-                                 FacilityTypeId: itemData.FacilityTypeId,
 
-                                 FormulaId: itemData.FormulaId,
 
-                                 ParameterFacilityCode: itemData.ParameterFacilityCode,
 
-                                 ParameterPropertyId: itemData.ParameterPropertyId
 
-                             }
 
-                         },
 
-                         requireTotalCount: true,
 
-                         pageSize: 20
 
-                     });
 
-                     gasMetaDataSource.filter([
 
-                             ["SiteId", "=", metaResultArrayElement[0]],
 
-                             "and",
 
-                             ["FacilityCode", "=", tempgasFacilityCode],  //가스 시설ID
 
-                             "and",
 
-                             ["FormulaId", "=", 1]
 
-                     ]);
 
-                     gasMetaDataSource.sort({ getter: "ParameterPropertyId", asc: true });
 
-                     gasMetaDataSource.load()
 
-                     .done(function (gasMetaResult) {
 
-                         gasMetaResultArray = new Array(gasMetaResult.length);
 
-                         for (var t in gasMetaResult) {
 
-                             gasMetaResultArray[t] = new Array(5);
 
-                         }
 
-                         for (var i in gasMetaResult) {
 
-                             gasMetaResultArray[i][0] = gasMetaResult[i].SiteId;
 
-                             gasMetaResultArray[i][1] = gasMetaResult[i].FacilityTypeId;
 
-                             gasMetaResultArray[i][2] = gasMetaResult[i].FormulaId;
 
-                             gasMetaResultArray[i][3] = gasMetaResult[i].ParameterFacilityCode;
 
-                             gasMetaResultArray[i][4] = gasMetaResult[i].ParameterPropertyId;
 
-                         }
 
-                         getAllPredictionData(metaResultArrayElement[0], 2, gasMetaResultArray[gasMetaResultCnt], gasMetaResultArray.length);
 
-                     })
 
-                     .fail(function (error) {
 
-                         utils.toast.show("데이터를 불러오는데 실패 하였습니다.");
 
-                         $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
 
-                     });
 
-                 } else {
 
-                 }
 
-             }
 
-             return true;
 
-         })
 
-         .fail(function (error) {
 
-             utils.toast.show("사용량 데이터를 불러오는데 실패 하였습니다.");
 
-         });
 
-     }
 
-     function YearToDay() {
 
-         var msecPerMinute = 1000 * 60;
 
-         var msecPerHour = msecPerMinute * 60;
 
-         var msecPerDay = msecPerHour * 24;
 
-         var date = new Date();
 
-         var dateMsec = date.getTime();
 
-         date.setMonth(0);
 
-         date.setDate(1);
 
-         date.setHours(0, 0, 0, 0);
 
-         var interval = dateMsec - date.getTime();
 
-         var days = Math.floor(interval / msecPerDay);
 
-         return days;
 
-     }
 
-     var performLength = 0;
 
-     var metaResultCnt = 0;
 
-     var sumPrediction = 0;
 
-     var sumCurPrediction = 0;
 
-     var metaResultArray;
 
-     function getEnergyData2(SiteId, FacilityTypeId, FormulaId, FuelTypeId) {
 
-         var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
 
-         var endDay = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
 
-         FuelTypeIdtemp = FuelTypeId;
 
-         //통합->각 에너지원별 차트 타입 초기화
 
-         $("#sideBarChart").dxChart("instance").option('commonSeriesSettings').type = "bar";
 
-         var opt;
 
-         if (yearSelectButton == "year") {
 
-             if (FuelTypeId == 1) {
 
-                 opt = [
 
-                         //{ valueField: "Prediction", name: "목표", color: '#72A7B3' },
 
-                         { valueField: "Prediction", name: "목표", color: '#007994' },
 
-                             { valueField: "Perform", name: "사용량", color: '#5F8B95' }
 
-                 ];
 
-             } else if (FuelTypeId == 2) {
 
-                 opt = [
 
-                         //{ valueField: "Prediction", name: "목표", color: '#90E68E' },
 
-                         { valueField: "Prediction", name: "목표", color: '#03C700' },
 
-                             { valueField: "Perform", name: "사용량", color: '#7CC77B' }
 
-                 ];
 
-             } else if (FuelTypeId == 3) {
 
-                 opt = [
 
-                         //{ valueField: "Prediction", name: "목표", color: '#FAE0D4' },
 
-                         { valueField: "Prediction", name: "목표", color: '#FC6D00' },
 
-                             { valueField: "Perform", name: "사용량", color: '#FDCFAD' }
 
-                 ];
 
-             } else {
 
-                 utils.toast.show("에너지원이 선택되지 않았습니다.");
 
-             }
 
-         } else {
 
-             if (FuelTypeId == 1) {
 
-                 opt = [
 
-                         //{ valueField: "Prediction", name: "목표", color: '#72A7B3' },
 
-                         { valueField: "Prediction", name: "목표", color: '#007994' },
 
-                             { valueField: "Perform", name: "사용량", color: '#5F8B95' }
 
-                            // , { valueField: "Goal", name: "목표치", color: '#FF0000', type: 'line' }
 
-                 ];
 
-             } else if (FuelTypeId == 2) {
 
-                 opt = [
 
-                         //{ valueField: "Prediction", name: "목표", color: '#90E68E' },
 
-                         { valueField: "Prediction", name: "목표", color: '#03C700' },
 
-                             { valueField: "Perform", name: "사용량", color: '#7CC77B' }
 
-                             //, { valueField: "Goal", name: "목표치", color: '#FF0000', type: 'line' }
 
-                 ];
 
-             } else if (FuelTypeId == 3) {
 
-                 opt = [
 
-                         //{ valueField: "Prediction", name: "목표", color: '#FAE0D4' },
 
-                         { valueField: "Prediction", name: "목표", color: '#FC6D00' },
 
-                             { valueField: "Perform", name: "사용량", color: '#FDCFAD' }
 
-                           // , { valueField: "Goal", name: "목표치", color: '#FF0000', type: 'line' }
 
-                 ];
 
-             } else {
 
-                 utils.toast.show("에너지원이 선택되지 않았습니다.");
 
-             }
 
-         }
 
-         $("#sideBarChart").dxChart("instance").option('series', opt);
 
-         //dataSource 초기화
 
-         for (var i = 0; i < dataSource.length; i++) {
 
-             dataSource[i].dateTime = i + 1;
 
-             dataSource[i].Prediction = 0;
 
-             dataSource[i].Perform = 0;
 
-             dataSource[i].Goal = 0;
 
-         }
 
-         $("#sideBarChart").dxChart("instance").option('dataSource', dataSource);
 
-         var metaDataSource = new DevExpress.data.DataSource({
 
-             store: {
 
-                 type: "odata",
 
-                 url: endpointSelector + "/BemsFormulaParameter"
 
-             },
 
-             map: function (itemData) {
 
-                 return {
 
-                     SiteId: itemData.SiteId,
 
-                     FacilityTypeId: itemData.FacilityTypeId,
 
-                     FormulaId: itemData.FormulaId,
 
-                     ParameterFacilityCode: itemData.ParameterFacilityCode,
 
-                     ParameterPropertyId: itemData.ParameterPropertyId
 
-                 }
 
-             },
 
-             requireTotalCount: true,
 
-             pageSize: 20
 
-         });
 
-         metaDataSource.filter([
 
-                 ["SiteId", "=", SiteId],
 
-                 "and",
 
-                 ["FacilityTypeId", "=", FacilityTypeId],
 
-                 "and",
 
-                 ["FormulaId", "=", FormulaId]
 
-         ]);
 
-         metaDataSource.sort({ getter: "ParameterPropertyId", asc: true });
 
-         metaDataSource.load()
 
-         .done(function (metaResult) {
 
-             //목표데이터는 1번 조회, 조회합계 산출
 
-             var getPredictionDataSource = new DevExpress.data.DataSource({
 
-                 store: {
 
-                     type: "odata",
 
-                     url: endpointSelector + "/BemsEnergyDaily"
 
-                 },
 
-                 map: function (itemData) {
 
-                     return {
 
-                         dateTime: itemData.CreatedDate,
 
-                         Prediction: itemData.Goal,
 
-                     }
 
-                 },
 
-                 requireTotalCount: true,
 
-                 pageSize: 366
 
-             });
 
-             if (yearSelectButton == "year") {
 
-                 getPredictionDataSource.filter([
 
-                     ["SiteId", "=", SiteId],
 
-                     "and",
 
-                     ["FuelTypeId", "=", FuelTypeId],
 
-                     "and",
 
-                     ["CreatedDate", ">=", new Date(tmpDate.getFullYear(), 0, 1)],
 
-                     "and",
 
-                     ["CreatedDate", "<", new Date(tmpDate.getFullYear(), 12, 31)]
 
-                 ]);
 
-             } else if (yearSelectButton == "month") {
 
-                 getPredictionDataSource.filter([
 
-                     ["SiteId", "=", SiteId],
 
-                     "and",
 
-                     ["FuelTypeId", "=", FuelTypeId],
 
-                     "and",
 
-                     ["CreatedDate", ">=", new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 1)],
 
-                     "and",
 
-                     ["CreatedDate", "<", new Date(tmpDate.getFullYear(), tmpDate.getMonth() + 1, 1)]
 
-                 ]);
 
-             } else {
 
-                 utils.toast.show("년/월 선택이 되지 않았습니다.");
 
-             }
 
-             getPredictionDataSource.sort({ getter: "CreatedDate", asc: true });
 
-             getPredictionDataSource.load()
 
-             .done(function (predictionResult) {
 
-                 for (var i in predictionResult) {
 
-                     //getPredictionDataSource._items[i].dateTime = (parseInt(i) + 1).toString();
 
-                     if (yearSelectButton == "year") {
 
-                         dataSource[(predictionResult[i].dateTime.getMonth()).toString()].dateTime = (predictionResult[i].dateTime.getMonth() + 1).toString();
 
-                         if (energySelectButton == "gasm3") {//가스m3변환
 
-                             dataSource[(predictionResult[i].dateTime.getMonth()).toString()].Prediction = dataSource[(predictionResult[i].dateTime.getMonth()).toString()].Prediction + predictionResult[i].Prediction / m3calValue;//1kWh당 10430kcal
 
-                             sumPrediction = parseFloat(sumPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString() / m3calValue);
 
-                             if (tmpDate.getFullYear() == new Date().getFullYear()) {
 
-                                 if (YearToDay() - 1 >= i) {
 
-                                     sumCurPrediction = parseFloat((parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString()) / m3calValue));
 
-                                 }
 
-                             } else {
 
-                                 sumCurPrediction = parseFloat((parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString()) / m3calValue));
 
-                             }
 
-                         } else {
 
-                             dataSource[(predictionResult[i].dateTime.getMonth()).toString()].Prediction = dataSource[(predictionResult[i].dateTime.getMonth()).toString()].Prediction + predictionResult[i].Prediction;
 
-                             sumPrediction = parseFloat(sumPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
 
-                             if (tmpDate.getFullYear() == new Date().getFullYear()) {
 
-                                 if (YearToDay() - 1 >= i) {
 
-                                     sumCurPrediction = parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
 
-                                 }
 
-                             } else {
 
-                                 sumCurPrediction = parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
 
-                             }
 
-                         }
 
-                     } else if (yearSelectButton == "month") {
 
-                         dataSource[i].dateTime = (parseInt(i) + 1).toString();
 
-                         if (energySelectButton == "gasm3") {//가스m3변환
 
-                             dataSource[i].Prediction = predictionResult[i].Prediction / m3calValue;
 
-                             sumPrediction = parseFloat(sumPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString()) / m3calValue;
 
-                             if (tmpDate.getFullYear() == new Date().getFullYear() && tmpDate.getMonth() == new Date().getMonth()) {
 
-                                 if ((new Date().getDate() - 1) >= i) {
 
-                                     sumCurPrediction = parseFloat((parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString()) / m3calValue));
 
-                                 }
 
-                             } else {
 
-                                 sumCurPrediction = parseFloat((parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString()) / m3calValue));
 
-                             }
 
-                         } else {
 
-                             dataSource[i].Prediction = predictionResult[i].Prediction;
 
-                             sumPrediction = parseFloat(sumPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
 
-                             if (tmpDate.getFullYear() == new Date().getFullYear() && tmpDate.getMonth() == new Date().getMonth()) {
 
-                                 if ((new Date().getDate() - 1) >= i) {
 
-                                     sumCurPrediction = parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
 
-                                 }
 
-                             } else {
 
-                                 sumCurPrediction = parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
 
-                             }
 
-                         }
 
-                     } else {
 
-                         utils.toast.show("년/월 선택이 되지 않았습니다.");
 
-                     }
 
-                 }
 
-                 metaResultArray = new Array(metaResult.length);
 
-                 for (var t in metaResult) {
 
-                     metaResultArray[t] = new Array(5);
 
-                 }
 
-                 for (var i in metaResult) {
 
-                     metaResultArray[i][0] = metaResult[i].SiteId;
 
-                     metaResultArray[i][1] = metaResult[i].FacilityTypeId;
 
-                     metaResultArray[i][2] = metaResult[i].FormulaId;
 
-                     metaResultArray[i][3] = metaResult[i].ParameterFacilityCode;
 
-                     metaResultArray[i][4] = metaResult[i].ParameterPropertyId;
 
-                 }
 
-                 GetPerformData(metaResultArray[metaResultCnt], metaResultArray.length);
 
-                 if (yearSelectButton == "month")
 
-                     sumPerform_function(metaResultArray[metaResultCnt]);
 
-             })
 
-             .fail(function (error) {
 
-                 utils.toast.show("목표 데이터를 불러오는데 실패 하였습니다.");
 
-                 $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
 
-             });
 
-         })
 
-         .fail(function (error) {
 
-             utils.toast.show("메타 데이터를 불러오는데 실패 하였습니다.");
 
-             $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
 
-         });
 
-     }
 
-     function delay(gap) { /* gap is in millisecs */
 
-         var then, now;
 
-         then = new Date().getTime();
 
-         now = then;
 
-         while ((now - then) < gap) {
 
-             now = new Date().getTime();  // 현재시간을 읽어 함수를 불러들인 시간과의 차를 이용하여 처리 
 
-         }
 
-     }
 
-     var totalPerform = 0;
 
-     var sumPerform = 0;
 
-     function SetEnergyResult() {
 
-         var compareValue = 0;
 
-         var today = new Date();
 
-         var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
 
-         var endDay = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
 
-         if (energySelectButton == "all") {
 
-             $("#sideBarChart").dxChart("instance").option('dataSource', allDataSource);//병합데이터 최종 연동
 
-         } else {
 
-             $("#sideBarChart").dxChart("instance").option('dataSource', dataSource);//병합데이터 최종 연동
 
-         }
 
-         $("#textPrediction").html(numberWithCommas(sumPrediction.toFixed(2).toString()));
 
-         $("#textPrediction2").html(numberWithCommas(sumCurPrediction.toFixed(2).toString()));
 
-         $("#textPerform").html(numberWithCommas(totalPerform.toFixed(2).toString()));
 
-         if (yearSelectButton == "year") {
 
-             if (energySelectButton == "all") {
 
-                 var length = powerMetaResultArray.length + gasMetaResultArray.length;
 
-                 if (tmpDate.getFullYear() != new Date().getFullYear()) {
 
-                     $("#textPredictionStandard").html("[1.1 ~ 12.31]");
 
-                     $("#textPerformStandard").html("[1.1 ~ 12.31]");
 
-                 } else {
 
-                     var tempDate = new Date();
 
-                     $("#textPredictionStandard").html("[1.1 ~ " + (tempDate.getMonth() + 1) + "." + tempDate.getDate() + "]");
 
-                     $("#textPerformStandard").html("[1.1 ~ " + (tempDate.getMonth() + 1) + "." + tempDate.getDate() + "]");
 
-                 }
 
-             } else {
 
-                 if (tmpDate.getFullYear() != new Date().getFullYear()) {
 
-                     $("#textPredictionStandard").html("[1.1 ~ 12.31]");
 
-                     $("#textPerformStandard").html("[1.1 ~ 12.31]");
 
-                 } else {
 
-                     var tempDate = new Date();
 
-                     $("#textPredictionStandard").html("[1.1 ~ " + (tempDate.getMonth() + 1) + "." + tempDate.getDate() + "]");
 
-                     $("#textPerformStandard").html("[1.1 ~ " + (tempDate.getMonth() + 1) + "." + tempDate.getDate() + "]");
 
-                 }
 
-             }
 
-         } else if (yearSelectButton == "month") {
 
-             if (energySelectButton == "all") {
 
-                 var length = powerMetaResultArray.length + gasMetaResultArray.length;
 
-                 if (tmpDate.getFullYear() == today.getFullYear() && tmpDate.getMonth() == today.getMonth()) {
 
-                     $("#textPredictionStandard").html("[" + (tmpDate.getMonth() + 1) + ".1 ~ " + (tmpDate.getMonth() + 1) + "." + today.getDate() + "]");
 
-                     $("#textPerformStandard").html("[" + (tmpDate.getMonth() + 1) + ".1 ~ " + (tmpDate.getMonth() + 1) + "." + today.getDate() + "]");
 
-                 }
 
-                 else {
 
-                     $("#textPredictionStandard").html("[" + (tmpDate.getMonth() + 1) + ".1 ~ " + (tmpDate.getMonth() + 1) + "." + endDay + "]");
 
-                     $("#textPerformStandard").html("[" + (tmpDate.getMonth() + 1) + ".1 ~ " + (tmpDate.getMonth() + 1) + "." + endDay + "]");
 
-                 }
 
-             } else {
 
-                 if (tmpDate.getFullYear() == today.getFullYear() && tmpDate.getMonth() == today.getMonth()) {
 
-                     $("#textPredictionStandard").html("[" + (tmpDate.getMonth() + 1) + ".1 ~ " + (tmpDate.getMonth() + 1) + "." + today.getDate() + "]");
 
-                     $("#textPerformStandard").html("[" + (tmpDate.getMonth() + 1) + ".1 ~ " + (tmpDate.getMonth() + 1) + "." + today.getDate() + "]");
 
-                 }
 
-                 else {
 
-                     $("#textPredictionStandard").html("[" + (tmpDate.getMonth() + 1) + ".1 ~ " + (tmpDate.getMonth() + 1) + "." + endDay + "]");
 
-                     $("#textPerformStandard").html("[" + (tmpDate.getMonth() + 1) + ".1 ~ " + (tmpDate.getMonth() + 1) + "." + endDay + "]");
 
-                 }
 
-             }
 
-         } else {
 
-             utils.toast.show("년/월 선택이 되지 않았습니다.");
 
-         }
 
-         if (totalPerform != 0) {
 
-             compareValue = totalPerform / sumCurPrediction;
 
-             compareValue = (compareValue * 100).toFixed(2);
 
-             var resultTmp = compareValue;
 
-             if (!isFinite(resultTmp) || isNaN(resultTmp)) {
 
-                 $("#textResult").html("계산수치 부적절");
 
-             } else {
 
-                 $("#textResult").html(resultTmp.toString() + "%");
 
-             }
 
-         }
 
-         else {
 
-             compareValue = totalPerform / sumCurPrediction;
 
-             compareValue = (compareValue * 100).toFixed(2);
 
-             var resultTmp = (100 - compareValue).toFixed(2);
 
-             if (!isFinite(resultTmp) || isNaN(resultTmp)) {
 
-                 $("#textResult").html("계산수치 부적절");
 
-             } else {
 
-                 $("#textResult").html(compareValue.toString() + "%");
 
-             }
 
-         }
 
-         if (yearSelectButton == "year") {
 
-             if (energySelectButton == "all") {
 
-                 var length = powerMetaResultArray.length + gasMetaResultArray.length;
 
-                 var tempDate = new Date();
 
-                 if (tmpDate.getFullYear() == today.getFullYear()) {
 
-                     $("#textResultStandard").html("[1.1 ~ " + (tempDate.getMonth() + 1) + "." + tempDate.getDate() + "]");
 
-                 }
 
-                 else {
 
-                     $("#textResultStandard").html("[1.1 ~ 12.31]");
 
-                 }
 
-             } else {
 
-                 var tempDate = new Date();
 
-                 if (tmpDate.getFullYear() == today.getFullYear()) {
 
-                     $("#textResultStandard").html("[1.1 ~ " + (tempDate.getMonth() + 1) + "." + tempDate.getDate() + "]");
 
-                 }
 
-                 else {
 
-                     $("#textResultStandard").html("[1.1 ~ 12.31]");
 
-                 }
 
-             }
 
-         } else if (yearSelectButton == "month") {
 
-             if (energySelectButton == "all") {
 
-                 var length = powerMetaResultArray.length + gasMetaResultArray.length;
 
-                 if (tmpDate.getFullYear() == today.getFullYear() && tmpDate.getMonth() == today.getMonth()) {
 
-                     $("#textResultStandard").html("[" + (tmpDate.getMonth() + 1) + ".1 ~ " + (tmpDate.getMonth() + 1) + "." + today.getDate() + "]");
 
-                 }
 
-                 else {
 
-                     $("#textResultStandard").html("[" + (tmpDate.getMonth() + 1) + ".1 ~ " + (tmpDate.getMonth() + 1) + "." + endDay + "]");
 
-                 }
 
-             } else {
 
-                 if (tmpDate.getFullYear() == today.getFullYear() && tmpDate.getMonth() == today.getMonth()) {
 
-                     $("#textResultStandard").html("[" + (tmpDate.getMonth() + 1) + ".1 ~ " + (tmpDate.getMonth() + 1) + "." + today.getDate() + "]");
 
-                 }
 
-                 else {
 
-                     $("#textResultStandard").html("[" + (tmpDate.getMonth() + 1) + ".1 ~ " + (tmpDate.getMonth() + 1) + "." + endDay + "]");
 
-                 }
 
-             }
 
-         } else {
 
-             utils.toast.show("년/월 선택이 되지 않았습니다.");
 
-         }
 
-         var maxValue = 0;
 
-         if (energySelectButton == "all") {
 
-             for (var i = 0; i < allDataSource.length; i++) {
 
-                 if (allDataSource[i].PredictionPower > maxValue) {
 
-                     maxValue = allDataSource[i].PredictionPower;
 
-                 } else if (allDataSource[i].PredictionGas > maxValue) {
 
-                     maxValue = allDataSource[i].PredictionGas;
 
-                 } else if (allDataSource[i].PerformPower > maxValue) {
 
-                     maxValue = allDataSource[i].PerformPower;
 
-                 } else if (allDataSource[i].PerformGas > maxValue) {
 
-                     maxValue = allDataSource[i].PerformGas;
 
-                 } else {
 
-                     maxValue = maxValue;
 
-                 }
 
-             }
 
-         } else {
 
-             for (var i = 0; i < dataSource.length; i++) {
 
-                 if (dataSource[i].Prediction > maxValue) {
 
-                     maxValue = dataSource[i].Prediction;
 
-                 } else if (dataSource[i].Perform > maxValue) {
 
-                     maxValue = dataSource[i].Perform;
 
-                 }
 
-                 else {
 
-                     maxValue = maxValue;
 
-                 }
 
-             }
 
-         }
 
-         var valAxis = $("#sideBarChart").dxChart("instance").option('valueAxis');
 
-         //valAxis.max = parseInt(maxValue * 1.1);
 
-         if (energySelectButton == "all") {
 
-             //valAxis.max = valAxis.max * 1.5;
 
-         }
 
-         $("#sideBarChart").dxChart("instance").option('valueAxis', valAxis);
 
-         if (totalPerform != 0) {
 
-             $("#dxCircularGauge").dxCircularGauge("instance").option('value', compareValue);
 
-         }
 
-         else {
 
-             $("#dxCircularGauge").dxCircularGauge("instance").option('value', 0.00);
 
-         }
 
-         performLength = 0;
 
-         totalPerform = 0;
 
-         sumPerform = 0;
 
-         sumPrediction = 0;
 
-         sumCurPrediction = 0;
 
-         metaResultCnt = 0;
 
-         powerMetaResultCnt = 0;
 
-         gasMetaResultCnt = 0;
 
-         $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
 
-     }
 
-     function GetPerformData(metaResultArrayElement, recursiveCnt) {
 
-         var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
 
-         var endDay = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
 
-         var getPerformDataSource = new DevExpress.data.DataSource({
 
-             store: {
 
-                 type: "odata",
 
-                 url: endpointSelector + "/BemsMonitoringPointHistoryDaily"
 
-             },
 
-             map: function (itemData) {
 
-                 return {
 
-                     dateTime: itemData.CreatedDateTime,
 
-                     Perform: itemData.DailyValue
 
-                 }
 
-             },
 
-             requireTotalCount: true,
 
-             pageSize: 366
 
-         });
 
-         if (yearSelectButton == "year") {
 
-             getPerformDataSource.filter([
 
-                 ["SiteId", "=", metaResultArrayElement[0]],
 
-                 "and",
 
-                 ["FacilityCode", "=", metaResultArrayElement[3]],
 
-                 "and",
 
-                 ["PropertyId", "=", metaResultArrayElement[4]],
 
-                 "and",
 
-                 ["CreatedDateTime", ">=", new Date(tmpDate.getFullYear(), 0, 1)],
 
-                 "and",
 
-                 ["CreatedDateTime", "<", new Date(tmpDate.getFullYear(), 12, 31)]
 
-             ]);
 
-         } else if (yearSelectButton == "month") {
 
-             getPerformDataSource.filter([
 
-                 ["SiteId", "=", metaResultArrayElement[0]],
 
-                 "and",
 
-                 ["FacilityCode", "=", metaResultArrayElement[3]],
 
-                 "and",
 
-                 ["PropertyId", "=", metaResultArrayElement[4]],
 
-                 "and",
 
-                 ["CreatedDateTime", ">=", new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 1)],
 
-                 "and",
 
-                 ["CreatedDateTime", "<", new Date(tmpDate.getFullYear(), tmpDate.getMonth() + 1, 1)]
 
-             ]);
 
-         } else {
 
-             utils.toast.show("년/월 선택이 되지 않았습니다.");
 
-         }
 
-         getPerformDataSource.sort({ getter: "CreatedDateTime", asc: true });
 
-         getPerformDataSource.load()
 
-         .done(function (result) {
 
-             for (var i in result) {
 
-                 if (yearSelectButton == "year") {
 
-                     if (energySelectButton == "gaskwh" || energySelectButton == "all") {//가스m3변환
 
-                         if (FuelTypeIdtemp == 2) {
 
-                             dataSource[(result[i].dateTime.getMonth()).toString()].Perform = dataSource[(result[i].dateTime.getMonth()).toString()].Perform + result[i].Perform * m3calValue;
 
-                             totalPerform = parseFloat(totalPerform.toString()) + parseFloat(result[i].Perform.toString()) * m3calValue;
 
-                         }
 
-                         else {
 
-                             dataSource[(result[i].dateTime.getMonth()).toString()].Perform = dataSource[(result[i].dateTime.getMonth()).toString()].Perform + result[i].Perform;
 
-                             totalPerform = parseFloat(totalPerform.toString()) + parseFloat(result[i].Perform.toString());
 
-                         }
 
-                     } else {
 
-                         dataSource[(result[i].dateTime.getMonth()).toString()].Perform = dataSource[(result[i].dateTime.getMonth()).toString()].Perform + result[i].Perform;
 
-                         totalPerform = parseFloat(totalPerform.toString()) + parseFloat(result[i].Perform.toString());
 
-                     }
 
-                     performLength++;
 
-                 } else if (yearSelectButton == "month") {
 
-                     var GetDate = result[i].dateTime.getDate() - 1;
 
-                     //목표데이터와 실측데이터 병합
 
-                     if (energySelectButton == "gaskwh" || energySelectButton == "all") {//가스m3변환
 
-                         if (FuelTypeIdtemp == 2) {
 
-                             dataSource[GetDate].Perform = dataSource[GetDate].Perform + result[i].Perform * m3calValue;
 
-                             totalPerform = parseFloat(totalPerform.toString()) + parseFloat(result[i].Perform.toString()) * m3calValue;
 
-                         }
 
-                         else {
 
-                             dataSource[GetDate].Perform = dataSource[GetDate].Perform + result[i].Perform;
 
-                             totalPerform = parseFloat(totalPerform.toString()) + parseFloat(result[i].Perform.toString());
 
-                         }
 
-                     } else {
 
-                         dataSource[GetDate].Perform = dataSource[GetDate].Perform + result[i].Perform;
 
-                         totalPerform = parseFloat(totalPerform.toString()) + parseFloat(result[i].Perform.toString());
 
-                     }
 
-                     performLength++;
 
-                 } else {
 
-                     utils.toast.show("년/월 선택이 되지 않았습니다.");
 
-                 }
 
-             }
 
-             metaResultCnt++;
 
-             recursiveCnt--;
 
-             if (recursiveCnt >= 1) {
 
-                 GetPerformData(metaResultArray[metaResultCnt], recursiveCnt);
 
-             } else {
 
-                 SetEnergyResult();
 
-             }
 
-             return true;
 
-         })
 
-         .fail(function (error) {
 
-             utils.toast.show("사용량 데이터를 불러오는데 실패 하였습니다.");
 
-             $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
 
-         });
 
-     }
 
-     function sumPerform_function(metaResultArrayElement) {
 
-         var Today = new Date();
 
-         var getPerformDataSource1 = new DevExpress.data.DataSource({
 
-             store: {
 
-                 type: "odata",
 
-                 url: endpointSelector + "/BemsMonitoringPointHistoryDaily"
 
-             },
 
-             map: function (itemData) {
 
-                 return {
 
-                     dateTime: itemData.CreatedDateTime,
 
-                     Perform: itemData.DailyValue
 
-                 }
 
-             },
 
-             requireTotalCount: true,
 
-             pageSize: 366
 
-         });
 
-         if (yearSelectButton == "month") {
 
-             getPerformDataSource1.filter([
 
-                 ["SiteId", "=", metaResultArrayElement[0]],
 
-                 "and",
 
-                 ["FacilityCode", "=", metaResultArrayElement[3]],
 
-                 "and",
 
-                 ["PropertyId", "=", metaResultArrayElement[4]],
 
-                 "and",
 
-                 ["CreatedDateTime", ">=", new Date(Today.getFullYear(), 0, 1)],
 
-                 "and",
 
-                 ["CreatedDateTime", "<", new Date(Today.getFullYear(), Today.getMonth(), Today.getDate() + 1)]
 
-             ]);
 
-         }
 
-         getPerformDataSource1.sort({ getter: "CreatedDateTime", asc: true });
 
-         getPerformDataSource1.load()
 
-         .done(function (result) {
 
-             for (var i in result) {
 
-                 if (yearSelectButton == "month") {
 
-                     //목표데이터와 실측데이터 병합
 
-                     if (energySelectButton == "gaskwh" || energySelectButton == "all") {//가스m3변환
 
-                         if (FuelTypeIdtemp == 2)
 
-                             sumPerform = parseFloat(sumPerform.toString()) + parseFloat(result[i].Perform.toString()) * m3calValue;
 
-                         else
 
-                             sumPerform = parseFloat(sumPerform.toString()) + parseFloat(result[i].Perform.toString());
 
-                     } else {
 
-                         sumPerform = parseFloat(sumPerform.toString()) + parseFloat(result[i].Perform.toString());
 
-                     }
 
-                 }
 
-             }
 
-         })
 
-         .fail(function (error) {
 
-             utils.toast.show("사용량 데이터를 불러오는데 실패 하였습니다.");
 
-         });
 
-     }
 
-     function numberWithCommas(x) {
 
-         return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
 
-     }
 
-     function handleViewShown() {
 
-         energySelectButton = "all";
 
-         yearSelectButton = "month";
 
-         $("#LoadPanel").dxLoadPanel({
 
-             message: '로딩 중...',
 
-             showIndicator: true,
 
-             visible: false
 
-         });
 
-         $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
 
-         visiblePopup(false);
 
-         var argAxis = $("#sideBarChart").dxChart("instance").option('argumentAxis');
 
-         var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
 
-         $("#divGoal").hide();
 
-         $("#modGoalBtn").hide();
 
-         if (yearSelectButton == "month") {
 
-             argAxis.max = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
 
-             var labelObj = {
 
-                 customizeText: function () {
 
-                     return this.value + '일';
 
-                 }
 
-             };
 
-         } else {
 
-             argAxis.max = 12;
 
-             var labelObj = {
 
-                 customizeText: function () {
 
-                     return this.value + '월';
 
-                 }
 
-             };
 
-         }
 
-         argAxis.label = labelObj;
 
-         $("#sideBarChart").dxChart("instance").option('argumentAxis', argAxis);
 
-         //getAllData2(1);
 
-         $('#allBtn').trigger('click');
 
-     }
 
-     var now = new Date();
 
-     var firstDay = new Date(now.getFullYear(), now.getMonth(), 1);
 
-     var searchViewOptions = {
 
-     };
 
-     function handleSearchInSearchView() {
 
-     }
 
-     var viewModel = $.extend(BWA.CommonView.create(params, viewInfo, searchViewOptions, ko.observable(null), handleViewShown, null, handleSearchInSearchView),
 
-         {
 
-             viewShowing: handleViewShowing,
 
-             chartOptions: {
 
-                 dataSource: dataSource,
 
-                 barWidth: 0.5,
 
-                 size: {
 
-                     height: 520
 
-                 },
 
-                 commonSeriesSettings: {
 
-                     argumentField: "dateTime",
 
-                     type: "bar"
 
-                 },
 
-                 series: [
 
-                     //{ valueField: "Prediction", name: "목표", color: '#72A7B3' },
 
-                     { valueField: "Prediction", name: "목표", color: '#007994' },
 
-                     { valueField: "Perform", name: "사용량", color: '#5F8B95' }
 
-                 ],
 
-                 legend: {
 
-                     verticalAlignment: "top",
 
-                     horizontalAlignment: "center",
 
-                     position: "outside",
 
-                     border: { visible: false }
 
-                 },
 
-                 valueAxis: ko.observable({
 
-                     visible: true,
 
-                     label: {
 
-                         customizeText: function () {
 
-                             if (this.value >= 1000 && this.value < 10000) {
 
-                                 this.value = this.value.toString().substring(0, 1) + 'K';
 
-                             } else if (this.value >= 10000) {
 
-                                 this.value = this.value.toString().substring(0, 2) + 'K';
 
-                             } else {
 
-                                 this.value = this.value;
 
-                             }
 
-                             return this.value + ' kWh';
 
-                         }
 
-                     },
 
-                     min: 0,
 
-                     //max: 11000,
 
-                     valueType: 'numeric',
 
-                     //tickInterval: 1000
 
-                 }),
 
-                 argumentAxis: ko.observable({
 
-                     visible: true,
 
-                     label: {
 
-                         customizeText: function () {
 
-                             return this.value + '일';
 
-                         }
 
-                     },
 
-                     min: 1,
 
-                     max: 32 - new Date(now.getFullYear, now.getMonth, 32).getDate(),
 
-                     valueType: 'numeric',
 
-                     tickInterval: 1
 
-                 }),
 
-                 "export": {
 
-                     enabled: true
 
-                 },
 
-                 tooltip: {
 
-                     enabled: true,
 
-                     //format: 'largeNumber',
 
-                     customizeTooltip: function (point) {
 
-                         return {
 
-                             text: numberWithCommas(point.value.toFixed(2))
 
-                         };
 
-                     }
 
-                 }
 
-             },
 
-             startDatePicker: {
 
-                 pickerType: "calendar",
 
-                 value: firstDay,
 
-                 formatString: "yyyy년 MM월",
 
-                 maxZoomLevel: "year",
 
-                 width: "9%",
 
-                 onValueChanged: function () {
 
-                     $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
 
-                     if (energySelectButton == "all") {
 
-                         $("#divGoal").hide();
 
-                         $("#modGoalBtn").hide();
 
-                         var argSeries = this.chartOptions.series;
 
-                         //argSeries = [{ valueField: "PredictionPower", name: "목표 전력", stack: "prediction", color: '#72A7B3' },
 
-                         argSeries = [{ valueField: "PredictionPower", name: "목표 전력", stack: "prediction", color: '#007994' },
 
-                             //{ valueField: "PredictionGas", name: "목표 가스", stack: "prediction", color: '#90E68E' },
 
-                                         { valueField: "PredictionGas", name: "목표 가스", stack: "prediction", color: '#03C700' },
 
-                                         { valueField: "PerformPower", name: "전력 사용량", stack: "perform", color: '#5F8B95' },
 
-                                         { valueField: "PerformGas", name: "가스 사용량", stack: "perform", color: '#7CC77B' }, ];
 
-                         this.chartOptions.series = argSeries;
 
-                         var argAxis = $("#sideBarChart").dxChart("instance").option('argumentAxis');
 
-                         var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
 
-                         if (yearSelectButton == "month") {
 
-                             argAxis.max = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
 
-                             var labelObj = {
 
-                                 customizeText: function () {
 
-                                     return this.value + '일';
 
-                                 }
 
-                             };
 
-                         } else {
 
-                             argAxis.max = 12;
 
-                             var labelObj = {
 
-                                 customizeText: function () {
 
-                                     return this.value + '월';
 
-                                 }
 
-                             };
 
-                         }
 
-                         argAxis.label = labelObj;
 
-                         $("#sideBarChart").dxChart("instance").option('argumentAxis', argAxis);
 
-                         getAllData2(SITEID);
 
-                     } else if (energySelectButton == "power") {
 
-                         if (yearSelectButton == "month") {
 
-                             $("#divGoal").show();
 
-                             $("#modGoalBtn").show();
 
-                         } else {
 
-                             $("#divGoal").hide();
 
-                             $("#modGoalBtn").hide();
 
-                         }
 
-                         var argSeries = this.chartOptions.series;
 
-                         argSeries = [{ valueField: "Prediction", name: "목표", color: '#007994' }, { valueField: "Perform", name: "사용량", color: '#5F8B95' }];
 
-                         this.chartOptions.series = argSeries;
 
-                         var argAxis = $("#sideBarChart").dxChart("instance").option('argumentAxis');
 
-                         var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
 
-                         if (yearSelectButton == "month") {
 
-                             argAxis.max = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
 
-                             var labelObj = {
 
-                                 customizeText: function () {
 
-                                     return this.value + '일';
 
-                                 }
 
-                             };
 
-                         } else {
 
-                             argAxis.max = 12;
 
-                             var labelObj = {
 
-                                 customizeText: function () {
 
-                                     return this.value + '월';
 
-                                 }
 
-                             };
 
-                         }
 
-                         argAxis.label = labelObj;
 
-                         $("#sideBarChart").dxChart("instance").option('argumentAxis', argAxis);
 
-                         getEnergyData2(SITEID, $Code.FacilityType.ELECTRICITY, 1, 1);
 
-                     } else if (energySelectButton == "gaskwh") {
 
-                         if (yearSelectButton == "month") {
 
-                             $("#divGoal").show();
 
-                             $("#modGoalBtn").show();
 
-                         } else {
 
-                             $("#divGoal").hide();
 
-                             $("#modGoalBtn").hide();
 
-                         }
 
-                         var argSeries = this.chartOptions.series;
 
-                         argSeries = [{ valueField: "Prediction", name: "목표", color: '#03C700' }, { valueField: "Perform", name: "사용량", color: '#7CC77B' }];
 
-                         this.chartOptions.series = argSeries;
 
-                         var argAxis = $("#sideBarChart").dxChart("instance").option('argumentAxis');
 
-                         var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
 
-                         if (yearSelectButton == "month") {
 
-                             argAxis.max = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
 
-                             var labelObj = {
 
-                                 customizeText: function () {
 
-                                     return this.value + '일';
 
-                                 }
 
-                             };
 
-                         } else {
 
-                             argAxis.max = 12;
 
-                             var labelObj = {
 
-                                 customizeText: function () {
 
-                                     return this.value + '월';
 
-                                 }
 
-                             };
 
-                         }
 
-                         argAxis.label = labelObj;
 
-                         $("#sideBarChart").dxChart("instance").option('argumentAxis', argAxis);
 
-                         getEnergyData2(SITEID, $Code.FacilityType.GAS, 1, 2);
 
-                     } else if (energySelectButton == "gasm3") {
 
-                         if (yearSelectButton == "month") {
 
-                             $("#divGoal").show();
 
-                             $("#modGoalBtn").show();
 
-                         } else {
 
-                             $("#divGoal").hide();
 
-                             $("#modGoalBtn").hide();
 
-                         }
 
-                         var argSeries = this.chartOptions.series;
 
-                         argSeries = [{ valueField: "Prediction", name: "목표", color: '#03C700' }, { valueField: "Perform", name: "사용량", color: '#7CC77B' }];
 
-                         this.chartOptions.series = argSeries;
 
-                         var argAxis = $("#sideBarChart").dxChart("instance").option('argumentAxis');
 
-                         var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
 
-                         if (yearSelectButton == "month") {
 
-                             argAxis.max = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
 
-                             var labelObj = {
 
-                                 customizeText: function () {
 
-                                     return this.value + '일';
 
-                                 }
 
-                             };
 
-                         } else {
 
-                             argAxis.max = 12;
 
-                             var labelObj = {
 
-                                 customizeText: function () {
 
-                                     return this.value + '월';
 
-                                 }
 
-                             };
 
-                         }
 
-                         argAxis.label = labelObj;
 
-                         $("#sideBarChart").dxChart("instance").option('argumentAxis', argAxis);
 
-                         getEnergyData2(SITEID, $Code.FacilityType.GAS, 1, 2);
 
-                     } else if (energySelectButton == "water") {
 
-                         if (yearSelectButton == "month") {
 
-                             $("#divGoal").show();
 
-                             $("#modGoalBtn").show();
 
-                         } else {
 
-                             $("#divGoal").hide();
 
-                             $("#modGoalBtn").hide();
 
-                         }
 
-                         var argSeries = this.chartOptions.series;
 
-                         argSeries = [{ valueField: "Prediction", name: "목표", color: '#FC6D00' }, { valueField: "Perform", name: "사용량", color: '#FDCFAD' }];
 
-                         this.chartOptions.series = argSeries;
 
-                         var argAxis = $("#sideBarChart").dxChart("instance").option('argumentAxis');
 
-                         var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
 
-                         if (yearSelectButton == "month") {
 
-                             argAxis.max = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
 
-                             var labelObj = {
 
-                                 customizeText: function () {
 
-                                     return this.value + '일';
 
-                                 }
 
-                             };
 
-                         } else {
 
-                             argAxis.max = 12;
 
-                             var labelObj = {
 
-                                 customizeText: function () {
 
-                                     return this.value + '월';
 
-                                 }
 
-                             };
 
-                         }
 
-                         argAxis.label = labelObj;
 
-                         $("#sideBarChart").dxChart("instance").option('argumentAxis', argAxis);
 
-                         getEnergyData2(SITEID, $Code.FacilityType.WATER, 1, 3);
 
-                     } else {
 
-                         utils.toast.show("에너지원이 선택되지 않았습니다.");
 
-                     }
 
-                 }
 
-             },
 
-             tooltipVisible: ko.observable(false),
 
-             toggleTooltip: function () {
 
-                 this.tooltipVisible(!this.tooltipVisible());
 
-             },
 
-             monthButtonClicked: function () {
 
-                 $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
 
-                 yearSelectButton = "month";
 
-                 $("#startDatePicker").dxDateBox("instance").option("formatString", "yyyy년 MM월");
 
-                 $("#startDatePicker").dxDateBox("instance").option("maxZoomLevel", "year");
 
-                 $("#startDatePicker").dxDateBox("instance").option("width", "9%");
 
-                 $("#monthBtn").css("background-image", "linear-gradient(180deg,#9babc3 0%,#41618c 100%)");
 
-                 $("#yearBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
 
-                 var argAxis = this.chartOptions.argumentAxis();
 
-                 var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
 
-                 argAxis.max = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
 
-                 var labelObj = {
 
-                     customizeText: function () {
 
-                         return this.value + '일';
 
-                     }
 
-                 };
 
-                 argAxis.label = labelObj;
 
-                 this.chartOptions.argumentAxis(argAxis);
 
-                 if (energySelectButton == "water") {
 
-                     var valAxis = this.chartOptions.valueAxis();
 
-                     valAxis.min = 0;
 
-                     //valAxis.max = 100;
 
-                     //valAxis.tickInterval = 10;
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             if (this.value >= 1000) {
 
-                                 this.value = this.value.toString().substring(0, 1) + 'K';
 
-                             } else {
 
-                                 this.value = this.value;
 
-                             }
 
-                             return this.value + ' m3';
 
-                         }
 
-                     };
 
-                     valAxis.label = labelObj;
 
-                     this.chartOptions.valueAxis(valAxis);
 
-                 } else if (energySelectButton == "gasm3") {
 
-                     var valAxis = this.chartOptions.valueAxis();
 
-                     valAxis.min = 0;
 
-                     //valAxis.max = 2000;
 
-                     //valAxis.tickInterval = 100;
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             if (this.value >= 1000 && this.value < 10000) {
 
-                                 this.value = this.value.toString().substring(0, 1) + 'K';
 
-                             } else if (this.value >= 10000 && this.value < 100000) {
 
-                                 this.value = this.value.toString().substring(0, 2) + 'K';
 
-                             } else if (this.value >= 100000 && this.value < 1000000) {
 
-                                 this.value = this.value.toString().substring(0, 3) + 'K';
 
-                             } else if (this.value >= 1000000 && this.value < 10000000) {
 
-                                 this.value = this.value.toString().substring(0, 1) + 'M';
 
-                             } else if (this.value >= 10000000 && this.value < 100000000) {
 
-                                 this.value = this.value.toString().substring(0, 2) + 'M';
 
-                             } else if (this.value >= 100000000) {
 
-                                 this.value = this.value.toString().substring(0, 3) + 'M';
 
-                             } else {
 
-                                 this.value = this.value;
 
-                             }
 
-                             return this.value + ' m3';
 
-                         }
 
-                     };
 
-                     valAxis.label = labelObj;
 
-                     this.chartOptions.valueAxis(valAxis);
 
-                 } else if (energySelectButton == "gaskwh") {
 
-                     var valAxis = this.chartOptions.valueAxis();
 
-                     valAxis.min = 0;
 
-                     //valAxis.max = 2000;
 
-                     //valAxis.tickInterval = 200;
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             if (this.value >= 1000 && this.value < 10000) {
 
-                                 this.value = this.value.toString().substring(0, 1) + 'K';
 
-                             } else if (this.value >= 10000 && this.value < 100000) {
 
-                                 this.value = this.value.toString().substring(0, 2) + 'K';
 
-                             } else if (this.value >= 100000 && this.value < 1000000) {
 
-                                 this.value = this.value.toString().substring(0, 3) + 'K';
 
-                             } else if (this.value >= 1000000 && this.value < 10000000) {
 
-                                 this.value = this.value.toString().substring(0, 1) + 'M';
 
-                             } else if (this.value >= 10000000 && this.value < 100000000) {
 
-                                 this.value = this.value.toString().substring(0, 2) + 'M';
 
-                             } else if (this.value >= 100000000) {
 
-                                 this.value = this.value.toString().substring(0, 3) + 'M';
 
-                             } else {
 
-                                 this.value = this.value;
 
-                             }
 
-                             return this.value + ' m3';
 
-                         }
 
-                     };
 
-                     valAxis.label = labelObj;
 
-                     this.chartOptions.valueAxis(valAxis);
 
-                 } else {
 
-                     var valAxis = this.chartOptions.valueAxis();
 
-                     valAxis.min = 0;
 
-                     //valAxis.max = 11000;
 
-                     //valAxis.tickInterval = 1000;
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             if (this.value >= 1000 && this.value < 10000) {
 
-                                 this.value = this.value.toString().substring(0, 1) + 'K';
 
-                             } else if (this.value >= 10000) {
 
-                                 this.value = this.value.toString().substring(0, 2) + 'K';
 
-                             } else {
 
-                                 this.value = this.value;
 
-                             }
 
-                             return this.value + ' kWh';
 
-                         }
 
-                     };
 
-                     valAxis.label = labelObj;
 
-                     this.chartOptions.valueAxis(valAxis);
 
-                 }
 
-                 if (energySelectButton == "all") {
 
-                     $("#unitPrediction").html("금월 목표 사용량(kWh)");
 
-                     $("#unitPerform").html("금월 사용량(kWh)");
 
-                     $("#unitPrediction2").html("금일까지 목표 사용량(kWh)");
 
-                     $("#divGoal").hide();
 
-                     $("#modGoalBtn").hide();
 
-                     var argSeries = this.chartOptions.series;
 
-                     argSeries = [{ valueField: "PredictionPower", name: "목표 전력", stack: "prediction", color: '#007994' },
 
-                                     { valueField: "PredictionGas", name: "목표 가스", stack: "prediction", color: '#03C700' },
 
-                                     { valueField: "PerformPower", name: "전력 사용량", stack: "perform", color: '#5F8B95' },
 
-                                     { valueField: "PerformGas", name: "가스 사용량", stack: "perform", color: '#7CC77B' }, ];
 
-                     this.chartOptions.series = argSeries;
 
-                     getAllData2(SITEID);
 
-                 } else if (energySelectButton == "power") {
 
-                     $("#unitPrediction").html("금월 목표 사용량(kWh)");
 
-                     $("#unitPerform").html("금월 사용량(kWh)");
 
-                     $("#unitPrediction2").html("금일까지 목표 사용량(kWh)");
 
-                     $("#divGoal").show();
 
-                     $("#modGoalBtn").show();
 
-                     var argSeries = this.chartOptions.series;
 
-                     argSeries = [{ valueField: "Prediction", name: "목표", color: '#007994' }, { valueField: "Perform", name: "사용량", color: '#5F8B95' }];
 
-                     this.chartOptions.series = argSeries;
 
-                     getEnergyData2(SITEID, $Code.FacilityType.ELECTRICITY, 1, 1);
 
-                 } else if (energySelectButton == "gaskwh") {
 
-                     $("#unitPrediction").html("금월 목표 사용량(kWh)");
 
-                     $("#unitPerform").html("금월 사용량(kWh)");
 
-                     $("#unitPrediction2").html("금일까지 목표 사용량(kWh)");
 
-                     $("#divGoal").show();
 
-                     $("#modGoalBtn").show();
 
-                     var argSeries = this.chartOptions.series;
 
-                     argSeries = [{ valueField: "Prediction", name: "목표", color: '#03C700' }, { valueField: "Perform", name: "사용량", color: '#7CC77B' }];
 
-                     this.chartOptions.series = argSeries;
 
-                     getEnergyData2(SITEID, $Code.FacilityType.GAS, 1, 2);
 
-                 } else if (energySelectButton == "gasm3") {
 
-                     $("#unitPrediction").html("금월 목표 사용량(m3)");
 
-                     $("#unitPerform").html("금월 사용량(m3)");
 
-                     $("#unitPrediction2").html("금일까지 목표 사용량(m3)");
 
-                     $("#divGoal").show();
 
-                     $("#modGoalBtn").show();
 
-                     var argSeries = this.chartOptions.series;
 
-                     argSeries = [{ valueField: "Prediction", name: "목표", color: '#03C700' }, { valueField: "Perform", name: "사용량", color: '#7CC77B' }];
 
-                     this.chartOptions.series = argSeries;
 
-                     getEnergyData2(SITEID, $Code.FacilityType.GAS, 1, 2);
 
-                 } else if (energySelectButton == "water") {
 
-                     $("#unitPrediction").html("금월 목표 사용량(m3)");
 
-                     $("#unitPerform").html("금월 사용량(m3)");
 
-                     $("#unitPrediction2").html("금일까지 목표 사용량(m3)");
 
-                     $("#divGoal").show();
 
-                     $("#modGoalBtn").show();
 
-                     var argSeries = this.chartOptions.series;
 
-                     argSeries = [{ valueField: "Prediction", name: "목표", color: '#FC6D00' }, { valueField: "Perform", name: "사용량", color: '#FDCFAD' }];
 
-                     this.chartOptions.series = argSeries;
 
-                     getEnergyData2(SITEID, $Code.FacilityType.WATER, 1, 3);
 
-                 } else {
 
-                     utils.toast.show("에너지원이 선택되지 않았습니다.");
 
-                 }
 
-             },
 
-             yearButtonClicked: function () {
 
-                 $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
 
-                 yearSelectButton = "year";
 
-                 $("#startDatePicker").dxDateBox("instance").option("formatString", "yyyy년");
 
-                 $("#startDatePicker").dxDateBox("instance").option("maxZoomLevel", "decade");
 
-                 $("#startDatePicker").dxDateBox("instance").option("width", "7%");
 
-                 $("#yearBtn").css("background-image", "linear-gradient(180deg,#9babc3 0%,#41618c 100%)");
 
-                 $("#monthBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
 
-                 var argAxis = this.chartOptions.argumentAxis();
 
-                 argAxis.max = 12;
 
-                 var labelObj = {
 
-                     customizeText: function () {
 
-                         return this.value + '월';
 
-                     }
 
-                 };
 
-                 argAxis.label = labelObj;
 
-                 this.chartOptions.argumentAxis(argAxis);
 
-                 if (energySelectButton == "water") {
 
-                     var valAxis = this.chartOptions.valueAxis();
 
-                     valAxis.min = 0;
 
-                     //valAxis.max = 5000;
 
-                     //valAxis.tickInterval = 500;
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             if (this.value >= 1000 && this.value < 10000) {
 
-                                 this.value = this.value.toString().substring(0, 1) + 'K';
 
-                             } else if (this.value >= 10000) {
 
-                                 this.value = this.value.toString().substring(0, 2) + 'K';
 
-                             } else {
 
-                                 this.value = this.value;
 
-                             }
 
-                             return this.value + ' m3';
 
-                         }
 
-                     };
 
-                     valAxis.label = labelObj;
 
-                     this.chartOptions.valueAxis(valAxis);
 
-                 } else if (energySelectButton == "gasm3") {
 
-                     var valAxis = this.chartOptions.valueAxis();
 
-                     valAxis.min = 0;
 
-                     //valAxis.max = 2000;
 
-                     //valAxis.tickInterval = this.value;
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             if (this.value >= 1000 && this.value < 10000) {
 
-                                 this.value = this.value.toString().substring(0, 1) + 'K';
 
-                             } else if (this.value >= 10000 && this.value < 100000) {
 
-                                 this.value = this.value.toString().substring(0, 2) + 'K';
 
-                             } else if (this.value >= 100000 && this.value < 1000000) {
 
-                                 this.value = this.value.toString().substring(0, 3) + 'K';
 
-                             } else if (this.value >= 1000000 && this.value < 10000000) {
 
-                                 this.value = this.value.toString().substring(0, 1) + 'M';
 
-                             } else if (this.value >= 10000000 && this.value < 100000000) {
 
-                                 this.value = this.value.toString().substring(0, 2) + 'M';
 
-                             } else if (this.value >= 100000000 && this.value < 1000000000) {
 
-                                 this.value = this.value.toString().substring(0, 3) + 'M';
 
-                             } else if (this.value >= 1000000000) {
 
-                                 this.value = this.value.toString().substring(0, 4) + 'M';
 
-                             } else {
 
-                                 this.value = this.value;
 
-                             }
 
-                             return this.value + ' m3';
 
-                         }
 
-                     };
 
-                     valAxis.label = labelObj;
 
-                     this.chartOptions.valueAxis(valAxis);
 
-                 } else if (energySelectButton == "gaskwh") {
 
-                     var valAxis = this.chartOptions.valueAxis();
 
-                     valAxis.min = 0;
 
-                     //valAxis.max = 2000;
 
-                     //valAxis.tickInterval = 200;
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             if (this.value >= 1000 && this.value < 10000) {
 
-                                 this.value = this.value.toString().substring(0, 1) + 'K';
 
-                             } else if (this.value >= 10000 && this.value < 100000) {
 
-                                 this.value = this.value.toString().substring(0, 2) + 'K';
 
-                             } else if (this.value >= 100000 && this.value < 1000000) {
 
-                                 this.value = this.value.toString().substring(0, 3) + 'K';
 
-                             } else if (this.value >= 1000000 && this.value < 10000000) {
 
-                                 this.value = this.value.toString().substring(0, 1) + 'M';
 
-                             } else if (this.value >= 10000000 && this.value < 100000000) {
 
-                                 this.value = this.value.toString().substring(0, 2) + 'M';
 
-                             } else if (this.value >= 100000000) {
 
-                                 this.value = this.value.toString().substring(0, 3) + 'M';
 
-                             } else {
 
-                                 this.value = this.value;
 
-                             }
 
-                             return this.value + ' m3';
 
-                         }
 
-                     };
 
-                     valAxis.label = labelObj;
 
-                     this.chartOptions.valueAxis(valAxis);
 
-                 } else {
 
-                     var valAxis = this.chartOptions.valueAxis();
 
-                     valAxis.min = 0;
 
-                     //valAxis.max = 500000;
 
-                     //valAxis.tickInterval = 50000;
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             if (this.value >= 1000 && this.value < 10000) {
 
-                                 this.value = this.value.toString().substring(0, 1) + 'K';
 
-                             } else if (this.value >= 10000 && this.value < 100000) {
 
-                                 this.value = this.value.toString().substring(0, 2) + 'K';
 
-                             } else if (this.value >= 100000) {
 
-                                 this.value = this.value.toString().substring(0, 3) + 'K';
 
-                             } else {
 
-                                 this.value = this.value;
 
-                             }
 
-                             return this.value + ' kWh';
 
-                         }
 
-                     };
 
-                     valAxis.label = labelObj;
 
-                     this.chartOptions.valueAxis(valAxis);
 
-                 }
 
-                 if (energySelectButton == "all") {
 
-                     $("#unitPrediction").html("금년 목표 사용량(kWh)");
 
-                     $("#unitPerform").html("금년 사용량(kWh)");
 
-                     $("#unitPrediction2").html("금일까지 목표 사용량(kWh)");
 
-                     $("#divGoal").hide();
 
-                     $("#modGoalBtn").hide();
 
-                     var argSeries = this.chartOptions.series;
 
-                     argSeries = [{ valueField: "PredictionPower", name: "목표 전력", stack: "prediction", color: '#007994' },
 
-                                     { valueField: "PredictionGas", name: "목표 가스", stack: "prediction", color: '#03C700' },
 
-                                     { valueField: "PerformPower", name: "전력 사용량", stack: "perform", color: '#5F8B95' },
 
-                                     { valueField: "PerformGas", name: "가스 사용량", stack: "perform", color: '#7CC77B' }, ];
 
-                     this.chartOptions.series = argSeries;
 
-                     getAllData2(SITEID);
 
-                 } else if (energySelectButton == "power") {
 
-                     $("#unitPrediction").html("금년 목표 사용량(kWh)");
 
-                     $("#unitPerform").html("금년 사용량(kWh)");
 
-                     $("#unitPrediction2").html("금일까지 목표 사용량(kWh)");
 
-                     $("#divGoal").hide();
 
-                     $("#modGoalBtn").hide();
 
-                     var argSeries = this.chartOptions.series;
 
-                     argSeries = [{ valueField: "Prediction", name: "목표", color: '#007994' }, { valueField: "Perform", name: "사용량", color: '#5F8B95' }];
 
-                     this.chartOptions.series = argSeries;
 
-                     getEnergyData2(SITEID, $Code.FacilityType.ELECTRICITY, 1, 1);
 
-                 } else if (energySelectButton == "gaskwh") {
 
-                     $("#unitPrediction").html("금년 목표 사용량(kWh)");
 
-                     $("#unitPerform").html("금년 사용량(kWh)");
 
-                     $("#unitPrediction2").html("금일까지 목표 사용량(kWh)");
 
-                     $("#divGoal").hide();
 
-                     $("#modGoalBtn").hide();
 
-                     var argSeries = this.chartOptions.series;
 
-                     argSeries = [{ valueField: "Prediction", name: "목표", color: '#03C700' }, { valueField: "Perform", name: "사용량", color: '#7CC77B' }];
 
-                     this.chartOptions.series = argSeries;
 
-                     getEnergyData2(SITEID, $Code.FacilityType.GAS, 1, 2);
 
-                 } else if (energySelectButton == "gasm3") {
 
-                     $("#unitPrediction").html("금년 목표 사용량(m3)");
 
-                     $("#unitPerform").html("금년 사용량(m3)");
 
-                     $("#unitPrediction2").html("금일까지 목표 사용량(m3)");
 
-                     $("#divGoal").hide();
 
-                     $("#modGoalBtn").hide();
 
-                     var argSeries = this.chartOptions.series;
 
-                     argSeries = [{ valueField: "Prediction", name: "목표", color: '#03C700' }, { valueField: "Perform", name: "사용량", color: '#7CC77B' }];
 
-                     this.chartOptions.series = argSeries;
 
-                     getEnergyData2(SITEID, $Code.FacilityType.GAS, 1, 2);
 
-                 } else if (energySelectButton == "water") {
 
-                     $("#unitPrediction").html("금년 목표 사용량(m3)");
 
-                     $("#unitPerform").html("금년 사용량(m3)");
 
-                     $("#unitPrediction2").html("금일까지 목표 사용량(m3)");
 
-                     $("#divGoal").hide();
 
-                     $("#modGoalBtn").hide();
 
-                     var argSeries = this.chartOptions.series;
 
-                     argSeries = [{ valueField: "Prediction", name: "목표", color: '#FC6D00' }, { valueField: "Perform", name: "사용량", color: '#FDCFAD' }];
 
-                     this.chartOptions.series = argSeries;
 
-                     getEnergyData2(SITEID, $Code.FacilityType.WATER, 1, 3);
 
-                 } else {
 
-                     utils.toast.show("에너지원이 선택되지 않았습니다.");
 
-                 }
 
-             },
 
-             powerButtonClicked: function () {
 
-                 $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
 
-                 energySelectButton = "power";
 
-                 $("#powerBtn").css("background-image", "linear-gradient(180deg,#9babc3 0%,#41618c 100%)");
 
-                 $("#allBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
 
-                 $("#gasm3Btn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
 
-                 $("#gaskWhBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
 
-                 $("#waterBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
 
-                 if (yearSelectButton == "month") {
 
-                     $("#unitPrediction").html("금월 목표 사용량(kWh)");
 
-                     $("#unitPerform").html("금월 사용량(kWh)");
 
-                     $("#unitPrediction2").html("금일까지 목표 사용량(kWh)");
 
-                     $("#divGoal").show();
 
-                     $("#modGoalBtn").show();
 
-                     var valAxis = this.chartOptions.valueAxis();
 
-                     valAxis.min = 0;
 
-                     //valAxis.max = 11000;
 
-                     //valAxis.tickInterval = 1000;
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             if (this.value >= 1000 && this.value < 10000) {
 
-                                 this.value = this.value.toString().substring(0, 1) + 'K';
 
-                             } else if (this.value >= 10000) {
 
-                                 this.value = this.value.toString().substring(0, 2) + 'K';
 
-                             } else {
 
-                                 this.value = this.value;
 
-                             }
 
-                             return this.value + ' kWh';
 
-                         }
 
-                     };
 
-                     valAxis.label = labelObj;
 
-                     this.chartOptions.valueAxis(valAxis);
 
-                 } else if (yearSelectButton == "year") {
 
-                     $("#unitPrediction").html("금년 목표 사용량(kWh)");
 
-                     $("#unitPerform").html("금년 사용량(kWh)");
 
-                     $("#unitPrediction2").html("금일까지 목표 사용량(kWh)");
 
-                     $("#divGoal").hide();
 
-                     $("#modGoalBtn").hide();
 
-                     var valAxis = this.chartOptions.valueAxis();
 
-                     valAxis.min = 0;
 
-                     //valAxis.max = 500000;
 
-                     //valAxis.tickInterval = 50000;
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             if (this.value >= 1000 && this.value < 10000) {
 
-                                 this.value = this.value.toString().substring(0, 1) + 'K';
 
-                             } else if (this.value >= 10000 && this.value < 100000) {
 
-                                 this.value = this.value.toString().substring(0, 2) + 'K';
 
-                             } else if (this.value >= 100000) {
 
-                                 this.value = this.value.toString().substring(0, 3) + 'K';
 
-                             } else {
 
-                                 this.value = this.value;
 
-                             }
 
-                             return this.value + ' kWh';
 
-                         }
 
-                     };
 
-                     valAxis.label = labelObj;
 
-                     this.chartOptions.valueAxis(valAxis);
 
-                 } else {
 
-                     utils.toast.show("년/월 선택이 되지 않았습니다.");
 
-                 }
 
-                 var argAxis = $("#sideBarChart").dxChart("instance").option('argumentAxis');
 
-                 var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
 
-                 if (yearSelectButton == "month") {
 
-                     argAxis.max = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             return this.value + '일';
 
-                         }
 
-                     };
 
-                 } else {
 
-                     argAxis.max = 12;
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             return this.value + '월';
 
-                         }
 
-                     };
 
-                 }
 
-                 argAxis.label = labelObj;
 
-                 $("#sideBarChart").dxChart("instance").option('argumentAxis', argAxis);
 
-                 getEnergyData2(SITEID, $Code.FacilityType.ELECTRICITY, 1, 1);
 
-             },
 
-             gasm3ButtonClicked: function () {
 
-                 $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
 
-                 energySelectButton = "gasm3";
 
-                 $("#gasm3Btn").css("background-image", "linear-gradient(180deg,#9babc3 0%,#41618c 100%)");
 
-                 $("#gaskWhBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
 
-                 $("#powerBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
 
-                 $("#waterBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
 
-                 $("#allBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
 
-                 if (yearSelectButton == "month") {
 
-                     $("#divGoal").show();
 
-                     $("#unitPrediction").html("금월 목표 사용량 (m3)");
 
-                     $("#unitPerform").html("금월 사용량(m3)");
 
-                     $("#unitPrediction2").html("금일까지 목표 사용량(m3)");
 
-                     $("#modGoalBtn").show();
 
-                     var valAxis = this.chartOptions.valueAxis();
 
-                     valAxis.min = 0;
 
-                     //valAxis.max = 2000;
 
-                     //valAxis.tickInterval = 100;
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             if (this.value >= 1000 && this.value < 10000) {
 
-                                 this.value = this.value.toString().substring(0, 1) + 'K';
 
-                             } else if (this.value >= 10000 && this.value < 100000) {
 
-                                 this.value = this.value.toString().substring(0, 2) + 'K';
 
-                             } else if (this.value >= 100000 && this.value < 1000000) {
 
-                                 this.value = this.value.toString().substring(0, 3) + 'K';
 
-                             } else if (this.value >= 1000000 && this.value < 10000000) {
 
-                                 this.value = this.value.toString().substring(0, 1) + 'M';
 
-                             } else if (this.value >= 10000000 && this.value < 100000000) {
 
-                                 this.value = this.value.toString().substring(0, 2) + 'M';
 
-                             } else if (this.value >= 100000000) {
 
-                                 this.value = this.value.toString().substring(0, 3) + 'M';
 
-                             } else {
 
-                                 this.value = this.value;
 
-                             }
 
-                             return this.value + ' m3';
 
-                         }
 
-                     };
 
-                     valAxis.label = labelObj;
 
-                     this.chartOptions.valueAxis(valAxis);
 
-                 } else if (yearSelectButton == "year") {
 
-                     $("#unitPrediction").html("금년 목표 사용량(m3)");
 
-                     $("#unitPerform").html("금년 사용량(m3)");
 
-                     $("#unitPrediction2").html("금일까지 목표 사용량(m3)");
 
-                     $("#divGoal").hide();
 
-                     $("#modGoalBtn").hide();
 
-                     var valAxis = this.chartOptions.valueAxis();
 
-                     valAxis.min = 0;
 
-                     //valAxis.max = 2000;
 
-                     //valAxis.tickInterval = 100;
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             if (this.value >= 1000 && this.value < 10000) {
 
-                                 this.value = this.value.toString().substring(0, 1) + 'K';
 
-                             } else if (this.value >= 10000 && this.value < 100000) {
 
-                                 this.value = this.value.toString().substring(0, 2) + 'K';
 
-                             } else if (this.value >= 100000 && this.value < 1000000) {
 
-                                 this.value = this.value.toString().substring(0, 3) + 'K';
 
-                             } else if (this.value >= 1000000 && this.value < 10000000) {
 
-                                 this.value = this.value.toString().substring(0, 1) + 'M';
 
-                             } else if (this.value >= 10000000 && this.value < 100000000) {
 
-                                 this.value = this.value.toString().substring(0, 2) + 'M';
 
-                             } else if (this.value >= 100000000 && this.value < 1000000000) {
 
-                                 this.value = this.value.toString().substring(0, 3) + 'M';
 
-                             } else if (this.value >= 1000000000) {
 
-                                 this.value = this.value.toString().substring(0, 4) + 'M';
 
-                             } else {
 
-                                 this.value = this.value;
 
-                             }
 
-                             return this.value + ' m3';
 
-                         }
 
-                     };
 
-                     valAxis.label = labelObj;
 
-                     this.chartOptions.valueAxis(valAxis);
 
-                 } else {
 
-                     utils.toast.show("년/월 선택이 되지 않았습니다.");
 
-                 }
 
-                 var argSeries = this.chartOptions.series;
 
-                 argSeries = [{ valueField: "Prediction", name: "목표", color: '#03C700' }, { valueField: "Perform", name: "사용량", color: '#7CC77B' }];
 
-                 this.chartOptions.series = argSeries;
 
-                 var argAxis = $("#sideBarChart").dxChart("instance").option('argumentAxis');
 
-                 var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
 
-                 if (yearSelectButton == "month") {
 
-                     argAxis.max = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             return this.value + '일';
 
-                         }
 
-                     };
 
-                 } else {
 
-                     argAxis.max = 12;
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             return this.value + '월';
 
-                         }
 
-                     };
 
-                 }
 
-                 argAxis.label = labelObj;
 
-                 $("#sideBarChart").dxChart("instance").option('argumentAxis', argAxis);
 
-                 getEnergyData2(SITEID, $Code.FacilityType.GAS, 1, 2);
 
-             },
 
-             gaskWhButtonClicked: function () {
 
-                 $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
 
-                 energySelectButton = "gaskwh";
 
-                 $("#gaskWhBtn").css("background-image", "linear-gradient(180deg,#9babc3 0%,#41618c 100%)");
 
-                 $("#gasm3Btn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
 
-                 $("#powerBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
 
-                 $("#waterBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
 
-                 $("#allBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
 
-                 if (yearSelectButton == "month") {
 
-                     $("#unitPrediction").html("금월 목표 사용량(kWh)");
 
-                     $("#unitPerform").html("금월 사용량(kWh)");
 
-                     $("#unitPrediction2").html("금일까지 목표 사용량(kWh)");
 
-                     $("#divGoal").show();
 
-                     $("#modGoalBtn").show();
 
-                     var valAxis = this.chartOptions.valueAxis();
 
-                     valAxis.min = 0;
 
-                     //valAxis.max = 2000;
 
-                     //valAxis.tickInterval = 200;
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             if (this.value >= 1000 && this.value < 10000) {
 
-                                 this.value = this.value.toString().substring(0, 1) + 'K';
 
-                             } else if (this.value >= 10000) {
 
-                                 this.value = this.value.toString().substring(0, 2) + 'K';
 
-                             } else {
 
-                                 this.value = this.value;
 
-                             }
 
-                             return this.value + ' kWh';
 
-                         }
 
-                     };
 
-                     valAxis.label = labelObj;
 
-                     this.chartOptions.valueAxis(valAxis);
 
-                 } else if (yearSelectButton == "year") {
 
-                     $("#unitPrediction").html("금년 목표 사용량(kWh)");
 
-                     $("#unitPerform").html("금년 사용량(kWh)");
 
-                     $("#unitPrediction2").html("금일까지 목표 사용량(kWh)");
 
-                     $("#divGoal").hide();
 
-                     $("#modGoalBtn").hide();
 
-                     var valAxis = this.chartOptions.valueAxis();
 
-                     valAxis.min = 0;
 
-                     //valAxis.max = 2000;
 
-                     //valAxis.tickInterval = 200;
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             if (this.value >= 1000 && this.value < 10000) {
 
-                                 this.value = this.value.toString().substring(0, 1) + 'K';
 
-                             } else if (this.value >= 10000 && this.value < 100000) {
 
-                                 this.value = this.value.toString().substring(0, 2) + 'K';
 
-                             } else if (this.value >= 100000) {
 
-                                 this.value = this.value.toString().substring(0, 3) + 'K';
 
-                             } else {
 
-                                 this.value = this.value;
 
-                             }
 
-                             return this.value + ' kWh';
 
-                         }
 
-                     };
 
-                     valAxis.label = labelObj;
 
-                     this.chartOptions.valueAxis(valAxis);
 
-                 } else {
 
-                     utils.toast.show("년/월 선택이 되지 않았습니다.");
 
-                 }
 
-                 var argSeries = this.chartOptions.series;
 
-                 argSeries = [{ valueField: "Prediction", name: "목표", color: '#03C700' }, { valueField: "Perform", name: "사용량", color: '#7CC77B' }];
 
-                 this.chartOptions.series = argSeries;
 
-                 var argAxis = $("#sideBarChart").dxChart("instance").option('argumentAxis');
 
-                 var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
 
-                 if (yearSelectButton == "month") {
 
-                     argAxis.max = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             return this.value + '일';
 
-                         }
 
-                     };
 
-                 } else {
 
-                     argAxis.max = 12;
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             return this.value + '월';
 
-                         }
 
-                     };
 
-                 }
 
-                 argAxis.label = labelObj;
 
-                 $("#sideBarChart").dxChart("instance").option('argumentAxis', argAxis);
 
-                 getEnergyData2(SITEID, $Code.FacilityType.GAS, 1, 2);
 
-             },
 
-             waterButtonClicked: function () {
 
-                 $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
 
-                 energySelectButton = "water";
 
-                 $("#waterBtn").css("background-image", "linear-gradient(180deg,#9babc3 0%,#41618c 100%)");
 
-                 $("#powerBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
 
-                 $("#allBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
 
-                 $("#gasm3Btn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
 
-                 $("#gaskWhBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
 
-                 if (yearSelectButton == "month") {
 
-                     $("#unitPrediction").html("금월 목표 사용량(m3)");
 
-                     $("#unitPerform").html("금월 사용량(m3)");
 
-                     $("#unitPrediction2").html("금일까지 목표 사용량(m3)");
 
-                     $("#divGoal").show();
 
-                     $("#modGoalBtn").show();
 
-                     var valAxis = this.chartOptions.valueAxis();
 
-                     valAxis.min = 0;
 
-                     //valAxis.max = 100;
 
-                     //valAxis.tickInterval = 10;
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             if (this.value >= 1000) {
 
-                                 this.value = this.value.toString().substring(0, 1) + 'K';
 
-                             } else {
 
-                                 this.value = this.value;
 
-                             }
 
-                             return this.value + ' m3';
 
-                         }
 
-                     };
 
-                     valAxis.label = labelObj;
 
-                     this.chartOptions.valueAxis(valAxis);
 
-                 } else if (yearSelectButton == "year") {
 
-                     $("#unitPrediction").html("금년 목표 사용량(m3)");
 
-                     $("#unitPerform").html("금년 사용량(m3)");
 
-                     $("#unitPrediction2").html("금일까지 목표 사용량(m3)");
 
-                     $("#divGoal").hide();
 
-                     $("#modGoalBtn").hide();
 
-                     var valAxis = this.chartOptions.valueAxis();
 
-                     valAxis.min = 0;
 
-                     //valAxis.max = 5000;
 
-                     //valAxis.tickInterval = 500;
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             if (this.value >= 1000 && this.value < 10000) {
 
-                                 this.value = this.value.toString().substring(0, 1) + 'K';
 
-                             } else if (this.value >= 10000) {
 
-                                 this.value = this.value.toString().substring(0, 2) + 'K';
 
-                             } else {
 
-                                 this.value = this.value;
 
-                             }
 
-                             return this.value + ' kWh';
 
-                         }
 
-                     };
 
-                     valAxis.label = labelObj;
 
-                     this.chartOptions.valueAxis(valAxis);
 
-                 } else {
 
-                     utils.toast.show("년/월 선택이 되지 않았습니다.");
 
-                 }
 
-                 var argSeries = this.chartOptions.series;
 
-                 argSeries = [{ valueField: "Prediction", name: "목표", color: '#FC6D00' }, { valueField: "Perform", name: "사용량", color: '#FDCFAD' }];
 
-                 this.chartOptions.series = argSeries;
 
-                 getEnergyData2(SITEID, $Code.FacilityType.WATER, 1, 3);
 
-             },
 
-             allButtonClicked: function () {
 
-                 $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
 
-                 energySelectButton = "all";
 
-                 $("#allBtn").css("background-image", "linear-gradient(180deg,#9babc3 0%,#41618c 100%)");
 
-                 $("#powerBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
 
-                 $("#waterBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
 
-                 $("#gasm3Btn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
 
-                 $("#gaskWhBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
 
-                 $("#divGoal").hide();
 
-                 $("#modGoalBtn").hide();
 
-                 if (yearSelectButton == "month") {
 
-                     $("#unitPrediction").html("금월 목표 사용량(kWh)");
 
-                     $("#unitPerform").html("금월 사용량(kWh)");
 
-                     $("#unitPrediction2").html("금일까지 목표 사용량(kWh)");
 
-                     var valAxis = this.chartOptions.valueAxis();
 
-                     valAxis.min = 0;
 
-                     //valAxis.max = 11000;
 
-                     //valAxis.tickInterval = 1000;
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             if (this.value >= 1000 && this.value < 10000) {
 
-                                 this.value = this.value.toString().substring(0, 1) + 'K';
 
-                             } else if (this.value >= 10000) {
 
-                                 this.value = this.value.toString().substring(0, 2) + 'K';
 
-                             } else {
 
-                                 this.value = this.value;
 
-                             }
 
-                             return this.value + ' kWh';
 
-                         }
 
-                     };
 
-                     valAxis.label = labelObj;
 
-                     this.chartOptions.valueAxis(valAxis);
 
-                 } else if (yearSelectButton == "year") {
 
-                     $("#unitPrediction").html("금년 목표 사용량(kWh)");
 
-                     $("#unitPerform").html("금년 사용량(kWh)");
 
-                     $("#unitPrediction2").html("금일까지 목표 사용량(kWh)");
 
-                     var valAxis = this.chartOptions.valueAxis();
 
-                     valAxis.min = 0;
 
-                     //valAxis.max = 500000;
 
-                     //valAxis.tickInterval = 50000;
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             if (this.value >= 1000 && this.value < 10000) {
 
-                                 this.value = this.value.toString().substring(0, 1) + 'K';
 
-                             } else if (this.value >= 10000 && this.value < 100000) {
 
-                                 this.value = this.value.toString().substring(0, 2) + 'K';
 
-                             } else if (this.value >= 100000) {
 
-                                 this.value = this.value.toString().substring(0, 3) + 'K';
 
-                             } else {
 
-                                 this.value = this.value;
 
-                             }
 
-                             return this.value + ' kWh';
 
-                         }
 
-                     };
 
-                     valAxis.label = labelObj;
 
-                     this.chartOptions.valueAxis(valAxis);
 
-                 }
 
-                 var argSeries = this.chartOptions.series;
 
-                 argSeries = [{ valueField: "PredictionPower", name: "목표 전력", stack: "prediction", color: '#007994' },
 
-                                 { valueField: "PredictionGas", name: "목표 가스", stack: "prediction", color: '#03C700' },
 
-                                 { valueField: "PerformPower", name: "전력 사용량", stack: "perform", color: '#5F8B95' },
 
-                                 { valueField: "PerformGas", name: "가스 사용량", stack: "perform", color: '#7CC77B' }, ];
 
-                 this.chartOptions.series = argSeries;
 
-                 var argAxis = $("#sideBarChart").dxChart("instance").option('argumentAxis');
 
-                 var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
 
-                 if (yearSelectButton == "month") {
 
-                     argAxis.max = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             return this.value + '일';
 
-                         }
 
-                     };
 
-                 } else {
 
-                     argAxis.max = 12;
 
-                     var labelObj = {
 
-                         customizeText: function () {
 
-                             return this.value + '월';
 
-                         }
 
-                     };
 
-                 }
 
-                 argAxis.label = labelObj;
 
-                 $("#sideBarChart").dxChart("instance").option('argumentAxis', argAxis);
 
-                 getAllData2(SITEID);
 
-             },
 
-             dxCircularGauge: {
 
-                 geometry: {
 
-                     startAngle: 180,
 
-                     endAngle: 0
 
-                 },
 
-                 scale: {
 
-                     startValue: 0,
 
-                     endValue: 150,
 
-                 },
 
-                 rangeContainer: {
 
-                     ranges: [
 
- 			            { startValue: 0, endValue: 90, color: '#77DD77' },
 
-                         { startValue: 90, endValue: 100, color: 'orange' },
 
-                         { startValue: 100, endValue: 150, color: '#92000A' }
 
-                     ],
 
-                 },
 
-                 tickInterval: 50,
 
-                 label: {
 
-                     customizeText: function (arg) {
 
-                         return arg.valueText + " %";
 
-                     }
 
-                 },
 
-                 value: 0,
 
-                 valueIndicator: {
 
-                     type: "triangleNeedle",
 
-                     color: "#8FBC8F"
 
-                 },
 
-                 animation: {
 
-                     easing: 'linear'
 
-                 },
 
-                 spindleSize: 14,
 
-                 indentFromCenter: 0,
 
-                 tooltip: {
 
-                     enabled: true
 
-                 }
 
-             },
 
-             modGoalButtonClicked: function () {
 
-                 visiblePopup(true);
 
-             },
 
-             dataGrid: {
 
-                 dataSource: goalDataSource,
 
-                 columns: ["날짜", "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"],
 
-                 scrolling: {
 
-                     mode: 'standard'
 
-                 },
 
-                 paging: { enabled: false }
 
-             }
 
-         }
 
-     );
 
-     viewModel.popupOptions = {
 
-         width: 1000,
 
-         height: 800,
 
-         visible: visiblePopup,
 
-         dragEnabled: false,
 
-         shading: false,
 
-         showTitle: true,
 
-         title: "목표치",
 
-         showCloseButton: true,
 
-         onShown: function (t, tt) {
 
-         }
 
-     };
 
-     return viewModel;
 
- };
 
 
  |