Commit a8f6ea6d by 纪旭 韦

修改下载时excel顶部时间显示

parents 235e54d3 3bf7c507
......@@ -324,7 +324,7 @@ public IActionResult AllComputeViewDownload([FromBody] BeginEndTimeDown request)
if (null == list)
throw new PerformanceException("当前绩效记录不存在");
var filepath = downloadService.AllComputerViewReportByDate(request.HospitalId, list, "/report/wholehospital_grant", "全院绩效发放");
var filepath = downloadService.AllComputerViewReportByDate(request.HospitalId, list, "/report/wholehospital_grant", "全院绩效发放", date);
var memoryStream = new MemoryStream();
using (var stream = new FileStream(filepath, FileMode.Open))
......@@ -385,7 +385,7 @@ public IActionResult GethosdataView([FromBody] BeginEndTimeDown request)
if (null == list)
throw new PerformanceException("当前绩效记录不存在");
var filepath = downloadService.AllComputerViewReportByDate(request.HospitalId, list, "/report/wholehospital_accounting_grant", "全院核算绩效发放");
var filepath = downloadService.AllComputerViewReportByDate(request.HospitalId, list, "/report/wholehospital_accounting_grant", "全院核算绩效发放", date);
var memoryStream = new MemoryStream();
using (var stream = new FileStream(filepath, FileMode.Open))
......@@ -446,7 +446,7 @@ public IActionResult AllComputeByPMViewDownLoad([FromBody] BeginEndTimeDown requ
if (null == list)
throw new PerformanceException("当前绩效记录不存在");
var filepath = downloadService.AllComputerViewReportByDate(request.HospitalId, list, "/report/wholehospital_finance_grant", "财务全院绩效发放");
var filepath = downloadService.AllComputerViewReportByDate(request.HospitalId, list, "/report/wholehospital_finance_grant", "财务全院绩效发放", date);
var memoryStream = new MemoryStream();
using (var stream = new FileStream(filepath, FileMode.Open))
......
......@@ -181,7 +181,8 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string
{
var allot = perallotRepository.GetEntity(t => t.ID == allotId);
var hospital = perforHospital.GetEntity(t => t.ID == allot.HospitalId);
return AllComputerDown(hospital, dynamics, route, name);
var title = $"{allot.Year}{allot.Month}{hospital.HosName}医院 --- {name}";
return AllComputerDown(hospital, dynamics, route, title, name);
}
/// <summary>
/// 财务、全院绩效发放下载(时间段)
......@@ -190,18 +191,21 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string
/// <param name="allData"></param>
/// <param name="isAll"></param>
/// <returns></returns>
public string AllComputerViewReportByDate(int HospitalId, List<dynamic> dynamics, string route, string name)
public string AllComputerViewReportByDate(int hospitalId, List<dynamic> dynamics, string route, string name, BeginEndTime date)
{
var hospital = perforHospital.GetEntity(t => t.ID == HospitalId);
return AllComputerDown(hospital, dynamics, route, name);
var hospital = perforHospital.GetEntity(t => t.ID == hospitalId);
var title = $"{date.BeginTime}{date.EndTime} {hospital.HosName}医院 --- {name}";
return AllComputerDown(hospital, dynamics, route, title, name);
}
public string AllComputerDown(sys_hospital hospital,List<dynamic> dynamics, string route, string name)
public string AllComputerDown(sys_hospital hospital, List<dynamic> dynamics, string route, string title, string name)
{
var headList = _computeService.CustomColumnHeaders(hospital.ID, route).Where(w => w.States == 1).ToList();
var dpath = Path.Combine(evn.ContentRootPath, "Files", "PerformanceRelease", $"{hospital.ID}");
FileHelper.CreateDirectory(dpath);
string filepath = Path.Combine(dpath, $"{hospital.HosName}-{name}-{DateTime.Now:yyyyMMdd}");
FileHelper.DeleteFile(filepath);
string[] notSum = new string[] { "year", "month" };
using (FileStream fs = new FileStream(filepath, FileMode.OpenOrCreate))
using (ExcelPackage package = new ExcelPackage(fs))
{
......@@ -209,7 +213,7 @@ public string AllComputerDown(sys_hospital hospital,List<dynamic> dynamics, stri
if (dynamics != null && dynamics.Count() > 0)
{
worksheet.SetValue(1, 1, $"{allot.Year}{allot.Month}{hospital.HosName}医院 --- {name}");
worksheet.SetValue(1, 1, title);
var headers = ((IDictionary<string, object>)dynamics.ElementAt(0)).Keys;
for (int col = 0; col < headList.Count; col++)
......@@ -228,7 +232,7 @@ public string AllComputerDown(sys_hospital hospital,List<dynamic> dynamics, stri
}
if (col == 0)
worksheet.SetValue(dynamics.Count() + 2, col + 1, "合计");
else
else if (!notSum.Contains(headList[col].Name.ToLower()))
worksheet.Cells[dynamics.Count() + 2, col + 1].Formula = string.Format("SUM({0})", new ExcelAddress(2, col + 1, dynamics.Count() + 1, col + 1).Address);
}
......@@ -238,8 +242,8 @@ public string AllComputerDown(sys_hospital hospital,List<dynamic> dynamics, stri
worksheet.Row(row).Height = 20;
for (int col = worksheet.Dimension.Start.Column; col <= worksheet.Dimension.End.Column; col++)
{
worksheet.Cells[row, col].Style.Border.BorderAround(ExcelBorderStyle.Thin);
worksheet.Cells[row, col].Style.Numberformat.Format = "#,##0.00";
worksheet.Cells[row, col].Style.Border.BorderAround(ExcelBorderStyle.Thin);
worksheet.Cells[row, col].Style.VerticalAlignment = ExcelVerticalAlignment.Center;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment