diff --git a/SolarPower/Controllers/StationReportController.cs b/SolarPower/Controllers/StationReportController.cs index cac5a04..87d8814 100644 --- a/SolarPower/Controllers/StationReportController.cs +++ b/SolarPower/Controllers/StationReportController.cs @@ -928,7 +928,15 @@ namespace SolarPower.Controllers } else if(postObject.FormType == 1) { - name = "月"; + if(postObject.SearchType == 2) + { + name = "月"; + } + else + { + name = "區間"; + } + } else if (postObject.FormType == 3) { @@ -939,11 +947,12 @@ namespace SolarPower.Controllers { AllowClose = false }; + string companyName = postObject.PowerStation[0].Name; workbook.Write(ms); ms.Flush(); ms.Seek(0, SeekOrigin.Begin); var Datename = postObject.Time.Replace("-", ""); - return File(ms, "application/vnd.ms-excel", "FIC太陽能監控平台" + "_" + name + "報表" + "_" + postObject.Userid + Datename + ".xlsx"); + return File(ms, "application/vnd.ms-excel", companyName + "_" + name + "報表" + "_" + postObject.Userid + Datename + ".xlsx"); } public string Checknull(string a) @@ -1513,7 +1522,14 @@ namespace SolarPower.Controllers } else { - name = "月"; + if(postObject.SearchType == 2) + { + name = "月"; + } + else + { + name = "區間"; + } } var Datename = postObject.Time.Replace("-", ""); @@ -1527,11 +1543,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太陽能監控平台" + "_" + name + "報表" + "_" + postObject.Userid + Datename + ".xlsx"); + string companyName = postObject.PowerStation[0].Name; + var n = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "report", Datename, companyName + "_" + name + "報表" + "_" + 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太陽能監控平台" + "_" + name + "報表" + "_" + postObject.Userid+ Datename + ".xlsx"); + return Path.Combine("\\" + "upload" ,"report", Datename, companyName + "_" + name + "報表" + "_" + postObject.Userid+ Datename + ".xlsx"); } public async Task>> GetMaxForm(Select_table2 post) @@ -1645,7 +1662,7 @@ namespace SolarPower.Controllers index++; cell = row.CreateCell(index); - cell.SetCellValue(Math.Round(form.AvgIrradiance,2)); + cell.SetCellValue(Math.Round(form.Irradiance,2)); cell.CellStyle = styleLine12; index++; @@ -1893,11 +1910,12 @@ namespace SolarPower.Controllers { AllowClose = false }; + string companyName = postObject.PowerStation[0].Name; workbook.Write(ms); 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", companyName + "_" + "綜合比較" + "_" + postObject.Userid + Datename + ".xlsx"); } public string ExportExcelmaxtableBackDownload(string post) @@ -1992,7 +2010,7 @@ namespace SolarPower.Controllers index++; cell = row.CreateCell(index); - cell.SetCellValue(Math.Round(form.AvgIrradiance, 2)); + cell.SetCellValue(Math.Round(form.Irradiance, 2)); cell.CellStyle = styleLine12; index++; @@ -2244,12 +2262,13 @@ 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"); + string companyName = postObject.PowerStation[0].Name; + var n = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "report", Datename, companyName + "_" + "綜合比較" + "_" + 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, companyName + "_" + "綜合比較" + "_" + postObject.Userid + Datename + ".xlsx"); } public async Task>> CheckExcel(Select_table2 post) diff --git a/SolarPower/Models/StationReport.cs b/SolarPower/Models/StationReport.cs index 55a57a1..77393ec 100644 --- a/SolarPower/Models/StationReport.cs +++ b/SolarPower/Models/StationReport.cs @@ -86,18 +86,24 @@ namespace SolarPower.Models public string PowerstationName { get; set; } public int PowerstationId { get; set; } public int PowerstationType { get; set; } + public int Days { get; set; } public double Kwh { get; set; } public string PowerstationDB { get; set; } public double SolarHour { get; set; } - public double AvgIrradiance { get; set; } + public double Irradiance { get; set; } public double AvgPR { get; set; } public double AvgKWHKWP { get; set; } public double TodayMoney { get; set; } + public double PowerRate { get; set; } + public double GeneratingCapacity { get; set; } + public double TotalKWH { get; set; } private string mintime; private string maxtime; + private string electricityMeterAt; public string Maxtime { get { return Convert.ToDateTime(maxtime).ToString("yyyy/MM/dd"); } set { maxtime = value; } } public string Mintime { get { return Convert.ToDateTime(mintime).ToString("yyyy/MM/dd"); } set { mintime = value; } } + public string ElectricityMeterAt { get { return Convert.ToDateTime(electricityMeterAt).ToString("yyyy/MM/dd"); } set { electricityMeterAt = value; } } } public class CityArray @@ -107,6 +113,7 @@ namespace SolarPower.Models public double SolarHour { get; set; } public int Count { get; set; } public double Kwhkwp { get; set; } + public double GeneratingCapacity { get; set; } } diff --git a/SolarPower/Repository/Implement/StationReportRepository.cs b/SolarPower/Repository/Implement/StationReportRepository.cs index e423a54..a1522e4 100644 --- a/SolarPower/Repository/Implement/StationReportRepository.cs +++ b/SolarPower/Repository/Implement/StationReportRepository.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using System.Data; using System.Linq; using System.Threading.Tasks; +using System.Reflection; namespace SolarPower.Repository.Implement { @@ -79,12 +80,23 @@ namespace SolarPower.Repository.Implement )z on a.PowerStationID = z.id where DATE_FORMAT(a.report_date,''%Y-%m-%d'') = ''{post.Time}'' and a.PowerStationID = {post.PowerStation} GROUP BY DATE_FORMAT(a.report_date,''%Y-%m-%d %H:%i'') - order by DATE_FORMAT(a.report_date,''%Y-%m-%d %H:%i'') '); - - #select @sql as 'mySelect'; #顯示動態語法 + order by DATE_FORMAT(a.report_date,''%Y-%m-%d %H:%i'') ; + -- step 2 + create TEMPORARY TABLE temp_inv2 as + select * from temp_inv; + -- step 3 + select * from temp_inv + union + SELECT ''總計'' report_date, ', @SQL, + ', round(sum(hourKWH), 2) hourKWH, round(sum(hourKWHp), 2) hourKWHp, round(sum(irradiance), 2) irradiance, + avg(temperature) temperature, round(sum(hourmoney), 2) hourmoney, avg(totKWH) totKWH, avg(totKWHKWP) totKWHKWP, avg(totmoney) totmoney, ''電站名稱'' stationName, + avg(daymoney) daymoney, avg(tothour) tothour, avg(pr) pr, avg(GeneratingCapacity) GeneratingCapacity + from temp_inv2'); + #select @sql as 'mySelect'; #顯示動態語法 PREPARE stmt FROM @sql; EXECUTE stmt; - DEALLOCATE PREPARE stmt;"; + DEALLOCATE PREPARE stmt;"; + break; case 1: if(post.SearchType == 2) @@ -131,7 +143,7 @@ namespace SolarPower.Repository.Implement # select @sql as 'mySelect'; #顯示動態語法 PREPARE stmt FROM @sql; EXECUTE stmt; - DEALLOCATE PREPARE stmt;"; + DEALLOCATE PREPARE stmt;"; } else { @@ -180,7 +192,7 @@ namespace SolarPower.Repository.Implement # select @sql as 'mySelect'; #顯示動態語法 PREPARE stmt FROM @sql; EXECUTE stmt; - DEALLOCATE PREPARE stmt;"; + DEALLOCATE PREPARE stmt;"; } break; @@ -193,7 +205,7 @@ namespace SolarPower.Repository.Implement ) INTO @sql FROM inverter_history_month where powerstationId = {post.PowerStation} and DATE_FORMAT(`TIMESTAMP`,'%Y') = '{post.Time}'; SET @sql = CONCAT('SELECT DATE_FORMAT(a.TIMESTAMP,''%Y/%m'') report_date, ', @sql, - ',b.todayKWH ''dayKWH'', round((b.todayKWH / c.monthKWH)*100,2) ''dayKWHp'', b.SOLARHOUR ''tothour'', b.KWHKWP ''KWHKWP'', b.PR, + ',b.todayKWH ''dayKWH'', round((b.todayKWH / c.monthKWH)*100,2) ''dayKWHp'', b.SOLARHOUR ''tothour'', b.KWHKWP ''KWHKWP'', b.PR,z.GeneratingCapacity, d.irradiance ''irradiance'', d.Temperature ''temperature'', b.money ''soldmoney'', c.monthKWH ''monthKWH'', c.money ''monthmoney'', stationName, powerRate ''monthmoneyone'',SolarType,SiteDB FROM inverter_history_month a left join @@ -218,7 +230,7 @@ namespace SolarPower.Repository.Implement ) d on a.powerStationid = d.powerStationid and DATE_FORMAT(a.TIMESTAMP,''%Y-%m'') = d.report_date join ( - select id, name stationName, powerRate,SolarType,SiteDB from power_station where id = {post.PowerStation} + select id, name stationName, powerRate,SolarType,SiteDB,GeneratingCapacity from power_station where id = {post.PowerStation} )z on a.powerstationid = z.id where DATE_FORMAT(a.TIMESTAMP,''%Y'') = ''{post.Time}'' GROUP BY DATE_FORMAT(a.TIMESTAMP,''%Y-%m'') @@ -227,8 +239,7 @@ namespace SolarPower.Repository.Implement # select @sql as 'mySelect'; #顯示動態語法 PREPARE stmt FROM @sql; EXECUTE stmt; - DEALLOCATE PREPARE stmt;"; - + DEALLOCATE PREPARE stmt;"; break; } @@ -322,6 +333,7 @@ namespace SolarPower.Repository.Implement /// public async Task> GetMaxtablebody(Select_table2 post) { + string day1 = $"{1} 'Days'"; List result = new List(); using (IDbConnection conn = _databaseHelper.GetConnection()) { @@ -334,11 +346,54 @@ namespace SolarPower.Repository.Implement ids.Add(Convert.ToInt32(i.Value)); } string[] times = { }; - if(post.SearchType == 1) + if (post.SearchType == 1) { times = post.Time.Replace('-', 'a').Replace('/', '-').Replace(" ", "").Split('a'); } + + + if (post.SearchType == 2) + { + DateTime today = DateTime.Now.Date; + DateTime FirstDay = DateTime.ParseExact(post.Time, "yyyy-MM", System.Globalization.CultureInfo.InvariantCulture); + DateTime LastDay = FirstDay.AddMonths(1).AddDays(-FirstDay.AddMonths(1).Day); + if((LastDay-today).Days > 0) + { + LastDay = today.AddDays(-1); + } + + day1 = $"TIMESTAMPDIFF(DAY,'{FirstDay}','{LastDay}') 'Days'"; + } + else if (post.SearchType == 3) + { + DateTime yFirstDay = DateTime.ParseExact(post.Time, "yyyy", System.Globalization.CultureInfo.InvariantCulture); + DateTime yLastDay = yFirstDay.AddMonths(12).AddDays(-yFirstDay.AddMonths(1).Day); + if ((yLastDay - DateTime.Now.Date).Days > 0) + { + yLastDay = DateTime.Now.Date.AddDays(-1); + } + day1 = $"TIMESTAMPDIFF(DAY,'{yFirstDay}','{yLastDay}') 'Days'"; + } + else + { + day1 = post.SearchType switch + { + 0 => $"{1} 'Days'", + 1 => $"TIMESTAMPDIFF(DAY,'{times[0]}','{times[1]}') 'Days'", + _ => "" + }; + } + + //var day1 = post.SearchType switch + //{ + // 0 => $"{1} 'Days'", + // 1 => $"TIMESTAMPDIFF(DAY,'{times[0]}','{times[1]}') 'Days'", + // 2 => $"TIMESTAMPDIFF(DAY,'{FirstDay}','{LastDay}') 'Days'", + // 3 => $"TIMESTAMPDIFF(DAY,'{yFirstDay}','{yLastDay}') 'Days'", + // _ => "" + //}; + var wheretime = post.SearchType switch { 0 => $"AND DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d') = '{post.Time}'", @@ -399,28 +454,28 @@ namespace SolarPower.Repository.Implement // ) n ON n.Id = ps.Id // WHERE ps.Id IN @ids ORDER BY ps.CityId"; string sql = $@"SELECT ct.`Name` AS 'CityName', ar.Name AS 'AreaName', ps.Name AS 'PowerstationName', ps.SiteDB AS 'PowerstationDB', ps.SolarType AS 'PowerstationType', - ps.Id as 'PowerStationId', - a.SolarHour ,a.Kwh ,a.PR AvgPR, a.KWHKWP AvgKWHKWP,c.Irradiance AvgIrradiance, - (a.TODAYKWH * PowerRate) 'TodayMoney', a.Id,a.time,a.maxtime,a.mintime + ps.Id as 'PowerStationId', ps.ElectricityMeterAt as 'electricityMeterAt', ps.PowerRate, ps.GeneratingCapacity, + a.SolarHour ,a.Kwh ,a.PR AvgPR, a.KWHKWP AvgKWHKWP,c.Irradiance Irradiance, a.TOTALKWH TotalKWH, + (a.TODAYKWH * PowerRate) 'TodayMoney', a.Id,a.time,a.maxtime,a.mintime, {day1} FROM power_station ps LEFT JOIN city ct ON ct.Id = ps.CityId LEFT JOIN area ar ON ar.Id = ps.AreaId left JOIN ( - SELECT powerStationid id, ps.SOLARHOUR AS 'SolarHour',ps.TODAYKWH 'Kwh' , PR, KWHKWP, TODAYKWH, - DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d') AS 'time', - MAX(DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d %H:%i')) AS 'maxtime', - MIN(DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d %H:%i')) AS 'mintime', ps.PowerStationId - FROM power_station_history_day ps - WHERE ps.PowerStationId IN @ids {wheretime} - GROUP BY DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d'),ps.PowerStationId + SELECT powerStationid id, ps.SOLARHOUR AS 'SolarHour',ps.TODAYKWH 'Kwh' , PR, KWHKWP, TODAYKWH, TOTALKWH, + DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d') AS 'time', + MAX(DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d %H:%i')) AS 'maxtime', + MIN(DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d %H:%i')) AS 'mintime', ps.PowerStationId + FROM power_station_history_day ps + WHERE ps.PowerStationId IN @ids {wheretime} + GROUP BY ps.PowerStationId ) a ON ps.Id = a.Id - LEFT JOIN + LEFT JOIN ( SELECT SUM(ps.Irradiance) AS Irradiance , DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d') AS TIME ,ps.PowerStationId - from sensor_history_hour ps - WHERE ps.PowerStationId IN @ids {wheretime} - GROUP BY DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d'),ps.PowerStationId + from sensor_history_day ps + WHERE ps.PowerStationId IN @ids {wheretime} + GROUP BY ps.PowerStationId ) c ON a.Id = c.PowerStationId and a.time = c.time WHERE ps.Id IN @ids ORDER BY ps.CityId"; result = (await conn.QueryAsync(sql,new { ids = ids}, commandTimeout: 300)).ToList(); diff --git a/SolarPower/Views/StationReport/Index.cshtml b/SolarPower/Views/StationReport/Index.cshtml index 5d3c0ab..24fdc76 100644 --- a/SolarPower/Views/StationReport/Index.cshtml +++ b/SolarPower/Views/StationReport/Index.cshtml @@ -271,7 +271,8 @@ 縣市 - 平均發電量(kWp) + 裝置容量 + 總發電量(kWh) 日均發電度數 @@ -826,7 +827,7 @@ }) str += "小時
發電量
(kWh)"; str += "小時
發電量
百分比
(%)"; - str += "小時
平均
日照度
(W/㎡)"; + str += "小時
累積
日照度
(W/㎡)"; str += "小時
平均
模組
溫度
(°C)"; if (rel.data.showMoney == 1) { str += "小時
售電
金額
(NTD)"; @@ -844,7 +845,7 @@ str += "日照小時(hr)"; str += "日均發電度數"; str += "PR%"; - str += "累積日照量(W/㎡)"; + str += "日
累積
日照度
(W/㎡)"; str += "日
平均
模組溫度
(°C)"; if (rel.data.showMoney == 1) { str += "日
售電金額
(NTD)"; @@ -862,7 +863,7 @@ str += "日照小時(hr)"; str += "日均發電度數"; str += "PR%"; - str += "累積日照量(W/㎡)"; + str += "日
累積
日照度
(W/㎡)"; str += "日
平均
模組溫度
(°C)"; if (rel.data.showMoney == 1) { str += "日
售電金額
(NTD)"; @@ -872,9 +873,14 @@ case 2: //綜合比較 str += "區域"; str += "電站名稱"; - str += "發電量"; + str += "電站類型"; + str += "掛錶日期"; + str += "裝置容量"; + str += "躉售費率"; + str += "每kw日均獲利"; str += "日均發電度數"; - str += "平均日照"; + str += "發電量"; + str += "累積日照量"; str += "PR"; if (rel.data.showMoney == 1) { str += "發電金額"; @@ -893,7 +899,7 @@ str += "日照小時(hr)"; str += "日均發電度數"; str += "PR%"; - str += "月
平均
日照度
(W/㎡)"; + str += "月
累積
日照度
(W/㎡)"; str += "月
平均
模組溫度
(°C)"; if (rel.data.showMoney == 1) { str += "月
售電金額
(NTD)"; @@ -1012,6 +1018,7 @@ var kWhkwp = 0; var ntd = 0; var ntdone = 0; + var averageDailyProfit = 0; var sta = ""; var GeneratingCapacity = 0; $.each(rel.data, function (index, inverter) { @@ -1039,6 +1046,7 @@ ntd = inverter.totmoney ? Math.round(inverter.totmoney) : 0; ntdone = inverter.totmoney / inverter.totKWH ? Math.round(inverter.totmoney / inverter.totKWH * 10000) / 10000 : 0; GeneratingCapacity = inverter.GeneratingCapacity; + averageDailyProfit = ntd / GeneratingCapacity ? Math.round(ntd / GeneratingCapacity * 10000) / 10000 : 0; }) var stc = ""; /* stc += "" + '日照小時' + "";*/ @@ -1049,6 +1057,7 @@ if (showmoney == 1) { stc += "" + '日售電金額(NTD)' + ""; stc += "" + '日售電單價(NTD)' + ""; + stc += "" + '日均獲利(NTD)' + ""; } stc += ""; @@ -1062,6 +1071,7 @@ if (showmoney == 1) { stb += "" + toThousands(Math.round(ntd)) + ""; stb += "" + Math.round(ntdone * 10000) / 10000 + ""; + stb += "" + toThousands(Math.round(averageDailyProfit)) + ""; } stb += ""; @@ -1080,6 +1090,7 @@ var monthmoney = 0; var monthmoneyone = 0; var monthday = 0; + var averageDailyProfit = 0; var sta = ""; var check_hire = false; var sitedb = ""; @@ -1117,6 +1128,7 @@ sitedb = inverter.SiteDB } GeneratingCapacity = inverter.GeneratingCapacity; + averageDailyProfit = monthmoney / GeneratingCapacity ? Math.round(monthmoney / GeneratingCapacity * 10000) / 10000 : 0; }) monthday = rel.data.length; @@ -1132,6 +1144,7 @@ stc += "" + '每度獲利' + ""; stc += "" + '售電金額(NTD)(月)' + ""; stc += "" + '售電單價(NTD)(月)' + ""; + stc += "" + '日均獲利(NTD)' + ""; } stc += "" + '售電天數(月)' + ""; stc += ""; @@ -1147,6 +1160,8 @@ stb += "" + 0 + ""; stb += "" + 0 + ""; stb += "" + 0 + ""; + stb += "" + 0 + ""; + stb += "" + 0 + ""; stb += ""; } else { @@ -1159,7 +1174,8 @@ if (showmoney == 1) { stb += "" + toThousands((monthmoney / GeneratingCapacity).toFixed(3)) + ""; stb += "" + toThousands(Math.round(monthmoney)) + ""; - stb += "" + Math.round(monthmoneyone / monthday*10000)/10000 + ""; + stb += "" + Math.round(monthmoneyone / monthday * 10000) / 10000 + ""; + stb += "" + toThousands(Math.round(averageDailyProfit / monthday)) + ""; } stb += "" + monthday + ""; stb += ""; @@ -1209,6 +1225,7 @@ var monthmoney = 0; var monthmoneyone = 0; var monthday = 0; + var averageDailyProfit = 0; var sta = ""; var check_hire = false; var sitedb = ""; @@ -1239,6 +1256,7 @@ monthKWH = inverter.monthKWH ? toThousands(inverter.monthKWH) : 0; monthmoney = inverter.monthmoney ? inverter.monthmoney : 0; monthmoneyone += inverter.monthmoneyone ? inverter.monthmoneyone : 0; + averageDailyProfit = monthmoney / inverter.GeneratingCapacity ? Math.round(monthmoney / inverter.GeneratingCapacity * 10000) / 10000 : 0; if (inverter.SolarType == 1) { check_hire = true; @@ -1257,6 +1275,7 @@ if (showmoney == 1) { stc += "" + '售電金額(NTD)(年)' + ""; stc += "" + '售電單價(NTD)(年)' + ""; + stc += "" + '日均獲利(NTD)' + ""; } stc += "" + '售電月數(年)' + ""; stc += ""; @@ -1272,6 +1291,7 @@ stb += "" + 0 + ""; stb += "" + 0 + ""; stb += "" + 0 + ""; + stb += "" + 0 + ""; stb += ""; } else { @@ -1281,7 +1301,8 @@ stb += "" + monthKWH + ""; if (showmoney == 1) { stb += "" + toThousands(Math.round(monthmoney)) + ""; - stb += "" + Math.round(monthmoneyone / monthday*10000)/10000 + ""; + stb += "" + Math.round(monthmoneyone / monthday * 10000) / 10000 + ""; + stb += "" + toThousands(Math.round((averageDailyProfit / monthday / 30 * 10000) / 10000)) + ""; } stb += "" + monthday + ""; stb += ""; @@ -1332,6 +1353,7 @@ var monthmoney = 0; var monthmoneyone = 0; var monthday = 0; + var averageDailyProfit = 0; var sta = ""; var check_hire = false; var sitedb = ""; @@ -1369,6 +1391,7 @@ sitedb = inverter.SiteDB } GeneratingCapacity = inverter.GeneratingCapacity; + averageDailyProfit = monthmoney / GeneratingCapacity ? Math.round(monthmoney / GeneratingCapacity * 10000) / 10000 : 0; }) monthday = rel.data.length; @@ -1384,6 +1407,7 @@ stc += "" + '每度獲利' + ""; stc += "" + '售電金額(NTD)(月)' + ""; stc += "" + '售電單價(NTD)(月)' + ""; + stc += "" + '日均獲利(NTD)' + ""; } stc += "" + '售電天數(月)' + ""; stc += ""; @@ -1399,6 +1423,8 @@ stb += "" + 0 + ""; stb += "" + 0 + ""; stb += "" + 0 + ""; + stb += "" + 0 + ""; + stb += "" + 0 + ""; stb += ""; } else { @@ -1412,6 +1438,7 @@ stb += "" + toThousands((monthmoney / GeneratingCapacity).toFixed(3)) + ""; stb += "" + toThousands(Math.round(monthmoney)) + ""; stb += "" + Math.round(monthmoneyone / monthday * 10000) / 10000 + ""; + stb += "" + toThousands(Math.round(averageDailyProfit / monthday)) + ""; } stb += "" + monthday + ""; stb += ""; @@ -1567,6 +1594,8 @@ kwp: data.kwh, hour: data.solarHour, kwhkwp: data.avgKWHKWP, + generatingCapacity: data.generatingCapacity, + totalKWH: data.totalKWH, count : 1 } if (CityArray.length == 0) { @@ -1580,7 +1609,9 @@ n.kwp += cityinfo.kwp; n.hour += cityinfo.hour; n.count += cityinfo.count; - n.kwhkwp += cityinfo.kwhkwp + n.kwhkwp += cityinfo.kwhkwp; + n.generatingCapacity += cityinfo.generatingCapacity; + n.totalKWH += cityinfo.totalKWH; npush = false; } }); @@ -1589,13 +1620,17 @@ } } - StrInfoBody += ""; StrInfoBody += "" + data.cityName + data.areaName + ""; StrInfoBody += "" + data.powerstationName + ""; + StrInfoBody += "" + data.powerstationType + ""; + StrInfoBody += "" + data.electricityMeterAt + ""; + StrInfoBody += "" + data.generatingCapacity.toFixed(2) + ""; + StrInfoBody += "" + data.powerRate.toFixed(2) + ""; + StrInfoBody += "" + toThousands((data.todayMoney / data.generatingCapacity / data.days).toFixed(2)) + "";//每kw日均獲利 + StrInfoBody += "" + toThousands(data.avgKWHKWP.toFixed(2)) + ""; // 日均發電度數 StrInfoBody += "" + toThousands(data.kwh.toFixed(2)) + ""; // 發電量 - StrInfoBody += "" + toThousands(data.avgKWHKWP.toFixed(2)) + ""; // 有效發電小時 - StrInfoBody += "" + toThousands(data.avgIrradiance.toFixed(2)) + ""; // 平均日照 + StrInfoBody += "" + toThousands(data.irradiance.toFixed(2)) + ""; // 累積日照 StrInfoBody += "" + toThousands(data.avgPR.toFixed(2)) + ""; if (showmoney == 1) { @@ -1617,8 +1652,9 @@ $.each(CityArray, function (index, data) { CityInfoBody += ""; CityInfoBody += "" + data.city + ""; - CityInfoBody += "" + toThousands((data.kwp / data.count).toFixed(2)) + ""; - CityInfoBody += "" + toThousands((data.kwhkwp / data.count).toFixed(2)) + ""; + CityInfoBody += "" + data.generatingCapacity + ""; + CityInfoBody += "" + toThousands(data.totalKWH) + ""; + CityInfoBody += "" + toThousands((data.totalKWH / data.generatingCapacity).toFixed(2)) + ""; CityInfoBody += ""; }) //上面