From bf09f05433599a511cd0736f5b1468abafcf151e Mon Sep 17 00:00:00 2001 From: "wanling040@gmail.com" Date: Tue, 9 Aug 2022 16:26:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A0=B1=E8=A1=A8=E6=9F=A5=E8=A9=A2-=E6=97=A5?= =?UTF-8?q?=E6=9C=88=E5=B9=B4=E5=8D=80=E9=96=93=E5=A0=B1=E8=A1=A8=E9=A1=AF?= =?UTF-8?q?=E7=A4=BA:=20=E5=85=A8=E9=83=A8=E6=95=B8=E5=80=BC=E9=83=BD?= =?UTF-8?q?=E5=8F=96=E8=87=B3=E5=B0=8F=E6=95=B8=E9=BB=9E=E5=85=A9=E4=BD=8D?= =?UTF-8?q?=EF=BC=9B=E5=A0=B1=E8=A1=A8=E5=8C=AF=E5=87=BA=E7=9A=84=E6=AA=94?= =?UTF-8?q?=E6=A1=88=E5=90=8D=E7=A8=B1=E6=94=B9=E7=82=BA=E5=85=AC=E5=8F=B8?= =?UTF-8?q?=E5=90=8D=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/StationReportController.cs | 17 +- .../Implement/StationReportRepository.cs | 46 ++++- .../Interface/IStationReportRepository.cs | 1 + SolarPower/Views/StationReport/Index.cshtml | 166 +++++++++--------- 4 files changed, 143 insertions(+), 87 deletions(-) diff --git a/SolarPower/Controllers/StationReportController.cs b/SolarPower/Controllers/StationReportController.cs index e7803e8..ed5a06c 100644 --- a/SolarPower/Controllers/StationReportController.cs +++ b/SolarPower/Controllers/StationReportController.cs @@ -976,7 +976,10 @@ namespace SolarPower.Controllers { AllowClose = false }; - string companyName = postObject.PowerStation[0].Name; + + int powerStationId = int.Parse(postObject.PowerStation[0].Value); + var getCompany = stationReportRepository.GetCompanyNameByPowerStationId(powerStationId); + string companyName = getCompany.Result; workbook.Write(ms); ms.Flush(); ms.Seek(0, SeekOrigin.Begin); @@ -1591,7 +1594,9 @@ namespace SolarPower.Controllers { Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "report", Datename)); } - string companyName = postObject.PowerStation[0].Name; + int powerStationId = int.Parse(postObject.PowerStation[0].Value); + var getCompany = stationReportRepository.GetCompanyNameByPowerStationId(powerStationId); + string companyName = getCompany.Result; 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); @@ -2017,7 +2022,9 @@ namespace SolarPower.Controllers { AllowClose = false }; - string companyName = postObject.PowerStation[0].Name; + int powerStationId = int.Parse(postObject.PowerStation[0].Value); + var getCompany = stationReportRepository.GetCompanyNameByPowerStationId(powerStationId); + string companyName = getCompany.Result; workbook.Write(ms); ms.Flush(); ms.Seek(0, SeekOrigin.Begin); @@ -2428,7 +2435,9 @@ namespace SolarPower.Controllers { Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "report", Datename)); } - string companyName = postObject.PowerStation[0].Name; + int powerStationId = int.Parse(postObject.PowerStation[0].Value); + var getCompany = stationReportRepository.GetCompanyNameByPowerStationId(powerStationId); + string companyName = getCompany.Result; 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); diff --git a/SolarPower/Repository/Implement/StationReportRepository.cs b/SolarPower/Repository/Implement/StationReportRepository.cs index 9036209..ec0c058 100644 --- a/SolarPower/Repository/Implement/StationReportRepository.cs +++ b/SolarPower/Repository/Implement/StationReportRepository.cs @@ -315,12 +315,24 @@ namespace SolarPower.Repository.Implement // EXECUTE stmt; // DEALLOCATE PREPARE stmt;"; #endregion + DateTime firstDay = new DateTime(int.Parse(post.Time), 01, 01); + DateTime lastDay; + if (DateTime.Now.Year == int.Parse(post.Time)) + { + lastDay = DateTime.Now.Date; + } + else + { + lastDay = new DateTime(int.Parse(post.Time), 12, 31); + } + string days = (lastDay - firstDay).TotalDays.ToString(); + sql = @$" DROP TABLE IF EXISTS temp_inv; create TEMPORARY TABLE temp_inv as SELECT DATE_FORMAT(a.report_date,'%Y/%m') report_date, {inv} 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, d.IrrDay + c.monthKWH 'monthKWH', c.money 'monthmoney', stationName, powerRate 'monthmoneyone',SolarType,SiteDB, d.IrrDay, {days} Days FROM report_invday a left join ( # 每日加總 inv select powerStationid, DATE_FORMAT(TIMESTAMP,'%Y-%m') report_date, siteid, sitetype, @@ -358,7 +370,7 @@ namespace SolarPower.Repository.Implement SELECT '總計' report_date, {inv} round(sum(dayKWH), 2) dayKWH, round(sum(dayKWHp), 2) dayKWHp, round(max(tothour), 2) tothour, avg(KWHKWP) KWHKWP, round(avg(PR), 2) PR, GeneratingCapacity, round(sum(irradiance), 2) irradiance, avg(temperature) temperature, round(sum(soldmoney), 2) soldmoney, - round(monthKWH, 2) monthKWH, monthmoney, stationName, monthmoneyone, SolarType, SiteDB, IrrDay + round(monthKWH, 2) monthKWH, monthmoney, stationName, monthmoneyone, SolarType, SiteDB, IrrDay, 0 from temp_inv2 a; "; break; @@ -805,5 +817,35 @@ namespace SolarPower.Repository.Implement return a; } } + + public async Task GetCompanyNameByPowerStationId(int powerStationId) + { + string result; + using (IDbConnection conn = _databaseHelper.GetConnection()) + { + conn.Open(); + try + { + var sql = @$"SELECT c.Name + FROM power_station ps + LEFT JOIN company c ON ps.CompanyId = c.id + WHERE ps.id = {powerStationId} AND ps.Deleted = 0"; + + result = await conn.QueryFirstOrDefaultAsync(sql); + + + } + catch (Exception exception) + { + throw exception; + } + finally + { + conn.Close(); + } + return result; + } + } + } } diff --git a/SolarPower/Repository/Interface/IStationReportRepository.cs b/SolarPower/Repository/Interface/IStationReportRepository.cs index 3edc23f..b1f38c3 100644 --- a/SolarPower/Repository/Interface/IStationReportRepository.cs +++ b/SolarPower/Repository/Interface/IStationReportRepository.cs @@ -14,5 +14,6 @@ namespace SolarPower.Repository.Interface Task> GetMaxtablebody(Select_table2 post); Task Findhaveinv(Select_table post); Task CheckExcelAsync(Select_table post); + Task GetCompanyNameByPowerStationId(int powerStationId); } } diff --git a/SolarPower/Views/StationReport/Index.cshtml b/SolarPower/Views/StationReport/Index.cshtml index e9bb767..587a0e3 100644 --- a/SolarPower/Views/StationReport/Index.cshtml +++ b/SolarPower/Views/StationReport/Index.cshtml @@ -1024,25 +1024,27 @@ sta += "" + toThousands(Number(inverter[i]).toFixed(2)) + ""; } }); - sta += "" + toThousands(Number(inverter.hourKWH)) + ""; - sta += "" + toThousands(Number(inverter.hourKWHp)) + ""; - sta += "" + toThousands(Number(inverter.irrDayHour)) + ""; // body 小時平均日照度 irradiance - sta += "" + toThousands(Number(inverter.temperature)) + ""; //body 小時平均模組溫度 + sta += "" + toThousands(Number(inverter.hourKWH).toFixed(2)) + ""; + sta += "" + toThousands(Number(inverter.hourKWHp).toFixed(2)) + ""; + sta += "" + toThousands(Number(inverter.irrDayHour).toFixed(2)) + ""; // body 小時平均日照度 irradiance + sta += "" + toThousands(Number(inverter.temperature).toFixed(2)) + ""; //body 小時平均模組溫度 if (showmoney == 1) { - sta += "" + toThousands(Math.round(Number(inverter.hourmoney))) + ""; + sta += "" + toThousands((Number(inverter.hourmoney).toFixed(2))) + ""; } sta += ""; - thour = inverter.tothour ? inverter.tothour.toFixed(2) : 0; - tpr = inverter.pr ? inverter.pr.toFixed(2) : 0; - tkwh = inverter.totKWH ? inverter.totKWH.toFixed(2) : 0; - kWhkwp = inverter.totKWHKWP ? inverter.totKWHKWP.toFixed(2) : 0; // 日報 有效發電小時 - 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; + if (index < rel.data.length - 1) { + thour = inverter.tothour ? inverter.tothour.toFixed(2) : 0; + tpr = inverter.pr ? inverter.pr.toFixed(2) : 0; + tkwh = inverter.totKWH ? inverter.totKWH.toFixed(2) : 0; + //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; + GeneratingCapacity = inverter.GeneratingCapacity ? inverter.GeneratingCapacity.toFixed(2) : 0; + averageDailyProfit = ntd / GeneratingCapacity ? (ntd / GeneratingCapacity).toFixed(2) : 0; + } }) var stc = ""; -/* stc += "" + '日照小時' + "";*/ stc += "" + '日均發電度數' + ""; stc += "" + 'PR%' + ""; stc += "" + '日發電量(kWh)' + ""; @@ -1057,14 +1059,14 @@ var stb = ""; /* stb += "" + thour + "";*/ - stb += "" + toThousands(kWhkwp) + ""; //header - 有效發電小時 + stb += "" + toThousands(kWhkwp) + ""; //header - 有效發電小時 kWhkwp stb += "" + toThousands(tpr) + ""; // stb += "" + toThousands(tkwh) + ""; stb += "" + toThousands(GeneratingCapacity) + ""; if (showmoney == 1) { - stb += "" + toThousands(Math.round(ntd)) + ""; - stb += "" + Math.round(ntdone * 10000) / 10000 + ""; - stb += "" + toThousands(Math.round(averageDailyProfit)) + ""; + stb += "" + toThousands(ntd) + ""; + stb += "" + toThousands(ntdone) + ""; + stb += "" + toThousands(averageDailyProfit) + ""; } stb += ""; @@ -1095,18 +1097,18 @@ if (inverter[i] == null) { sta += "" + 0 + ""; } else { - sta += "" + toThousands(inverter[i]) + ""; + sta += "" + toThousands(inverter[i].toFixed(2)) + ""; } }); - sta += "" + toThousands(inverter.dayKWH) + ""; - sta += "" + ((inverter.dayKWHp == null) ? 0 : toThousands(inverter.dayKWHp)) + ""; - sta += "" + inverter.tothour + ""; - sta += "" + toThousands(inverter.KWHKWP) + ""; + sta += "" + toThousands(inverter.dayKWH.toFixed(2)) + ""; + sta += "" + ((inverter.dayKWHp == null) ? 0 : toThousands(inverter.dayKWHp.toFixed(2))) + ""; + sta += "" + inverter.tothour.toFixed(2) + ""; + sta += "" + toThousands(inverter.KWHKWP.toFixed(2)) + ""; sta += "" + ((inverter.PR == null) ? 0 : toThousands(inverter.PR.toFixed(2))) + ""; - sta += "" + ((inverter.IrrDay == null) ? 0 : toThousands(inverter.IrrDay)) + ""; - sta += "" + inverter.temperature + ""; + sta += "" + ((inverter.IrrDay == null) ? 0 : toThousands(inverter.IrrDay.toFixed(2))) + ""; + sta += "" + inverter.temperature.toFixed(2) + ""; if (showmoney == 1) { - sta += "" + toThousands(Math.round(inverter.soldmoney)) + ""; + sta += "" + toThousands(inverter.soldmoney.toFixed(2)) + ""; } sta += ""; avghour += inverter.tothour ? inverter.tothour : 0; @@ -1120,7 +1122,7 @@ sitedb = inverter.SiteDB } GeneratingCapacity = inverter.GeneratingCapacity; - averageDailyProfit = monthmoney / GeneratingCapacity ? Math.round(monthmoney / GeneratingCapacity * 10000) / 10000 : 0; + averageDailyProfit = monthmoney / GeneratingCapacity ? (monthmoney / GeneratingCapacity) : 0; }) monthday = (rel.data.length - 1);//最後一筆是總計 monthmoneyone = rel.data[0].monthmoneyone ? rel.data[0].monthmoneyone : 0; @@ -1161,16 +1163,16 @@ /*stb += "" + (avghour / monthday).toFixed(2) + "";*/ stb += "" + toThousands((avgKWHKWP / monthday).toFixed(2)) + ""; stb += "" + toThousands((avgdayKWH / monthday).toFixed(2)) + ""; - stb += "" + toThousands(monthKWH) + ""; - stb += "" + toThousands(GeneratingCapacity) + ""; + stb += "" + toThousands(monthKWH.toFixed(2)) + ""; + stb += "" + toThousands(GeneratingCapacity.toFixed(2)) + ""; if (showmoney == 1) { - stb += "" + toThousands((monthmoney / GeneratingCapacity).toFixed(3)) + ""; - stb += "" + toThousands(Math.round(monthmoney)) + ""; - stb += "" + monthmoneyone + ""; - stb += "" + toThousands(Math.round(averageDailyProfit / monthday)) + ""; + stb += "" + toThousands((monthmoney / GeneratingCapacity).toFixed(2)) + ""; + stb += "" + toThousands(monthmoney.toFixed(2)) + ""; + stb += "" + toThousands(monthmoneyone.toFixed(2)) + ""; + stb += "" + toThousands((averageDailyProfit / monthday).toFixed(2)) + ""; } - stb += "" + monthday + ""; + stb += "" + monthday.toFixed(2) + ""; stb += ""; } var std = ""; @@ -1191,8 +1193,8 @@ 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 += "" + toThousands((monthmoney * value.leaseRate / 100).toFixed(2)) + ""; + std += "" + toThousands((monthmoney * value.leaseRate / 100 * 1.05).toFixed(2)) + ""; std += ""; }) $('#HireTableBody').append(std); @@ -1217,6 +1219,7 @@ var monthmoneyone = 0; var monthday = 0; var averageDailyProfit = 0; + var days = 0; var sta = ""; var check_hire = false; var sitedb = ""; @@ -1227,27 +1230,27 @@ if (inverter[i] == null) { sta += "" + 0 + ""; } else { - sta += "" + toThousands(inverter[i]) + ""; + sta += "" + toThousands(inverter[i].toFixed(2)) + ""; } }); - sta += "" + toThousands(inverter.dayKWH) + ""; - sta += "" + toThousands(inverter.dayKWHp) + ""; - sta += "" + toThousands(inverter.tothour) + ""; - sta += "" + toThousands(inverter.KWHKWP) + ""; + sta += "" + toThousands(inverter.dayKWH.toFixed(2)) + ""; + sta += "" + toThousands(inverter.dayKWHp.toFixed(2)) + ""; + sta += "" + toThousands(inverter.tothour.toFixed(2)) + ""; + sta += "" + toThousands(inverter.KWHKWP.toFixed(2)) + ""; sta += "" + toThousands(inverter.PR.toFixed(2)) + ""; - sta += "" + toThousands(inverter.irradiance) + ""; - sta += "" + toThousands(inverter.temperature) + ""; + sta += "" + toThousands(inverter.irradiance.toFixed(2)) + ""; + sta += "" + toThousands(inverter.temperature.toFixed(2)) + ""; if (showmoney == 1) { - sta += "" + toThousands(Math.round(inverter.soldmoney)) + ""; + 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 ? toThousands(inverter.monthKWH) : 0; + monthKWH = inverter.monthKWH ? inverter.monthKWH : 0; monthmoney = inverter.monthmoney ? inverter.monthmoney : 0; - - averageDailyProfit = monthmoney / inverter.GeneratingCapacity ? Math.round(monthmoney / inverter.GeneratingCapacity * 10000) / 10000 : 0; + + averageDailyProfit = monthmoney / inverter.GeneratingCapacity ? (monthmoney / inverter.GeneratingCapacity) : 0; if (inverter.SolarType == 1) { check_hire = true; @@ -1255,8 +1258,9 @@ } }) - monthday = rel.data.length; + monthday = (rel.data.length - 1); monthmoneyone = rel.data[0].monthmoneyone ? rel.data[0].monthmoneyone : 0; + days = rel.data[0].Days; var stc = ""; @@ -1287,16 +1291,16 @@ stb += ""; } else { - stb += "" + (avghour / monthday).toFixed(2) + ""; - stb += "" + (avgKWHKWP / monthday).toFixed(2) + ""; + stb += "" + toThousands((avghour / monthday).toFixed(2)) + ""; + stb += "" + toThousands((avgKWHKWP / monthday).toFixed(2)) + ""; stb += "" + toThousands((avgdayKWH / monthday).toFixed(2)) + ""; - stb += "" + monthKWH + ""; + stb += "" + toThousands(monthKWH.toFixed(2)) + ""; if (showmoney == 1) { - stb += "" + toThousands(Math.round(monthmoney)) + ""; - stb += "" + monthmoneyone + ""; - stb += "" + toThousands(Math.round((averageDailyProfit / monthday / 30 * 10000) / 10000)) + ""; + stb += "" + toThousands(monthmoney.toFixed(2)) + ""; + stb += "" + toThousands(monthmoneyone.toFixed(2)) + ""; + stb += "" + toThousands((averageDailyProfit / days).toFixed(2)) + ""; } - stb += "" + monthday + ""; + stb += "" + toThousands(monthday.toFixed(2)) + ""; stb += ""; } var std = ""; @@ -1317,8 +1321,8 @@ std += ""; std += "" + value.landowner + ""; std += "" + toThousands(value.leaseRate) + "%" + ""; - std += "" + toThousands(Math.round(monthmoney * value.leaseRate / 100)) + ""; - std += "" + toThousands(Math.round(monthmoney * value.leaseRate / 100 * 1.05)) + ""; + std += "" + toThousands((monthmoney * value.leaseRate / 100).toFixed(2)) + ""; + std += "" + toThousands((monthmoney * value.leaseRate / 100 * 1.05).toFixed(2)) + ""; std += ""; }) $('#HireTableBody').append(std); @@ -1355,18 +1359,18 @@ if (inverter[i] == null) { sta += "" + 0 + ""; } else { - sta += "" + toThousands(inverter[i]) + ""; + sta += "" + toThousands(inverter[i].toFixed(2)) + ""; } }); - sta += "" + toThousands(inverter.dayKWH) + ""; - sta += "" + ((inverter.dayKWHp == null) ? 0 : toThousands(inverter.dayKWHp)) + ""; - sta += "" + inverter.tothour + ""; - sta += "" + toThousands(inverter.KWHKWP) + ""; + sta += "" + toThousands(inverter.dayKWH.toFixed(2)) + ""; + sta += "" + ((inverter.dayKWHp == null) ? 0 : toThousands(inverter.dayKWHp.toFixed(2))) + ""; + sta += "" + toThousands(inverter.tothour.toFixed(2)) + ""; + sta += "" + toThousands(inverter.KWHKWP.toFixed(2)) + ""; sta += "" + ((inverter.PR == null) ? 0 : toThousands(inverter.PR.toFixed(2))) + ""; - sta += "" + ((inverter.IrrDay == null) ? 0 : toThousands(inverter.IrrDay)) + ""; - sta += "" + inverter.temperature + ""; + sta += "" + ((inverter.IrrDay == null) ? 0 : toThousands(inverter.IrrDay.toFixed(2))) + ""; + sta += "" + toThousands(inverter.temperature.toFixed(2)) + ""; if (showmoney == 1) { - sta += "" + toThousands(Math.round(inverter.soldmoney)) + ""; + sta += "" + toThousands(inverter.soldmoney.toFixed(2)) + ""; } sta += ""; avghour += inverter.tothour ? inverter.tothour : 0; @@ -1381,9 +1385,9 @@ sitedb = inverter.SiteDB } GeneratingCapacity = inverter.GeneratingCapacity; - averageDailyProfit = monthmoney / GeneratingCapacity ? Math.round(monthmoney / GeneratingCapacity * 10000) / 10000 : 0; + averageDailyProfit = monthmoney / GeneratingCapacity ? (monthmoney / GeneratingCapacity) : 0; }) - monthday = rel.data.length; + monthday = (rel.data.length - 1); var stc = ""; @@ -1421,16 +1425,16 @@ /*stb += "" + (avghour / monthday).toFixed(2) + "";*/ stb += "" + toThousands((avgKWHKWP / monthday).toFixed(2)) + ""; stb += "" + toThousands((avgdayKWH / monthday).toFixed(2)) + ""; - stb += "" + toThousands(monthKWH) + ""; - stb += "" + toThousands(GeneratingCapacity) + ""; + stb += "" + toThousands(monthKWH.toFixed(2)) + ""; + stb += "" + toThousands(GeneratingCapacity.toFixed(2)) + ""; if (showmoney == 1) { - 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 += "" + toThousands((monthmoney / GeneratingCapacity).toFixed(2)) + ""; + stb += "" + toThousands(monthmoney.toFixed(2)) + ""; + stb += "" + toThousands(monthmoneyone / monthday.toFixed(2)) + ""; + stb += "" + toThousands((averageDailyProfit / monthday).toFixed(2)) + ""; } - stb += "" + monthday + ""; + stb += "" + toThousands(monthday.toFixed(2)) + ""; stb += ""; } var std = ""; @@ -1451,8 +1455,8 @@ 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 += "" + toThousands((monthmoney * value.leaseRate / 100).toFixed(2)) + ""; + std += "" + toThousands((monthmoney * value.leaseRate / 100 * 1.05).toFixed(2)) + ""; std += ""; }) $('#HireTableBody').append(std); @@ -1625,17 +1629,17 @@ /*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 / data.generatingCapacity).toFixed(2)) + ""; // 日均發電度數 StrInfoBody += "" + toThousands(data.kwh.toFixed(2)) + ""; // 發電量 /*StrInfoBody += "" + toThousands(data.irradiance.toFixed(2)) + ""; // 累積日照*/ StrInfoBody += "" + toThousands(data.avgPR.toFixed(2)) + ""; if (showmoney == 1) { - StrInfoBody += "" + toThousands(Math.round(data.todayMoney, 2)) + ""; + StrInfoBody += "" + toThousands(data.todayMoney.toFixed(2)) + ""; - StrInfoBody += "" + Math.round(data.todayMoney * hirerate * 0.01, 2)+ ""; + StrInfoBody += "" + toThousands((data.todayMoney * hirerate * 0.01).toFixed(2)) + ""; - StrInfoBody += "" + toThousands(Math.round(data.todayMoney, 2)) + ""; + StrInfoBody += "" + toThousands(data.todayMoney.toFixed(2)) + ""; } @@ -1650,7 +1654,7 @@ $.each(CityArray, function (index, data) { CityInfoBody += ""; CityInfoBody += "" + data.city + ""; - CityInfoBody += "" + data.generatingCapacity.toFixed(2) + ""; + CityInfoBody += "" + toThousands(data.generatingCapacity.toFixed(2)) + ""; CityInfoBody += "" + toThousands(data.kwp.toFixed(2)) + ""; CityInfoBody += "" + toThousands((data.kwp / data.generatingCapacity).toFixed(2)) + ""; CityInfoBody += "";