From fc968f85be49a18aa5dce2e43d6b98d1cd668f31 Mon Sep 17 00:00:00 2001 From: "wanling040@gmail.com" Date: Mon, 25 Jul 2022 18:32:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8D=E8=A9=9E=E4=BF=AE=E6=94=B9:=20?= =?UTF-8?q?=E7=B6=9C=E5=90=88=E5=A0=B1=E8=A1=A8=3D>=20=E7=B6=9C=E5=90=88?= =?UTF-8?q?=E6=AF=94=E8=BC=83=E3=80=81=E5=8D=80=E9=96=93=E5=A0=B1=E8=A1=A8?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=80=E5=80=8Btype?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/StationReportController.cs | 10 +- .../Implement/StationReportRepository.cs | 103 ++++---- SolarPower/Views/StationReport/Index.cshtml | 246 +++++++++++++++--- 3 files changed, 266 insertions(+), 93 deletions(-) diff --git a/SolarPower/Controllers/StationReportController.cs b/SolarPower/Controllers/StationReportController.cs index 0ad8c2d..cac5a04 100644 --- a/SolarPower/Controllers/StationReportController.cs +++ b/SolarPower/Controllers/StationReportController.cs @@ -1609,7 +1609,7 @@ namespace SolarPower.Controllers }; var Formhead = GetTableHead(select_Table);//取head - var sheet = workbook.CreateSheet("綜合報表"); + var sheet = workbook.CreateSheet("綜合比較"); int RowPosition = 0; int index = 0; var citycount = Formbody.Result.Data.GroupBy(a => a.CityName).Count(); @@ -1897,7 +1897,7 @@ namespace SolarPower.Controllers ms.Flush(); ms.Seek(0, SeekOrigin.Begin); var Datename = postObject.Time.Replace("-", ""); - return File(ms, "application/vnd.ms-excel", "FIC太陽能監控平台" + "_" + "綜合報表" + "_" + postObject.Userid + Datename + ".xlsx"); + return File(ms, "application/vnd.ms-excel", "FIC太陽能監控平台" + "_" + "綜合比較" + "_" + postObject.Userid + Datename + ".xlsx"); } public string ExportExcelmaxtableBackDownload(string post) @@ -1956,7 +1956,7 @@ namespace SolarPower.Controllers }; var Formhead = GetTableHead(select_Table);//取head - var sheet = workbook.CreateSheet("綜合報表"); + var sheet = workbook.CreateSheet("綜合比較"); int RowPosition = 0; int index = 0; var citycount = Formbody.Result.Data.GroupBy(a => a.CityName).Count(); @@ -2244,12 +2244,12 @@ namespace SolarPower.Controllers { Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "report", Datename)); } - var n = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "report", Datename, "FIC太陽能監控平台" + "_" + "綜合報表" + "_" + postObject.Userid + Datename + ".xlsx"); + var n = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "report", Datename, "FIC太陽能監控平台" + "_" + "綜合比較" + "_" + postObject.Userid + Datename + ".xlsx"); FileStream FS = new FileStream(n, FileMode.Create, FileAccess.Write); workbook.Write(FS); FS.Close(); - return Path.Combine("\\" + "upload", "report", Datename, "FIC太陽能監控平台" + "_" + "綜合報表" + "_" + postObject.Userid + Datename + ".xlsx"); + return Path.Combine("\\" + "upload", "report", Datename, "FIC太陽能監控平台" + "_" + "綜合比較" + "_" + postObject.Userid + Datename + ".xlsx"); } public async Task>> CheckExcel(Select_table2 post) diff --git a/SolarPower/Repository/Implement/StationReportRepository.cs b/SolarPower/Repository/Implement/StationReportRepository.cs index 733906c..8eb6ac4 100644 --- a/SolarPower/Repository/Implement/StationReportRepository.cs +++ b/SolarPower/Repository/Implement/StationReportRepository.cs @@ -316,7 +316,7 @@ namespace SolarPower.Repository.Implement } /// - /// 綜合報表 + /// 綜合比較 /// /// /// @@ -482,8 +482,6 @@ namespace SolarPower.Repository.Implement #DEALLOCATE PREPARE stmt;"; break; case 1: - if (post.SearchType == 2) - { sql = @$" SET @sql = NULL; SELECT @@ -527,56 +525,7 @@ namespace SolarPower.Repository.Implement #PREPARE stmt FROM @sql; #EXECUTE stmt; #DEALLOCATE PREPARE stmt;"; - } - else - { - var times = post.Time.Replace('-', 'a').Replace('/', '-').Replace(" ", "").Split('a'); - - sql = @$"SET @sql = NULL; - SELECT - GROUP_CONCAT(DISTINCT - CONCAT('max(case when INVERTERID = ''', INVERTERID, ''' then round(a.KWH, 2) end) ''inv_', right(INVERTERID, 2), '''') - ) INTO @sql - FROM inverter_history_day where powerstationId = {post.PowerStation} and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') BETWEEN '{times[0]}' AND '{times[1]}'; - SET @sql = CONCAT('SELECT DATE_FORMAT(a.TIMESTAMP,''%m/%d'') report_date, ', @sql, - ',b.TODAYKWH ''dayKWH'', round((b.TODAYKWH / c.monthKWH)*100,2) ''dayKWHp'', b.SOLARHOUR ''tothour'', b.KWHKWP ''KWHKWP'', b.PR, - d.irradiance ''irradiance'', d.Temperature ''temperature'', b.money ''soldmoney'', - c.monthKWH ''monthKWH'', c.money ''monthmoney'', stationName, powerRate ''monthmoneyone'',SolarType,SiteDB - FROM inverter_history_day a left join - ( # 每日加總 inv - select powerStationid, DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'') report_date, siteid, sitetype, #, round(KWH, 2) KWH, - round(todayKWH, 2) todayKWH,round(KWHKWP, 2) KWHKWP, round(PR, 2) PR, ifnull(round(money, 2),0) money, round(SOLARHOUR, 2) SOLARHOUR - from power_station_history_day - where powerstationid = {post.PowerStation} and DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'') BETWEEN ''{times[0]}'' AND ''{times[1]}'' - ) b on a.powerStationid = b.powerStationid and DATE_FORMAT(a.TIMESTAMP,''%Y-%m-%d'') = b.report_date - left join - ( # month - SELECT powerStationid, ROUND(AVG(TODAYKWH),2) AS monthKWH, - ROUND(AVG(KWHKWP),2) AS KWHKWP, - ROUND(AVG(PR),2) AS PR, - ROUND(SUM(MONEY),2) AS money, - ROUND(SUM(SOLARHOUR),2) AS SOLARHOUR - FROM power_station_history_day where powerstationid = {post.PowerStation} and DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'') BETWEEN ''{times[0]}'' AND ''{times[1]}'' - ) c on a.powerStationid = c.powerStationid - left join - ( - select powerStationID, DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'')report_date, irradiance, Temperature - from sensor_history_day - where powerstationid = {post.PowerStation} and DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'') BETWEEN ''{times[0]}'' AND ''{times[1]}'' - ) d on a.powerStationid = d.powerStationid and DATE_FORMAT(a.TIMESTAMP,''%Y-%m-%d'') = d.report_date - join - ( - select id, name stationName, powerRate, SolarType, SiteDB from power_station where id = {post.PowerStation} - )z on a.powerstationid = z.id - where DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'') BETWEEN ''{times[0]}'' AND ''{times[1]}'' - GROUP BY DATE_FORMAT(a.TIMESTAMP,''%Y-%m-%d'') - order by DATE_FORMAT(a.TIMESTAMP,''%Y-%m-%d'') '); - - select @sql as 'mySelect'; #顯示動態語法 - #PREPARE stmt FROM @sql; - #EXECUTE stmt; - #DEALLOCATE PREPARE stmt;"; - } + break; case 3: sql = @$" @@ -626,6 +575,54 @@ namespace SolarPower.Repository.Implement "; break; + case 4: + var times = post.Time.Replace('-', 'a').Replace('/', '-').Replace(" ", "").Split('a'); + + sql = @$"SET @sql = NULL; + SELECT + GROUP_CONCAT(DISTINCT + CONCAT('max(case when INVERTERID = ''', INVERTERID, ''' then round(a.KWH, 2) end) ''inv_', right(INVERTERID, 2), '''') + ) INTO @sql + FROM inverter_history_day where powerstationId = {post.PowerStation} and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') BETWEEN '{times[0]}' AND '{times[1]}'; + SET @sql = CONCAT('SELECT DATE_FORMAT(a.TIMESTAMP,''%m/%d'') report_date, ', @sql, + ',b.TODAYKWH ''dayKWH'', round((b.TODAYKWH / c.monthKWH)*100,2) ''dayKWHp'', b.SOLARHOUR ''tothour'', b.KWHKWP ''KWHKWP'', b.PR, + d.irradiance ''irradiance'', d.Temperature ''temperature'', b.money ''soldmoney'', + c.monthKWH ''monthKWH'', c.money ''monthmoney'', stationName, powerRate ''monthmoneyone'',SolarType,SiteDB + FROM inverter_history_day a left join + ( # 每日加總 inv + select powerStationid, DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'') report_date, siteid, sitetype, #, round(KWH, 2) KWH, + round(todayKWH, 2) todayKWH,round(KWHKWP, 2) KWHKWP, round(PR, 2) PR, ifnull(round(money, 2),0) money, round(SOLARHOUR, 2) SOLARHOUR + from power_station_history_day + where powerstationid = {post.PowerStation} and DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'') BETWEEN ''{times[0]}'' AND ''{times[1]}'' + ) b on a.powerStationid = b.powerStationid and DATE_FORMAT(a.TIMESTAMP,''%Y-%m-%d'') = b.report_date + left join + ( # month + SELECT powerStationid, ROUND(AVG(TODAYKWH),2) AS monthKWH, + ROUND(AVG(KWHKWP),2) AS KWHKWP, + ROUND(AVG(PR),2) AS PR, + ROUND(SUM(MONEY),2) AS money, + ROUND(SUM(SOLARHOUR),2) AS SOLARHOUR + FROM power_station_history_day where powerstationid = {post.PowerStation} and DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'') BETWEEN ''{times[0]}'' AND ''{times[1]}'' + ) c on a.powerStationid = c.powerStationid + left join + ( + select powerStationID, DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'')report_date, irradiance, Temperature + from sensor_history_day + where powerstationid = {post.PowerStation} and DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'') BETWEEN ''{times[0]}'' AND ''{times[1]}'' + ) d on a.powerStationid = d.powerStationid and DATE_FORMAT(a.TIMESTAMP,''%Y-%m-%d'') = d.report_date + join + ( + select id, name stationName, powerRate, SolarType, SiteDB from power_station where id = {post.PowerStation} + )z on a.powerstationid = z.id + where DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'') BETWEEN ''{times[0]}'' AND ''{times[1]}'' + GROUP BY DATE_FORMAT(a.TIMESTAMP,''%Y-%m-%d'') + order by DATE_FORMAT(a.TIMESTAMP,''%Y-%m-%d'') '); + + select @sql as 'mySelect'; #顯示動態語法 + #PREPARE stmt FROM @sql; + #EXECUTE stmt; + #DEALLOCATE PREPARE stmt;"; + break; } a = await conn.QueryAsync(sql,commandTimeout: 300); } diff --git a/SolarPower/Views/StationReport/Index.cshtml b/SolarPower/Views/StationReport/Index.cshtml index c07da44..78f58ea 100644 --- a/SolarPower/Views/StationReport/Index.cshtml +++ b/SolarPower/Views/StationReport/Index.cshtml @@ -6,16 +6,8 @@ @using SolarPower.Models.Role @model RoleLayerEnum - -
- - - - - - - - +
+
@@ -222,8 +214,8 @@ - - + +
@@ -354,7 +346,7 @@ $('#year2btn').hide(); $('#intervalbtn').hide(); //document.getElementById("monthbtn").disabled = true;//月報表鎖定 - //document.getElementById("yearbtn").disabled = false;//綜合報表鎖定 + //document.getElementById("yearbtn").disabled = false;//綜合比較鎖定 //document.getElementById("daybtn").disabled = false;//日報表鎖定 //#endregion @@ -372,7 +364,7 @@ $(e).removeClass("btn-secondary").addClass("btn-success"); document.getElementById("DateGettextdiv").style.display = "none";//隱藏 document.getElementById("DateGet").style.display = "";//隱藏 - + switch (type) { case 0: $('#DateGet').prop({ 'type': 'date' }); $(".btn-change-quickSearch1").html("昨天"); @@ -385,11 +377,10 @@ $('#year2btn').hide(); $('#intervalbtn').hide(); @*document.getElementById("monthbtn").disabled = true;//月報表鎖定 - document.getElementById("yearbtn").disabled = false;//綜合報表鎖定 + document.getElementById("yearbtn").disabled = false;//綜合比較鎖定 document.getElementById("daybtn").disabled = false;//日報表鎖定*@ break; case 1: - //#region Date-Picker datepicker = $('#DateGettext').daterangepicker({ autoUpdateInput: false, @@ -428,7 +419,7 @@ $('#intervalbtn').show(); @*document.getElementById("daybtn").disabled = true;//日報表鎖定 document.getElementById("monthbtn").disabled = false;//月報表鎖定 - document.getElementById("yearbtn").disabled = false;//綜合報表鎖定*@ + document.getElementById("yearbtn").disabled = false;//綜合比較鎖定*@ break; case 2: $('#DateGet').prop({ 'type': 'month' }); $(".btn-change-quickSearch1").html("本月"); @@ -442,7 +433,7 @@ $('#intervalbtn').hide(); @*document.getElementById("daybtn").disabled = true;//日報表鎖定 document.getElementById("monthbtn").disabled = false;//月報表鎖定 - document.getElementById("yearbtn").disabled = false;//綜合報表鎖定*@ + document.getElementById("yearbtn").disabled = false;//綜合比較鎖定*@ break; case 3: $(".btn-change-quickSearch1").html("今年"); @@ -457,7 +448,7 @@ $('#intervalbtn').hide(); @*document.getElementById("daybtn").disabled = true;//日報表鎖定 document.getElementById("monthbtn").disabled = true;//月報表鎖定 - document.getElementById("yearbtn").disabled = false;//綜合報表鎖定*@ + document.getElementById("yearbtn").disabled = false;//綜合比較鎖定*@ break; } if (type == 1) { @@ -483,6 +474,7 @@ } break; case 1: + case 4://區間 if (day == 0) { //#region 預設近7天 var today = new Date(new Date().setDate(new Date().getDate() - 1)); @@ -728,6 +720,7 @@ $("#yearbtn").attr("disabled", true); $("#year2btn").attr("disabled", true); $(".btn-station").attr("disabled", true); + $("#intervalbtn").attr("disabled", true); break; case 1: $("#daybtn").attr("disabled", true); @@ -735,6 +728,7 @@ $("#yearbtn").attr("disabled", true); $("#year2btn").attr("disabled", true); $(".btn-station").attr("disabled", true); + $("#intervalbtn").attr("disabled", true); break; case 2: $("#daybtn").attr("disabled", true); @@ -742,6 +736,7 @@ $("#yearbtn").html('').attr("disabled", true); $("#year2btn").attr("disabled", true); $(".btn-station").attr("disabled", true); + $("#intervalbtn").attr("disabled", true); break; case 3: $("#daybtn").attr("disabled", true); @@ -749,6 +744,15 @@ $("#yearbtn").attr("disabled", true); $("#year2btn").html('').attr("disabled", true); $(".btn-station").attr("disabled", true); + $("#intervalbtn").attr("disabled", true); + break; + case 4: + $("#daybtn").attr("disabled", true); + $("#monthbtn").attr("disabled", true); + $("#yearbtn").attr("disabled", true); + $("#year2btn").attr("disabled", true); + $(".btn-station").attr("disabled", true); + $("#intervalbtn").html('').attr("disabled", true); break; } @@ -766,6 +770,7 @@ $("#yearbtn").attr("disabled", false); $("#year2btn").attr("disabled", false); $(".btn-station").attr("disabled", false); + $("#intervalbtn").attr("disabled", false); break; case 1: $("#daybtn").attr("disabled", false); @@ -773,13 +778,15 @@ $("#yearbtn").attr("disabled", false); $("#year2btn").attr("disabled", false); $(".btn-station").attr("disabled", false); + $("#intervalbtn").attr("disabled", false); break; case 2: $("#daybtn").attr("disabled", false); $("#monthbtn").attr("disabled", false); - $("#yearbtn").html('綜合報表').attr("disabled", false); + $("#yearbtn").html('綜合比較').attr("disabled", false); $("#year2btn").attr("disabled", false); $(".btn-station").attr("disabled", false); + $("#intervalbtn").attr("disabled", false); break; case 3: $("#daybtn").attr("disabled", false); @@ -787,11 +794,20 @@ $("#yearbtn").attr("disabled", false); $("#year2btn").html('年報表').attr("disabled", false); $(".btn-station").attr("disabled", false); + $("#intervalbtn").attr("disabled", false); break; - } + case 4: + $("#daybtn").attr("disabled", false); + $("#monthbtn").attr("disabled", false); + $("#yearbtn").attr("disabled", false); + $("#year2btn").attr("disabled", false); + $(".btn-station").attr("disabled", false); + $("#intervalbtn").html('區間報表').attr("disabled", false); + break; + } return; } - + $('#TableHead').empty(); var str = ""; @@ -828,7 +844,7 @@ str += "日
售電金額
(NTD)"; } break; - case 2: //綜合報表 + case 2: //綜合比較 str += "區域"; str += "電站名稱"; str += "發電量"; @@ -858,15 +874,32 @@ str += "月
售電金額
(NTD)"; } break; + case 4: // 區間報 + str += "Date"; + $.each(rel.data.inv, function (index, inverter) { + haveinvertName.push(inverter); + str += "" + inverter + ""; + }) + str += "日
發電量
(kWh)"; + str += "日
發電量
百分比
(%)"; + str += "日照小時(hr)"; + str += "日均發電度數"; + str += "PR%"; + str += "累積日照量(W/㎡)"; + str += "日
平均
模組溫度
(°C)"; + if (rel.data.showMoney == 1) { + str += "日
售電金額
(NTD)"; + } + break; } str += ""; $('#TableHead').append(str); - + if (form != 2) { // 日月年 報 tablebody(form, rel.data.showMoney); } else { - //綜合報表 + //綜合比較 maxtableinfobody(rel.data.showMoney); } hideLoading(); @@ -909,6 +942,7 @@ $("#yearbtn").attr("disabled", false); $("#year2btn").attr("disabled", false); $(".btn-station").attr("disabled", false); + $("#intervalbtn").attr("disabled", false); break; case 1: $("#daybtn").attr("disabled", false); @@ -916,13 +950,15 @@ $("#yearbtn").attr("disabled", false); $("#year2btn").attr("disabled", false); $(".btn-station").attr("disabled", false); + $("#intervalbtn").attr("disabled", false); break; case 2: $("#daybtn").attr("disabled", false); $("#monthbtn").attr("disabled", false); - $("#yearbtn").html('綜合報表').attr("disabled", false); + $("#yearbtn").html('綜合比較').attr("disabled", false); $("#year2btn").attr("disabled", false); $(".btn-station").attr("disabled", false); + $("#intervalbtn").attr("disabled", false); break; case 3: $("#daybtn").attr("disabled", false); @@ -930,6 +966,15 @@ $("#yearbtn").attr("disabled", false); $("#year2btn").html('年報表').attr("disabled", false); $(".btn-station").attr("disabled", false); + $("#intervalbtn").attr("disabled", false); + break; + case 4: + $("#daybtn").attr("disabled", false); + $("#monthbtn").attr("disabled", false); + $("#yearbtn").attr("disabled", false); + $("#year2btn").attr("disabled", false); + $(".btn-station").attr("disabled", false); + $("#intervalbtn").html('區間報表').attr("disabled", false); break; } @@ -947,7 +992,7 @@ } //var sta = ""; - + $('#totbody').empty(); $('#tothead').empty(); if (form == 0) {//日報表 @@ -1072,7 +1117,7 @@ stc += "" + '發電量平均(kWh)(日)' + ""; stc += "" + '發電量(kWh)(月)' + ""; stc += "" + '裝置容量' + ""; - + if (showmoney == 1) { stc += "" + '每度獲利' + ""; stc += "" + '售電金額(NTD)(月)' + ""; @@ -1100,7 +1145,7 @@ stb += "" + toThousands((avgdayKWH / monthday).toFixed(2)) + ""; stb += "" + toThousands(monthKWH) + ""; stb += "" + toThousands(GeneratingCapacity) + ""; - + if (showmoney == 1) { stb += "" + toThousands((monthmoney / GeneratingCapacity).toFixed(3)) + ""; stb += "" + toThousands(Math.round(monthmoney)) + ""; @@ -1117,6 +1162,7 @@ PowerstationId: nowpowerstation } $('#HireTableBody').empty(); + showLoading(); var posturl = "/StationReport/GetHireInfo"; $.post(posturl, dataTosent, function (rel) { if (rel.code != "0000") { @@ -1238,6 +1284,7 @@ PowerstationId: nowpowerstation } $('#HireTableBody').empty(); + showLoading(); var posturl = "/StationReport/GetHireInfo"; $.post(posturl, dataTosent, function (rel) { if (rel.code != "0000") { @@ -1267,6 +1314,135 @@ haveinvertName = []; } + else if (form == 4) {//區間報表 + var avghour = 0; + var avgKWHKWP = 0; + var avgdayKWH = 0; + var monthKWH = 0; + var monthmoney = 0; + var monthmoneyone = 0; + var monthday = 0; + var sta = ""; + var check_hire = false; + var sitedb = ""; + var GeneratingCapacity = 0; + $.each(rel.data, function (index, inverter) { + sta += ""; + sta += "" + inverter.report_date + ""; + $.each(haveinvertName, function (item, i) { + if (inverter[i] == null) { + sta += "" + 0 + ""; + } else { + sta += "" + toThousands(inverter[i]) + ""; + } + }); + sta += "" + toThousands(inverter.dayKWH) + ""; + sta += "" + ((inverter.dayKWHp == null) ? 0 : toThousands(inverter.dayKWHp)) + ""; + sta += "" + inverter.tothour + ""; + sta += "" + toThousands(inverter.KWHKWP) + ""; + sta += "" + ((inverter.PR == null) ? 0 : toThousands(inverter.PR.toFixed(2))) + ""; + sta += "" + ((inverter.IrrDay == null) ? 0 : toThousands(inverter.IrrDay)) + ""; + sta += "" + inverter.temperature + ""; + if (showmoney == 1) { + sta += "" + toThousands(Math.round(inverter.soldmoney)) + ""; + } + sta += ""; + avghour += inverter.tothour ? inverter.tothour : 0; + avgKWHKWP += inverter.KWHKWP ? inverter.KWHKWP : 0; + avgdayKWH += inverter.dayKWH ? inverter.dayKWH : 0; + monthKWH = inverter.monthKWH ? inverter.monthKWH : 0; + monthmoney = inverter.monthmoney ? inverter.monthmoney : 0; + monthmoneyone += inverter.monthmoneyone ? inverter.monthmoneyone : 0; + + if (inverter.SolarType == 1) { + check_hire = true; + sitedb = inverter.SiteDB + } + GeneratingCapacity = inverter.GeneratingCapacity; + }) + monthday = rel.data.length; + + + var stc = ""; + /*stc += "" + '日照平均(日)' + "";*/ + stc += "" + '日均發電度數(日)' + ""; + stc += "" + '發電量平均(kWh)(日)' + ""; + stc += "" + '發電量(kWh)(月)' + ""; + stc += "" + '裝置容量' + ""; + + if (showmoney == 1) { + stc += "" + '每度獲利' + ""; + stc += "" + '售電金額(NTD)(月)' + ""; + stc += "" + '售電單價(NTD)(月)' + ""; + } + stc += "" + '售電天數(月)' + ""; + stc += ""; + + + + var stb = ""; + if (monthday == 0) { + stb += "" + 0 + ""; + stb += "" + 0 + ""; + stb += "" + 0 + ""; + stb += "" + 0 + ""; + stb += "" + 0 + ""; + stb += "" + 0 + ""; + stb += "" + 0 + ""; + stb += ""; + } + else { + /*stb += "" + (avghour / monthday).toFixed(2) + "";*/ + stb += "" + toThousands((avgKWHKWP / monthday).toFixed(2)) + ""; + stb += "" + toThousands((avgdayKWH / monthday).toFixed(2)) + ""; + stb += "" + toThousands(monthKWH) + ""; + stb += "" + toThousands(GeneratingCapacity) + ""; + + if (showmoney == 1) { + stb += "" + toThousands((monthmoney / GeneratingCapacity).toFixed(3)) + ""; + stb += "" + toThousands(Math.round(monthmoney)) + ""; + stb += "" + Math.round(monthmoneyone / monthday * 10000) / 10000 + ""; + } + stb += "" + monthday + ""; + stb += ""; + } + var std = ""; + if (check_hire == true && showmoney == 1) { + var dataTosent = + { + Sitedb: sitedb, + PowerstationId: nowpowerstation + } + $('#HireTableBody').empty(); + showLoading(); + var posturl = "/StationReport/GetHireInfo"; + $.post(posturl, dataTosent, function (rel) { + if (rel.code != "0000") { + hideLoading(); + toast_error(rel.data.msg); + return; + } + $.each(rel.data, function (index, value) { + std += ""; + std += "" + value.landowner + ""; + std += "" + value.leaseRate + "%" + ""; + std += "" + toThousands(Math.round(monthmoney * value.leaseRate / 100)) + ""; + std += "" + toThousands(Math.round(monthmoney * value.leaseRate / 100 * 1.05)) + ""; + std += ""; + }) + $('#HireTableBody').append(std); + $('#hiretable').show(); + }) + } + + $('#TableBody').empty(); + $('#TableBody').append(sta); + $('#totbody').append(stb); + $('#tothead').append(stc); + + + haveinvertName = []; + } $('#overviewtable').show(); $('#detailtable').show(); @@ -1322,7 +1498,7 @@ } } } - // 綜合報表 + // 綜合比較 function maxtableinfobody(showmoney) { var send_data = @@ -1349,7 +1525,7 @@ } $("#daybtn").attr("disabled", false); $("#monthbtn").attr("disabled", false); - $("#yearbtn").html('綜合報表').attr("disabled", false); + $("#yearbtn").html('綜合比較').attr("disabled", false); $("#year2btn").attr("disabled", false); $(".btn-station").attr("disabled", false); var maxtime = ""; @@ -1412,7 +1588,7 @@ StrInfoBody += "" + toThousands(data.avgIrradiance.toFixed(2)) + ""; // 平均日照 StrInfoBody += "" + toThousands(data.avgPR.toFixed(2)) + ""; if (showmoney == 1) { - + StrInfoBody += "" + toThousands(Math.round(data.todayMoney)) + ""; StrInfoBody += "" + Math.round(data.todayMoney * hirerate * 0.01)+ ""; @@ -1453,7 +1629,7 @@ } - + TotalBody += "" + toThousands(kwp.toFixed(2)) + ""; TotalBody += "" + toThousands((kwhkwp / rel.data.length).toFixed(2)) + ""; TotalBody += ""; @@ -1472,7 +1648,7 @@ $('#overviewtable').show(); $('#detailtable').show(); - + nowform = 2; $('#all').show(); hideLoading(); @@ -1506,6 +1682,6 @@ return hirerate; } - + } \ No newline at end of file