85 lines
5.1 KiB
C#
85 lines
5.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using NPOI.SS.UserModel;
|
|
using Weee.Models;
|
|
using Weee.Models.ExtensionMethods;
|
|
using Resources;
|
|
using Weee.DataTransferObject;
|
|
|
|
namespace Weee.Supports
|
|
{
|
|
public class OrganizationLCAExcelExport : ExcelExporter
|
|
{
|
|
public void InsertOrganizationLcaData(IWorkbook workbook, ISheet sheet, OrganizationLCAReportDTO data)
|
|
{
|
|
// hack 組織型excel報表內容產生處 !!... Thomas Mao
|
|
var borderStyle = this.CreateCommonStyleWithBorder(workbook);
|
|
var noneBorderStyle = this.CreateCommonStyleWithoutBorder(workbook);
|
|
var decimalFormat = "G5";
|
|
var totalValue = data.WorkhourSum +
|
|
data.PowerSum +
|
|
data.CarSum +
|
|
data.GasolineSum +
|
|
data.KitchenSum +
|
|
data.FireEQSum +
|
|
data.RefSum +
|
|
data.SteamSum;
|
|
sheet.GetRow(0).GetCell(0).SetCellValue(data.CompanyName);
|
|
sheet.GetRow(2).GetCell(0).SetCellValue(Resource.DuringInterrogation);
|
|
sheet.GetRow(2).GetCell(1).SetCellValue(data.DuringInventory);
|
|
|
|
//sheet Name
|
|
sheet.GetRow(7).GetCell(0).SetCellValue("排放源");
|
|
sheet.GetRow(8).GetCell(0).SetCellValue("總工時");
|
|
sheet.GetRow(9).GetCell(0).SetCellValue("用電量");
|
|
sheet.GetRow(10).GetCell(0).SetCellValue("車輛");
|
|
sheet.GetRow(11).GetCell(0).SetCellValue("柴油");
|
|
sheet.GetRow(12).GetCell(0).SetCellValue("廚房");
|
|
sheet.GetRow(13).GetCell(0).SetCellValue("消防設備");
|
|
sheet.GetRow(14).GetCell(0).SetCellValue("冷媒");
|
|
sheet.GetRow(15).GetCell(0).SetCellValue("用蒸氣量");
|
|
sheet.GetRow(16).GetCell(0).SetCellValue("總合");
|
|
sheet.GetRow(17).GetCell(0).SetCellValue("占總排放量比例");
|
|
|
|
//sheet Name
|
|
sheet.GetRow(7).GetCell(1).SetCellValue("CO2");
|
|
sheet.GetRow(8).GetCell(1).SetCellValue(data.WorkhourSum.ToString(decimalFormat));
|
|
sheet.GetRow(9).GetCell(1).SetCellValue(data.PowerSum.ToString(decimalFormat));
|
|
sheet.GetRow(10).GetCell(1).SetCellValue(data.CarSum.ToString(decimalFormat));
|
|
sheet.GetRow(11).GetCell(1).SetCellValue(data.GasolineSum.ToString(decimalFormat));
|
|
sheet.GetRow(12).GetCell(1).SetCellValue(data.KitchenSum.ToString(decimalFormat));
|
|
sheet.GetRow(13).GetCell(1).SetCellValue(data.FireEQSum.ToString(decimalFormat));
|
|
sheet.GetRow(14).GetCell(1).SetCellValue(data.RefSum.ToString(decimalFormat));
|
|
sheet.GetRow(15).GetCell(1).SetCellValue(data.SteamSum.ToString(decimalFormat));
|
|
sheet.GetRow(16).GetCell(1).SetCellValue(totalValue.ToString(decimalFormat));
|
|
sheet.GetRow(17).GetCell(1).SetCellValue("100%");
|
|
|
|
//sheet Name
|
|
sheet.GetRow(7).GetCell(2).SetCellValue("總和");
|
|
sheet.GetRow(8).GetCell(2).SetCellValue(data.WorkhourSum.ToString(decimalFormat));
|
|
sheet.GetRow(9).GetCell(2).SetCellValue(data.PowerSum.ToString(decimalFormat));
|
|
sheet.GetRow(10).GetCell(2).SetCellValue(data.CarSum.ToString(decimalFormat));
|
|
sheet.GetRow(11).GetCell(2).SetCellValue(data.GasolineSum.ToString(decimalFormat));
|
|
sheet.GetRow(12).GetCell(2).SetCellValue(data.KitchenSum.ToString(decimalFormat));
|
|
sheet.GetRow(13).GetCell(2).SetCellValue(data.FireEQSum.ToString(decimalFormat));
|
|
sheet.GetRow(14).GetCell(2).SetCellValue(data.RefSum.ToString(decimalFormat));
|
|
sheet.GetRow(15).GetCell(2).SetCellValue(data.SteamSum.ToString(decimalFormat));
|
|
sheet.GetRow(16).GetCell(2).SetCellValue(totalValue.ToString(decimalFormat));
|
|
sheet.GetRow(17).GetCell(2).SetCellValue("100%");
|
|
|
|
//sheet Name
|
|
sheet.GetRow(7).GetCell(3).SetCellValue("比例(%)");
|
|
sheet.GetRow(8).GetCell(3).SetCellValue((totalValue == 0 ? 0 : data.WorkhourSum/totalValue).ToString("P2"));//DL-75 begin
|
|
sheet.GetRow(9).GetCell(3).SetCellValue((totalValue == 0 ? 0 : data.PowerSum / totalValue).ToString("P2"));
|
|
sheet.GetRow(10).GetCell(3).SetCellValue((totalValue == 0 ? 0 : data.CarSum / totalValue).ToString("P2"));
|
|
sheet.GetRow(11).GetCell(3).SetCellValue((totalValue == 0 ? 0 : data.GasolineSum / totalValue).ToString("P2"));
|
|
sheet.GetRow(12).GetCell(3).SetCellValue((totalValue == 0 ? 0 : data.KitchenSum / totalValue).ToString("P2"));
|
|
sheet.GetRow(13).GetCell(3).SetCellValue((totalValue == 0 ? 0 : data.FireEQSum / totalValue).ToString("P2"));
|
|
sheet.GetRow(14).GetCell(3).SetCellValue((totalValue == 0 ? 0 : data.RefSum / totalValue).ToString("P2"));
|
|
sheet.GetRow(15).GetCell(3).SetCellValue((totalValue == 0 ? 0 : data.SteamSum / totalValue).ToString("P2"));//DL-75 end
|
|
sheet.GetRow(16).GetCell(3).SetCellValue("100%");
|
|
}
|
|
}
|
|
} |