From 0c42f22241bfb40970fd61c1fb02f18c4edf8a9f Mon Sep 17 00:00:00 2001 From: "wanling040@gmail.com" Date: Wed, 10 Aug 2022 17:52:52 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9B=BB=E7=AB=99=E5=A0=B1=E8=A1=A8:=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A5=E6=9C=88=E5=B9=B4=E5=8D=80=E9=96=93?= =?UTF-8?q?=E5=A0=B1=E8=A1=A8=E5=8C=AF=E5=87=BA=E5=92=8C=E7=B6=9C=E5=90=88?= =?UTF-8?q?=E6=AF=94=E8=BC=83=E5=8C=AF=E5=87=BA=E7=9A=84=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=92=8C=E5=8F=96=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/StationReportController.cs | 171 +++++++++++------- SolarPower/Views/StationReport/Index.cshtml | 44 +++-- 2 files changed, 137 insertions(+), 78 deletions(-) diff --git a/SolarPower/Controllers/StationReportController.cs b/SolarPower/Controllers/StationReportController.cs index ed5a06c..7a59d73 100644 --- a/SolarPower/Controllers/StationReportController.cs +++ b/SolarPower/Controllers/StationReportController.cs @@ -267,24 +267,32 @@ namespace SolarPower.Controllers #region 顯示body //RowPosition = 1 RowPosition++; var thour = ""; var tpr = ""; var tkwh = ""; var kWhkwp = ""; var ntd = ""; var ntdone = "";var GeneratingCapacity = "";var AverageDailyProfit = ""; + int vForDataCount = 0; foreach (dynamic body in Formbody.Result.Data) { index = 0; var dbody = body as IDictionary; - thour = Checknull(Math.Round(Convert.ToDouble(dbody["tothour"]), 2).ToString()); - tpr = Checknull(Math.Round(Convert.ToDouble(dbody["pr"]), 2).ToString()); - tkwh = Checknull(Math.Round(Convert.ToDouble(dbody["totKWH"]), 2).ToString()); - kWhkwp = Checknull(Math.Round(Convert.ToDouble(dbody["totKWHKWP"]), 2).ToString()); - ntd = Checknull(Math.Round(Convert.ToDouble(dbody["totmoney"]), 2).ToString()); - GeneratingCapacity = Checknull(Math.Round(Convert.ToDouble(dbody["GeneratingCapacity"]), 2).ToString()); - - double onemoney = Convert.ToDouble(ntd) / Convert.ToDouble(tkwh); - if (double.IsNaN(onemoney)) + if (vForDataCount < (Formbody.Result.Data.Count - 1))//最後一筆(總計),不須取值 { - onemoney = 0; + vForDataCount++; + thour = Checknull(Math.Round(Convert.ToDouble(dbody["tothour"]), 2).ToString()); + tpr = Checknull(Math.Round(Convert.ToDouble(dbody["pr"]), 2).ToString()); + tkwh = Checknull(Math.Round(Convert.ToDouble(dbody["totKWH"]), 2).ToString()); + kWhkwp = Checknull(Math.Round(Convert.ToDouble(dbody["totKWHKWP"]), 2).ToString()); + ntd = Checknull(Math.Round(Convert.ToDouble(dbody["totmoney"]), 2).ToString()); + GeneratingCapacity = Checknull(Math.Round(Convert.ToDouble(dbody["GeneratingCapacity"]), 2).ToString()); + + double kwp = Convert.ToDouble(tkwh) / Convert.ToDouble(GeneratingCapacity); + kWhkwp = Checknull(Math.Round(kwp, 2).ToString()); + + double onemoney = Convert.ToDouble(ntd) / Convert.ToDouble(tkwh); + if (double.IsNaN(onemoney)) + { + onemoney = 0; + } + ntdone = Checknull(Math.Round(onemoney, 2).ToString()); + AverageDailyProfit = Checknull(Math.Round((Convert.ToDouble(ntd) / Convert.ToDouble(GeneratingCapacity)), 2).ToString()); } - ntdone = Checknull(Math.Round(onemoney, 4).ToString()); - AverageDailyProfit = Checknull(Math.Round((Convert.ToDouble(ntd) / Convert.ToDouble(GeneratingCapacity)), 2).ToString()); row = sheet.CreateRow(RowPosition); cell = row.CreateCell(index); @@ -302,7 +310,7 @@ namespace SolarPower.Controllers List bodynames = new List(){ "hourKWH", "hourKWHp", - "irradiance", + "irrDayHour", "temperature" }; if (Formhead.Result.Data.ShowMoney == 1) @@ -467,18 +475,26 @@ namespace SolarPower.Controllers var monthGeneratingCapacity = ""; var check_hire = false; var sitedb = ""; + vForDataCount = 0; foreach (dynamic body in Formbody.Result.Data) { index2 = 0; var dbody = body as IDictionary; + if (vForDataCount < (Formbody.Result.Data.Count - 1))//最後一筆(總計),不須取值 + { + vForDataCount++; + avghour = (Convert.ToDouble(dbody["tothour"].ToString()) + Convert.ToDouble(avghour)).ToString(); + avgKWHKWP = (Convert.ToDouble(dbody["KWHKWP"].ToString()) + Convert.ToDouble(avgKWHKWP)).ToString(); + avgdayKWH = (Convert.ToDouble(dbody["dayKWH"].ToString()) + Convert.ToDouble(avgdayKWH)).ToString(); + monthKWH = dbody["monthKWH"] == null ? "0" : dbody["monthKWH"].ToString(); + monthmoney = dbody["monthmoney"] == null ? "0" : dbody["monthmoney"].ToString(); + monthmoneyone = (Convert.ToDouble(dbody["monthmoneyone"].ToString()) + Convert.ToDouble(monthmoneyone)).ToString(); + monthGeneratingCapacity = Checknull(Math.Round(Convert.ToDouble(dbody["GeneratingCapacity"]), 2).ToString()); + } + + double kwp = Convert.ToDouble(monthKWH) / Convert.ToDouble(monthGeneratingCapacity); + avgKWHKWP = Checknull(Math.Round(kwp, 2).ToString()); - avghour = (Convert.ToDouble(dbody["tothour"].ToString()) + Convert.ToDouble(avghour)).ToString(); - avgKWHKWP = (Convert.ToDouble(dbody["KWHKWP"].ToString()) + Convert.ToDouble(avgKWHKWP)).ToString(); - avgdayKWH = (Convert.ToDouble(dbody["dayKWH"].ToString()) + Convert.ToDouble(avgdayKWH)).ToString(); - monthKWH = dbody["monthKWH"] == null ? "0": dbody["monthKWH"].ToString(); - monthmoney = dbody["monthmoney"] == null ? "0" : dbody["monthmoney"].ToString(); - monthmoneyone = (Convert.ToDouble(dbody["monthmoneyone"].ToString()) + Convert.ToDouble(monthmoneyone)).ToString(); - monthGeneratingCapacity = Checknull(Math.Round(Convert.ToDouble(dbody["GeneratingCapacity"]), 2).ToString()); if (dbody["SolarType"].ToString() == "1" && Formhead.Result.Data.ShowMoney == 1)//檢驗是否為租用 { check_hire = true; @@ -533,7 +549,7 @@ namespace SolarPower.Controllers #region 顯示總量//RowPosition = body + 2 RowPosition += 2;//空兩行 index = 0; - var Useday = Formbody.Result.Data.Count; + var Useday = (Formbody.Result.Data.Count - 1);//最後一筆為總計,故減1 row = sheet.CreateRow(RowPosition); //cell = row.CreateCell(index); @@ -610,7 +626,7 @@ namespace SolarPower.Controllers if (Formhead.Result.Data.ShowMoney == 1) { cell = row.CreateCell(index); - cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoney) / Convert.ToDouble(monthGeneratingCapacity), 3)); + cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoney) / Convert.ToDouble(monthGeneratingCapacity), 2)); cell.CellStyle = styleLine12; index++; cell = row.CreateCell(index); @@ -618,7 +634,7 @@ namespace SolarPower.Controllers cell.CellStyle = styleLine12; index++; cell = row.CreateCell(index); - cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoneyone) / Useday, 4)); + cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoneyone) / Useday, 2)); cell.CellStyle = styleLine12; index++; cell = row.CreateCell(index); @@ -741,18 +757,24 @@ namespace SolarPower.Controllers check_hire = false; sitedb = ""; monthGeneratingCapacity = ""; + string days = "0"; + vForDataCount = 0; foreach (dynamic body in Formbody.Result.Data) { index3 = 0; var dbody = body as IDictionary; - - avghour = (Convert.ToDouble(dbody["tothour"].ToString()) + Convert.ToDouble(avghour)).ToString(); - avgKWHKWP = (Convert.ToDouble(dbody["KWHKWP"].ToString()) + Convert.ToDouble(avgKWHKWP)).ToString(); - avgdayKWH = (Convert.ToDouble(dbody["dayKWH"].ToString()) + Convert.ToDouble(avgdayKWH)).ToString(); - monthKWH = dbody["monthKWH"] == null ? "0" : dbody["monthKWH"].ToString(); - monthmoney = dbody["monthmoney"] == null ? "0" : dbody["monthmoney"].ToString(); - monthmoneyone = (Convert.ToDouble(dbody["monthmoneyone"].ToString()) + Convert.ToDouble(monthmoneyone)).ToString(); - monthGeneratingCapacity = Checknull(Math.Round(Convert.ToDouble(dbody["GeneratingCapacity"]), 2).ToString()); + if (vForDataCount < (Formbody.Result.Data.Count - 1))//最後一筆(總計),不須取值 + { + vForDataCount++; + avghour = (Convert.ToDouble(dbody["tothour"].ToString()) + Convert.ToDouble(avghour)).ToString(); + avgKWHKWP = (Convert.ToDouble(dbody["KWHKWP"].ToString()) + Convert.ToDouble(avgKWHKWP)).ToString(); + avgdayKWH = (Convert.ToDouble(dbody["dayKWH"].ToString()) + Convert.ToDouble(avgdayKWH)).ToString(); + monthKWH = dbody["monthKWH"] == null ? "0" : dbody["monthKWH"].ToString(); + monthmoney = dbody["monthmoney"] == null ? "0" : dbody["monthmoney"].ToString(); + monthmoneyone = (Convert.ToDouble(dbody["monthmoneyone"].ToString()) + Convert.ToDouble(monthmoneyone)).ToString(); + monthGeneratingCapacity = Checknull(Math.Round(Convert.ToDouble(dbody["GeneratingCapacity"]), 2).ToString()); + days = Checknull(Math.Round(Convert.ToDouble(dbody["Days"])).ToString()); + } if (dbody["SolarType"].ToString() == "1" && Formhead.Result.Data.ShowMoney == 1)//檢驗是否為租用 { check_hire = true; @@ -807,7 +829,7 @@ namespace SolarPower.Controllers #region 顯示總量//RowPosition = body + 2 RowPosition += 2;//空兩行 index = 0; - Useday = Formbody.Result.Data.Count; + Useday = (Formbody.Result.Data.Count - 1);//最後一筆為總計,故減1 row = sheet.CreateRow(RowPosition); cell = row.CreateCell(index); @@ -819,6 +841,10 @@ namespace SolarPower.Controllers cell.CellStyle = styleLine12; index++; cell = row.CreateCell(index); + cell.SetCellValue("裝置容量"); + cell.CellStyle = styleLine12; + index++; + cell = row.CreateCell(index); cell.SetCellValue("發電量平均(kWh)(月)"); cell.CellStyle = styleLine12; index++; @@ -856,7 +882,11 @@ namespace SolarPower.Controllers cell.CellStyle = styleLine12; index++; cell = row.CreateCell(index); - cell.SetCellValue(Math.Round(Convert.ToDouble(avgKWHKWP) / Useday, 2)); + cell.SetCellValue(Math.Round(Convert.ToDouble(monthKWH) / Convert.ToDouble(monthGeneratingCapacity), 2)); + cell.CellStyle = styleLine12; + index++; + cell = row.CreateCell(index); + cell.SetCellValue(Math.Round(Convert.ToDouble(monthGeneratingCapacity), 2));/// cell.CellStyle = styleLine12; index++; cell = row.CreateCell(index); @@ -878,7 +908,7 @@ namespace SolarPower.Controllers cell.CellStyle = styleLine12; index++; cell = row.CreateCell(index); - cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoney) / Convert.ToDouble(monthGeneratingCapacity) / Useday / 30, 2));//一個月為30天 + cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoney) / Convert.ToDouble(monthGeneratingCapacity) / Convert.ToDouble(days), 2));//一個月為30天 Useday / 30 cell.CellStyle = styleLine12; index++; } @@ -1142,25 +1172,32 @@ namespace SolarPower.Controllers #region 顯示body //RowPosition = 1 RowPosition++; var thour = ""; var tpr = ""; var tkwh = ""; var kWhkwp = ""; var ntd = ""; var ntdone = ""; var GeneratingCapacity = ""; var AverageDailyProfit = ""; + int vForDataCount = 0; foreach (dynamic body in Formbody.Result.Data) { - index = 0; var dbody = body as IDictionary; - thour = Checknull(Math.Round(Convert.ToDouble(dbody["tothour"]), 2).ToString()); - tpr = Checknull(Math.Round(Convert.ToDouble(dbody["pr"]), 2).ToString()); - tkwh = Checknull(Math.Round(Convert.ToDouble(dbody["totKWH"]), 2).ToString()); - kWhkwp = Checknull(Math.Round(Convert.ToDouble(dbody["totKWHKWP"]), 2).ToString()); - ntd = Checknull(Math.Round(Convert.ToDouble(dbody["totmoney"]), 2).ToString()); - GeneratingCapacity = Checknull(Math.Round(Convert.ToDouble(dbody["GeneratingCapacity"]), 2).ToString()); - - double onemoney = Convert.ToDouble(ntd) / Convert.ToDouble(tkwh); - if (double.IsNaN(onemoney)) + if (vForDataCount < (Formbody.Result.Data.Count - 1))//最後一筆為總計,不須取值 { - onemoney = 0; + vForDataCount++; + thour = Checknull(Math.Round(Convert.ToDouble(dbody["tothour"]), 2).ToString()); + tpr = Checknull(Math.Round(Convert.ToDouble(dbody["pr"]), 2).ToString()); + tkwh = Checknull(Math.Round(Convert.ToDouble(dbody["totKWH"]), 2).ToString()); + kWhkwp = Checknull(Math.Round(Convert.ToDouble(dbody["totKWHKWP"]), 2).ToString()); + ntd = Checknull(Math.Round(Convert.ToDouble(dbody["totmoney"]), 2).ToString()); + GeneratingCapacity = Checknull(Math.Round(Convert.ToDouble(dbody["GeneratingCapacity"]), 2).ToString()); + + double kwp = Convert.ToDouble(tkwh) / Convert.ToDouble(GeneratingCapacity); + kWhkwp = Checknull(Math.Round(kwp, 2).ToString()); + + double onemoney = Convert.ToDouble(ntd) / Convert.ToDouble(tkwh); + if (double.IsNaN(onemoney)) + { + onemoney = 0; + } + ntdone = Checknull(Math.Round(onemoney, 2).ToString()); + AverageDailyProfit = Checknull(Math.Round((Convert.ToDouble(ntd) / Convert.ToDouble(GeneratingCapacity)), 2).ToString()); } - ntdone = Checknull(Math.Round(onemoney, 4).ToString()); - AverageDailyProfit = Checknull(Math.Round((Convert.ToDouble(ntd) / Convert.ToDouble(GeneratingCapacity)), 2).ToString()); row = sheet.CreateRow(RowPosition); cell = row.CreateCell(index); @@ -1178,7 +1215,7 @@ namespace SolarPower.Controllers List bodynames = new List(){ "hourKWH", "hourKWHp", - "irradiance", + "irrDayHour", "temperature" }; if (Formhead.Result.Data.ShowMoney == 1) @@ -1344,18 +1381,26 @@ namespace SolarPower.Controllers var monthGeneratingCapacity = ""; var check_hire = false; var sitedb = ""; + vForDataCount = 0; foreach (dynamic body in Formbody.Result.Data) { index2 = 0; var dbody = body as IDictionary; + if (vForDataCount < (Formbody.Result.Data.Count - 1))//最後一筆為總計,不須取值 + { + vForDataCount++; + avghour = (Convert.ToDouble(dbody["tothour"].ToString()) + Convert.ToDouble(avghour)).ToString(); + avgKWHKWP = (Convert.ToDouble(dbody["KWHKWP"].ToString()) + Convert.ToDouble(avgKWHKWP)).ToString(); + avgdayKWH = (Convert.ToDouble(dbody["dayKWH"].ToString()) + Convert.ToDouble(avgdayKWH)).ToString(); + monthKWH = dbody["monthKWH"] == null ? "0" : dbody["monthKWH"].ToString(); + monthmoney = dbody["monthmoney"] == null ? "0" : dbody["monthmoney"].ToString(); + monthmoneyone = (Convert.ToDouble(dbody["monthmoneyone"].ToString()) + Convert.ToDouble(monthmoneyone)).ToString(); + monthGeneratingCapacity = Checknull(Math.Round(Convert.ToDouble(dbody["GeneratingCapacity"]), 2).ToString()); + + double kwp = Convert.ToDouble(monthKWH) / Convert.ToDouble(monthGeneratingCapacity); + avgKWHKWP = Checknull(Math.Round(kwp, 2).ToString()); + } - avghour = (Convert.ToDouble(dbody["tothour"].ToString()) + Convert.ToDouble(avghour)).ToString(); - avgKWHKWP = (Convert.ToDouble(dbody["KWHKWP"].ToString()) + Convert.ToDouble(avgKWHKWP)).ToString(); - avgdayKWH = (Convert.ToDouble(dbody["dayKWH"].ToString()) + Convert.ToDouble(avgdayKWH)).ToString(); - monthKWH = dbody["monthKWH"] == null ? "0" : dbody["monthKWH"].ToString(); - monthmoney = dbody["monthmoney"] == null ? "0" : dbody["monthmoney"].ToString(); - monthmoneyone = (Convert.ToDouble(dbody["monthmoneyone"].ToString()) + Convert.ToDouble(monthmoneyone)).ToString(); - monthGeneratingCapacity = Checknull(Math.Round(Convert.ToDouble(dbody["GeneratingCapacity"]), 2).ToString()); if (dbody["SolarType"].ToString() == "1" && Formhead.Result.Data.ShowMoney == 1)//檢驗是否為租用 { check_hire = true; @@ -1410,7 +1455,7 @@ namespace SolarPower.Controllers #region 顯示總量//RowPosition = body + 2 RowPosition += 2;//空兩行 index = 0; - var Useday = Formbody.Result.Data.Count; + var Useday = (Formbody.Result.Data.Count - 1);//最後一筆為總計,故減1 row = sheet.CreateRow(RowPosition); //cell = row.CreateCell(index); @@ -1487,7 +1532,7 @@ namespace SolarPower.Controllers if (Formhead.Result.Data.ShowMoney == 1) { cell = row.CreateCell(index); - cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoney) / Convert.ToDouble(monthGeneratingCapacity), 3)); + cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoney) / Convert.ToDouble(monthGeneratingCapacity), 2)); cell.CellStyle = styleLine12; index++; cell = row.CreateCell(index); @@ -1495,7 +1540,7 @@ namespace SolarPower.Controllers cell.CellStyle = styleLine12; index++; cell = row.CreateCell(index); - cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoneyone) / Useday, 4)); + cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoneyone) / Useday, 2)); cell.CellStyle = styleLine12; index++; cell = row.CreateCell(index); @@ -1737,7 +1782,7 @@ namespace SolarPower.Controllers index++; cell = row.CreateCell(index); - cell.SetCellValue(Math.Round(form.AvgKWHKWP, 2));//日均發電度數 + cell.SetCellValue(Math.Round((form.Kwh/form.GeneratingCapacity), 2));//日均發電度數 cell.CellStyle = styleLine12; index++; @@ -1802,7 +1847,7 @@ namespace SolarPower.Controllers { City = form.CityName, Count = 1, - Kwh = form.TotalKWH, + Kwh = form.Kwh, SolarHour = form.SolarHour, Kwhkwp = form.AvgKWHKWP, GeneratingCapacity = form.GeneratingCapacity @@ -1834,7 +1879,7 @@ namespace SolarPower.Controllers "電站類型", "掛錶日期", "躉售費率", - "每kw日均獲利", + "日均獲利", "日均發電度數", "發電量", //"平均日照", @@ -1884,7 +1929,7 @@ namespace SolarPower.Controllers index++; cell = row.CreateCell(index); - cell.SetCellValue(Math.Round(cityArray.Kwh, 3)); + cell.SetCellValue(Math.Round(cityArray.Kwh, 2)); cell.CellStyle = styleLine12; region = new CellRangeAddress(cityRowPosition, cityRowPosition, index, index + 1); sheet.AddMergedRegion(region); @@ -2243,7 +2288,7 @@ namespace SolarPower.Controllers "電站類型", "掛錶日期", "躉售費率", - "每kw日均獲利", + "日均獲利", "日均發電度數", "發電量", //"平均日照", diff --git a/SolarPower/Views/StationReport/Index.cshtml b/SolarPower/Views/StationReport/Index.cshtml index 587a0e3..9ea1e96 100644 --- a/SolarPower/Views/StationReport/Index.cshtml +++ b/SolarPower/Views/StationReport/Index.cshtml @@ -219,7 +219,7 @@
- +
@@ -874,7 +874,7 @@ str += "掛錶日期"; /*str += "裝置容量";*/ str += "躉售費率"; - str += "每kw日均獲利"; + str += "日均獲利"; str += "日均發電度數"; str += "發電量"; str += "PR"; @@ -1111,11 +1111,13 @@ sta += "" + toThousands(inverter.soldmoney.toFixed(2)) + ""; } 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; + if (index < rel.data.length - 1) { + 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; + } if (inverter.SolarType == 1) { check_hire = true; @@ -1161,8 +1163,8 @@ } else { /*stb += "" + (avghour / monthday).toFixed(2) + "";*/ - stb += "" + toThousands((avgKWHKWP / monthday).toFixed(2)) + ""; - stb += "" + toThousands((avgdayKWH / monthday).toFixed(2)) + ""; + stb += "" + toThousands((monthKWH / GeneratingCapacity).toFixed(2)) + ""; + stb += "" + toThousands((monthKWH / monthday).toFixed(2)) + ""; stb += "" + toThousands(monthKWH.toFixed(2)) + ""; stb += "" + toThousands(GeneratingCapacity.toFixed(2)) + ""; @@ -1172,7 +1174,7 @@ stb += "" + toThousands(monthmoneyone.toFixed(2)) + ""; stb += "" + toThousands((averageDailyProfit / monthday).toFixed(2)) + ""; } - stb += "" + monthday.toFixed(2) + ""; + stb += "" + monthday + ""; stb += ""; } var std = ""; @@ -1219,6 +1221,7 @@ var monthmoneyone = 0; var monthday = 0; var averageDailyProfit = 0; + var generatingCapacity = 0; var days = 0; var sta = ""; var check_hire = false; @@ -1249,6 +1252,7 @@ avgdayKWH += inverter.dayKWH ? inverter.dayKWH : 0; monthKWH = inverter.monthKWH ? inverter.monthKWH : 0; monthmoney = inverter.monthmoney ? inverter.monthmoney : 0; + generatingCapacity = inverter.GeneratingCapacity ? inverter.GeneratingCapacity : 0; averageDailyProfit = monthmoney / inverter.GeneratingCapacity ? (monthmoney / inverter.GeneratingCapacity) : 0; @@ -1260,12 +1264,14 @@ }) monthday = (rel.data.length - 1); monthmoneyone = rel.data[0].monthmoneyone ? rel.data[0].monthmoneyone : 0; + //ntdone = inverter.totmoney / inverter.totKWH ? (inverter.totmoney / inverter.totKWH).toFixed(2) : 0; days = rel.data[0].Days; var stc = ""; stc += "" + '日照平均(月)' + ""; stc += "" + '日均發電度數(月)' + ""; + stc += "" + '裝置容量' + ""; stc += "" + '發電量平均(kWh)(月)' + ""; stc += "" + '發電量(kWh)(年)' + ""; if (showmoney == 1) { @@ -1292,15 +1298,17 @@ } else { stb += "" + toThousands((avghour / monthday).toFixed(2)) + ""; - stb += "" + toThousands((avgKWHKWP / monthday).toFixed(2)) + ""; - stb += "" + toThousands((avgdayKWH / monthday).toFixed(2)) + ""; + stb += "" + toThousands((monthKWH / generatingCapacity).toFixed(2)) + ""; + stb += "" + toThousands(generatingCapacity.toFixed(2)) + ""; + stb += "" + toThousands((monthKWH / monthday).toFixed(2)) + ""; stb += "" + toThousands(monthKWH.toFixed(2)) + ""; + if (showmoney == 1) { stb += "" + toThousands(monthmoney.toFixed(2)) + ""; stb += "" + toThousands(monthmoneyone.toFixed(2)) + ""; stb += "" + toThousands((averageDailyProfit / days).toFixed(2)) + ""; } - stb += "" + toThousands(monthday.toFixed(2)) + ""; + stb += "" + toThousands(monthday) + ""; stb += ""; } var std = ""; @@ -1423,7 +1431,8 @@ } else { /*stb += "" + (avghour / monthday).toFixed(2) + "";*/ - stb += "" + toThousands((avgKWHKWP / monthday).toFixed(2)) + ""; + //stb += "" + toThousands((avgKWHKWP / monthday).toFixed(2)) + ""; + stb += "" + toThousands((monthKWH / GeneratingCapacity).toFixed(2)) + ""; stb += "" + toThousands((avgdayKWH / monthday).toFixed(2)) + ""; stb += "" + toThousands(monthKWH.toFixed(2)) + ""; stb += "" + toThousands(GeneratingCapacity.toFixed(2)) + ""; @@ -1434,7 +1443,7 @@ stb += "" + toThousands(monthmoneyone / monthday.toFixed(2)) + ""; stb += "" + toThousands((averageDailyProfit / monthday).toFixed(2)) + ""; } - stb += "" + toThousands(monthday.toFixed(2)) + ""; + stb += "" + toThousands(monthday) + ""; stb += ""; } var std = ""; @@ -1481,6 +1490,8 @@ } function ExportExcel() { + $("#exportBtn").html('').attr("disabled", true); + var send_data = { SearchType: searchType, @@ -1495,10 +1506,12 @@ $("#post").val(JSON.stringify(send_data)); document.report.action = "StationReport/ExportExcel"; document.report.submit(); + $("#exportBtn").html(' 匯出').attr("disabled", false); return; } else { + $("#exportBtn").html(' 匯出').attr("disabled", false); var text = "原因如下:"; $.each(rel.data, function (index, val) { text += index + 1 + "." + val + ""; @@ -1521,6 +1534,7 @@ { window.location = "/StationReport/ExportExcelmaxtable?post=" + JSON.stringify(send_data); } + $("#exportBtn").html(' 匯出').attr("disabled", false); } } // 綜合比較