電站報表-新增欄位、更改檔名(公司名)

This commit is contained in:
wanling040@gmail.com 2022-07-29 18:08:03 +08:00
parent 0e62bc8062
commit b7456ab29e
4 changed files with 168 additions and 51 deletions

View File

@ -928,7 +928,15 @@ namespace SolarPower.Controllers
}
else if(postObject.FormType == 1)
{
name = "月";
if(postObject.SearchType == 2)
{
name = "月";
}
else
{
name = "區間";
}
}
else if (postObject.FormType == 3)
{
@ -939,11 +947,12 @@ namespace SolarPower.Controllers
{
AllowClose = false
};
string companyName = postObject.PowerStation[0].Name;
workbook.Write(ms);
ms.Flush();
ms.Seek(0, SeekOrigin.Begin);
var Datename = postObject.Time.Replace("-", "");
return File(ms, "application/vnd.ms-excel", "FIC太陽能監控平台" + "_" + name + "報表" + "_" + postObject.Userid + Datename + ".xlsx");
return File(ms, "application/vnd.ms-excel", companyName + "_" + name + "報表" + "_" + postObject.Userid + Datename + ".xlsx");
}
public string Checknull(string a)
@ -1513,7 +1522,14 @@ namespace SolarPower.Controllers
}
else
{
name = "月";
if(postObject.SearchType == 2)
{
name = "月";
}
else
{
name = "區間";
}
}
var Datename = postObject.Time.Replace("-", "");
@ -1527,11 +1543,12 @@ namespace SolarPower.Controllers
{
Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "report", Datename));
}
var n = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "report", Datename, "FIC太陽能監控平台" + "_" + name + "報表" + "_" + postObject.Userid + Datename + ".xlsx");
string companyName = postObject.PowerStation[0].Name;
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);
FS.Close();
return Path.Combine("\\" + "upload" ,"report", Datename, "FIC太陽能監控平台" + "_" + name + "報表" + "_" + postObject.Userid+ Datename + ".xlsx");
return Path.Combine("\\" + "upload" ,"report", Datename, companyName + "_" + name + "報表" + "_" + postObject.Userid+ Datename + ".xlsx");
}
public async Task<ApiResult<List<MaxFormbody>>> GetMaxForm(Select_table2 post)
@ -1645,7 +1662,7 @@ namespace SolarPower.Controllers
index++;
cell = row.CreateCell(index);
cell.SetCellValue(Math.Round(form.AvgIrradiance,2));
cell.SetCellValue(Math.Round(form.Irradiance,2));
cell.CellStyle = styleLine12;
index++;
@ -1893,11 +1910,12 @@ namespace SolarPower.Controllers
{
AllowClose = false
};
string companyName = postObject.PowerStation[0].Name;
workbook.Write(ms);
ms.Flush();
ms.Seek(0, SeekOrigin.Begin);
var Datename = postObject.Time.Replace("-", "");
return File(ms, "application/vnd.ms-excel", "FIC太陽能監控平台" + "_" + "綜合比較" + "_" + postObject.Userid + Datename + ".xlsx");
return File(ms, "application/vnd.ms-excel", companyName + "_" + "綜合比較" + "_" + postObject.Userid + Datename + ".xlsx");
}
public string ExportExcelmaxtableBackDownload(string post)
@ -1992,7 +2010,7 @@ namespace SolarPower.Controllers
index++;
cell = row.CreateCell(index);
cell.SetCellValue(Math.Round(form.AvgIrradiance, 2));
cell.SetCellValue(Math.Round(form.Irradiance, 2));
cell.CellStyle = styleLine12;
index++;
@ -2244,12 +2262,13 @@ namespace SolarPower.Controllers
{
Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "report", Datename));
}
var n = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "report", Datename, "FIC太陽能監控平台" + "_" + "綜合比較" + "_" + postObject.Userid + Datename + ".xlsx");
string companyName = postObject.PowerStation[0].Name;
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);
FS.Close();
return Path.Combine("\\" + "upload", "report", Datename, "FIC太陽能監控平台" + "_" + "綜合比較" + "_" + postObject.Userid + Datename + ".xlsx");
return Path.Combine("\\" + "upload", "report", Datename, companyName + "_" + "綜合比較" + "_" + postObject.Userid + Datename + ".xlsx");
}
public async Task<ApiResult<List<string>>> CheckExcel(Select_table2 post)

View File

@ -86,18 +86,24 @@ namespace SolarPower.Models
public string PowerstationName { get; set; }
public int PowerstationId { get; set; }
public int PowerstationType { get; set; }
public int Days { get; set; }
public double Kwh { get; set; }
public string PowerstationDB { get; set; }
public double SolarHour { get; set; }
public double AvgIrradiance { get; set; }
public double Irradiance { get; set; }
public double AvgPR { get; set; }
public double AvgKWHKWP { get; set; }
public double TodayMoney { get; set; }
public double PowerRate { get; set; }
public double GeneratingCapacity { get; set; }
public double TotalKWH { get; set; }
private string mintime;
private string maxtime;
private string electricityMeterAt;
public string Maxtime { get { return Convert.ToDateTime(maxtime).ToString("yyyy/MM/dd"); } set { maxtime = value; } }
public string Mintime { get { return Convert.ToDateTime(mintime).ToString("yyyy/MM/dd"); } set { mintime = value; } }
public string ElectricityMeterAt { get { return Convert.ToDateTime(electricityMeterAt).ToString("yyyy/MM/dd"); } set { electricityMeterAt = value; } }
}
public class CityArray
@ -107,6 +113,7 @@ namespace SolarPower.Models
public double SolarHour { get; set; }
public int Count { get; set; }
public double Kwhkwp { get; set; }
public double GeneratingCapacity { get; set; }
}

View File

@ -7,6 +7,7 @@ using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Reflection;
namespace SolarPower.Repository.Implement
{
@ -79,12 +80,23 @@ namespace SolarPower.Repository.Implement
)z on a.PowerStationID = z.id
where DATE_FORMAT(a.report_date,''%Y-%m-%d'') = ''{post.Time}'' and a.PowerStationID = {post.PowerStation}
GROUP BY DATE_FORMAT(a.report_date,''%Y-%m-%d %H:%i'')
order by DATE_FORMAT(a.report_date,''%Y-%m-%d %H:%i'') ');
#select @sql as 'mySelect'; #
order by DATE_FORMAT(a.report_date,''%Y-%m-%d %H:%i'') ;
-- step 2
create TEMPORARY TABLE temp_inv2 as
select * from temp_inv;
-- step 3
select * from temp_inv
union
SELECT '''' report_date, ', @SQL,
', round(sum(hourKWH), 2) hourKWH, round(sum(hourKWHp), 2) hourKWHp, round(sum(irradiance), 2) irradiance,
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
from temp_inv2');
#select @sql as 'mySelect'; #
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;";
DEALLOCATE PREPARE stmt;";
break;
case 1:
if(post.SearchType == 2)
@ -131,7 +143,7 @@ namespace SolarPower.Repository.Implement
# select @sql as 'mySelect'; #
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;";
DEALLOCATE PREPARE stmt;";
}
else
{
@ -180,7 +192,7 @@ namespace SolarPower.Repository.Implement
# select @sql as 'mySelect'; #
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;";
DEALLOCATE PREPARE stmt;";
}
break;
@ -193,7 +205,7 @@ namespace SolarPower.Repository.Implement
) INTO @sql
FROM inverter_history_month where powerstationId = {post.PowerStation} and DATE_FORMAT(`TIMESTAMP`,'%Y') = '{post.Time}';
SET @sql = CONCAT('SELECT DATE_FORMAT(a.TIMESTAMP,''%Y/%m'') report_date, ', @sql,
',b.todayKWH ''dayKWH'', round((b.todayKWH / c.monthKWH)*100,2) ''dayKWHp'', b.SOLARHOUR ''tothour'', b.KWHKWP ''KWHKWP'', b.PR,
',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
FROM inverter_history_month a left join
@ -218,7 +230,7 @@ namespace SolarPower.Repository.Implement
) d on a.powerStationid = d.powerStationid and DATE_FORMAT(a.TIMESTAMP,''%Y-%m'') = d.report_date
join
(
select id, name stationName, powerRate,SolarType,SiteDB 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 DATE_FORMAT(a.TIMESTAMP,''%Y'') = ''{post.Time}''
GROUP BY DATE_FORMAT(a.TIMESTAMP,''%Y-%m'')
@ -227,8 +239,7 @@ namespace SolarPower.Repository.Implement
# select @sql as 'mySelect'; #
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;";
DEALLOCATE PREPARE stmt;";
break;
}
@ -322,6 +333,7 @@ namespace SolarPower.Repository.Implement
/// <returns></returns>
public async Task<List<MaxFormbody>> GetMaxtablebody(Select_table2 post)
{
string day1 = $"{1} 'Days'";
List<MaxFormbody> result = new List<MaxFormbody>();
using (IDbConnection conn = _databaseHelper.GetConnection())
{
@ -334,11 +346,54 @@ namespace SolarPower.Repository.Implement
ids.Add(Convert.ToInt32(i.Value));
}
string[] times = { };
if(post.SearchType == 1)
if (post.SearchType == 1)
{
times = post.Time.Replace('-', 'a').Replace('/', '-').Replace(" ", "").Split('a');
}
if (post.SearchType == 2)
{
DateTime today = DateTime.Now.Date;
DateTime FirstDay = DateTime.ParseExact(post.Time, "yyyy-MM", System.Globalization.CultureInfo.InvariantCulture);
DateTime LastDay = FirstDay.AddMonths(1).AddDays(-FirstDay.AddMonths(1).Day);
if((LastDay-today).Days > 0)
{
LastDay = today.AddDays(-1);
}
day1 = $"TIMESTAMPDIFF(DAY,'{FirstDay}','{LastDay}') 'Days'";
}
else if (post.SearchType == 3)
{
DateTime yFirstDay = DateTime.ParseExact(post.Time, "yyyy", System.Globalization.CultureInfo.InvariantCulture);
DateTime yLastDay = yFirstDay.AddMonths(12).AddDays(-yFirstDay.AddMonths(1).Day);
if ((yLastDay - DateTime.Now.Date).Days > 0)
{
yLastDay = DateTime.Now.Date.AddDays(-1);
}
day1 = $"TIMESTAMPDIFF(DAY,'{yFirstDay}','{yLastDay}') 'Days'";
}
else
{
day1 = post.SearchType switch
{
0 => $"{1} 'Days'",
1 => $"TIMESTAMPDIFF(DAY,'{times[0]}','{times[1]}') 'Days'",
_ => ""
};
}
//var day1 = post.SearchType switch
//{
// 0 => $"{1} 'Days'",
// 1 => $"TIMESTAMPDIFF(DAY,'{times[0]}','{times[1]}') 'Days'",
// 2 => $"TIMESTAMPDIFF(DAY,'{FirstDay}','{LastDay}') 'Days'",
// 3 => $"TIMESTAMPDIFF(DAY,'{yFirstDay}','{yLastDay}') 'Days'",
// _ => ""
//};
var wheretime = post.SearchType switch
{
0 => $"AND DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d') = '{post.Time}'",
@ -399,28 +454,28 @@ namespace SolarPower.Repository.Implement
// ) n ON n.Id = ps.Id
// WHERE ps.Id IN @ids ORDER BY ps.CityId";
string sql = $@"SELECT ct.`Name` AS 'CityName', ar.Name AS 'AreaName', ps.Name AS 'PowerstationName', ps.SiteDB AS 'PowerstationDB', ps.SolarType AS 'PowerstationType',
ps.Id as 'PowerStationId',
a.SolarHour ,a.Kwh ,a.PR AvgPR, a.KWHKWP AvgKWHKWP,c.Irradiance AvgIrradiance,
(a.TODAYKWH * PowerRate) 'TodayMoney', a.Id,a.time,a.maxtime,a.mintime
ps.Id as 'PowerStationId', ps.ElectricityMeterAt as 'electricityMeterAt', ps.PowerRate, ps.GeneratingCapacity,
a.SolarHour ,a.Kwh ,a.PR AvgPR, a.KWHKWP AvgKWHKWP,c.Irradiance Irradiance, a.TOTALKWH TotalKWH,
(a.TODAYKWH * PowerRate) 'TodayMoney', a.Id,a.time,a.maxtime,a.mintime, {day1}
FROM power_station ps
LEFT JOIN city ct ON ct.Id = ps.CityId
LEFT JOIN area ar ON ar.Id = ps.AreaId
left JOIN
(
SELECT powerStationid id, ps.SOLARHOUR AS 'SolarHour',ps.TODAYKWH 'Kwh' , PR, KWHKWP, TODAYKWH,
DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d') AS 'time',
MAX(DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d %H:%i')) AS 'maxtime',
MIN(DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d %H:%i')) AS 'mintime', ps.PowerStationId
FROM power_station_history_day ps
WHERE ps.PowerStationId IN @ids {wheretime}
GROUP BY DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d'),ps.PowerStationId
SELECT powerStationid id, ps.SOLARHOUR AS 'SolarHour',ps.TODAYKWH 'Kwh' , PR, KWHKWP, TODAYKWH, TOTALKWH,
DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d') AS 'time',
MAX(DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d %H:%i')) AS 'maxtime',
MIN(DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d %H:%i')) AS 'mintime', ps.PowerStationId
FROM power_station_history_day ps
WHERE ps.PowerStationId IN @ids {wheretime}
GROUP BY ps.PowerStationId
) a ON ps.Id = a.Id
LEFT JOIN
LEFT JOIN
(
SELECT SUM(ps.Irradiance) AS Irradiance , DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d') AS TIME ,ps.PowerStationId
from sensor_history_hour ps
WHERE ps.PowerStationId IN @ids {wheretime}
GROUP BY DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d'),ps.PowerStationId
from sensor_history_day ps
WHERE ps.PowerStationId IN @ids {wheretime}
GROUP BY ps.PowerStationId
) c ON a.Id = c.PowerStationId and a.time = c.time
WHERE ps.Id IN @ids ORDER BY ps.CityId";
result = (await conn.QueryAsync<MaxFormbody>(sql,new { ids = ids}, commandTimeout: 300)).ToList();

View File

@ -271,7 +271,8 @@
<thead>
<tr>
<th>縣市</th>
<th>平均發電量(kWp)</th>
<th>裝置容量</th>
<th>總發電量(kWh)</th>
<th>日均發電度數</th>
</tr>
</thead>
@ -826,7 +827,7 @@
})
str += "<th>小時<br />發電量<br />(kWh)</th>";
str += "<th>小時<br />發電量<br />百分比<br />(%)</th>";
str += "<th>小時<br />平均<br />日照度<br />(W/㎡)</th>";
str += "<th>小時<br />累積<br />日照度<br />(W/㎡)</th>";
str += "<th>小時<br />平均<br />模組<br />溫度<br />(°C)</th>";
if (rel.data.showMoney == 1) {
str += "<th>小時<br />售電<br />金額<br />(NTD)</th>";
@ -844,7 +845,7 @@
str += "<th>日照小時(hr)</th>";
str += "<th>日均發電度數</th>";
str += "<th>PR%</th>";
str += "<th>累積日照量(W/㎡)</th>";
str += "<th>日<br />累積<br />日照度<br />(W/㎡)</th>";
str += "<th>日<br />平均<br />模組溫度<br />(°C)</th>";
if (rel.data.showMoney == 1) {
str += "<th>日<br />售電金額<br />(NTD)</th>";
@ -862,7 +863,7 @@
str += "<th>日照小時(hr)</th>";
str += "<th>日均發電度數</th>";
str += "<th>PR%</th>";
str += "<th>累積日照量(W/㎡)</th>";
str += "<th>日<br />累積<br />日照度<br />(W/㎡)</th>";
str += "<th>日<br />平均<br />模組溫度<br />(°C)</th>";
if (rel.data.showMoney == 1) {
str += "<th>日<br />售電金額<br />(NTD)</th>";
@ -872,9 +873,14 @@
case 2: //綜合比較
str += "<th>區域</th>";
str += "<th>電站名稱</th>";
str += "<th>發電量</th>";
str += "<th>電站類型</th>";
str += "<th>掛錶日期</th>";
str += "<th>裝置容量</th>";
str += "<th>躉售費率</th>";
str += "<th>每kw日均獲利</th>";
str += "<th>日均發電度數</th>";
str += "<th>平均日照</th>";
str += "<th>發電量</th>";
str += "<th>累積日照量</th>";
str += "<th>PR</th>";
if (rel.data.showMoney == 1) {
str += "<th>發電金額</th>";
@ -893,7 +899,7 @@
str += "<th>日照小時(hr)</th>";
str += "<th>日均發電度數</th>";
str += "<th>PR%</th>";
str += "<th>月<br />平均<br />日照度<br />(W/㎡)</th>";
str += "<th>月<br />累積<br />日照度<br />(W/㎡)</th>";
str += "<th>月<br />平均<br />模組溫度<br />(°C)</th>";
if (rel.data.showMoney == 1) {
str += "<th>月<br />售電金額<br />(NTD)</th>";
@ -1012,6 +1018,7 @@
var kWhkwp = 0;
var ntd = 0;
var ntdone = 0;
var averageDailyProfit = 0;
var sta = "";
var GeneratingCapacity = 0;
$.each(rel.data, function (index, inverter) {
@ -1039,6 +1046,7 @@
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;
})
var stc = "<tr>";
/* stc += "<th>" + '日照小時' + "</th>";*/
@ -1049,6 +1057,7 @@
if (showmoney == 1) {
stc += "<th>" + '日售電金額(NTD)' + "</th>";
stc += "<th>" + '日售電單價(NTD)' + "</th>";
stc += "<th>" + '日均獲利(NTD)' + "</th>";
}
stc += "</tr>";
@ -1062,6 +1071,7 @@
if (showmoney == 1) {
stb += "<td>" + toThousands(Math.round(ntd)) + "</td>";
stb += "<td>" + Math.round(ntdone * 10000) / 10000 + "</td>";
stb += "<td>" + toThousands(Math.round(averageDailyProfit)) + "</td>";
}
stb += "</tr>";
@ -1080,6 +1090,7 @@
var monthmoney = 0;
var monthmoneyone = 0;
var monthday = 0;
var averageDailyProfit = 0;
var sta = "";
var check_hire = false;
var sitedb = "";
@ -1117,6 +1128,7 @@
sitedb = inverter.SiteDB
}
GeneratingCapacity = inverter.GeneratingCapacity;
averageDailyProfit = monthmoney / GeneratingCapacity ? Math.round(monthmoney / GeneratingCapacity * 10000) / 10000 : 0;
})
monthday = rel.data.length;
@ -1132,6 +1144,7 @@
stc += "<th>" + '每度獲利' + "</th>";
stc += "<th>" + '售電金額(NTD)(月)' + "</th>";
stc += "<th>" + '售電單價(NTD)(月)' + "</th>";
stc += "<th>" + '日均獲利(NTD)' + "</th>";
}
stc += "<th>" + '售電天數(月)' + "</th>";
stc += "</tr>";
@ -1147,6 +1160,8 @@
stb += "<td>" + 0 + "</td>";
stb += "<td>" + 0 + "</td>";
stb += "<td>" + 0 + "</td>";
stb += "<td>" + 0 + "</td>";
stb += "<td>" + 0 + "</td>";
stb += "</tr>";
}
else {
@ -1159,7 +1174,8 @@
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>" + Math.round(monthmoneyone / monthday * 10000) / 10000 + "</td>";
stb += "<td>" + toThousands(Math.round(averageDailyProfit / monthday)) + "</td>";
}
stb += "<td>" + monthday + "</td>";
stb += "</tr>";
@ -1209,6 +1225,7 @@
var monthmoney = 0;
var monthmoneyone = 0;
var monthday = 0;
var averageDailyProfit = 0;
var sta = "";
var check_hire = false;
var sitedb = "";
@ -1239,6 +1256,7 @@
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) {
check_hire = true;
@ -1257,6 +1275,7 @@
if (showmoney == 1) {
stc += "<th>" + '售電金額(NTD)(年)' + "</th>";
stc += "<th>" + '售電單價(NTD)(年)' + "</th>";
stc += "<th>" + '日均獲利(NTD)' + "</th>";
}
stc += "<th>" + '售電月數(年)' + "</th>";
stc += "</tr>";
@ -1272,6 +1291,7 @@
stb += "<td>" + 0 + "</td>";
stb += "<td>" + 0 + "</td>";
stb += "<td>" + 0 + "</td>";
stb += "<td>" + 0 + "</td>";
stb += "</tr>";
}
else {
@ -1281,7 +1301,8 @@
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>" + Math.round(monthmoneyone / monthday * 10000) / 10000 + "</td>";
stb += "<td>" + toThousands(Math.round((averageDailyProfit / monthday / 30 * 10000) / 10000)) + "</td>";
}
stb += "<td>" + monthday + "</td>";
stb += "</tr>";
@ -1332,6 +1353,7 @@
var monthmoney = 0;
var monthmoneyone = 0;
var monthday = 0;
var averageDailyProfit = 0;
var sta = "";
var check_hire = false;
var sitedb = "";
@ -1369,6 +1391,7 @@
sitedb = inverter.SiteDB
}
GeneratingCapacity = inverter.GeneratingCapacity;
averageDailyProfit = monthmoney / GeneratingCapacity ? Math.round(monthmoney / GeneratingCapacity * 10000) / 10000 : 0;
})
monthday = rel.data.length;
@ -1384,6 +1407,7 @@
stc += "<th>" + '每度獲利' + "</th>";
stc += "<th>" + '售電金額(NTD)(月)' + "</th>";
stc += "<th>" + '售電單價(NTD)(月)' + "</th>";
stc += "<th>" + '日均獲利(NTD)' + "</th>";
}
stc += "<th>" + '售電天數(月)' + "</th>";
stc += "</tr>";
@ -1399,6 +1423,8 @@
stb += "<td>" + 0 + "</td>";
stb += "<td>" + 0 + "</td>";
stb += "<td>" + 0 + "</td>";
stb += "<td>" + 0 + "</td>";
stb += "<td>" + 0 + "</td>";
stb += "</tr>";
}
else {
@ -1412,6 +1438,7 @@
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>" + toThousands(Math.round(averageDailyProfit / monthday)) + "</td>";
}
stb += "<td>" + monthday + "</td>";
stb += "</tr>";
@ -1567,6 +1594,8 @@
kwp: data.kwh,
hour: data.solarHour,
kwhkwp: data.avgKWHKWP,
generatingCapacity: data.generatingCapacity,
totalKWH: data.totalKWH,
count : 1
}
if (CityArray.length == 0) {
@ -1580,7 +1609,9 @@
n.kwp += cityinfo.kwp;
n.hour += cityinfo.hour;
n.count += cityinfo.count;
n.kwhkwp += cityinfo.kwhkwp
n.kwhkwp += cityinfo.kwhkwp;
n.generatingCapacity += cityinfo.generatingCapacity;
n.totalKWH += cityinfo.totalKWH;
npush = false;
}
});
@ -1589,13 +1620,17 @@
}
}
StrInfoBody += "<tr>";
StrInfoBody += "<td>" + data.cityName + data.areaName + "</td>";
StrInfoBody += "<td>" + data.powerstationName + "</td>";
StrInfoBody += "<td>" + data.powerstationType + "</td>";
StrInfoBody += "<td>" + data.electricityMeterAt + "</td>";
StrInfoBody += "<td>" + data.generatingCapacity.toFixed(2) + "</td>";
StrInfoBody += "<td>" + data.powerRate.toFixed(2) + "</td>";
StrInfoBody += "<td>" + toThousands((data.todayMoney / data.generatingCapacity / data.days).toFixed(2)) + "</td>";//每kw日均獲利
StrInfoBody += "<td>" + toThousands(data.avgKWHKWP.toFixed(2)) + "</td>"; // 日均發電度數
StrInfoBody += "<td>" + toThousands(data.kwh.toFixed(2)) + "</td>"; // 發電量
StrInfoBody += "<td>" + toThousands(data.avgKWHKWP.toFixed(2)) + "</td>"; // 有效發電小時
StrInfoBody += "<td>" + toThousands(data.avgIrradiance.toFixed(2)) + "</td>"; // 平均日照
StrInfoBody += "<td>" + toThousands(data.irradiance.toFixed(2)) + "</td>"; // 累積日照
StrInfoBody += "<td>" + toThousands(data.avgPR.toFixed(2)) + "</td>";
if (showmoney == 1) {
@ -1617,8 +1652,9 @@
$.each(CityArray, function (index, data) {
CityInfoBody += "<tr>";
CityInfoBody += "<td>" + data.city + "</td>";
CityInfoBody += "<td>" + toThousands((data.kwp / data.count).toFixed(2)) + "</td>";
CityInfoBody += "<td>" + toThousands((data.kwhkwp / data.count).toFixed(2)) + "</td>";
CityInfoBody += "<td>" + data.generatingCapacity + "</td>";
CityInfoBody += "<td>" + toThousands(data.totalKWH) + "</td>";
CityInfoBody += "<td>" + toThousands((data.totalKWH / data.generatingCapacity).toFixed(2)) + "</td>";
CityInfoBody += "</tr>";
})
//上面