瀏覽代碼

团组模块 - 出入境费用-移动端 --> 其他费用 基础数据、详情更改;

LEIYI 1 月之前
父節點
當前提交
42bf15b409

+ 6 - 4
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -7256,7 +7256,7 @@ FROM
         }
 
         /// <summary>
-        /// 团组模块 - 出入境费用-移动端 - 其他款项 - 币种基础数据Data
+        /// 团组模块 - 出入境费用-移动端 - 其他款项 - 币种、费用类型基础数据Data
         /// </summary>
         /// <returns></returns>
         [HttpPost]
@@ -7284,7 +7284,9 @@ FROM
 
                 }).ToList();
 
-            return Ok(JsonView(true, "查询成功!", groupOtherRateData));
+            var otherFeeTypeData = await _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0 && x.STid == 92).Select(x => new { x.Id, x.Name }).ToListAsync();
+
+            return Ok(JsonView(true, "查询成功!", new { groupOtherRateData= groupOtherRateData, otherFeeTypeData = otherFeeTypeData }));
         }
 
         /// <summary>
@@ -7488,7 +7490,7 @@ FROM
             var subTypes = new List<int>() { 1, 2, 3, 4, 5, 6, 7 };
             if (!subTypes.Contains(dto.SubType)) return Ok(JsonView(false, $"请传入有效的subTypeId!"));
 
-            var eecInfo = await _sqlSugar.Queryable<Grp_EnterExitCost>().FirstAsync(it => it.DiId == dto.DiId && it.IsDel == 0);
+            var eecInfo = await _sqlSugar.Queryable<Grp_EnterExitCost>().OrderByDescending(x => x.CreateTime).FirstAsync(it => it.DiId == dto.DiId && it.IsDel == 0);
 
             if (eecInfo == null) return Ok(JsonView(false, $"出入境费用明细未录入!"));
             var subType = dto.SubType;
@@ -7665,7 +7667,7 @@ FROM
                         SetDataName = sd1.Name,
                         Cost = dop.Cost,
                         Currency = dop.Currency,
-                        CurrencyName = sd2.Remark,
+                        CurrencyName = sd2.Name,
                         SubTotal = dop.SubTotal,
                         Remark = dop.Remark,
                     })

+ 339 - 58
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -2,6 +2,7 @@
 using Microsoft.EntityFrameworkCore.Metadata.Internal;
 using NetUV.Core.Handles;
 using NPOI.SS.Formula.Functions;
+using NPOI.SS.Formula.PTG;
 using OASystem.API.OAMethodLib;
 using OASystem.Domain.AesEncryption;
 using OASystem.Domain.Dtos.Statistics;
@@ -1367,14 +1368,42 @@ ORDER BY
             // 获取工作簿中的工作表集合
             var worksheets = designer.Workbook.Worksheets;
 
+            #region 获取sheet,定义datatable,局部变量
+            //签证费用相关 
             var visaFeeSheet = worksheets["签证费用"];
+            var visaFeeDt = new DataTable($"VisaFeeView"); 
+            decimal visaCNYTotalCost = 0.00M;
+
+            //邀请费用相关 
+            var OAFeeSheet = worksheets["邀请费用"];
+            var OAFeeDt = new DataTable($"OAFeeView");
+            decimal OACNYTotalCost = 0.00M;
+
+            //机票费用相关 
+            var airTicketFeeSheet = worksheets["机票费用"];
+            var airTicketFeeDt = new DataTable($"AirTicketFeeView");
+            decimal airTicketCNYTotalCost = 0.00M;
+
+            //保险费用相关 
+            var insureFeeSheet = worksheets["保险费用"];
+            var insureFeeDt = new DataTable($"InsureFeeView");
+            decimal insureCNYTotalCost = 0.00M;
+
+            //其他费用相关 
+            var otherFeeSheet = worksheets["其他费用"];
+            var otherFeeDt = new DataTable($"OtherFeeView");
+            decimal otherCNYTotalCost = 0.00M;
+
+            #endregion
+
             #region 签证费用
             if (visaFeeSheet != null)
             {
                 string groupVisaFeeSql = string.Format(@"Select vi.Id As VisaId,vi.DIId As VisaDiId,vi.VisaClient,ccp.PayMoney,sd1.Name As PayMoneyCurrency,
-                                                         ccp.DayRate,ccp.Payee,ccp.AuditGMDate,ccp.OrbitalPrivateTransfer,sd2.Name As PayWay,
-                                                         sd3.Name As CardTypeName,ccp.IsPay,u.CnName As Applicant,vi.CreateTime,
-                                                         (((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100) As CNYPrice
+                                                         ccp.DayRate,ccp.Payee,ccp.AuditGMDate,sd2.Name As PaymentModes,sd3.Name As CardTypeName,u.CnName As Applicant,vi.CreateTime,
+                                                         (((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100) As CNYPrice,ccp.ConsumptionDate,
+														 Case When ccp.OrbitalPrivateTransfer = 0 Then '公转' Else '私转' End As CostMark,
+														 Case When ccp.IsPay = 0 Then '未付款' Else '已付款' End As IsPay,vi.Remark
                                                          From Grp_VisaInfo vi
                                                          Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 80 And vi.Id = ccp.CId
                                                          Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id
@@ -1383,83 +1412,335 @@ ORDER BY
                                                          Left Join Sys_Users u On ccp.CreateUserId = u.Id
                                                          Where vi.IsDel = 0 {1} And vi.DIId = {0} Order By CreateTime", diId,isAudit ? "And ccp.IsAuditGM = 1" : " ");
 
-                var groupVisaFeeViews = _sqlSugar.Queryable<Grp_VisaInfo>()
-                    .InnerJoin<Grp_CreditCardPayment>((vi, ccp) => ccp.IsDel == 0 && ccp.CTable == 80 && vi.Id == ccp.CId)
-                    .LeftJoin<Sys_SetData>((vi, ccp,sd1) => ccp.PaymentCurrency == sd1.Id)
-                    .LeftJoin<Sys_SetData>((vi, ccp, sd1, sd2) => ccp.PayDId == sd2.Id)
-                    .Where((vi, ccp, sd1) => vi.IsDel == 0 && vi.DIId == diId)
-                    .WhereIF(isAudit, (vi, ccp, sd1, sd2) => ccp.IsAuditGM == 1)
-                    .Select((vi, ccp, sd1, sd2) => new {
-                        //VisaClient = GetVisaClientNames( vi.VisaClient,_clientDatas),
-                        vi.VisaClient,
-                        ccp.PayMoney,
-                        ccp.DayRate,
-                        Currency = sd1.Name,
-                        ccp.ConsumptionDate,
-                        vi.Remark,
-                        ccp.Payee,
-                        PaymentModes = sd2.Name,
-                        CostMark = ccp.OrbitalPrivateTransfer == 0 ? "公转" : "私转",
-                        PaymentStatus = ccp.IsPay == 0 ? "未付款" :"已付款"
-                    })
-                    .ToList();
-               
-                var visaCNYTotalCost = groupVisaFeeViews.Sum(x => x.PayMoney * x.DayRate);
+                var groupVisaFeeViews = _sqlSugar.SqlQueryable<GroupVisaFeeExcelView>(groupVisaFeeSql).ToList();
+
+                foreach (var item in groupVisaFeeViews)
+                {
+                    string names = string.Empty;
+                    string visaClients = item.VisaClient;
+                    if (!string.IsNullOrEmpty(visaClients))
+                    {
+                        var clientIds = new string[] { };
+                        if (visaClients.Contains(',')) clientIds = visaClients.Split(',');
+                        else clientIds = new string[] { visaClients };
+
+                        if (clientIds.Length > 0)
+                        {
+                            var clientIds1 = new List<int>() { };
+                            foreach (var clientIdStr in clientIds)
+                            {
+                                var isInt = int.TryParse(clientIdStr, out int id);
+                                if (isInt) clientIds1.Add(id);
+                            }
+                            if (clientIds1.Count > 0)
+                            {
+                                var clients = _clientDatas.Where(it => clientIds1.Contains(it.Id)).ToList();
+
+                                foreach (var client in clients)
+                                {
+                                    EncryptionProcessor.DecryptProperties(client);
+                                    names += $"{client.LastName + client.FirstName},";
+                                }
+                            }
+                            else names = visaClients;
+                        }
+                        if (names.Length > 0) names = names.Substring(0, names.Length - 1);
+                        item.VisaClient = names;
+                    }
+                }
 
-                var visaFeeDt = CommonFun.ToDataTableArray(groupVisaFeeViews);
+                visaCNYTotalCost = groupVisaFeeViews.Sum(x => x.CNYPrice);
+
+                visaFeeDt = CommonFun.ToDataTableArray(groupVisaFeeViews);
                 visaFeeDt.TableName = $"VisaFeeView";
-                designer.SetDataSource(visaFeeDt);
-                designer.SetDataSource("VisaCNYTotalCost", visaCNYTotalCost.ToString("#0.00"));
+
+            }
+            #endregion
+
+            #region 邀请费用
+
+            if (OAFeeSheet != null)
+            {
+                string feeSql = string.Format(@"Select ioa.Id As IOAId,ioa.DiId As IOADiId,ioa.InviterArea,ioa.Inviter,CONVERT(DATE, ioa.InviteTime) AS InviteTime,
+                                                ioa.InviteCost,sd3.Name As InviteCurrency,ioa.SendCost,sd4.Name As SendCurrency,ioa.EventsCost,
+                                                sd5.Name As EventsCurrency,ioa.TranslateCost,sd6.Name As TranslateCurrency,ccp.PayMoney,
+                                                sd7.Name As PaymentCurrency,ccp.RMBPrice As CNYPrice,ccp.ConsumptionDate,
+                                                Case When ccp.OrbitalPrivateTransfer = 0 Then '公转' Else '私转' End As CostMark,
+                                                Case When ccp.IsPay = 0 Then '未付款' Else '已付款' End As IsPay,sd2.Name As PaymentModes,
+                                                ccp.Payee,ioa.Remark,ccp.AuditGMDate,u.CnName As Applicant,ioa.CreateTime
+                                                From  Grp_InvitationOfficialActivities ioa
+                                                Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 81 And ioa.Id = ccp.CId
+                                                Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id
+                                                Left Join Sys_SetData sd2 On ccp.PayDId = sd2.Id
+                                                Left Join Sys_SetData sd3 On ioa.InviteCurrency = sd3.Id
+                                                Left Join Sys_SetData sd4 On ioa.SendCurrency = sd4.Id
+                                                Left Join Sys_SetData sd5 On ioa.EventsCurrency = sd5.Id
+                                                Left Join Sys_SetData sd6 On ioa.TranslateCurrency = sd6.Id
+                                                Left Join Sys_SetData sd7 On ccp.PaymentCurrency = sd7.Id
+                                                Left Join Sys_Users u On ccp.CreateUserId = u.Id
+                                                Where ioa.IsDel = 0 {1} And  ioa.Diid = {0} Order By CreateTime", diId, isAudit ? "And ccp.IsAuditGM = 1" : " ");
+
+                var feeViews = _sqlSugar.SqlQueryable<GroupOAFeeExcelView>(feeSql).ToList();
+
+                OACNYTotalCost = feeViews.Sum(x => x.CNYPrice);
+                OAFeeDt = CommonFun.ToDataTableArray(feeViews);
+                OAFeeDt.TableName = $"OAFeeView";
+            }
+
+            #endregion
+
+            #region 机票费用
+
+            if (airTicketFeeSheet != null)
+            {
+                string feeSql = string.Format(@"Select atr.Id As AirId,atr.DIId As AirDiId,atr.FlightsCode,atr.FlightsCity,
+                                                sd4.Name As AirTypeName,atr.FlightsDate,atr.FlightsTime,atr.ClientName,atr.ClientNum,
+                                                atr.PriceDescription,ccp.PayMoney,ccp.DayRate,sd1.Name As PayMoneyCurrency,
+                                                (((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100) As CNYPrice,ccp.ConsumptionDate,
+                                                ccp.Payee,Case When ccp.OrbitalPrivateTransfer = 0 Then '公转' Else '私转' End As CostMark,
+                                                Case When ccp.IsPay = 0 Then '未付款' Else '已付款' End As IsPay,sd2.Name As PaymentModes,
+                                                sd3.Name As CardType,ccp.AuditGMDate,u.CnName As Applicant,atr.CreateTime,atr.Remark
+                                                From Grp_AirTicketReservations atr
+                                                Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 85 And atr.Id = ccp.CId
+                                                Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id
+                                                Left Join Sys_SetData sd2 On ccp.PayDId = sd2.Id
+                                                Left Join Sys_SetData sd3 On ccp.CTDId = sd3.Id
+                                                Left Join Sys_SetData sd4 On atr.CType = sd4.Id
+                                                Left Join Sys_Users u On ccp.CreateUserId = u.Id
+                                                Where atr.IsDel = 0 {1} And atr.DiId = {0} Order By CreateTime", diId, isAudit ? "And ccp.IsAuditGM = 1" : " ");
+
+                var feeViews = _sqlSugar.SqlQueryable<GroupAirTicketExcelView>(feeSql).ToList();
+
+                airTicketCNYTotalCost = feeViews.Sum(x => x.CNYPrice);
+                airTicketFeeDt = CommonFun.ToDataTableArray(feeViews);
+                airTicketFeeDt.TableName = $"AirTicketFeeView";
+            }
+
+            #endregion
+
+            #region 保险费用
+
+            if (insureFeeSheet != null)
+            {
+                string feeSql = string.Format(@"Select ic.Id As InsuranceId,ic.Diid As InsuranceDiId,ClientName,ccp.PayMoney,
+                                                sd1.Name As PayMoneyCurrency,ccp.DayRate,ccp.PayMoney * ccp.DayRate As CNYPrice,ccp.ConsumptionDate,
+                                                Case When ccp.OrbitalPrivateTransfer = 0 Then '公转' Else '私转' End As CostMark,
+                                                Case When ccp.IsPay = 0 Then '未付款' Else '已付款' End As IsPay,sd2.Name As PaymentModes,
+                                                ccp.Payee,ccp.AuditGMDate,u.CnName As Applicant,ic.CreateTime,ic.Remark
+                                                From Grp_Customers ic
+                                                Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 82 And ic.Id = ccp.CId
+                                                Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id
+                                                Left Join Sys_SetData sd2 On ccp.PayDId = sd2.Id
+                                                Left Join Sys_Users u On ccp.CreateUserId = u.Id
+                                                Where ic.IsDel = 0 {1} And ic.DiId = {0} Order By CreateTime", diId, isAudit ? "And ccp.IsAuditGM = 1" : " ");
+
+                var feeViews = _sqlSugar.SqlQueryable<GroupInsureExcelView>(feeSql).ToList();
+
+                foreach (var item in feeViews)
+                {
+                    string itemClientName = "";
+                    string insClients = item.ClientName;
+                    if (!string.IsNullOrEmpty(insClients))
+                    {
+                        string[] clientIds = new string[] { };
+                        if (insClients.Contains(',')) clientIds = insClients.Split(',');
+                        else clientIds = new string[] { insClients };
+
+                        if (clientIds.Length > 0)
+                        {
+                            List<int> output = new List<int>();
+                            foreach (var clientId in clientIds)
+                                if (int.TryParse(clientId, out int id)) 
+                                    output.Add(id);
+
+                            if (output.Count > 0)
+                            {
+                                var clients = _clientDatas.Where(it => output.Contains(it.Id)).ToList();
+                                
+                                foreach (var client in clients)
+                                {
+                                    EncryptionProcessor.DecryptProperties(client);
+                                    itemClientName += $"{client.LastName + client.FirstName},";
+                                }
+                                if (itemClientName.Length > 0)
+                                {
+                                    itemClientName = itemClientName.Substring(0, itemClientName.Length - 1);
+                                }
+                            }
+                            else itemClientName = insClients;
+                        }
+                    }
+
+                    item.ClientName = itemClientName;
+                }
+
+                insureCNYTotalCost = feeViews.Sum(x => x.CNYPrice);
+                insureFeeDt = CommonFun.ToDataTableArray(feeViews);
+                insureFeeDt.TableName = $"InsureFeeView";
+            }
+
+            #endregion
+
+            #region 其他费用 
+
+            if (insureFeeSheet != null)
+            {
+                string feeSql = string.Format(@"Select dp.Id As DPId,dp.DiId As DPDiId,dp.PriceName,ccp.PayMoney,sd1.Name As PayMoneyCurrency,
+                                                ccp.DayRate,(((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100) As CNYPrice,ccp.ConsumptionDate,
+                                                Case When ccp.OrbitalPrivateTransfer = 0 Then '公转' Else '私转' End As CostMark,
+                                                Case When ccp.IsPay = 0 Then '未付款' Else '已付款' End As IsPay,sd2.Name As PaymentModes,  
+                                                ccp.Payee,ccp.AuditGMDate,u.CnName As Applicant,dp.CreateTime,dp.Remark
+                                                From Grp_DecreasePayments dp
+                                                Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 98 And dp.Id = ccp.CId
+                                                Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id
+                                                Left Join Sys_SetData sd2 On ccp.PayDId = sd2.Id
+                                                Left Join Sys_Users u On ccp.CreateUserId = u.Id
+                                                Where dp.IsDel = 0 And ccp.Ctable = 98 {1} And dp.Diid = {0} 
+                                                Order By CreateTime", diId, isAudit ? "And ccp.IsAuditGM = 1" : " ");
+
+                var feeViews = _sqlSugar.SqlQueryable<GroupOtherFeeExcelView>(feeSql).ToList();
+
+                otherCNYTotalCost = feeViews.Sum(x => x.CNYPrice);
+                otherFeeDt = CommonFun.ToDataTableArray(feeViews);
+                otherFeeDt.TableName = $"OtherFeeView";
             }
+
             #endregion
 
+            #region 统一填充数据源
             designer.SetDataSource("GroupNo", groupNo);
             designer.SetDataSource("GroupName", groupName);
             designer.SetDataSource("Lister", lister);
-            designer.Process();
-            //文件名
-            string fileName = $"{groupName}[{groupNo}]_团组费用清单{DateTime.Now.ToString("yyyyMMddHHmmss")}.xls";
-            designer.Workbook.Save(AppSettingsHelper.Get("ExcelBasePath") + "GroupStatement/" + fileName);
-            string url = AppSettingsHelper.Get("ExcelBaseUrl") + "Office/Excel/GroupStatement/" + fileName;
-            return Ok(JsonView(true, "成功", url));
-        }
 
-        private string GetVisaClientNames(string nameStr, List<Crm_DeleClient> _clientDatas)
-        {
-            string names = string.Empty;
+            //签证
+            designer.SetDataSource(visaFeeDt);
+            designer.SetDataSource("VisaCNYTotalCost", $"{visaCNYTotalCost.ToString("#0.00")} CNY");
+            //商邀
+            designer.SetDataSource(OAFeeDt);
+            designer.SetDataSource("OACNYTotalCost", $"{OACNYTotalCost.ToString("#0.00")} CNY");
+            //机票
+            designer.SetDataSource(airTicketFeeDt);
+            designer.SetDataSource("AirTicketCNYTotalCost", $"{airTicketCNYTotalCost.ToString("#0.00")} CNY");
+            //保险
+            designer.SetDataSource(insureFeeDt);
+            designer.SetDataSource("InsureCNYTotalCost", $"{insureCNYTotalCost.ToString("#0.00")} CNY");
+            //其他费用
+            designer.SetDataSource(otherFeeDt);
+            designer.SetDataSource("OtherCNYTotalCost", $"{otherCNYTotalCost.ToString("#0.00")} CNY");
+
+            designer.Process();
 
-            string visaClients = nameStr;
-            if (!string.IsNullOrEmpty(visaClients))
+            #region 单元格样式设置  未付款设置为红色
+            /*
+            * 设置单元格样式
+            */
+            //背景颜色
+            Style style = designer.Workbook.CreateStyle();
+            style.ForegroundColor = System.Drawing.Color.Red;
+            style.Pattern = BackgroundType.Solid;
+            //字体
+            style.Font.Name = "微软雅黑";                   // 字体名称
+            style.Font.Size = 10;                           // 字体大小
+            style.Font.Color = System.Drawing.Color.White;  // 字体颜色
+
+            #region 签证费用单元格
+            for (int i = 0; i < visaFeeDt.Rows.Count; i++)
             {
-                var clientIds = new string[] { };
-                if (visaClients.Contains(',')) clientIds = visaClients.Split(',');
-                else clientIds = new string[] { visaClients };
+                var isPayStr = visaFeeDt.Rows[i]["IsPay"].ToString();
+                if (string.IsNullOrEmpty(isPayStr)) break;
+
+                if (isPayStr.Equals("未付款"))
+                {
+                    var excelIndex = 6 + i;
+
+                    if (visaFeeSheet != null)
+                    {
+                        Aspose.Cells.Range range = visaFeeSheet.Cells.CreateRange($"A{excelIndex}", $"I{excelIndex}");
+                        range.ApplyStyle(style, new StyleFlag() { CellShading = true, Font = true });
+                    }
+                }
+            }
+            #endregion
 
-                if (clientIds.Length > 0)
+            #region 商邀费用单元格
+            for (int i = 0; i < OAFeeDt.Rows.Count; i++)
+            {
+                var isPayStr = OAFeeDt.Rows[i]["IsPay"].ToString();
+                if (string.IsNullOrEmpty(isPayStr)) break;
+                if (isPayStr.Equals("未付款"))
                 {
-                    var clientIds1 = new List<int>() { };
-                    foreach (var clientIdStr in clientIds)
+                    var excelIndex = 6 + i;
+
+                    if (OAFeeSheet != null)
                     {
-                        var isInt = int.TryParse(clientIdStr, out int id);
-                        if (isInt) clientIds1.Add(id);
+                        Aspose.Cells.Range range = OAFeeSheet.Cells.CreateRange($"A{excelIndex}", $"R{excelIndex}");
+                        range.ApplyStyle(style, new StyleFlag() { CellShading = true, Font = true });
                     }
-                    if (clientIds1.Count > 0)
+                }
+            }
+            #endregion
+
+            #region 机票费用单元格
+            for (int i = 0; i < airTicketFeeDt.Rows.Count; i++)
+            {
+                var isPayStr = airTicketFeeDt.Rows[i]["IsPay"].ToString();
+                if (string.IsNullOrEmpty(isPayStr)) break;
+
+                if (isPayStr.Equals("未付款"))
+                {
+                    var excelIndex = 6 + i;
+                    if (airTicketFeeSheet != null)
                     {
-                        var clients = _clientDatas.Where(it => clientIds1.Contains(it.Id)).ToList();
+                        Aspose.Cells.Range range = airTicketFeeSheet.Cells.CreateRange($"A{excelIndex}", $"M{excelIndex}");
+                        range.ApplyStyle(style, new StyleFlag() { CellShading = true, Font = true });
+                    }
+                }
+            }
+            #endregion
 
-                        foreach (var client in clients)
-                        {
-                            EncryptionProcessor.DecryptProperties(client);
-                            names += $"{client.LastName + client.FirstName},";
-                        }
+            #region 保险费用单元格
+            for (int i = 0; i < insureFeeDt.Rows.Count; i++)
+            {
+                var isPayStr = insureFeeDt.Rows[i]["IsPay"].ToString();
+                if (string.IsNullOrEmpty(isPayStr)) break;
+
+                if (isPayStr.Equals("未付款"))
+                {
+                    var excelIndex = 6 + i;
+                    if (insureFeeSheet != null)
+                    {
+                        Aspose.Cells.Range range = insureFeeSheet.Cells.CreateRange($"A{excelIndex}", $"I{excelIndex}");
+                        range.ApplyStyle(style, new StyleFlag() { CellShading = true, Font = true });
                     }
-                    else names = visaClients;
                 }
             }
+            #endregion
 
-            if (names.Length > 0) names = names.Substring(0, names.Length - 1);
+            #region 其他费用单元格
+            for (int i = 0; i < otherFeeDt.Rows.Count; i++)
+            {
+                var isPayStr = otherFeeDt.Rows[i]["IsPay"].ToString();
+                if (string.IsNullOrEmpty(isPayStr)) break;
+
+                if (isPayStr.Equals("未付款"))
+                {
+                    var excelIndex = 6 + i;
+                    if (otherFeeSheet != null)
+                    {
+                        Aspose.Cells.Range range = otherFeeSheet.Cells.CreateRange($"A{excelIndex}", $"J{excelIndex}");
+                        range.ApplyStyle(style, new StyleFlag() { CellShading = true, Font = true });
+                    }
+                }
+            }
+            #endregion
+            #endregion
+            #endregion
 
-            return names;
+            //文件名
+            string fileName = $"{groupName}[{groupNo}]_团组费用清单{DateTime.Now.ToString("yyyyMMddHHmmss")}.xls";
+            designer.Workbook.Save(AppSettingsHelper.Get("ExcelBasePath") + "GroupStatement/" + fileName);
+            string url = AppSettingsHelper.Get("ExcelBaseUrl") + "Office/Excel/GroupStatement/" + fileName;
+            return Ok(JsonView(true, "成功", url));
         }
 
         #endregion

+ 476 - 0
OASystem/OASystem.Domain/ViewModels/Statistics/GroupStatementView.cs

@@ -1322,4 +1322,480 @@ namespace OASystem.Domain.ViewModels.Statistics
     }
     #endregion
 
+    #region 团组统计报表下载
+
+    /// <summary>
+    /// Excel 签证费用View
+    /// </summary>
+    public class GroupVisaFeeExcelView
+    {
+        public int VisaId { get; set; }
+
+        public int VisaDiId { get; set; }
+
+        /// <summary>
+        /// 客户名称
+        /// </summary>
+        public string? VisaClient { get; set; }
+
+        /// <summary>
+        /// 付款金额
+        /// </summary>
+        public decimal PayMoney { get; set; } = 0.00M;
+
+        /// <summary>
+        /// 付款金额
+        /// </summary>
+        public decimal CNYPrice { get; set; } = 0.00M;
+
+        /// <summary>
+        /// 付款币种
+        /// </summary>
+        public string? PayMoneyCurrency { get; set; }
+
+        /// <summary>
+        /// 当时汇率
+        /// </summary>
+        public decimal DayRate { get; set; } = 1.0000M;
+
+        /// <summary>
+        /// 付款时间
+        /// </summary>
+        public string? AuditGMDate { get; set; }
+        /// <summary>
+        /// 收款方
+        /// </summary>
+        public string? Payee { get; set; }
+
+        /// <summary>
+        /// 费用标识
+        /// -1 未选择 0 公转 1 私转
+        /// </summary>
+        public string CostMark { get; set; }
+
+        /// <summary>
+        /// 支付方式
+        /// </summary>
+        public string? PaymentModes { get; set; }
+
+        /// <summary>
+        /// 卡类型
+        /// </summary>
+        public string? CardType { get; set; }
+
+        /// <summary>
+        /// 是否支付
+        /// </summary>
+        public string IsPay { get; set; }
+
+        /// <summary>
+        /// 付款时间
+        /// </summary>
+        public string ConsumptionDate { get; set; }
+
+        public string Remark { get; set; }
+
+        /// <summary>
+        /// 操作人
+        /// </summary>
+        public string? Applicant { get; set; }
+
+        public DateTime CreateTime { get; set; }
+    }
+
+    /// <summary>
+    /// Excel 商邀费用View
+    /// </summary>
+    public class GroupOAFeeExcelView
+    {
+
+        public int IOAId { get; set; }
+
+        public int IOADiId { get; set; }
+
+        /// <summary>
+        /// 邀请方地区
+        /// </summary>
+        public string? InviterArea { get; set; }
+
+        /// <summary>
+        /// 邀请方
+        /// </summary>
+        public string? Inviter { get; set; }
+
+        /// <summary>
+        /// 邀请时间
+        /// </summary>
+        public string? InviteTime { get; set; }
+
+        /// <summary>
+        /// 邀请函费用
+        /// </summary>
+        public decimal InviteCost { get; set; } = 0.00M;
+
+        /// <summary>
+        /// 邀请函币种
+        /// </summary>
+        public string? InviteCurrency { get; set; }
+
+        /// <summary>
+        /// 快递费用
+        /// </summary>
+        public decimal SendCost { get; set; } = 0.00M;
+
+        /// <summary>
+        /// 快递币种
+        /// </summary>
+        public string? SendCurrency { get; set; }
+
+        /// <summary>
+        /// 活动费用
+        /// </summary>
+        public decimal EventsCost { get; set; } = 0.00M;
+
+        /// <summary>
+        /// 活动币种
+        /// </summary>
+        public string? EventsCurrency { get; set; }
+
+        /// <summary>
+        /// 翻译费用
+        /// </summary>
+        public decimal TranslateCost { get; set; } = 0.00M;
+
+        /// <summary>
+        /// 翻译币种
+        /// </summary>
+        public string? TranslateCurrency { get; set; }
+
+        /// <summary>
+        /// 付款金额
+        /// </summary>
+        public decimal PayMoney { get; set; } = 0.00M;
+
+        /// <summary>
+        /// 付款币种汇率
+        /// </summary>
+        public decimal DayRate { get; set; } = 0.0000M;
+
+        /// <summary>
+        /// 付款币种
+        /// </summary>
+        public string? PaymentCurrency { get; set; }
+
+        /// <summary>
+        /// 人民币费用
+        /// </summary>
+        public decimal CNYPrice { get; set; } = 0.00M;
+
+        /// <summary>
+        /// 收款方
+        /// </summary>
+        public string? Payee { get; set; }
+
+        /// <summary>
+        /// 消费日期
+        /// </summary>
+        public string ConsumptionDate { get; set; }
+
+        /// <summary>
+        /// 费用标识
+        /// </summary>
+        public string CostMark { get; set; }
+
+        /// <summary>
+        /// 支付标识
+        /// </summary>
+        public string IsPay { get; set; }
+
+        /// <summary>
+        /// 支付方式
+        /// </summary>
+        public string PaymentModes { get; set; }
+
+        /// <summary>
+        /// 备注
+        /// </summary>
+        public string Remark { get; set; }
+
+        /// <summary>
+        /// 审核时间
+        /// </summary>
+        public string? AuditGMDate { get; set; }
+
+        /// <summary>
+        /// 操作人
+        /// </summary>
+        public string? Applicant { get; set; }
+
+        public DateTime CreateTime { get; set; }
+    }
+
+    /// <summary>
+    /// Excel 机票费用View
+    /// </summary>
+    public class GroupAirTicketExcelView
+    {
+        public int AirId { get; set; }
+        public int AirDiId { get; set; }
+
+        /// <summary>
+        /// 航班号
+        /// </summary>
+        public string? FlightsCode { get; set; }
+
+        /// <summary>
+        /// 城市A-B
+        /// </summary>
+        public string? FlightsCity { get; set; }
+
+        /// <summary>
+        /// 舱位类型
+        /// </summary>
+        public string? AirTypeName { get; set; }
+
+        /// <summary>
+        /// 航班日期
+        /// </summary>
+        public string? FlightsDate { get; set; }
+
+        /// <summary>
+        /// 航班时间
+        /// </summary>
+        public string? FlightsTime { get; set; }
+
+        /// <summary>
+        /// 客户姓名
+        /// </summary>
+        public string? ClientName { get; set; }
+
+        /// <summary>
+        /// 客户人数
+        /// </summary>
+        public int ClientNum { get; set; }
+
+        /// <summary>
+        /// 费用描述
+        /// </summary>
+        public string PriceDescription { get; set; }
+
+        /// <summary>
+        /// 付款金额
+        /// </summary>
+        public decimal PayMoney { get; set; } = 0.00M;
+
+        /// <summary>
+        /// 当时汇率
+        /// </summary>
+        public decimal DayRate { get; set; } = 1.0000M;
+
+        /// <summary>
+        /// 付款币种
+        /// </summary>
+        public string? PayMoneyCurrency { get; set; }
+
+        /// <summary>
+        /// CNY 金额
+        /// </summary>
+        public decimal CNYPrice { get; set; } = 0.00M;
+
+        /// <summary>
+        /// 付款时间
+        /// </summary>
+        public string ConsumptionDate { get; set; }
+
+        /// <summary>
+        /// 收款方
+        /// </summary>
+        public string? Payee { get; set; }
+
+        /// <summary>
+        /// 费用标识
+        /// </summary>
+        public string CostMark { get; set; }
+
+        /// <summary>
+        /// 是否支付
+        /// </summary>
+        public string IsPay { get; set; }
+
+        /// <summary>
+        /// 支付方式
+        /// </summary>
+        public string? PaymentModes { get; set; }
+
+        /// <summary>
+        /// 卡类型
+        /// </summary>
+        public string? CardType { get; set; }
+
+        /// <summary>
+        /// 审核时间
+        /// </summary>
+        public string? AuditGMDate { get; set; }
+
+        /// <summary>
+        /// 操作人
+        /// </summary>
+        public string? Applicant { get; set; }
+
+        /// <summary>
+        /// 创建时间
+        /// </summary>
+        public DateTime CreateTime { get; set; }
+
+        /// <summary>
+        /// SetDataId
+        /// </summary>
+        public int CType { get; set; }
+
+        public string Remark { get; set; }
+    }
+
+
+    /// <summary>
+    /// Excel 保险费用View
+    /// </summary>
+    public class GroupInsureExcelView
+    {
+
+        public int InsuranceId { get; set; }
+
+        public int InsuranceDiId { get; set; }
+
+        /// <summary>
+        /// 客户名称
+        /// </summary>
+        public string? ClientName { get; set; }
+
+        /// <summary>
+        /// 付款金额
+        /// </summary>
+        public decimal PayMoney { get; set; } = 0.00M;
+
+        /// <summary>
+        /// 付款币种
+        /// </summary>
+        public string? PayMoneyCurrency { get; set; }
+
+        /// <summary>
+        /// 当时汇率
+        /// </summary>
+        public decimal DayRate { get; set; }
+
+        /// <summary>
+        /// 人民币金额
+        /// </summary>
+        public decimal CNYPrice { get; set; } = 0.00M;
+
+        /// <summary>
+        /// 付款时间
+        /// </summary>
+        public string ConsumptionDate { get; set; }
+
+        /// <summary>
+        /// 费用标识
+        /// </summary>
+        public string CostMark { get; set; }
+
+        /// <summary>
+        /// 审核时间
+        /// </summary>
+        public string? AuditGMDate { get; set; }
+
+        /// <summary>
+        /// 收款方
+        /// </summary>
+        public string? Payee { get; set; }
+
+        /// <summary>
+        /// 是否支付
+        /// </summary>
+        public string IsPay { get; set; }
+
+        /// <summary>
+        /// 支付方式
+        /// </summary>
+        public string? PaymentModes { get; set; }
+
+        /// <summary>
+        /// 操作人
+        /// </summary>
+        public string? Applicant { get; set; }
+
+        public DateTime CreateTime { get; set; }
+
+        public string Remark { get; set; }
+    }
+
+    /// <summary>
+    /// Excel 保险费用View
+    /// </summary>
+    public class GroupOtherFeeExcelView
+    {
+        public int DPId { get; set; }
+        public int DPDiId { get; set; }
+
+        /// <summary>
+        /// 费用名称
+        /// </summary>
+        public string? PriceName { get; set; }
+
+        /// <summary>
+        /// 付款金额
+        /// </summary>
+        public decimal PayMoney { get; set; } = 0.00M;
+
+        /// <summary>
+        /// 付款币种
+        /// </summary>
+        public string? PayMoneyCurrency { get; set; }
+
+        /// <summary>
+        /// 当时汇率
+        /// </summary>
+        public decimal DayRate { get; set; } = 1.0000M;
+
+        /// <summary>
+        /// 人民币金额
+        /// </summary>
+        public decimal CNYPrice { get; set; } = 0.00M;
+
+        /// <summary>
+        /// 付款时间
+        /// </summary>
+        public string? AuditGMDate { get; set; }
+
+        /// <summary>
+        /// 收款方
+        /// </summary>
+        public string? Payee { get; set; }
+
+        /// <summary>
+        /// 费用标识
+        /// </summary>
+        public string CostMark { get; set; }
+
+        /// <summary>
+        /// 支付方式
+        /// </summary>
+        public string? PaymentModes { get; set; }
+
+        /// <summary>
+        /// 是否支付
+        /// </summary>
+        public string IsPay { get; set; }
+
+        /// <summary>
+        /// 操作人
+        /// </summary>
+        public string? Applicant { get; set; }
+
+        public DateTime CreateTime { get; set; }
+
+        public string? Remark { get; set; }
+    }
+
+    #endregion
+
 }