| | |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using Microsoft.Extensions.Logging; |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml; |
| | | using OfficeOpenXml.Style; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using System.Linq; |
| | | using System.Threading.Tasks; |
| | | using System.Transactions; |
| | |
| | | actionEntity1.PageIco = "fa fa-plus"; |
| | | actionEntity1.ActionName = "打印"; |
| | | actionlist.Add(actionEntity1); |
| | | |
| | | ActionEntity actionEntity2 = new ActionEntity(); |
| | | actionEntity2.OpenType = 0; |
| | | actionEntity2.ActionUrl = ""; |
| | | actionEntity2.ActionFun = "Daochu"; |
| | | actionEntity2.PageIco = "fa fa-plus"; |
| | | actionEntity2.ActionName = "导出"; |
| | | actionlist.Add(actionEntity2); |
| | | |
| | | ViewData["ActionInfo"] = actionlist; |
| | | ViewBag.accounttype = _liaotianService.GetSYScode("fi_account", "accounttype").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); |
| | | ViewBag.FiSubject = _ifiSubjectService.GetList().Select(x => new { code = x.Id, label = x.Subjectname }).ToList(); |
| | |
| | | } |
| | | |
| | | |
| | | public IActionResult GetDaochu(FiAccountRecordDTOSearch search) |
| | | { |
| | | |
| | | search.page = 1; |
| | | search.rows = 10000; |
| | | var aaa = _iFiAccountRecordService.SearchByPaging(search); |
| | | var data1 = aaa.DataList; |
| | | |
| | | ExcelPackage.LicenseContext = OfficeOpenXml.LicenseContext.NonCommercial; |
| | | using var ep = new ExcelPackage(); |
| | | |
| | | //添加sheet |
| | | using var worksheet = ep.Workbook.Worksheets.Add("档案客户资料"); |
| | | |
| | | |
| | | |
| | | int x = 1; |
| | | int y = 1; |
| | | var columnTitles = new List<string>() |
| | | { |
| | | "记录类型","账户类型","账户名称","科目名称","金额","余额","收(支)款单位" |
| | | ,"操作人","摘要","订单号","操作时间" |
| | | |
| | | }; |
| | | foreach (var columnTitle in columnTitles) |
| | | { |
| | | //设置样式 |
| | | var cell = worksheet.Cells[x, y++]; |
| | | cell.Style.Font.Bold = true; |
| | | cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; |
| | | cell.Style.VerticalAlignment = ExcelVerticalAlignment.Center; |
| | | cell.Value = columnTitle; |
| | | } |
| | | foreach (var item in data1) |
| | | { |
| | | x++; |
| | | y = 1; |
| | | |
| | | |
| | | var cell = worksheet.Cells[x, y++]; |
| | | cell.Value = item.RecordTypeName; |
| | | cell = worksheet.Cells[x, y++]; |
| | | cell.Value = item.AccounttypeName; |
| | | cell = worksheet.Cells[x, y++]; |
| | | cell.Value = item.AccountName; |
| | | cell = worksheet.Cells[x, y++]; |
| | | cell.Value = item.SubjectName; |
| | | cell = worksheet.Cells[x, y++]; |
| | | cell.Value = item.Money; |
| | | cell = worksheet.Cells[x, y++]; |
| | | cell.Value = item.Balance; |
| | | cell = worksheet.Cells[x, y++]; |
| | | cell.Value = item.PaymentUnit; |
| | | cell = worksheet.Cells[x, y++]; |
| | | cell.Value = item.CreaterName; |
| | | cell = worksheet.Cells[x, y++]; |
| | | cell.Value = item.OperationalMatters; |
| | | cell = worksheet.Cells[x, y++]; |
| | | cell.Value = item.Remark; |
| | | cell = worksheet.Cells[x, y++]; |
| | | cell.Value = item.CreatetimeName; |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | worksheet.Cells[worksheet.Dimension.Address].AutoFitColumns(); |
| | | |
| | | using (var stream = new MemoryStream()) |
| | | { |
| | | ep.SaveAs(stream); |
| | | return new FileContentResult(stream.ToArray(), |
| | | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") |
| | | { |
| | | FileDownloadName = "导出收入支出资料" + DateTime.Now.ToString("yyyyMMdd") + ".xlsx" |
| | | }; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | public IActionResult print(FiAccountRecordDTOSearch search) |
| | | { |
| | | |