diff --git a/SolarPower/Controllers/ElectricitySoldRecordController.cs b/SolarPower/Controllers/ElectricitySoldRecordController.cs index 2ed6abd..03f083b 100644 --- a/SolarPower/Controllers/ElectricitySoldRecordController.cs +++ b/SolarPower/Controllers/ElectricitySoldRecordController.cs @@ -328,7 +328,7 @@ namespace SolarPower.Controllers ICellStyle style14bodyleftnoborder = workbook.CreateCellStyle(); style14bodyleftnoborder.SetFont(font14); style14bodyleftnoborder.Alignment = HorizontalAlignment.Left; - style14bodyleftnoborder.VerticalAlignment = VerticalAlignment.Center; + style14bodyleftnoborder.VerticalAlignment = VerticalAlignment.Top; style14bodyleftnoborder.BorderLeft = BorderStyle.Medium; style14bodyleftnoborder.WrapText = true; @@ -600,21 +600,24 @@ namespace SolarPower.Controllers row = sheet.CreateRow(27); //第27行 + row.Height = 40 * 15; region = new CellRangeAddress(27, 29, 1, 6); sheet.AddMergedRegion(region); cell = row.CreateCell(1); - cell.SetCellValue($"計算期間:{bill.Result.StartAt}-{bill.Result.EndAt} \r售電收入 = ( 度數 {bill.Result.Kwh} * 費率{Math.Round(bill.Result.Money / 1.05 / bill.Result.Kwh,2)}) * 1.05 = {bill.Result.Money} 元"); + cell.SetCellValue($"{bill.Result.PowerName}-太陽光電售電收入 \r計算期間:{bill.Result.StartAt}-{bill.Result.EndAt} \r售電收入 = ( 度數 {bill.Result.Kwh} * 費率{bill.Result.PowerRate}) * 1.05 = {bill.Result.Kwh * bill.Result.PowerRate * 1.05} 元"); cell.CellStyle = style14bodyleftnoborder; cell = row.CreateCell(6); cell.CellStyle = style14bodyrightnoborder; row = sheet.CreateRow(28); //第28行 + row.Height = 40 * 15; cell = row.CreateCell(1); cell.CellStyle = style14bodyleftnoborder; cell = row.CreateCell(6); cell.CellStyle = style14bodyrightnoborder; row = sheet.CreateRow(29); //第29行 + row.Height = 40 * 15; cell = row.CreateCell(1); cell.CellStyle = style14bodyleftnoborder; cell = row.CreateCell(6); diff --git a/SolarPower/Models/ElectricitySoldRecord.cs b/SolarPower/Models/ElectricitySoldRecord.cs index 903e59b..1a2bf99 100644 --- a/SolarPower/Models/ElectricitySoldRecord.cs +++ b/SolarPower/Models/ElectricitySoldRecord.cs @@ -48,6 +48,8 @@ namespace SolarPower.Models private string endAt; public string EndAt { get { return Convert.ToDateTime(endAt).ToString("yyyy/MM/dd"); } set { endAt = value; } } public int Kwh { get; set; } + public double PowerRate { get; set; } + public string PowerName { get; set; } } } diff --git a/SolarPower/Repository/Implement/ElectricitySoldRecordRepository.cs b/SolarPower/Repository/Implement/ElectricitySoldRecordRepository.cs index 421f606..161f97b 100644 --- a/SolarPower/Repository/Implement/ElectricitySoldRecordRepository.cs +++ b/SolarPower/Repository/Implement/ElectricitySoldRecordRepository.cs @@ -82,7 +82,7 @@ namespace SolarPower.Repository.Implement try { var sql = @$"SELECT es.Money,ps.GUINumber,ps.TPCInvoiceBuyer,ps.TPCInvoiceAddress,cp.Name,cp.Logo,ps.Id, - es.StartAt,es.EndAt,es.Kwh + es.StartAt,es.EndAt,es.Kwh,ps.PowerRate,ps.Name as PowerName FROM electricity_sold_record es LEFT JOIN power_station ps ON es.PowerstationId = ps.Id