月報表 - 台電費率 - 直接呈現不計算

This commit is contained in:
cesar liu 2022-08-05 11:31:56 +08:00
parent e7638b5a6a
commit 1a0769f5ea
2 changed files with 16 additions and 15 deletions

View File

@ -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;

View File

@ -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 = "<tr>";
@ -1167,7 +1167,7 @@
if (showmoney == 1) {
stb += "<td>" + toThousands((monthmoney / GeneratingCapacity).toFixed(3)) + "</td>";
stb += "<td>" + toThousands(Math.round(monthmoney)) + "</td>";
stb += "<td>" + Math.round(monthmoneyone / monthday * 10000) / 10000 + "</td>";
stb += "<td>" + monthmoneyone + "</td>";
stb += "<td>" + toThousands(Math.round(averageDailyProfit / monthday)) + "</td>";
}
stb += "<td>" + monthday + "</td>";
@ -1246,7 +1246,7 @@
avgdayKWH += inverter.dayKWH ? inverter.dayKWH : 0;
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) {
@ -1256,6 +1256,7 @@
})
monthday = rel.data.length;
monthmoneyone = rel.data[0].monthmoneyone ? rel.data[0].monthmoneyone : 0;
var stc = "<tr>";
@ -1292,7 +1293,7 @@
stb += "<td>" + monthKWH + "</td>";
if (showmoney == 1) {
stb += "<td>" + toThousands(Math.round(monthmoney)) + "</td>";
stb += "<td>" + Math.round(monthmoneyone / monthday * 10000) / 10000 + "</td>";
stb += "<td>" + monthmoneyone + "</td>";
stb += "<td>" + toThousands(Math.round((averageDailyProfit / monthday / 30 * 10000) / 10000)) + "</td>";
}
stb += "<td>" + monthday + "</td>";