年報表

This commit is contained in:
b110212000 2021-09-11 19:42:53 +08:00
parent b5eaa782e3
commit 4b6b90e412
4 changed files with 397 additions and 33 deletions

View File

@ -514,34 +514,34 @@ namespace SolarPower.Controllers
row = sheet.CreateRow(RowPosition);
cell = row.CreateCell(index);
cell.SetCellValue("日小時平均");
cell.SetCellValue("日照平均(日)");
cell.CellStyle = styleLine12;
index++;
cell = row.CreateCell(index);
cell.SetCellValue("kWH/kWP平均");
cell.SetCellValue("kWH/kWP平均(日)");
cell.CellStyle = styleLine12;
index++;
cell = row.CreateCell(index);
cell.SetCellValue("發電量平均(kWh)");
cell.SetCellValue("發電量平均(kWh)(日)");
cell.CellStyle = styleLine12;
index++;
cell = row.CreateCell(index);
cell.SetCellValue("發電量(kWh)");
cell.SetCellValue("發電量(kWh)(月)");
cell.CellStyle = styleLine12;
index++;
if (Formhead.Result.Data.ShowMoney == 1)
{
cell = row.CreateCell(index);
cell.SetCellValue("售電金額(NTD)");
cell.SetCellValue("售電金額(NTD)(月)");
cell.CellStyle = styleLine12;
index++;
cell = row.CreateCell(index);
cell.SetCellValue("售電單價(NTD)");
cell.SetCellValue("售電單價(NTD)(月)");
cell.CellStyle = styleLine12;
index++;
}
cell = row.CreateCell(index);
cell.SetCellValue("售電天數");
cell.SetCellValue("售電天數(月)");
cell.CellStyle = styleLine12;
@ -639,6 +639,252 @@ namespace SolarPower.Controllers
}
#endregion
break;
case 3: // 年報表
#region head //RowPosition = 0
IRow row3 = sheet.CreateRow(RowPosition);
ICell cell3 = row3.CreateCell(0);
int index3 = 0;
cell3.SetCellValue("Date");
cell3.CellStyle = styleLine12;
sheet.SetColumnWidth(index3, 4 * 160 * 8);
index3++;
foreach (var head in Formhead.Result.Data.Inv)
{
cell3 = row3.CreateCell(index3);
cell3.SetCellValue(head);
cell3.CellStyle = styleLine12;
sheet.SetColumnWidth(index3, 4 * 160 * 8);
index3++;
}
List<string> lasthead3 = new List<string>()
{
"月發電量(kWh)",
"月發電量百分比(%)",
"日照小時(hr)",
"kWH/kWP",
"PR%",
"月平均日照度(W/㎡)",
"月平均模組溫度(°C)"
};
if (Formhead.Result.Data.ShowMoney == 1)
{
lasthead3.Add("月售電金額(NTD)");
}
foreach (var head in lasthead3)
{
cell3 = row3.CreateCell(index3);
cell3.SetCellValue(head);
cell3.CellStyle = styleLine12;
sheet.SetColumnWidth(index3, 4 * 160 * 12);
index3++;
}
#endregion
#region body //RowPosition = 1
RowPosition++;
avghour = "0"; avgKWHKWP = "0"; avgdayKWH = "0"; monthKWH = "0"; monthmoney = "0"; monthmoneyone = "0";
check_hire = false;
sitedb = "";
foreach (dynamic body in Formbody.Result.Data)
{
index3 = 0;
var dbody = body as IDictionary<string, object>;
avghour = (Convert.ToDouble(dbody["tothour"].ToString()) + Convert.ToDouble(avghour)).ToString();
avgKWHKWP = (Convert.ToDouble(dbody["KWHKWP"].ToString()) + Convert.ToDouble(avgKWHKWP)).ToString();
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();
if (dbody["SolarType"].ToString() == "1" && Formhead.Result.Data.ShowMoney == 1)//檢驗是否為租用
{
check_hire = true;
sitedb = dbody["SiteDB"].ToString();
}
row3 = sheet.CreateRow(RowPosition);
cell3 = row3.CreateCell(index3);
var b = dbody["report_date"].ToString();
cell3.SetCellValue(b);
cell3.CellStyle = styleLine12;
index3++;
foreach (var head in Formhead.Result.Data.Inv)
{
cell3 = row3.CreateCell(index3);
cell3.SetCellValue(dbody[head] == null ? 0 : Convert.ToDouble(dbody[head].ToString()));
cell3.CellStyle = styleLine12;
index3++;
}
List<string> bodynames = new List<string>(){
"dayKWH",
"dayKWHp",
"tothour",
"KWHKWP",
"PR",
"irradiance",
"temperature"
};
if (Formhead.Result.Data.ShowMoney == 1)
{
bodynames.Add("soldmoney");
}
foreach (var bodyname in bodynames)
{
cell3 = row3.CreateCell(index3);
if (dbody[bodyname] == null)
{
cell3.SetCellValue(0);
}
else
{
var c = dbody[bodyname].ToString();
cell3.SetCellValue(Convert.ToDouble(c));
}
cell3.CellStyle = styleLine12;
index3++;
}
RowPosition++;
}
#endregion
#region //RowPosition = body + 2
RowPosition += 2;//空兩行
index = 0;
Useday = Formbody.Result.Data.Count;
row = sheet.CreateRow(RowPosition);
cell = row.CreateCell(index);
cell.SetCellValue("日照平均(月)");
cell.CellStyle = styleLine12;
index++;
cell = row.CreateCell(index);
cell.SetCellValue("kWH/kWP平均(月)");
cell.CellStyle = styleLine12;
index++;
cell = row.CreateCell(index);
cell.SetCellValue("發電量平均(kWh)(月)");
cell.CellStyle = styleLine12;
index++;
cell = row.CreateCell(index);
cell.SetCellValue("發電量(kWh)(年)");
cell.CellStyle = styleLine12;
index++;
if (Formhead.Result.Data.ShowMoney == 1)
{
cell = row.CreateCell(index);
cell.SetCellValue("售電金額(NTD)(年)");
cell.CellStyle = styleLine12;
index++;
cell = row.CreateCell(index);
cell.SetCellValue("售電單價(NTD)(年)");
cell.CellStyle = styleLine12;
index++;
}
cell = row.CreateCell(index);
cell.SetCellValue("售電月數(年)");
cell.CellStyle = styleLine12;
index = 0;
RowPosition++;
row = sheet.CreateRow(RowPosition);
cell = row.CreateCell(index);
cell.SetCellValue(Math.Round(Convert.ToDouble(avghour) / Useday, 2));
cell.CellStyle = styleLine12;
index++;
cell = row.CreateCell(index);
cell.SetCellValue(Math.Round(Convert.ToDouble(avgKWHKWP) / Useday, 2));
cell.CellStyle = styleLine12;
index++;
cell = row.CreateCell(index);
cell.SetCellValue(Math.Round(Convert.ToDouble(avgdayKWH) / Useday, 2));
cell.CellStyle = styleLine12;
index++;
cell = row.CreateCell(index);
cell.SetCellValue(Convert.ToDouble(monthKWH));
cell.CellStyle = styleLine12;
index++;
if (Formhead.Result.Data.ShowMoney == 1)
{
cell = row.CreateCell(index);
cell.SetCellValue(Convert.ToDouble(monthmoney));
cell.CellStyle = styleLine12;
index++;
cell = row.CreateCell(index);
cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoneyone) / Useday, 2));
cell.CellStyle = styleLine12;
index++;
}
cell = row.CreateCell(index);
cell.SetCellValue(Useday);
cell.CellStyle = styleLine12;
#endregion
#region //RowPosition = 總量 + 2
if (check_hire == true)
{
RowPosition += 2;//空兩行
PsIdAndSiteDB set = new PsIdAndSiteDB()
{
PowerstationId = Convert.ToInt32(powerstationid.Value),
SiteDB = sitedb
};
var info = GetHireInfo(set);
index = 0;
row = sheet.CreateRow(RowPosition);
cell = row.CreateCell(index);
cell.SetCellValue("出租人");
cell.CellStyle = styleLine12;
index++;
cell = row.CreateCell(index);
cell.SetCellValue("租金比例");
cell.CellStyle = styleLine12;
index++;
cell = row.CreateCell(index);
cell.SetCellValue("租金金額(未稅)");
cell.CellStyle = styleLine12;
index++;
cell = row.CreateCell(index);
cell.SetCellValue("租金金額(含稅)");
cell.CellStyle = styleLine12;
foreach (var a in info.Result.Data)
{
RowPosition++;
index = 0;
row = sheet.CreateRow(RowPosition);
cell = row.CreateCell(index);
cell.SetCellValue(a.Landowner);
cell.CellStyle = styleLine12;
index++;
cell = row.CreateCell(index);
cell.SetCellValue(a.LeaseRate + "%");
cell.CellStyle = styleLine12;
index++;
cell = row.CreateCell(index);
cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoney) * Convert.ToDouble(a.LeaseRate) / 100, 2));
cell.CellStyle = styleLine12;
index++;
cell = row.CreateCell(index);
cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoney) * Convert.ToDouble(a.LeaseRate) / 100 * 1.05, 2));
cell.CellStyle = styleLine12;
index++;
}
}
#endregion
break;
@ -650,11 +896,14 @@ namespace SolarPower.Controllers
{
name = "日";
}
else
else if(postObject.FormType == 1)
{
name = "月";
}
else if (postObject.FormType == 3)
{
name = "年";
}
var ms = new NpoiMemoryStream
{

View File

@ -93,6 +93,11 @@ namespace SolarPower.Models
public double AvgPR { get; set; }
public double AvgKWHKWP { get; set; }
public double TodayMoney { get; set; }
private string mintime;
private string maxtime;
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 class CityArray

View File

@ -204,7 +204,7 @@ namespace SolarPower.Repository.Implement
) INTO @sql
FROM inverter_history_hour where powerstationId = {post.PowerStation};
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'', c.KWHKWP ''KWHKWP'', c.PR,
',b.todayKWH ''dayKWH'', round((b.todayKWH / c.monthKWH)*100,2) ''dayKWHp'', b.SOLARHOUR ''tothour'', b.KWHKWP ''KWHKWP'', c.PR,
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
@ -305,8 +305,8 @@ namespace SolarPower.Repository.Implement
{
0 => $"AND DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d') = '{post.Time}'",
1 => $"AND DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d') BETWEEN '{times[0]}' AND '{times[1]}'",
2 => $"AND DATE_FORMAT(ps.TIMESTAMP,'%Y-%m') = '{post.Time}'",
3 => $"AND DATE_FORMAT(ps.TIMESTAMP,'%Y') = '{post.Time}'",
2 => $"AND DATE_FORMAT(ps.TIMESTAMP,'%Y-%m') = '{post.Time}' AND DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d') != '{DateTime.Now.ToString("yyyy-MM-dd")}'",
3 => $"AND DATE_FORMAT(ps.TIMESTAMP,'%Y') = '{post.Time}' AND DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d') != '{DateTime.Now.ToString("yyyy-MM-dd")}'",
_ => ""
};
string sql = @$"SELECT
@ -322,12 +322,12 @@ namespace SolarPower.Repository.Implement
LEFT JOIN area a ON a.Id = ps.AreaId
left JOIN
(
SELECT a.SolarHour ,a.Kwh ,b.PR AvgPR,b.KWHKWP AvgKWHKWP,c.Irradiance AvgIrradiance,b.TodayMoney as 'TodayMoney',a.Id,a.time FROM
SELECT a.SolarHour ,a.Kwh ,b.PR AvgPR,b.KWHKWP AvgKWHKWP,c.Irradiance AvgIrradiance,b.TodayMoney as 'TodayMoney',a.Id,a.time,a.maxtime,a.mintime FROM
(
SELECT ps.Id,SUM(k.SolarHour) SolarHour,SUM(k.Kwh) Kwh , k.time FROM power_station ps
SELECT ps.Id,SUM(k.SolarHour) SolarHour,SUM(k.Kwh) Kwh , k.time , max(k.maxtime) maxtime ,min(k.mintime) mintime FROM power_station ps
LEFT JOIN
(
SELECT Max(ps.SOLARHOUR) AS 'SolarHour',MAX(ps.TODAYKWH) 'Kwh' ,DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d %H:%i') AS 'time', ps.PowerStationId
SELECT Max(ps.SOLARHOUR) AS 'SolarHour',MAX(ps.TODAYKWH) 'Kwh' ,DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d %H:%i') 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_hour ps
WHERE ps.PowerStationId IN @ids {wheretime}
GROUP BY DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d'),ps.PowerStationId
@ -525,6 +525,53 @@ namespace SolarPower.Repository.Implement
#EXECUTE stmt;
#DEALLOCATE PREPARE stmt;";
}
break;
case 3:
sql = @$"
SET @sql = NULL;
SELECT
GROUP_CONCAT(DISTINCT
CONCAT('max(case when INVERTERID = ''', INVERTERID, ''' then round(a.KWH, 2) end) ''inv_', right(INVERTERID, 4), '''')
) INTO @sql
FROM inverter_history_hour where powerstationId = {post.PowerStation};
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'', c.PR,
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
( # inv
select powerStationid, DATE_FORMAT(TIMESTAMP,''%Y-%m'') report_date, siteid, sitetype,
round(MONTHKWH, 2) todayKWH,round(KWHKWP, 2) KWHKWP, round(PR, 2) PR, ifnull(round(money, 2),0) money, round(SOLARHOUR, 2) SOLARHOUR
from power_station_history_month
where powerstationid = {post.PowerStation} and DATE_FORMAT(TIMESTAMP,''%Y'') = ''{post.Time}''
) b on a.powerStationid = b.powerStationid and DATE_FORMAT(a.TIMESTAMP,''%Y-%m'') = b.report_date
left join
( # month
select powerStationid, DATE_FORMAT(TIMESTAMP,''%Y'') report_date, sitetype, sum(round(monthKWH, 2)) monthKWH , avg(round(KWHKWP, 2)) KWHKWP
, avg(round(PR, 2)) PR, sum(round(money, 2)) money , sum(round(SOLARHOUR, 2)) SOLARHOUR
from power_station_history_month
where powerstationid = {post.PowerStation} and DATE_FORMAT(TIMESTAMP,''%Y'') = ''{post.Time}'' group by DATE_FORMAT(TIMESTAMP,''%Y'')
) c on a.powerStationid = c.powerStationid and DATE_FORMAT(a.TIMESTAMP,''%Y'') = c.report_date
left join
(
select powerStationID, DATE_FORMAT(TIMESTAMP,''%Y-%m'')report_date, irradiance, Temperature
from sensor_history_month
where powerstationid = {post.PowerStation} and DATE_FORMAT(TIMESTAMP,''%Y'') = ''{post.Time}''
) 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}
)z on a.powerstationid = z.id
where DATE_FORMAT(a.TIMESTAMP,''%Y'') = ''{post.Time}''
GROUP BY DATE_FORMAT(a.TIMESTAMP,''%Y-%m'')
order by DATE_FORMAT(a.TIMESTAMP,''%Y-%m'') ');
select @sql as 'mySelect'; #
#PREPARE stmt FROM @sql;
#EXECUTE stmt;
#DEALLOCATE PREPARE stmt;
";
break;
}

View File

@ -207,10 +207,10 @@
</div>
</div>
<div class="pr-3" id="quickSearchOption">
<button type="button" class="btn btn-primary waves-effect waves-themed ml-1" onclick="Dateform(0)" id="daybtn">日報表</button>
<button type="button" class="btn btn-primary waves-effect waves-themed ml-1" onclick="Dateform(1)" id="monthbtn">月報表</button>
<button type="button" class="btn btn-primary waves-effect waves-themed ml-1" onclick="Dateform(3)" id="year2btn">年報表</button>
<button type="button" class="btn btn-primary waves-effect waves-themed ml-1" onclick="Dateform(2)" id="yearbtn">綜合報表</button>
<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(2,this)" id="yearbtn">綜合報表</button>
</div>
</div>
<div class="mb-3 d-flex justify-content-start">
@ -319,9 +319,10 @@
$('#monthbtn').hide();
$('#yearbtn').show();
$('#daybtn').show();
document.getElementById("monthbtn").disabled = true;//月報表鎖定
document.getElementById("yearbtn").disabled = false;//綜合報表鎖定
document.getElementById("daybtn").disabled = false;//日報表鎖定
$('#year2btn').hide();
//document.getElementById("monthbtn").disabled = true;//月報表鎖定
//document.getElementById("yearbtn").disabled = false;//綜合報表鎖定
//document.getElementById("daybtn").disabled = false;//日報表鎖定
//#endregion
//#region 載入左邊選單列表
@ -335,9 +336,10 @@
if ($(".btn-change-searchType").hasClass("btn-success")) {
$(".btn-change-searchType").removeClass("btn-success").addClass("btn-secondary");
}
$(e).removeClass("btn-secondary").addClass("btn-success");
document.getElementById("DateGettextdiv").style.display = "none";//隱藏
document.getElementById("DateGet").style.display = "";//隱藏
$(e).removeClass("btn-secondary").addClass("btn-success");
switch (type) {
case 0: $('#DateGet').prop({ 'type': 'date' });
$(".btn-change-quickSearch1").html("昨天");
@ -347,6 +349,7 @@
$('#monthbtn').hide();
$('#yearbtn').show();
$('#daybtn').show();
$('#year2btn').hide();
@*document.getElementById("monthbtn").disabled = true;//月報表鎖定
document.getElementById("yearbtn").disabled = false;//綜合報表鎖定
document.getElementById("daybtn").disabled = false;//日報表鎖定*@
@ -387,6 +390,7 @@
$('#daybtn').hide();
$('#monthbtn').show();
$('#yearbtn').show();
$('#year2btn').hide();
@*document.getElementById("daybtn").disabled = true;//日報表鎖定
document.getElementById("monthbtn").disabled = false;//月報表鎖定
document.getElementById("yearbtn").disabled = false;//綜合報表鎖定*@
@ -399,6 +403,7 @@
$('#daybtn').hide();
$('#monthbtn').show();
$('#yearbtn').show();
$('#year2btn').hide();
@*document.getElementById("daybtn").disabled = true;//日報表鎖定
document.getElementById("monthbtn").disabled = false;//月報表鎖定
document.getElementById("yearbtn").disabled = false;//綜合報表鎖定*@
@ -412,6 +417,7 @@
$('#daybtn').hide();
$('#monthbtn').hide();
$('#yearbtn').show();
$('#year2btn').show();
@*document.getElementById("daybtn").disabled = true;//日報表鎖定
document.getElementById("monthbtn").disabled = true;//月報表鎖定
document.getElementById("yearbtn").disabled = false;//綜合報表鎖定*@
@ -702,7 +708,7 @@
$("#daybtn").attr("disabled", true);
$("#monthbtn").attr("disabled", true);
$("#yearbtn").attr("disabled", true);
$("#year2btn").attr('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>', true);
$("#year2btn").html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>').attr("disabled", true);
$(".btn-station").attr("disabled", true);
break;
}
@ -798,6 +804,23 @@
str += "<th>省電費用</th>";
}
break;
case 3:
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>kWH/kWP</th>";
str += "<th>PR%</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>";
}
break;
}
str += "</tr>";
$('#TableHead').append(str);
@ -809,7 +832,15 @@
}, 'json');
}
function Dateform(form) {
function Dateform(form,e) {
if ($(".btn-report").hasClass("btn-success")) {
$(".btn-report").removeClass("btn-success").addClass("btn-primary");
}
$(e).removeClass("btn-primary").addClass("btn-success");
$('#hiretable').hide();
$('#maxtable').hide();
tablehand(form);
@ -1104,15 +1135,15 @@
var stc = "<tr>";
stc += "<th>" + '日照平均()' + "</th>";
stc += "<th>" + 'kWH/kWP()' + "</th>";
stc += "<th>" + '發電量平均(kWh)()' + "</th>";
stc += "<th>" + '發電量(kWh)()' + "</th>";
stc += "<th>" + '日照平均()' + "</th>";
stc += "<th>" + 'kWH/kWP()' + "</th>";
stc += "<th>" + '發電量平均(kWh)()' + "</th>";
stc += "<th>" + '發電量(kWh)()' + "</th>";
if (showmoney == 1) {
stc += "<th>" + '售電金額(NTD)()' + "</th>";
stc += "<th>" + '售電單價(NTD)()' + "</th>";
stc += "<th>" + '售電金額(NTD)()' + "</th>";
stc += "<th>" + '售電單價(NTD)()' + "</th>";
}
stc += "<th>" + '售電天數(月)' + "</th>";
stc += "<th>" + '售電月數(年)' + "</th>";
stc += "</tr>";
@ -1228,8 +1259,32 @@
toast_warning(rel.msg);
return;
}
$("#daybtn").attr("disabled", false);
$("#monthbtn").attr("disabled", false);
$("#yearbtn").html('綜合報表').attr("disabled", false);
$("#year2btn").attr("disabled", false);
$(".btn-station").attr("disabled", false);
var maxtime = "";
var mintime = "";
//下方
$.each(rel.data, function (index, data) {
if (maxtime == "") {
maxtime = data.maxtime;
}
if (mintime == "") {
mintime = data.mintime;
}
if (Date.parse(data.maxtime).valueOf() > Date.parse(maxtime).valueOf())
{
maxtime = data.maxtime;
}
if (Date.parse(data.mintime).valueOf() < Date.parse(mintime).valueOf()) {
mintime = data.mintime;
}
var hirerate = 0;
if (data.powerstationType == 1)
{
@ -1302,7 +1357,15 @@
//#endregion
//#region TotalBody
TotalBody += "<tr>";
TotalBody += "<th>" + timerange + "</th>";
if (searchType == 0) {
TotalBody += "<th>" + maxtime + "</th>";
}
else {
TotalBody += "<th>" + mintime + "-" + maxtime + "</th>";
}
TotalBody += "<th>" + kwp.toFixed(2) + "</th>";
TotalBody += "<th>" + (kwhkwp / rel.data.length).toFixed(2) + "</th>";
TotalBody += "</tr>";