報表: 單售電金額直接讀取power_station的powerRate

This commit is contained in:
wanli 2022-11-01 23:22:56 +08:00
parent bc0e48b97c
commit 76713cfc5a
3 changed files with 35 additions and 26 deletions

View File

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

View File

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

View File

@ -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 += "<td>" + toThousands((monthmoney / GeneratingCapacity).toFixed(2)) + "</td>";
stb += "<td>" + toThousands(monthmoney.toFixed(2)) + "</td>";
stb += "<td>" + toThousands(monthmoneyone.toFixed(2)) + "</td>";
stb += "<td>" + toThousands(monthmoneyone) + "</td>";
stb += "<td>" + toThousands((averageDailyProfit / monthday).toFixed(2)) + "</td>";
}
stb += "<td>" + monthday + "</td>";
@ -1305,7 +1306,7 @@
if (showmoney == 1) {
stb += "<td>" + toThousands(monthmoney.toFixed(2)) + "</td>";
stb += "<td>" + toThousands(monthmoneyone.toFixed(2)) + "</td>";
stb += "<td>" + toThousands(monthmoneyone) + "</td>";
stb += "<td>" + toThousands((averageDailyProfit / days).toFixed(2)) + "</td>";
}
stb += "<td>" + toThousands(monthday) + "</td>";
@ -1440,7 +1441,7 @@
if (showmoney == 1) {
stb += "<td>" + toThousands((monthmoney / GeneratingCapacity).toFixed(2)) + "</td>";
stb += "<td>" + toThousands(monthmoney.toFixed(2)) + "</td>";
stb += "<td>" + toThousands(monthmoneyone / monthday.toFixed(2)) + "</td>";
stb += "<td>" + toThousands(monthmoneyone / monthday) + "</td>";
stb += "<td>" + toThousands((averageDailyProfit / monthday).toFixed(2)) + "</td>";
}
stb += "<td>" + toThousands(monthday) + "</td>";