diff --git a/SolarPower/Controllers/StationReportController.cs b/SolarPower/Controllers/StationReportController.cs index 0f58032..3d870a5 100644 --- a/SolarPower/Controllers/StationReportController.cs +++ b/SolarPower/Controllers/StationReportController.cs @@ -280,17 +280,18 @@ namespace SolarPower.Controllers 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()); + ntdone = Checknull(Convert.ToDouble(dbody["daymoney"]).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()); + //double onemoney = Convert.ToDouble(ntd) / Convert.ToDouble(tkwh); + //if (double.IsNaN(onemoney)) + //{ + // onemoney = 0; + //} + //ntdone = Checknull(onemoney.ToString()); AverageDailyProfit = Checknull(Math.Round((Convert.ToDouble(ntd) / Convert.ToDouble(GeneratingCapacity)), 2).ToString()); } @@ -488,7 +489,8 @@ namespace SolarPower.Controllers 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(); + monthmoneyone = dbody["monthmoneyone"] == null ? "0" : dbody["monthmoneyone"].ToString(); + //monthmoneyone = (Convert.ToDouble(dbody["monthmoneyone"].ToString()) + Convert.ToDouble(monthmoneyone)).ToString(); monthGeneratingCapacity = Checknull(Math.Round(Convert.ToDouble(dbody["GeneratingCapacity"]), 2).ToString()); @@ -635,7 +637,8 @@ namespace SolarPower.Controllers cell.CellStyle = styleLine12; index++; cell = row.CreateCell(index); - cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoneyone) / Useday, 2)); + //cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoneyone) / Useday, 2)); + cell.SetCellValue(Convert.ToDouble(monthmoneyone)); cell.CellStyle = styleLine12; index++; cell = row.CreateCell(index); @@ -772,7 +775,8 @@ namespace SolarPower.Controllers 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(); + monthmoneyone = dbody["monthmoneyone"] == null ? "0" : dbody["monthmoneyone"].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()); } @@ -905,7 +909,8 @@ namespace SolarPower.Controllers cell.CellStyle = styleLine12; index++; cell = row.CreateCell(index); - cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoneyone) / Useday, 2)); + //cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoneyone) / Useday, 2)); + cell.SetCellValue(Convert.ToDouble(monthmoneyone)); cell.CellStyle = styleLine12; index++; cell = row.CreateCell(index); @@ -1186,17 +1191,18 @@ namespace SolarPower.Controllers 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()); + ntdone = Checknull(Convert.ToDouble(dbody["daymoney"]).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()); + //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()); } @@ -1395,7 +1401,8 @@ namespace SolarPower.Controllers 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(); + monthmoneyone = dbody["monthmoneyone"] == null ? "0" : dbody["monthmoneyone"].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); @@ -1541,7 +1548,8 @@ namespace SolarPower.Controllers cell.CellStyle = styleLine12; index++; cell = row.CreateCell(index); - cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoneyone) / Useday, 2)); + //cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoneyone) / Useday, 2)); + cell.SetCellValue(Convert.ToDouble(monthmoneyone)); cell.CellStyle = styleLine12; index++; cell = row.CreateCell(index); @@ -1773,7 +1781,7 @@ namespace SolarPower.Controllers index++; cell = row.CreateCell(index); - cell.SetCellValue(Math.Round(form.PowerRate, 2)); + cell.SetCellValue(form.PowerRate); cell.CellStyle = styleLine12; index++; @@ -2182,7 +2190,7 @@ namespace SolarPower.Controllers index++; cell = row.CreateCell(index); - cell.SetCellValue(Math.Round(form.PowerRate, 2)); + cell.SetCellValue(form.PowerRate); cell.CellStyle = styleLine12; index++; diff --git a/SolarPower/Repository/Implement/StationReportRepository.cs b/SolarPower/Repository/Implement/StationReportRepository.cs index 4f2e7ee..89d418c 100644 --- a/SolarPower/Repository/Implement/StationReportRepository.cs +++ b/SolarPower/Repository/Implement/StationReportRepository.cs @@ -116,7 +116,7 @@ namespace SolarPower.Repository.Implement SELECT '總計' report_date, {inv} round(sum(hourKWH), 2) hourKWH, round(sum(hourKWHp), 2) hourKWHp, round(sum(irrDay),2) irrDay, round(sum(irrDayHour),2) irrDayHour, round( avg(temperature), 2) temperature, round(sum(hourmoney), 2) hourmoney, round(sum(totKWH), 2) totKWH, round(sum(totKWHKWP),2) totKWHKWP, round(sum(totmoney),2) totmoney, '電站名稱' stationName, - round( sum(daymoney), 2) daymoney, round(sum(tothour), 2) tothour, round(sum(pr), 2) pr, avg(GeneratingCapacity) GeneratingCapacity + daymoney, round(sum(tothour), 2) tothour, round(sum(pr), 2) pr, avg(GeneratingCapacity) GeneratingCapacity from temp_inv2 a; "; break; @@ -649,7 +649,7 @@ namespace SolarPower.Repository.Implement ( select id, name stationName, powerRate,GeneratingCapacity from power_station where id = {post.PowerStation} )z on a.PowerStationID = z.id - where DATE_FORMAT(a.report_date,''%Y-%m-%d'') = ''{post.Time}'' and + where DATE_FORMAT(a.report_date,''%Y-%m-%d'') = ''{post.Time}'' GROUP BY DATE_FORMAT(a.report_date,''%Y-%m-%d %H:%i'') order by DATE_FORMAT(a.report_date,''%Y-%m-%d %H:%i'') '); diff --git a/SolarPower/Views/StationReport/Index.cshtml b/SolarPower/Views/StationReport/Index.cshtml index 7cdfc14..cba1f01 100644 --- a/SolarPower/Views/StationReport/Index.cshtml +++ b/SolarPower/Views/StationReport/Index.cshtml @@ -1039,7 +1039,8 @@ //kWhkwp = inverter.totKWHKWP ? inverter.totKWHKWP.toFixed(2) : 0; // 日報 有效發電小時 kWhkwp = inverter.totKWHKWP ? (inverter.totKWH / inverter.GeneratingCapacity).toFixed(2) : 0; // 日報 有效發電小時 ntd = inverter.totmoney ? inverter.totmoney.toFixed(2) : 0; - ntdone = inverter.totmoney / inverter.totKWH ? (inverter.totmoney / inverter.totKWH).toFixed(2) : 0; + //ntdone = inverter.totmoney / inverter.totKWH ? (inverter.totmoney / inverter.totKWH) : 0; + ntdone = inverter.daymoney ? inverter.daymoney : 0; GeneratingCapacity = inverter.GeneratingCapacity ? inverter.GeneratingCapacity.toFixed(2) : 0; averageDailyProfit = ntd / GeneratingCapacity ? (ntd / GeneratingCapacity).toFixed(2) : 0; } @@ -1171,7 +1172,7 @@ if (showmoney == 1) { stb += "" + toThousands((monthmoney / GeneratingCapacity).toFixed(2)) + ""; stb += "" + toThousands(monthmoney.toFixed(2)) + ""; - stb += "" + toThousands(monthmoneyone.toFixed(2)) + ""; + stb += "" + toThousands(monthmoneyone) + ""; stb += "" + toThousands((averageDailyProfit / monthday).toFixed(2)) + ""; } stb += "" + monthday + ""; @@ -1305,7 +1306,7 @@ if (showmoney == 1) { stb += "" + toThousands(monthmoney.toFixed(2)) + ""; - stb += "" + toThousands(monthmoneyone.toFixed(2)) + ""; + stb += "" + toThousands(monthmoneyone) + ""; stb += "" + toThousands((averageDailyProfit / days).toFixed(2)) + ""; } stb += "" + toThousands(monthday) + ""; @@ -1440,7 +1441,7 @@ if (showmoney == 1) { stb += "" + toThousands((monthmoney / GeneratingCapacity).toFixed(2)) + ""; stb += "" + toThousands(monthmoney.toFixed(2)) + ""; - stb += "" + toThousands(monthmoneyone / monthday.toFixed(2)) + ""; + stb += "" + toThousands(monthmoneyone / monthday) + ""; stb += "" + toThousands((averageDailyProfit / monthday).toFixed(2)) + ""; } stb += "" + toThousands(monthday) + "";