diff --git a/SolarPower/Repository/Implement/StationReportRepository.cs b/SolarPower/Repository/Implement/StationReportRepository.cs index 188afef..9036209 100644 --- a/SolarPower/Repository/Implement/StationReportRepository.cs +++ b/SolarPower/Repository/Implement/StationReportRepository.cs @@ -114,9 +114,9 @@ namespace SolarPower.Repository.Implement select * from temp_inv union SELECT '總計' report_date, {inv} - round(sum(hourKWH), 2) hourKWH, round(sum(hourKWHp), 2) hourKWHp, avg(irrDay) irrDay, avg(irrDayHour) irrDayHour, - 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 + round(sum(hourKWH), 2) hourKWH, round(sum(hourKWHp), 2) hourKWHp, round(avg(irrDay),2) irrDay, round(avg(irrDayHour),2) irrDayHour, + round( avg(temperature), 2) temperature, round(sum(hourmoney), 2) hourmoney, round(avg(totKWH), 2) totKWH, round(avg(totKWHKWP),2) totKWHKWP, round(avg(totmoney),2) totmoney, '電站名稱' stationName, + round( avg(daymoney), 2) daymoney, round(avg(tothour), 2) tothour, round(avg(pr), 2) pr, avg(GeneratingCapacity) GeneratingCapacity from temp_inv2 a; "; break; @@ -151,7 +151,7 @@ namespace SolarPower.Repository.Implement ) d on a.powerStationid = d.powerStationid and DATE_FORMAT(a.report_date,'%Y-%m-%d') = d.report_date join ( - select id, name stationName, powerRate,SolarType,SiteDB,GeneratingCapacity 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 a.PowerStationID ={post.PowerStation} and DATE_FORMAT(a.report_date,'%Y-%m') = '{post.Time}' GROUP BY DATE_FORMAT(a.report_date,'%Y-%m-%d') @@ -164,9 +164,9 @@ namespace SolarPower.Repository.Implement select * from temp_inv union 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, - monthKWH, monthmoney, stationName, monthmoneyone, SolarType, SiteDB, IrrDay + round(sum(dayKWH), 2) dayKWH, round(sum(dayKWHp), 2) dayKWHp, round(max(tothour), 2) tothour, round(avg(KWHKWP), 2) KWHKWP, round(avg(PR), 2) PR, + GeneratingCapacity, round(sum(irradiance), 2) irradiance, round(avg(temperature), 2) temperature, round(sum(soldmoney), 2) soldmoney, + round(monthKWH, 2) monthKWH, monthmoney, stationName, monthmoneyone, SolarType, SiteDB, IrrDay from temp_inv2 a; "; } else @@ -263,8 +263,8 @@ namespace SolarPower.Repository.Implement union 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, - monthKWH, monthmoney, stationName, monthmoneyone, SolarType, SiteDB, IrrDay + GeneratingCapacity, round(sum(irradiance), 2) irradiance, round(avg(temperature), 2) temperature, round(sum(soldmoney), 2) soldmoney, + round( monthKWH,2) monthKWH , monthmoney, stationName, monthmoneyone, SolarType, SiteDB, round(IrrDay , 2) IrrDay from temp_inv2 a; "; } @@ -320,7 +320,7 @@ namespace SolarPower.Repository.Implement 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, IrrDay + c.monthKWH 'monthKWH', c.money 'monthmoney', stationName, powerRate 'monthmoneyone',SolarType,SiteDB, d.IrrDay FROM report_invday a left join ( # 每日加總 inv select powerStationid, DATE_FORMAT(TIMESTAMP,'%Y-%m') report_date, siteid, sitetype, @@ -358,7 +358,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, - monthKWH, monthmoney, stationName, monthmoneyone, SolarType, SiteDB, IrrDay + round(monthKWH, 2) monthKWH, monthmoney, stationName, monthmoneyone, SolarType, SiteDB, IrrDay from temp_inv2 a; "; break; diff --git a/SolarPower/Views/StationReport/Index.cshtml b/SolarPower/Views/StationReport/Index.cshtml index 794f1e0..e9bb767 100644 --- a/SolarPower/Views/StationReport/Index.cshtml +++ b/SolarPower/Views/StationReport/Index.cshtml @@ -1114,7 +1114,6 @@ 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; @@ -1124,6 +1123,7 @@ averageDailyProfit = monthmoney / GeneratingCapacity ? Math.round(monthmoney / GeneratingCapacity * 10000) / 10000 : 0; }) monthday = (rel.data.length - 1);//最後一筆是總計 + monthmoneyone = rel.data[0].monthmoneyone ? rel.data[0].monthmoneyone : 0; var stc = "