From 15eb82df2d6ec539e9d4245bfe08d531e8eb6379 Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期日, 27 四月 2025 14:33:26 +0800 Subject: [PATCH] 修改培训订单占多个座位 --- zhengcaioa/zhengcaioa/Controllers/Finance/FiAccountIncomeController.cs | 156 +++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 137 insertions(+), 19 deletions(-) diff --git a/zhengcaioa/zhengcaioa/Controllers/Finance/FiAccountIncomeController.cs b/zhengcaioa/zhengcaioa/Controllers/Finance/FiAccountIncomeController.cs index 24b5206..891ddad 100644 --- a/zhengcaioa/zhengcaioa/Controllers/Finance/FiAccountIncomeController.cs +++ b/zhengcaioa/zhengcaioa/Controllers/Finance/FiAccountIncomeController.cs @@ -4,8 +4,11 @@ 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; @@ -23,15 +26,17 @@ private readonly IFiAccountRecordService _iFiAccountRecordService; private readonly IFiSubjectService _ifiSubjectService; + private readonly IPltPageService _pltPageService; - - public FiAccountIncomeController(ILogger<FiAccountIncomeController> logger, IFiAccountService fiAccountService, ILiaotianService liaotianService, IFiAccountRecordService iFiAccountRecordService, IFiSubjectService ifiSubjectService) + public FiAccountIncomeController(ILogger<FiAccountIncomeController> logger, IFiAccountService fiAccountService, ILiaotianService liaotianService, IFiAccountRecordService iFiAccountRecordService, IFiSubjectService ifiSubjectService + , IPltPageService pltPageService) { _logger = logger; _fiAccountService = fiAccountService; _liaotianService = liaotianService; _iFiAccountRecordService = iFiAccountRecordService; _ifiSubjectService = ifiSubjectService; + _pltPageService = pltPageService; } @@ -47,20 +52,34 @@ actionEntity.PageIco = "fa fa-search"; actionEntity.ActionName = "鏌ヨ"; actionlist.Add(actionEntity); - ActionEntity actionEntity1 = new ActionEntity(); - actionEntity1.OpenType = 0; - actionEntity1.ActionUrl = ""; - actionEntity1.ActionFun = "Add"; - actionEntity1.PageIco = "fa fa-plus"; - actionEntity1.ActionName = "鏂板"; - actionlist.Add(actionEntity1); - ActionEntity actionEntity2 = new ActionEntity(); - actionEntity2.OpenType = 0; - actionEntity2.ActionUrl = ""; - actionEntity2.ActionFun = "PrintDetail"; - actionEntity2.PageIco = "fa fa-plus"; - actionEntity2.ActionName = "鎵撳嵃鏄庣粏"; - actionlist.Add(actionEntity2); + //ActionEntity actionEntity1 = new ActionEntity(); + //actionEntity1.OpenType = 0; + //actionEntity1.ActionUrl = ""; + //actionEntity1.ActionFun = "Add"; + //actionEntity1.PageIco = "fa fa-plus"; + //actionEntity1.ActionName = "鏂板"; + //actionlist.Add(actionEntity1); + //ActionEntity actionEntity2 = new ActionEntity(); + //actionEntity2.OpenType = 0; + //actionEntity2.ActionUrl = ""; + //actionEntity2.ActionFun = "PrintDetail"; + //actionEntity2.PageIco = "fa fa-plus"; + //actionEntity2.ActionName = "鎵撳嵃鏄庣粏"; + //actionlist.Add(actionEntity2); + var pageEntities = _pltPageService.GetUserPage(curentuser.Id, "/FiAccountIncome/Index/"); + var pageEntities1 = pageEntities.Where(x => x.PageMethod == "01").ToList(); + foreach (var pageEntity in pageEntities1) + { + ActionEntity actionEntity1 = new ActionEntity(); + actionEntity1.OpenType = pageEntity.OpenType; + actionEntity1.ActionUrl = ""; + actionEntity1.ActionFun = pageEntity.PageShortcut; + actionEntity1.PageIco = pageEntity.PageIco; + actionEntity1.ActionName = pageEntity.PageName; + actionlist.Add(actionEntity1); + } + + ViewData["ActionInfo"] = actionlist; ViewBag.accounttype = _liaotianService.GetSYScode("fi_account", "accounttype").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); @@ -74,6 +93,7 @@ var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); ViewData["curentuser"] = curentuser; search.RecordTypeId = "1"; + search.Creater = "1111"; return new JsonResult(_iFiAccountRecordService.SearchByPaging(search)); } @@ -143,11 +163,14 @@ data.RecordTypeId = "1";//鏀跺叆 data.Department = ""; - - resultEntity = _iFiAccountRecordService.save(data); + firmAccount.AllIncome = (firmAccount.AllIncome ?? 0) + data.Money ; firmAccount.Balance = (firmAccount.Balance??0) + data.Money; + + data.AccountMoney = firmAccount.Balance; + + resultEntity = _iFiAccountRecordService.save(data); resultEntity = _fiAccountService.save(firmAccount); scope.Complete(); @@ -207,6 +230,15 @@ 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(); @@ -224,7 +256,93 @@ return new JsonResult(_iFiAccountRecordService.SearchByPaging(search)); } - + + 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("妗f瀹㈡埛璧勬枡"); + + + + 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.AccountMoney; + 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) { -- Gitblit v1.9.1