名詞修改: 綜合報表=> 綜合比較、區間報表新增一個type

This commit is contained in:
wanling040@gmail.com 2022-07-25 18:32:26 +08:00
parent 9a9b4f0d77
commit fc968f85be
3 changed files with 266 additions and 93 deletions

View File

@ -1609,7 +1609,7 @@ namespace SolarPower.Controllers
};
var Formhead = GetTableHead(select_Table);//取head
var sheet = workbook.CreateSheet("綜合報表");
var sheet = workbook.CreateSheet("綜合比較");
int RowPosition = 0;
int index = 0;
var citycount = Formbody.Result.Data.GroupBy(a => a.CityName).Count();
@ -1897,7 +1897,7 @@ namespace SolarPower.Controllers
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", "FIC太陽能監控平台" + "_" + "綜合比較" + "_" + postObject.Userid + Datename + ".xlsx");
}
public string ExportExcelmaxtableBackDownload(string post)
@ -1956,7 +1956,7 @@ namespace SolarPower.Controllers
};
var Formhead = GetTableHead(select_Table);//取head
var sheet = workbook.CreateSheet("綜合報表");
var sheet = workbook.CreateSheet("綜合比較");
int RowPosition = 0;
int index = 0;
var citycount = Formbody.Result.Data.GroupBy(a => a.CityName).Count();
@ -2244,12 +2244,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太陽能監控平台" + "_" + "綜合報表" + "_" + postObject.Userid + Datename + ".xlsx");
var n = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "report", Datename, "FIC太陽能監控平台" + "_" + "綜合比較" + "_" + 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, "FIC太陽能監控平台" + "_" + "綜合比較" + "_" + postObject.Userid + Datename + ".xlsx");
}
public async Task<ApiResult<List<string>>> CheckExcel(Select_table2 post)

View File

@ -316,7 +316,7 @@ namespace SolarPower.Repository.Implement
}
/// <summary>
/// 綜合報表
/// 綜合比較
/// </summary>
/// <param name="post"></param>
/// <returns></returns>
@ -482,8 +482,6 @@ namespace SolarPower.Repository.Implement
#DEALLOCATE PREPARE stmt;";
break;
case 1:
if (post.SearchType == 2)
{
sql = @$"
SET @sql = NULL;
SELECT
@ -527,56 +525,7 @@ namespace SolarPower.Repository.Implement
#PREPARE stmt FROM @sql;
#EXECUTE stmt;
#DEALLOCATE PREPARE stmt;";
}
else
{
var times = post.Time.Replace('-', 'a').Replace('/', '-').Replace(" ", "").Split('a');
sql = @$"SET @sql = NULL;
SELECT
GROUP_CONCAT(DISTINCT
CONCAT('max(case when INVERTERID = ''', INVERTERID, ''' then round(a.KWH, 2) end) ''inv_', right(INVERTERID, 2), '''')
) INTO @sql
FROM inverter_history_day where powerstationId = {post.PowerStation} and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') BETWEEN '{times[0]}' AND '{times[1]}';
SET @sql = CONCAT('SELECT DATE_FORMAT(a.TIMESTAMP,''%m/%d'') report_date, ', @sql,
',b.TODAYKWH ''dayKWH'', round((b.TODAYKWH / c.monthKWH)*100,2) ''dayKWHp'', b.SOLARHOUR ''tothour'', b.KWHKWP ''KWHKWP'', b.PR,
d.irradiance ''irradiance'', d.Temperature ''temperature'', b.money ''soldmoney'',
c.monthKWH ''monthKWH'', c.money ''monthmoney'', stationName, powerRate ''monthmoneyone'',SolarType,SiteDB
FROM inverter_history_day a left join
( # inv
select powerStationid, DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'') report_date, siteid, sitetype, #, round(KWH, 2) KWH,
round(todayKWH, 2) todayKWH,round(KWHKWP, 2) KWHKWP, round(PR, 2) PR, ifnull(round(money, 2),0) money, round(SOLARHOUR, 2) SOLARHOUR
from power_station_history_day
where powerstationid = {post.PowerStation} and DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'') BETWEEN ''{times[0]}'' AND ''{times[1]}''
) b on a.powerStationid = b.powerStationid and DATE_FORMAT(a.TIMESTAMP,''%Y-%m-%d'') = b.report_date
left join
( # month
SELECT powerStationid, ROUND(AVG(TODAYKWH),2) AS monthKWH,
ROUND(AVG(KWHKWP),2) AS KWHKWP,
ROUND(AVG(PR),2) AS PR,
ROUND(SUM(MONEY),2) AS money,
ROUND(SUM(SOLARHOUR),2) AS SOLARHOUR
FROM power_station_history_day where powerstationid = {post.PowerStation} and DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'') BETWEEN ''{times[0]}'' AND ''{times[1]}''
) c on a.powerStationid = c.powerStationid
left join
(
select powerStationID, DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'')report_date, irradiance, Temperature
from sensor_history_day
where powerstationid = {post.PowerStation} and DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'') BETWEEN ''{times[0]}'' AND ''{times[1]}''
) d on a.powerStationid = d.powerStationid and DATE_FORMAT(a.TIMESTAMP,''%Y-%m-%d'') = d.report_date
join
(
select id, name stationName, powerRate, SolarType, SiteDB from power_station where id = {post.PowerStation}
)z on a.powerstationid = z.id
where DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'') BETWEEN ''{times[0]}'' AND ''{times[1]}''
GROUP BY DATE_FORMAT(a.TIMESTAMP,''%Y-%m-%d'')
order by DATE_FORMAT(a.TIMESTAMP,''%Y-%m-%d'') ');
select @sql as 'mySelect'; #
#PREPARE stmt FROM @sql;
#EXECUTE stmt;
#DEALLOCATE PREPARE stmt;";
}
break;
case 3:
sql = @$"
@ -626,6 +575,54 @@ namespace SolarPower.Repository.Implement
";
break;
case 4:
var times = post.Time.Replace('-', 'a').Replace('/', '-').Replace(" ", "").Split('a');
sql = @$"SET @sql = NULL;
SELECT
GROUP_CONCAT(DISTINCT
CONCAT('max(case when INVERTERID = ''', INVERTERID, ''' then round(a.KWH, 2) end) ''inv_', right(INVERTERID, 2), '''')
) INTO @sql
FROM inverter_history_day where powerstationId = {post.PowerStation} and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') BETWEEN '{times[0]}' AND '{times[1]}';
SET @sql = CONCAT('SELECT DATE_FORMAT(a.TIMESTAMP,''%m/%d'') report_date, ', @sql,
',b.TODAYKWH ''dayKWH'', round((b.TODAYKWH / c.monthKWH)*100,2) ''dayKWHp'', b.SOLARHOUR ''tothour'', b.KWHKWP ''KWHKWP'', b.PR,
d.irradiance ''irradiance'', d.Temperature ''temperature'', b.money ''soldmoney'',
c.monthKWH ''monthKWH'', c.money ''monthmoney'', stationName, powerRate ''monthmoneyone'',SolarType,SiteDB
FROM inverter_history_day a left join
( # inv
select powerStationid, DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'') report_date, siteid, sitetype, #, round(KWH, 2) KWH,
round(todayKWH, 2) todayKWH,round(KWHKWP, 2) KWHKWP, round(PR, 2) PR, ifnull(round(money, 2),0) money, round(SOLARHOUR, 2) SOLARHOUR
from power_station_history_day
where powerstationid = {post.PowerStation} and DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'') BETWEEN ''{times[0]}'' AND ''{times[1]}''
) b on a.powerStationid = b.powerStationid and DATE_FORMAT(a.TIMESTAMP,''%Y-%m-%d'') = b.report_date
left join
( # month
SELECT powerStationid, ROUND(AVG(TODAYKWH),2) AS monthKWH,
ROUND(AVG(KWHKWP),2) AS KWHKWP,
ROUND(AVG(PR),2) AS PR,
ROUND(SUM(MONEY),2) AS money,
ROUND(SUM(SOLARHOUR),2) AS SOLARHOUR
FROM power_station_history_day where powerstationid = {post.PowerStation} and DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'') BETWEEN ''{times[0]}'' AND ''{times[1]}''
) c on a.powerStationid = c.powerStationid
left join
(
select powerStationID, DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'')report_date, irradiance, Temperature
from sensor_history_day
where powerstationid = {post.PowerStation} and DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'') BETWEEN ''{times[0]}'' AND ''{times[1]}''
) d on a.powerStationid = d.powerStationid and DATE_FORMAT(a.TIMESTAMP,''%Y-%m-%d'') = d.report_date
join
(
select id, name stationName, powerRate, SolarType, SiteDB from power_station where id = {post.PowerStation}
)z on a.powerstationid = z.id
where DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'') BETWEEN ''{times[0]}'' AND ''{times[1]}''
GROUP BY DATE_FORMAT(a.TIMESTAMP,''%Y-%m-%d'')
order by DATE_FORMAT(a.TIMESTAMP,''%Y-%m-%d'') ');
select @sql as 'mySelect'; #
#PREPARE stmt FROM @sql;
#EXECUTE stmt;
#DEALLOCATE PREPARE stmt;";
break;
}
a = await conn.QueryAsync<dynamic>(sql,commandTimeout: 300);
}

View File

@ -6,16 +6,8 @@
@using SolarPower.Models.Role
@model RoleLayerEnum
<link rel="stylesheet" href="~/css/loading.css" />
<div class="loadEffect" id="loading" style="top: 10%;">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<div class="d-flex justify-content-center text-secondary" style="top: 10%; transform: translateY(50%); z-index: 100; position: relative;">
<div class="spinner-border" role="status" style="width: 3rem; height: 3rem; display:none;" id="loading"></div>
</div>
<div class="container-fluid">
@ -222,8 +214,8 @@
<button type="button" class="btn btn-primary waves-effect waves-themed ml-1 btn-report" onclick="Dateform(0,this)" id="daybtn">日報表</button>
<button type="button" class="btn btn-primary waves-effect waves-themed ml-1 btn-report" onclick="Dateform(1,this)" id="monthbtn">月報表</button>
<button type="button" class="btn btn-primary waves-effect waves-themed ml-1 btn-report" onclick="Dateform(3,this)" id="year2btn">年報表</button>
<button type="button" class="btn btn-primary waves-effect waves-themed ml-1 btn-report" onclick="Dateform(1,this)" id="intervalbtn">區間報表</button>
<button type="button" class="btn btn-primary waves-effect waves-themed ml-1 btn-report" onclick="Dateform(2,this)" id="yearbtn">綜合報表</button>
<button type="button" class="btn btn-primary waves-effect waves-themed ml-1 btn-report" onclick="Dateform(4,this)" id="intervalbtn">區間報表</button>
<button type="button" class="btn btn-primary waves-effect waves-themed ml-1 btn-report" onclick="Dateform(2,this)" id="yearbtn">綜合比較</button>
</div>
</div>
<div class="mb-3 d-flex justify-content-start">
@ -354,7 +346,7 @@
$('#year2btn').hide();
$('#intervalbtn').hide();
//document.getElementById("monthbtn").disabled = true;//月報表鎖定
//document.getElementById("yearbtn").disabled = false;//綜合報表鎖定
//document.getElementById("yearbtn").disabled = false;//綜合比較鎖定
//document.getElementById("daybtn").disabled = false;//日報表鎖定
//#endregion
@ -372,7 +364,7 @@
$(e).removeClass("btn-secondary").addClass("btn-success");
document.getElementById("DateGettextdiv").style.display = "none";//隱藏
document.getElementById("DateGet").style.display = "";//隱藏
switch (type) {
case 0: $('#DateGet').prop({ 'type': 'date' });
$(".btn-change-quickSearch1").html("昨天");
@ -385,11 +377,10 @@
$('#year2btn').hide();
$('#intervalbtn').hide();
@*document.getElementById("monthbtn").disabled = true;//月報表鎖定
document.getElementById("yearbtn").disabled = false;//綜合報表鎖定
document.getElementById("yearbtn").disabled = false;//綜合比較鎖定
document.getElementById("daybtn").disabled = false;//日報表鎖定*@
break;
case 1:
//#region Date-Picker
datepicker = $('#DateGettext').daterangepicker({
autoUpdateInput: false,
@ -428,7 +419,7 @@
$('#intervalbtn').show();
@*document.getElementById("daybtn").disabled = true;//日報表鎖定
document.getElementById("monthbtn").disabled = false;//月報表鎖定
document.getElementById("yearbtn").disabled = false;//綜合報表鎖定*@
document.getElementById("yearbtn").disabled = false;//綜合比較鎖定*@
break;
case 2: $('#DateGet').prop({ 'type': 'month' });
$(".btn-change-quickSearch1").html("本月");
@ -442,7 +433,7 @@
$('#intervalbtn').hide();
@*document.getElementById("daybtn").disabled = true;//日報表鎖定
document.getElementById("monthbtn").disabled = false;//月報表鎖定
document.getElementById("yearbtn").disabled = false;//綜合報表鎖定*@
document.getElementById("yearbtn").disabled = false;//綜合比較鎖定*@
break;
case 3:
$(".btn-change-quickSearch1").html("今年");
@ -457,7 +448,7 @@
$('#intervalbtn').hide();
@*document.getElementById("daybtn").disabled = true;//日報表鎖定
document.getElementById("monthbtn").disabled = true;//月報表鎖定
document.getElementById("yearbtn").disabled = false;//綜合報表鎖定*@
document.getElementById("yearbtn").disabled = false;//綜合比較鎖定*@
break;
}
if (type == 1) {
@ -483,6 +474,7 @@
}
break;
case 1:
case 4://區間
if (day == 0) {
//#region 預設近7天
var today = new Date(new Date().setDate(new Date().getDate() - 1));
@ -728,6 +720,7 @@
$("#yearbtn").attr("disabled", true);
$("#year2btn").attr("disabled", true);
$(".btn-station").attr("disabled", true);
$("#intervalbtn").attr("disabled", true);
break;
case 1:
$("#daybtn").attr("disabled", true);
@ -735,6 +728,7 @@
$("#yearbtn").attr("disabled", true);
$("#year2btn").attr("disabled", true);
$(".btn-station").attr("disabled", true);
$("#intervalbtn").attr("disabled", true);
break;
case 2:
$("#daybtn").attr("disabled", true);
@ -742,6 +736,7 @@
$("#yearbtn").html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>').attr("disabled", true);
$("#year2btn").attr("disabled", true);
$(".btn-station").attr("disabled", true);
$("#intervalbtn").attr("disabled", true);
break;
case 3:
$("#daybtn").attr("disabled", true);
@ -749,6 +744,15 @@
$("#yearbtn").attr("disabled", true);
$("#year2btn").html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>').attr("disabled", true);
$(".btn-station").attr("disabled", true);
$("#intervalbtn").attr("disabled", true);
break;
case 4:
$("#daybtn").attr("disabled", true);
$("#monthbtn").attr("disabled", true);
$("#yearbtn").attr("disabled", true);
$("#year2btn").attr("disabled", true);
$(".btn-station").attr("disabled", true);
$("#intervalbtn").html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>').attr("disabled", true);
break;
}
@ -766,6 +770,7 @@
$("#yearbtn").attr("disabled", false);
$("#year2btn").attr("disabled", false);
$(".btn-station").attr("disabled", false);
$("#intervalbtn").attr("disabled", false);
break;
case 1:
$("#daybtn").attr("disabled", false);
@ -773,13 +778,15 @@
$("#yearbtn").attr("disabled", false);
$("#year2btn").attr("disabled", false);
$(".btn-station").attr("disabled", false);
$("#intervalbtn").attr("disabled", false);
break;
case 2:
$("#daybtn").attr("disabled", false);
$("#monthbtn").attr("disabled", false);
$("#yearbtn").html('綜合報表').attr("disabled", false);
$("#yearbtn").html('綜合比較').attr("disabled", false);
$("#year2btn").attr("disabled", false);
$(".btn-station").attr("disabled", false);
$("#intervalbtn").attr("disabled", false);
break;
case 3:
$("#daybtn").attr("disabled", false);
@ -787,11 +794,20 @@
$("#yearbtn").attr("disabled", false);
$("#year2btn").html('年報表').attr("disabled", false);
$(".btn-station").attr("disabled", false);
$("#intervalbtn").attr("disabled", false);
break;
}
case 4:
$("#daybtn").attr("disabled", false);
$("#monthbtn").attr("disabled", false);
$("#yearbtn").attr("disabled", false);
$("#year2btn").attr("disabled", false);
$(".btn-station").attr("disabled", false);
$("#intervalbtn").html('區間報表').attr("disabled", false);
break;
}
return;
}
$('#TableHead').empty();
var str = "<tr>";
@ -828,7 +844,7 @@
str += "<th>日<br />售電金額<br />(NTD)</th>";
}
break;
case 2: //綜合報表
case 2: //綜合比較
str += "<th>區域</th>";
str += "<th>電站名稱</th>";
str += "<th>發電量</th>";
@ -858,15 +874,32 @@
str += "<th>月<br />售電金額<br />(NTD)</th>";
}
break;
case 4: // 區間報
str += "<th>Date</th>";
$.each(rel.data.inv, function (index, inverter) {
haveinvertName.push(inverter);
str += "<th>" + inverter + "</th>";
})
str += "<th>日<br />發電量<br />(kWh)</th>";
str += "<th>日<br />發電量<br />百分比<br />(%)</th>";
str += "<th>日照小時(hr)</th>";
str += "<th>日均發電度數</th>";
str += "<th>PR%</th>";
str += "<th>累積日照量(W/㎡)</th>";
str += "<th>日<br />平均<br />模組溫度<br />(°C)</th>";
if (rel.data.showMoney == 1) {
str += "<th>日<br />售電金額<br />(NTD)</th>";
}
break;
}
str += "</tr>";
$('#TableHead').append(str);
if (form != 2) {
// 日月年 報
tablebody(form, rel.data.showMoney);
} else {
//綜合報表
//綜合比較
maxtableinfobody(rel.data.showMoney);
}
hideLoading();
@ -909,6 +942,7 @@
$("#yearbtn").attr("disabled", false);
$("#year2btn").attr("disabled", false);
$(".btn-station").attr("disabled", false);
$("#intervalbtn").attr("disabled", false);
break;
case 1:
$("#daybtn").attr("disabled", false);
@ -916,13 +950,15 @@
$("#yearbtn").attr("disabled", false);
$("#year2btn").attr("disabled", false);
$(".btn-station").attr("disabled", false);
$("#intervalbtn").attr("disabled", false);
break;
case 2:
$("#daybtn").attr("disabled", false);
$("#monthbtn").attr("disabled", false);
$("#yearbtn").html('綜合報表').attr("disabled", false);
$("#yearbtn").html('綜合比較').attr("disabled", false);
$("#year2btn").attr("disabled", false);
$(".btn-station").attr("disabled", false);
$("#intervalbtn").attr("disabled", false);
break;
case 3:
$("#daybtn").attr("disabled", false);
@ -930,6 +966,15 @@
$("#yearbtn").attr("disabled", false);
$("#year2btn").html('年報表').attr("disabled", false);
$(".btn-station").attr("disabled", false);
$("#intervalbtn").attr("disabled", false);
break;
case 4:
$("#daybtn").attr("disabled", false);
$("#monthbtn").attr("disabled", false);
$("#yearbtn").attr("disabled", false);
$("#year2btn").attr("disabled", false);
$(".btn-station").attr("disabled", false);
$("#intervalbtn").html('區間報表').attr("disabled", false);
break;
}
@ -947,7 +992,7 @@
}
//var sta = "";
$('#totbody').empty();
$('#tothead').empty();
if (form == 0) {//日報表
@ -1072,7 +1117,7 @@
stc += "<th>" + '發電量平均(kWh)(日)' + "</th>";
stc += "<th>" + '發電量(kWh)(月)' + "</th>";
stc += "<th>" + '裝置容量' + "</th>";
if (showmoney == 1) {
stc += "<th>" + '每度獲利' + "</th>";
stc += "<th>" + '售電金額(NTD)(月)' + "</th>";
@ -1100,7 +1145,7 @@
stb += "<td>" + toThousands((avgdayKWH / monthday).toFixed(2)) + "</td>";
stb += "<td>" + toThousands(monthKWH) + "</td>";
stb += "<td>" + toThousands(GeneratingCapacity) + "</td>";
if (showmoney == 1) {
stb += "<td>" + toThousands((monthmoney / GeneratingCapacity).toFixed(3)) + "</td>";
stb += "<td>" + toThousands(Math.round(monthmoney)) + "</td>";
@ -1117,6 +1162,7 @@
PowerstationId: nowpowerstation
}
$('#HireTableBody').empty();
showLoading();
var posturl = "/StationReport/GetHireInfo";
$.post(posturl, dataTosent, function (rel) {
if (rel.code != "0000") {
@ -1238,6 +1284,7 @@
PowerstationId: nowpowerstation
}
$('#HireTableBody').empty();
showLoading();
var posturl = "/StationReport/GetHireInfo";
$.post(posturl, dataTosent, function (rel) {
if (rel.code != "0000") {
@ -1267,6 +1314,135 @@
haveinvertName = [];
}
else if (form == 4) {//區間報表
var avghour = 0;
var avgKWHKWP = 0;
var avgdayKWH = 0;
var monthKWH = 0;
var monthmoney = 0;
var monthmoneyone = 0;
var monthday = 0;
var sta = "";
var check_hire = false;
var sitedb = "";
var GeneratingCapacity = 0;
$.each(rel.data, function (index, inverter) {
sta += "<tr>";
sta += "<td>" + inverter.report_date + "</td>";
$.each(haveinvertName, function (item, i) {
if (inverter[i] == null) {
sta += "<td>" + 0 + "</td>";
} else {
sta += "<td>" + toThousands(inverter[i]) + "</td>";
}
});
sta += "<td>" + toThousands(inverter.dayKWH) + "</td>";
sta += "<td>" + ((inverter.dayKWHp == null) ? 0 : toThousands(inverter.dayKWHp)) + "</td>";
sta += "<td>" + inverter.tothour + "</td>";
sta += "<td>" + toThousands(inverter.KWHKWP) + "</td>";
sta += "<td>" + ((inverter.PR == null) ? 0 : toThousands(inverter.PR.toFixed(2))) + "</td>";
sta += "<td>" + ((inverter.IrrDay == null) ? 0 : toThousands(inverter.IrrDay)) + "</td>";
sta += "<td>" + inverter.temperature + "</td>";
if (showmoney == 1) {
sta += "<td>" + toThousands(Math.round(inverter.soldmoney)) + "</td>";
}
sta += "</tr>";
avghour += inverter.tothour ? inverter.tothour : 0;
avgKWHKWP += inverter.KWHKWP ? inverter.KWHKWP : 0;
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;
sitedb = inverter.SiteDB
}
GeneratingCapacity = inverter.GeneratingCapacity;
})
monthday = rel.data.length;
var stc = "<tr>";
/*stc += "<th>" + '日照平均(日)' + "</th>";*/
stc += "<th>" + '日均發電度數(日)' + "</th>";
stc += "<th>" + '發電量平均(kWh)(日)' + "</th>";
stc += "<th>" + '發電量(kWh)(月)' + "</th>";
stc += "<th>" + '裝置容量' + "</th>";
if (showmoney == 1) {
stc += "<th>" + '每度獲利' + "</th>";
stc += "<th>" + '售電金額(NTD)(月)' + "</th>";
stc += "<th>" + '售電單價(NTD)(月)' + "</th>";
}
stc += "<th>" + '售電天數(月)' + "</th>";
stc += "</tr>";
var stb = "<tr>";
if (monthday == 0) {
stb += "<td>" + 0 + "</td>";
stb += "<td>" + 0 + "</td>";
stb += "<td>" + 0 + "</td>";
stb += "<td>" + 0 + "</td>";
stb += "<td>" + 0 + "</td>";
stb += "<td>" + 0 + "</td>";
stb += "<td>" + 0 + "</td>";
stb += "</tr>";
}
else {
/*stb += "<td>" + (avghour / monthday).toFixed(2) + "</td>";*/
stb += "<td>" + toThousands((avgKWHKWP / monthday).toFixed(2)) + "</td>";
stb += "<td>" + toThousands((avgdayKWH / monthday).toFixed(2)) + "</td>";
stb += "<td>" + toThousands(monthKWH) + "</td>";
stb += "<td>" + toThousands(GeneratingCapacity) + "</td>";
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>" + monthday + "</td>";
stb += "</tr>";
}
var std = "";
if (check_hire == true && showmoney == 1) {
var dataTosent =
{
Sitedb: sitedb,
PowerstationId: nowpowerstation
}
$('#HireTableBody').empty();
showLoading();
var posturl = "/StationReport/GetHireInfo";
$.post(posturl, dataTosent, function (rel) {
if (rel.code != "0000") {
hideLoading();
toast_error(rel.data.msg);
return;
}
$.each(rel.data, function (index, value) {
std += "<tr>";
std += "<td>" + value.landowner + "</td>";
std += "<td>" + value.leaseRate + "%" + "</td>";
std += "<td>" + toThousands(Math.round(monthmoney * value.leaseRate / 100)) + "</td>";
std += "<td>" + toThousands(Math.round(monthmoney * value.leaseRate / 100 * 1.05)) + "</td>";
std += "</tr>";
})
$('#HireTableBody').append(std);
$('#hiretable').show();
})
}
$('#TableBody').empty();
$('#TableBody').append(sta);
$('#totbody').append(stb);
$('#tothead').append(stc);
haveinvertName = [];
}
$('#overviewtable').show();
$('#detailtable').show();
@ -1322,7 +1498,7 @@
}
}
}
// 綜合報表
// 綜合比較
function maxtableinfobody(showmoney)
{
var send_data =
@ -1349,7 +1525,7 @@
}
$("#daybtn").attr("disabled", false);
$("#monthbtn").attr("disabled", false);
$("#yearbtn").html('綜合報表').attr("disabled", false);
$("#yearbtn").html('綜合比較').attr("disabled", false);
$("#year2btn").attr("disabled", false);
$(".btn-station").attr("disabled", false);
var maxtime = "";
@ -1412,7 +1588,7 @@
StrInfoBody += "<td>" + toThousands(data.avgIrradiance.toFixed(2)) + "</td>"; // 平均日照
StrInfoBody += "<td>" + toThousands(data.avgPR.toFixed(2)) + "</td>";
if (showmoney == 1) {
StrInfoBody += "<td>" + toThousands(Math.round(data.todayMoney)) + "</td>";
StrInfoBody += "<td>" + Math.round(data.todayMoney * hirerate * 0.01)+ "</td>";
@ -1453,7 +1629,7 @@
}
TotalBody += "<th>" + toThousands(kwp.toFixed(2)) + "</th>";
TotalBody += "<th>" + toThousands((kwhkwp / rel.data.length).toFixed(2)) + "</th>";
TotalBody += "</tr>";
@ -1472,7 +1648,7 @@
$('#overviewtable').show();
$('#detailtable').show();
nowform = 2;
$('#all').show();
hideLoading();
@ -1506,6 +1682,6 @@
return hirerate;
}
</script>
}