From 4b6b90e4129f9ff1cf2b00bcce3c017b7c89b522 Mon Sep 17 00:00:00 2001 From: b110212000 Date: Sat, 11 Sep 2021 19:42:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B4=E5=A0=B1=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/StationReportController.cs | 267 +++++++++++++++++- SolarPower/Models/StationReport.cs | 5 + .../Implement/StationReportRepository.cs | 59 +++- SolarPower/Views/StationReport/Index.cshtml | 99 +++++-- 4 files changed, 397 insertions(+), 33 deletions(-) diff --git a/SolarPower/Controllers/StationReportController.cs b/SolarPower/Controllers/StationReportController.cs index 53934b0..ec4be5e 100644 --- a/SolarPower/Controllers/StationReportController.cs +++ b/SolarPower/Controllers/StationReportController.cs @@ -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 lasthead3 = new List() + { + "月發電量(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; + + 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 bodynames = new List(){ + "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 { diff --git a/SolarPower/Models/StationReport.cs b/SolarPower/Models/StationReport.cs index 22a962c..f540ad3 100644 --- a/SolarPower/Models/StationReport.cs +++ b/SolarPower/Models/StationReport.cs @@ -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 diff --git a/SolarPower/Repository/Implement/StationReportRepository.cs b/SolarPower/Repository/Implement/StationReportRepository.cs index a7e1dd8..99b4717 100644 --- a/SolarPower/Repository/Implement/StationReportRepository.cs +++ b/SolarPower/Repository/Implement/StationReportRepository.cs @@ -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; } diff --git a/SolarPower/Views/StationReport/Index.cshtml b/SolarPower/Views/StationReport/Index.cshtml index 1899283..d239a81 100644 --- a/SolarPower/Views/StationReport/Index.cshtml +++ b/SolarPower/Views/StationReport/Index.cshtml @@ -207,10 +207,10 @@
- - - - + + + +
@@ -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('', true); + $("#year2btn").html('').attr("disabled", true); $(".btn-station").attr("disabled", true); break; } @@ -798,6 +804,23 @@ str += "省電費用"; } break; + case 3: + str += "Date"; + $.each(rel.data.inv, function (index, inverter) { + haveinvertName.push(inverter); + str += "" + inverter + ""; + }) + str += "月
發電量
(kWh)"; + str += "月
發電量
百分比
(%)"; + str += "日照小時(hr)"; + str += "kWH/kWP"; + str += "PR%"; + str += "月
平均
日照度
(W/㎡)"; + str += "月
平均
模組溫度
(°C)"; + if (rel.data.showMoney == 1) { + str += "月
售電金額
(NTD)"; + } + break; } str += ""; $('#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 = ""; - stc += "" + '日照平均(日)' + ""; - stc += "" + 'kWH/kWP(日)' + ""; - stc += "" + '發電量平均(kWh)(日)' + ""; - stc += "" + '發電量(kWh)(月)' + ""; + stc += "" + '日照平均(月)' + ""; + stc += "" + 'kWH/kWP(月)' + ""; + stc += "" + '發電量平均(kWh)(月)' + ""; + stc += "" + '發電量(kWh)(年)' + ""; if (showmoney == 1) { - stc += "" + '售電金額(NTD)(月)' + ""; - stc += "" + '售電單價(NTD)(月)' + ""; + stc += "" + '售電金額(NTD)(年)' + ""; + stc += "" + '售電單價(NTD)(年)' + ""; } - stc += "" + '售電天數(月)' + ""; + stc += "" + '售電月數(年)' + ""; stc += ""; @@ -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 += ""; - TotalBody += "" + timerange + ""; + if (searchType == 0) { + TotalBody += "" + maxtime + ""; + } + else { + TotalBody += "" + mintime + "-" + maxtime + ""; + } + + + TotalBody += "" + kwp.toFixed(2) + ""; TotalBody += "" + (kwhkwp / rel.data.length).toFixed(2) + ""; TotalBody += "";