Browse Source

Merge branch 'develop' of http://132.232.92.186:3000/XinXiBu/OA2023 into develop

yuanrf 1 year ago
parent
commit
a165ab4ef3

+ 328 - 32
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -1,14 +1,20 @@
-using Microsoft.AspNetCore.Http;
+using Aspose.Cells;
+using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
 using OASystem.API.OAMethodLib;
 using OASystem.API.OAMethodLib.File;
 using OASystem.Domain;
 using OASystem.Domain.Dtos.Financial;
+using OASystem.Domain.Dtos.Groups;
+using OASystem.Domain.Entities.Financial;
 using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.ViewModels.Financial;
 using OASystem.Domain.ViewModels.Groups;
+using OASystem.Domain.ViewModels.SmallFun;
 using OASystem.Infrastructure.Repositories.Financial;
 using OASystem.Infrastructure.Repositories.Groups;
+using SqlSugar;
+using StackExchange.Redis;
 using System.Data;
 
 namespace OASystem.API.Controllers
@@ -34,8 +40,8 @@ namespace OASystem.API.Controllers
         /// 初始化
         /// </summary>
         public FinancialController(IMapper mapper, IConfiguration configuration, DailyFeePaymentRepository daiRep, SqlSugarClient sqlSugar, SetDataTypeRepository setDataTypeRep,
-            TeamRateRepository teamRateRep, ForeignReceivablesRepository ForForeignReceivablesRep, ProceedsReceivedRepository proceedsReceivedRep, 
-            PaymentRefundAndOtherMoneyRepository paymentRefundAndOtherMoneyRep) 
+            TeamRateRepository teamRateRep, ForeignReceivablesRepository ForForeignReceivablesRep, ProceedsReceivedRepository proceedsReceivedRep,
+            PaymentRefundAndOtherMoneyRepository paymentRefundAndOtherMoneyRep)
         {
             _mapper = mapper;
             _config = configuration;
@@ -70,7 +76,7 @@ namespace OASystem.API.Controllers
             return Ok(JsonView(data));
         }
 
-        
+
         /// <summary>
         /// 获取日付申请 基础数据源 - 转账表识 
         /// </summary>
@@ -114,7 +120,7 @@ namespace OASystem.API.Controllers
 
             return Ok(JsonView(data));
         }
-        
+
         /// <summary>
         /// 日付申请 Single Search By Id
         /// </summary>
@@ -133,7 +139,7 @@ namespace OASystem.API.Controllers
 
             return Ok(JsonView(result.Data));
         }
-        
+
         /// <summary>
         /// 日付申请 添加
         /// </summary>
@@ -247,28 +253,28 @@ namespace OASystem.API.Controllers
 
                     //if (priceSubTypeData.Where(s => s.Id == feeData.PriceTypeId).ToList().Count() > 0)//大运会专属模板
                     //{
-                        
+
                     //    //AsposeHelper.ExpertExcelToModel("日常费用付款申请模板-大运会数据.xls", "DailyPayment", "大运会所有日常费用付款申请.xls",
                     //    //    pairs, datas);
                     //}
                     //else  //日付常规模板
                     //{
-                        pairs.Clear();
-                        pairs.Add("Opertor", userName);
-                        pairs.Add("DateTime", feeData.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")); 
-                        pairs.Add("FAuditStatus", feeData.FAuditDesc); 
-                        pairs.Add("MAuditStatus", feeData.MAuditDesc);
-                        pairs.Add("SumPrice", feeData.SumPrice);
-
-                        DataTable data = AsposeHelper.ListToDataTable("DailyFeePayment", feeData.FeeContents);
-                        datas.Clear();
-                        datas.Add(data);
-                        string fileName = string.Format("{0}-日常费用付款申请.xlsx", feeData.Instructions);
-                        string msg = AsposeHelper.ExpertExcelToModel("日常费用付款申请模板.xlsx", "DailyPayment", fileName, pairs, datas);
-
-                        return Ok(JsonView(true, msg));
+                    pairs.Clear();
+                    pairs.Add("Opertor", userName);
+                    pairs.Add("DateTime", feeData.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"));
+                    pairs.Add("FAuditStatus", feeData.FAuditDesc);
+                    pairs.Add("MAuditStatus", feeData.MAuditDesc);
+                    pairs.Add("SumPrice", feeData.SumPrice);
+
+                    DataTable data = AsposeHelper.ListToDataTable("DailyFeePayment", feeData.FeeContents);
+                    datas.Clear();
+                    datas.Add(data);
+                    string fileName = string.Format("{0}-日常费用付款申请.xlsx", feeData.Instructions);
+                    string msg = AsposeHelper.ExpertExcelToModel("日常费用付款申请模板.xlsx", "DailyPayment", fileName, pairs, datas);
+
+                    return Ok(JsonView(true, msg));
                     //}
-                   
+
                 }
                 else
                 {
@@ -276,7 +282,7 @@ namespace OASystem.API.Controllers
                 }
             }
 
-           
+
             return Ok(JsonView(true));
         }
         #endregion
@@ -291,7 +297,7 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostPageSearchCommissionList(GroupCommissionDto dto)
         {
-             var data = await GroupCommission.GetCommissionPageList(dto);
+            var data = await GroupCommission.GetCommissionPageList(dto);
 
             return Ok(JsonView(data.Data));
         }
@@ -754,7 +760,7 @@ namespace OASystem.API.Controllers
                     return Ok(JsonView(false, "参数不能为空!"));
                 }
 
-                Result ffrData = await _proceedsReceivedRep.PostAmountReceived(dto.DiId );
+                Result ffrData = await _proceedsReceivedRep.PostAmountReceived(dto.DiId);
                 dynamic data = null;
                 if (dto.PortType == 1)
                 {
@@ -762,9 +768,9 @@ namespace OASystem.API.Controllers
                     {
                         return Ok(JsonView(false, ffrData.Msg));
                     }
-                    data= ffrData.Data;
+                    data = ffrData.Data;
                 }
-                else if(dto.PortType == 2)
+                else if (dto.PortType == 2)
                 {
                     if (ffrData.Code != 0)
                     {
@@ -785,7 +791,7 @@ namespace OASystem.API.Controllers
                 {
                     return Ok(JsonView(false, "请选择正确的端口号!"));
                 }
-                return Ok(JsonView(true,"操作成功!", data));
+                return Ok(JsonView(true, "操作成功!", data));
             }
             catch (Exception ex)
             {
@@ -895,11 +901,11 @@ namespace OASystem.API.Controllers
         {
             try
             {
-                if (dto == null)  return Ok(JsonView(false, "参数不能为空!"));
-               
+                if (dto == null) return Ok(JsonView(false, "参数不能为空!"));
+
                 if (dto.PageId <= 0) return Ok(JsonView(false, "请传入正确的的页面Id!"));
-               
-                if (dto.UserId <= 0)  return Ok(JsonView(false, "请传入正确的的员工Id!")); 
+
+                if (dto.UserId <= 0) return Ok(JsonView(false, "请传入正确的的员工Id!"));
 
                 #region 页面功能权限处理
                 PageFunAuthViewBase pageFunAuth = new PageFunAuthViewBase();
@@ -1100,5 +1106,295 @@ namespace OASystem.API.Controllers
             }
         }
         #endregion
+
+        #region 应收报表
+
+        /// <summary>
+        /// 应收报表
+        /// 查询 根据日期范围
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostSyntheticalReceivableByDateRange(PostSyntheticalReceivableByDateRangeDto dto)
+        {
+
+            string sqlWhere = " Where di.IsDel=0 ";
+
+            #region 验证
+            if (string.IsNullOrEmpty(dto.beginDt) && string.IsNullOrEmpty(dto.endDt))
+            {
+                return Ok(JsonView(false, "日期参数至少填写一个!"));
+            }
+
+            if (!string.IsNullOrEmpty(dto.beginDt))
+            {
+                if (Regex.Match(dto.beginDt, @"^\d{4}-\d{2}-\d{2}$").Value.Length < 1)
+                {
+                    return Ok(JsonView(false, "日期参数格式错误,应为yyyy-MM-dd!"));
+                }
+                else
+                {
+                    sqlWhere += string.Format(@" And di.VisitDate >= '{0} 00:00:00' ", dto.beginDt);
+                }
+            }
+
+            if (!string.IsNullOrEmpty(dto.endDt))
+            {
+                if (Regex.Match(dto.endDt, @"^\d{4}-\d{2}-\d{2}$").Value.Length < 1)
+                {
+                    return Ok(JsonView(false, "日期参数格式错误,应为yyyy-MM-dd!"));
+                }
+                else
+                {
+                    sqlWhere += string.Format(@" And di.VisitDate <= '{0} 23:59:59' ", dto.endDt);
+                }
+            }
+
+
+            #endregion
+
+            string sql = string.Format(@" select distinct fr.diid,di.TeamName,di.ClientUnit,di.VisitDate from Fin_ForeignReceivables fr join Grp_DelegationInfo di on fr.DIID = di.id  {0} ", sqlWhere);
+
+            List<PostSyntheticalReceivableByDateRangeView> list_rst = _sqlSugar.SqlQueryable<PostSyntheticalReceivableByDateRangeView>(sql).ToList();
+
+            decimal sumAll_fr = 0M;
+            decimal sumAll_pr = 0M;
+            decimal sumAll_balance = 0M;
+
+            if (list_rst.Count > 0)
+            {
+                int rowNumber = 1;
+                foreach (var item_rst in list_rst)
+                {
+                    item_rst.No = rowNumber;
+                    rowNumber++;
+
+                    int diId = item_rst.diid;
+                    decimal sum_fr = 0M;
+                    decimal sum_pr = 0M;
+                    string str_client = string.Empty;
+                    decimal sum_other = 0M;
+                    decimal balance = 0M;
+                    string str_schedule = string.Empty;
+
+                    //1. 缺超支费用!!!!!!!!!!!!!!!!!!!!
+                    string sql_fr = string.Format(@" Select * From Fin_ForeignReceivables Where IsDel=0 And Diid={0} ", diId);
+                    List<Fin_ForeignReceivables> list_fr = _sqlSugar.SqlQueryable<Fin_ForeignReceivables>(sql_fr).ToList();
+                    sum_fr = list_fr.Sum(s => s.ItemSumPrice);
+
+                    //2.
+                    string sql_pr = string.Format(@" Select * From Fin_ProceedsReceived Where IsDel=0 And Diid={0} ", diId);
+                    List<Fin_ProceedsReceived> list_pr = _sqlSugar.SqlQueryable<Fin_ProceedsReceived>(sql_pr).ToList();
+                    foreach (var item_pr in list_pr)
+                    {
+                        sum_pr += item_pr.Price;
+                        str_client += string.Format(@"{0};", item_pr.Client);
+                        str_schedule += string.Format(@"{0};", item_pr.Remark);
+                    }
+                    if (str_schedule.Length > 0)
+                    {
+                        str_schedule = str_schedule.TrimEnd(';');
+                    }
+                    if (str_client.Length > 0)
+                    {
+                        str_client = str_client.TrimEnd(';');
+                    }
+
+                    //3.
+                    string sql_other = string.Format(@" Select * From Fin_OtherPrice where diid = {0} and isdel = 0 and RefundType = 1 and PayType=1 ", diId);
+                    List<Fin_OtherPrice> list_other = _sqlSugar.SqlQueryable<Fin_OtherPrice>(sql_other).ToList();
+                    sum_other = list_other.Sum(s => s.Price);
+
+                    item_rst.frPrice = sum_fr.ToString("#0.00");
+                    item_rst.prPrice = (sum_pr - sum_other).ToString("#0.00");
+                    item_rst.balPrice = (sum_fr - (sum_pr - sum_other)).ToString("#0.00");
+                    item_rst.prClient = str_client;
+                    item_rst.schedule = str_schedule;
+
+                    string tempVisitDate = Convert.ToDateTime(item_rst.visitDate).ToString("yyyy-MM-dd");
+
+                    sumAll_fr += sum_fr;
+                    sumAll_pr += (sum_pr - sum_other);
+                    sumAll_balance += (sum_fr - (sum_pr - sum_other));
+
+                }
+
+                PostSyntheticalReceivableByDateRangeResultView result = new PostSyntheticalReceivableByDateRangeResultView();
+                result.total_fr = sumAll_fr.ToString("#0.00");
+                result.total_pr = sumAll_pr.ToString("#0.00");
+                result.total_balance = sumAll_balance.ToString("#0.00");
+                result.dataList = new List<PostSyntheticalReceivableByDateRangeView>(list_rst);
+
+                if (dto.requestType == 1)
+                {
+                    return Ok(JsonView(true, "请求成功", result, list_rst.Count));
+                }
+                else
+                {
+                    //----------------------------
+                    List<Excel_SyntheticalReceivableByDateRange> list_Ex = new List<Excel_SyntheticalReceivableByDateRange>();
+                    WorkbookDesigner designer = new WorkbookDesigner();
+                    designer.Workbook = new Workbook(AppSettingsHelper.Get("ExcelBasePath") + "Template/应收款项模板 - 副本.xls");
+
+                    int excNo = 1;
+                    foreach (var item in list_rst)
+                    {
+                        Excel_SyntheticalReceivableByDateRange exc = new Excel_SyntheticalReceivableByDateRange();
+                        exc.No = excNo.ToString();
+                        excNo++;
+                        exc.TeamName = item.teamName;
+                        exc.ClientUnit = item.clientUnit;
+                        exc.VisitDate = item.visitDate;
+                        exc.Accounts = item.frPrice;
+                        exc.Received = item.prPrice;
+                        exc.Balance = item.balPrice;
+                        exc.Collection = item.schedule;
+                        DateTime time = Convert.ToDateTime(item.visitDate);
+                        TimeSpan ts = DateTime.Now - time;
+                        float SY = float.Parse(item.balPrice);
+                        if (ts.Days >= 365 && SY > 0)
+                        {
+                            exc.Sign = "需收款";
+                        }
+                        else
+                        {
+                            exc.Sign = "";
+                        }
+                        list_Ex.Add(exc);
+                    }
+
+                    var dt = CommonFun.GetDataTableFromIList(list_Ex);
+                    dt.TableName = "Excel_SyntheticalReceivableByDateRange";
+                    if (dt != null)
+                    {
+                        designer.SetDataSource("SumPrice", "应收合计:" + result.total_fr + "RMB  已收合计:" + result.total_pr + "RMB  余款合计:" + result.total_balance + "RMB");
+
+                        //数据源
+                        designer.SetDataSource(dt);
+
+
+                        //根据数据源处理生成报表内容
+                        designer.Process();
+
+                        string fileName = ("Receivable/应收款项(" + dto.beginDt + "~" + dto.endDt + ").xlsx");
+                        designer.Workbook.Save(AppSettingsHelper.Get("ExcelBasePath") + fileName);
+                        string rst = AppSettingsHelper.Get("ExcelBaseUrl") + AppSettingsHelper.Get("ExcelFtpPath") + fileName;
+                        return Ok(JsonView(true, "成功", new { url = rst }));
+                    }
+
+
+                }
+
+            }
+
+
+            return Ok(JsonView(true, "获取成功", "", list_rst.Count));
+
+        }
+
+        #endregion
+
+        #region 付款申请
+
+        /// <summary>
+        /// 应收报表
+        /// 查询 根据日期范围
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostPayRequest_Center(PostPayRequestByDateRangeDto dto)
+        {
+            tree_Fin_DailyFeePaymentResult dailyResult = PayRequest_DailyByDateRange(dto.beginDt, dto.endDt);
+
+
+            return Ok(JsonView(true, "获取成功", new { daily = dailyResult }));
+
+            return Ok(JsonView(false, "获取失败"));
+        }
+
+        /// <summary>
+        /// 付款申请
+        /// 查询 根据日期范围
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        private tree_Fin_DailyFeePaymentResult PayRequest_DailyByDateRange(string beginDt, string endDt)
+        {
+            #region sql条件处理
+            string sqlWhere = string.Format(@" And dfp.CreateTime between '{0} 00:00:00' And '{1} 23:59:59' ", beginDt, endDt);
+
+            string sql_1 = string.Format(@"Select * From (	
+                                                Select row_number() over (order by dfp.Id Desc) as RowNumber,
+                                                    dfp.Id,dfp.CompanyId,c.CompanyName,dfp.Instructions,dfp.SumPrice,
+                                                    dfp.CreateUserId,u.CnName CreateUser,dfp.CreateTime,dfp.FAudit,dfp.MAudit,
+                                                    dfp.PriceTypeId,dfp.TransferTypeId 
+                                                From Fin_DailyFeePayment dfp
+                                                Inner Join Sys_Company c On dfp.CompanyId = c.Id
+                                                Left Join Sys_Users u On dfp.CreateUserId = u.Id
+                                                Where dfp.IsDel=0 {0} And dfp.FAudit = 1 And dfp.MAudit = 1
+                                                ) temp ", sqlWhere);
+            #endregion
+
+            List<tree_Fin_DailyFeePaymentPageListView> DailyFeePaymentData = _sqlSugar.SqlQueryable<tree_Fin_DailyFeePaymentPageListView>(sql_1).ToList();
+
+            Dictionary<int, string> dic_setData = new Dictionary<int, string>();
+
+            foreach (var item in DailyFeePaymentData)
+            {
+                if (dic_setData.ContainsKey(item.PriceTypeId))
+                {
+                    item.priceTypeStr = dic_setData[item.PriceTypeId];
+                }
+                else
+                {
+                    Sys_SetData sd_priceType = _daiRep.Query<Sys_SetData>(s => s.Id == item.PriceTypeId).First();
+                    if (sd_priceType != null)
+                    {
+                        item.priceTypeStr = sd_priceType.Name;
+                        dic_setData.Add(item.PriceTypeId, sd_priceType.Name);
+                    }
+                }
+
+                if (dic_setData.ContainsKey(item.transferTypeId))
+                {
+                    item.transferTypeIdStr = dic_setData[item.transferTypeId];
+                    Sys_SetData sd_transfer = _daiRep.Query<Sys_SetData>(s => s.Id == item.transferTypeId).First();
+                    if (sd_transfer != null)
+                    {
+                        item.transferParentId = sd_transfer.STid;
+                        item.transferParentIdStr = sd_transfer.STid == 62 ? "公转" : sd_transfer.STid == 63 ? "私转" : "";
+                    }
+                }
+                else
+                {
+                    Sys_SetData sd_transfer = _daiRep.Query<Sys_SetData>(s => s.Id == item.transferTypeId).First();
+                    if (sd_transfer != null)
+                    {
+                        item.transferTypeIdStr = sd_transfer.Name;
+                        item.transferParentId = sd_transfer.STid;
+                        item.transferParentIdStr = sd_transfer.STid == 62 ? "公转" : sd_transfer.STid == 63 ? "私转" : "";
+                        dic_setData.Add(item.transferTypeId, sd_transfer.Name);
+                    }
+                }
+
+                string feeContentSql = string.Format(@"Select * From Fin_DailyFeePaymentContent 
+                                                        Where IsDel=0 And DFPId = {0} ", item.Id);
+                item.childList = _sqlSugar.SqlQueryable<Fin_DailyFeePaymentContentInfolView>(feeContentSql).ToList();
+
+            }
+
+            decimal total_gz = DailyFeePaymentData.Where(s => s.transferParentId == 62).Sum(d => d.SumPrice ?? 0M);
+            decimal total_sz = DailyFeePaymentData.Where(s => s.transferParentId == 63).Sum(d => d.SumPrice ?? 0M);
+
+            var result = new tree_Fin_DailyFeePaymentResult() { gz = total_gz, sz = total_sz, dataList = DailyFeePaymentData };
+
+            return result;
+        }
+
+        #endregion
     }
 }

+ 167 - 55
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -54,6 +54,11 @@ using OASystem.API.OAMethodLib.Hub.Hubs;
 using System.Collections.Generic;
 using OASystem.API.OAMethodLib.JuHeAPI;
 using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
+using SixLabors.Fonts.Tables.AdvancedTypographic;
+using Microsoft.EntityFrameworkCore;
+using System.Security.Cryptography.Xml;
+using MathNet.Numerics;
+using System.Security.Policy;
 
 namespace OASystem.API.Controllers
 {
@@ -540,7 +545,7 @@ namespace OASystem.API.Controllers
                         var userInfo = _usersRep._sqlSugar.Queryable<Sys_Users>().Where(it => it.IsDel == 0 && it.Id == dto.UserId).First();
                         if (userInfo != null) createGroupUser = userInfo.CnName;
 
-                        string title = $"新建团组";
+                        string title = $"";
                         string content = $"团组[{groupName}(创建人:{createGroupUser})]创建成功,请前往页面进行下一步操作!";
                         await GeneralMethod.MessageIssueAndNotification(MessageTypeEnum.GroupBusinessOperations, title, content, userIds, diId);
                     }
@@ -622,7 +627,7 @@ namespace OASystem.API.Controllers
                         var userInfo = _usersRep._sqlSugar.Queryable<Sys_Users>().Where(it => it.IsDel == 0 && it.Id == dto.UserId).First();
                         if (userInfo != null) createGroupUser = userInfo.CnName;
 
-                        string title = $"新建团组";
+                        string title = $"";
                         string content = $"团组[{groupName}(创建人:{createGroupUser})]创建成功,请前往页面进行下一步操作!";
                         await GeneralMethod.MessageIssueAndNotification(MessageTypeEnum.GroupBusinessOperations, title, content, userIds, diId);
                     }
@@ -1340,7 +1345,7 @@ namespace OASystem.API.Controllers
                     }
                     else
                     {
-                        CurrPayStr = (entity.PayMoney * (decimal.Parse(entity.PayPercentage.ToString("#0.00")) / 100 * entity.DayRate)).ConvertToDecimal1();
+                        CurrPayStr = (entity.PayMoney * entity.PayPercentage / 100 * entity.DayRate).ConvertToDecimal1();
                     }
                     _detail.CurrPay = CurrPayStr.ToString("#0.00") + " CNY";
 
@@ -1355,8 +1360,6 @@ namespace OASystem.API.Controllers
 
                     _detail.Balance = BalanceStr.ToString("#0.00") + " " + PaymentCurrency_WaitPay;
 
-
-
                     /*
                      * Bus名称
                      */
@@ -1396,9 +1399,9 @@ namespace OASystem.API.Controllers
                                 string isoppayStr = hotelReservations.Isoppay == 0 ? "是" : "否";
                                 _detail.PriceMsgContent = $"信用卡金额:{_detail.WaitPay} ({hotelCurrncyName})<br/>" +
                                                           $"房间说明: {hotelReservations.Remark} <br/>" +
-                                                          $"地税: {hotelReservations.GovernmentRent} {GovernmentRentCode} ({GovernmentRentName})<br/>" +
-                                                          $"城市税: {hotelReservations.CityTax} {CityTaxCode} ({CityTaxName})<br/>" +
-                                                          $"酒店早餐: {hotelReservations.BreakfastPrice} {BreakfastCode} ({BreakfastName})<br/>" +
+                                                          $"地税: {hotelReservations.GovernmentRent.ToString("#0.00")} {GovernmentRentCode} ({GovernmentRentName})<br/>" +
+                                                          $"城市税: {hotelReservations.CityTax.ToString("#0.00")} {CityTaxCode} ({CityTaxName})<br/>" +
+                                                          $"酒店早餐: {hotelReservations.BreakfastPrice.ToString("#0.00")} {BreakfastCode} ({BreakfastName})<br/>" +
                                                           $"酒店早餐是否由地接代付: {isoppayStr}";
                                 _detail.PriceNameContent = hotelReservations.HotelName;
                             }
@@ -1456,24 +1459,50 @@ namespace OASystem.API.Controllers
                             break;
                         case 81: //邀请/公务活动
 
-                            Grp_InvitationOfficialActivities invitationOfficialActivities = _InvitationOfficialActivities.Where(s => s.Id == entity.CId).FirstOrDefault();
-                            if (invitationOfficialActivities != null)
+                            Grp_InvitationOfficialActivities _ioa = _InvitationOfficialActivities.Where(s => s.Id == entity.CId).FirstOrDefault();
+                            if (_ioa != null)
                             {
-
-                                string ioaCurrencyCode = "Unknown";
-                                string ioaCurrencyName = "Unknown";
-
-                                var currencyData = currencyItems.Where(s => s.Id == invitationOfficialActivities.InviteCurrency && s.IsDel == 0).FirstOrDefault();
-                                if (currencyData != null)
+                                string inviteCurrName = "Unknown",     //邀请费用币种 Name
+                                       inviteCurrCode = "Unknown",     //邀请费用币种 Code
+                                       sendCurrName = "Unknown",       //快递费用币种 Name
+                                       sendCurrCode = "Unknown",       //快递费用币种 Code
+                                       eventsCurrName = "Unknown",     //公务活动费币种 Name
+                                       eventsCurrCode = "Unknown",     //公务活动费币种 Code
+                                       translateCurrName = "Unknown",  //公务翻译费 Name
+                                       translateCurrCode = "Unknown";  //公务翻译费 Code
+                                #region 处理费用币种
+                                var inviteCurrData = currencyItems.Where(s => s.Id == _ioa.InviteCurrency && s.IsDel == 0).FirstOrDefault();
+                                if (inviteCurrData != null)
+                                {
+                                    inviteCurrName = inviteCurrData.Remark;
+                                    inviteCurrCode = inviteCurrData.Name;
+                                }
+                                var sendCurrData = currencyItems.Where(s => s.Id == _ioa.SendCurrency && s.IsDel == 0).FirstOrDefault();
+                                if (sendCurrData != null)
+                                {
+                                    sendCurrName = sendCurrData.Remark;
+                                    sendCurrCode = sendCurrData.Name;
+                                }
+                                var eventsCurrData = currencyItems.Where(s => s.Id == _ioa.EventsCurrency && s.IsDel == 0).FirstOrDefault();
+                                if (eventsCurrData != null)
+                                {
+                                    eventsCurrName = eventsCurrData.Remark;
+                                    eventsCurrCode = eventsCurrData.Name;
+                                }
+                                var translateCurrData = currencyItems.Where(s => s.Id == _ioa.TranslateCurrency && s.IsDel == 0).FirstOrDefault();
+                                if (translateCurrData != null)
                                 {
-                                    ioaCurrencyCode = currencyData.Name;
-                                    ioaCurrencyName = currencyData.Remark;
+                                    translateCurrName = translateCurrData.Remark;
+                                    translateCurrCode = translateCurrData.Name;
                                 }
+                                #endregion
 
-                                _detail.PriceNameContent = invitationOfficialActivities.InviterArea;
-                                _detail.PriceMsgContent = "邀请费用:" + invitationOfficialActivities.InviteCost + " " + ioaCurrencyCode + "(" + ioaCurrencyName + ")<br/>" +
-                                                          "活动费用:- <br/>" +
-                                                          "备注:" + invitationOfficialActivities.Remark + "<br/>";
+                                _detail.PriceNameContent = _ioa.InviterArea;
+                                _detail.PriceMsgContent = $@"邀请费用:{_ioa.InviteCost.ToString("#0.00")} {inviteCurrCode}({inviteCurrName})<br/>" +
+                                                          $@"快递费用:{_ioa.SendCost.ToString("#0.00")} {sendCurrCode}({sendCurrName})<br/>" +
+                                                          $@"公务活动费:{_ioa.EventsCost.ToString("#0.00")} {eventsCurrCode}({eventsCurrName})<br/>" +
+                                                          $@"公务翻译费:{_ioa.TranslateCost.ToString("#0.00")} {translateCurrCode}({translateCurrName})<br/>" +
+                                                          $@"备注:" + _ioa.Remark + "<br/>";
 
                             }
 
@@ -1747,7 +1776,6 @@ namespace OASystem.API.Controllers
                         creditData.PayPercentage = 100M;
                     }
 
-
                     decimal CNYPrice = (creditData.PayMoney * (creditData.PayPercentage / 100)) * creditData.DayRate;
                     string msgTitle = $"[{groupNameStr}({creditTypeStr})]的费用申请";
                     string msgContent = "";
@@ -1760,20 +1788,19 @@ namespace OASystem.API.Controllers
                         msgContent = $"[{groupNameStr}({creditTypeStr})]费用申请(金额:{CNYPrice.ToString("0.00")} CNY({creditData.PayMoney.ToString("0.00")} {creditCurrency})) {auditStr}!";
                     }
 
-
                     msgDatas.Add(new { DiId = creditData.DIId, UserId = creditData.CreateUserId, MsgTitle = msgTitle, MsgContent = msgContent });
                 }
 
             }
             if (rst == 0)
             {
+                _groupRepository.CommitTran();
                 foreach (var item in msgDatas)
                 {
                     //发送消息
                     GeneralMethod.MessageIssueAndNotification(MessageTypeEnum.GroupExpenseAudit, item.MsgTitle, item.MsgContent, new List<int>() { item.UserId }, item.DiId);
                 }
 
-                _groupRepository.CommitTran();
                 return Ok(JsonView(true, "操作成功!"));
             }
 
@@ -2996,23 +3023,48 @@ namespace OASystem.API.Controllers
         {
             try
             {
-                var res = await _InvitationOfficialActivitiesRep.SoftDeleteByIdAsync<Grp_InvitationOfficialActivities>(dto.Id.ToString(), dto.DeleteUserId);
-                if (!res)
-                {
-                    var result = await _sqlSugar.Updateable<Grp_CreditCardPayment>().Where(a => a.CId == dto.Id && a.CTable == 81).SetColumns(a => new Grp_CreditCardPayment()
+                _sqlSugar.BeginTran();
+                var res1 = _sqlSugar.Updateable<Grp_InvitationOfficialActivities>()
+                                    .SetColumns(it => new Grp_InvitationOfficialActivities()
+                                    {
+                                        IsDel = 1,
+                                        DeleteUserId = dto.DeleteUserId,
+                                        DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+                                    })
+                                    .Where(it => it.Id == dto.Id)
+                                    .ExecuteCommand();
+                if (res1 > 0)
+                {
+                    int _diId = 0;
+                    var _ioaInfo = _sqlSugar.Queryable<Grp_InvitationOfficialActivities>().Where(it => it.Id == dto.Id).First();
+                    if (_ioaInfo!=null)
                     {
-                        IsDel = 1,
-                        DeleteUserId = dto.DeleteUserId,
-                        DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
-                    }).ExecuteCommandAsync();
-                    return Ok(JsonView(false, "删除失败"));
+                        _diId = _ioaInfo.DiId;
+                    }
+
+                    var res2 = _sqlSugar.Updateable<Grp_CreditCardPayment>()
+                                          .SetColumns(a => new Grp_CreditCardPayment()
+                                          {
+                                              IsDel = 1,
+                                              DeleteUserId = dto.DeleteUserId,
+                                              DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+                                          })
+                                          .Where(a => a.CId == dto.Id && a.DIId == _diId && a.CTable == 81 )
+                                          .ExecuteCommand();
+
+                    if (res2 > 0)
+                    {
+                        _sqlSugar.CommitTran();
+                        return Ok(JsonView(true, "删除成功!"));
+                    }
                 }
-                return Ok(JsonView(true, "删除成功!"));
+                _sqlSugar.RollbackTran();
+                return Ok(JsonView(false, "删除失败"));
             }
             catch (Exception ex)
             {
-                return Ok(JsonView(false, "程序错误!"));
-                throw;
+                _sqlSugar.RollbackTran();
+                return Ok(JsonView(false, ex.Message));
             }
         }
 
@@ -4194,7 +4246,6 @@ namespace OASystem.API.Controllers
             return Ok(jw);
         }
 
-
         /// <summary>
         /// 导游数据
         /// </summary>
@@ -4242,7 +4293,6 @@ namespace OASystem.API.Controllers
             return Ok(JsonView(true, "获取成功!", Data));
         }
 
-
         /// <summary>
         /// 成本通知
         /// </summary>
@@ -5679,7 +5729,7 @@ namespace OASystem.API.Controllers
 
 
         /// <summary>
-        ///     
+        ///  团组成本 各模块(酒店,地接,机票)成本提示
         /// </summary>
         /// <param name="dto"></param>
         /// <returns></returns>
@@ -5698,9 +5748,9 @@ namespace OASystem.API.Controllers
                 List<int> cTableIds = new List<int>() {
                     76    ,//酒店预订
                     77    ,//行程
-                    79    ,//车 / 导游地接
+                    79    ,//车/导游地接
                     80    ,//签证
-                    81    ,//邀请 / 公务活
+                    81    ,//邀请/公务活
                     82    ,//团组客户保险
                     85    ,//机票预订
                     98    ,//其他款项
@@ -5744,22 +5794,54 @@ namespace OASystem.API.Controllers
                     }
                 }
                 
-                GroupCostModulePromptView _view = new GroupCostModulePromptView()
-                { 
-                    CurrencyCode = _GroupCostParameters[0].Currency,
-                    Rate = _GroupCostParameters[0].Rate
-                };
-
+                GroupCostModulePromptView _view = new GroupCostModulePromptView();
+;
                 List<GroupCostModulePromptInfo> _ModulePromptInfos = new List<GroupCostModulePromptInfo>();
                 foreach (var item in _GroupCostParameters)
                 {
+
+                    decimal _rate = item.Rate;
+                    decimal _scale = 0.95M;
+                    #region 处理地接价格比例 总经理 国交部经理 主管 不下调 其他人 下调 5% 
+                    var userInfo = _usersRep._sqlSugar.Queryable<Sys_Users>().Where(it => it.IsDel == 0 && it.Id == dto.UserId).First();
+                    if (userInfo != null)
+                    {
+                        if (userInfo.DepId == 1 || userInfo.DepId == 7)
+                        {
+                            if (userInfo.JobPostId == 1 || userInfo.JobPostId == 22 || userInfo.JobPostId == 32)
+                            {
+                                _scale = 1.00M;
+                            }
+                        }
+                    }
+                    #endregion
+
+                  
+
                     GroupCostModulePromptInfo modulePromptInfo = new GroupCostModulePromptInfo()
                     {
+                        CurrencyCode = item.Currency,
+                        Rate = _rate,
                         CostType = item.CostType,
                         CostTypeStartTime = Convert.ToDateTime(item.CostTypeStartTime).ToString("yyyy-MM-dd"),
                         CostTypeEndTime = Convert.ToDateTime(item.CostTypeendTime).ToString("yyyy-MM-dd"),
                         CostTypeNumber = item.CostTypenumber
                     };
+                    if (_GroupCostParameters.Count > 1)
+                    {
+                        modulePromptInfo.CostTypeNumber = item.CostTypenumber;
+                       
+                    }
+                    else
+                    {
+                        modulePromptInfo.CostTypeNumber = item.LYJRS;
+                    }
+
+                    if (dto.CTable == 79)
+                    {
+                        modulePromptInfo.IndividualCost = item.DJCB / modulePromptInfo.CostTypeNumber;
+                        modulePromptInfo.TotalCost = item.DJCB;
+                    }
 
                     List<string> costTypes = new List<string>() { "A","B" };
 
@@ -5768,6 +5850,7 @@ namespace OASystem.API.Controllers
                     if (_GroupCostsDuplicates.Count() == 1)
                     {
                         _GroupCostsTypeData = _GroupCosts;
+                        
                     }
                     else
                     {
@@ -5808,18 +5891,47 @@ namespace OASystem.API.Controllers
                             );
                             break;
                         case 79: // 车/导游地接
+
                             datas.AddRange(
                                 _GroupCostsTypeData.Select(it => new
                                 {
-                                    it.Date,
-                                    it.CarCost,
-                                    it.TGS,
-                                    it.SGR,
-                                    it.TBR,
-                                    it.JS_ES,
-                                    it.Suite
+                                    Date = it.Date,
+                                    CarFee = (it.CarCost + it.CFM + it.CFOF) * _rate * _scale,
+                                    GuideFee = (it.TGS + it.TGOF + it.TGM+ it.TGA + it.TGTF + it.TGEF) * _rate * _scale,
+                                    MealFee = (it.B + it.L + it.D) * _rate * _scale,
+                                    TicketFee = it.EF * _rate * _scale,
+                                    TipFee = (it.TGTips + it.DRVTips) * _rate * _scale,
+                                    AirportTransferFee = 0.00M,
+                                    DrinksSnacksFruitFee = it.B_R_F * _rate * _scale,
+                                    TravelSupplies = it.TE * _rate * _scale,
+                                    LeadersFee = it.TLF * _rate * _scale,
+                                    CarFee1 = it.CarCost * _rate * _scale,
+                                    CarType = it.CarType,
+                                    SpentCash = it.PC * _rate * _scale,
                                 })
                             );
+
+                            break;
+                        case 85: // 机票
+                            datas.Add(
+                                new
+                                {
+                                    AirType = "经济舱",
+                                    AirNum = item.JJCRS,
+                                    AirDRCB = item.JJCCB,
+                                    AirZCB = (item.JJCRS * item.JJCCB)
+                                }
+                            );
+                            datas.Add(
+                                new
+                                {
+                                    AirType = "公务舱",
+                                    AirNum = item.GWCRS,
+                                    AirDRCB = item.GWCCB,
+                                    AirZCB = (item.GWCRS * item.GWCCB)
+                                }
+                            );
+
                             break;
                         default:
                             break;

+ 116 - 22
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -17,6 +17,7 @@ using Microsoft.AspNetCore.Mvc.RazorPages;
 using Microsoft.VisualBasic;
 using OASystem.Domain.Entities.Groups;
 using Microsoft.Extensions.DependencyInjection;
+using Aspose.Words.Lists;
 
 namespace OASystem.API.Controllers
 {
@@ -457,13 +458,13 @@ namespace OASystem.API.Controllers
                         item.AuditGMDate = Convert.ToDateTime(item.AuditGMDate).ToString("yyyy-MM-dd HH:mm:ss");
                     }
 
-                    CTGGRFeeStr += string.Format(@"{0}总费用:{1} {2}(人名币:{3} CNY 当时支付汇率:{4})\r\n", 
-                        item.Area, item.AmountPaid.ConvertToDecimal1(), item.PaymentCurrency, item.CNYPrice, item.DayRate);
+                    CTGGRFeeStr += string.Format(@"{0} 总费用:{1} {2}(人名币:{3} CNY 当时支付汇率:{4})\r\n", 
+                        item.Area, item.AmountPaid.ConvertToDecimal1().ToString("#0.00"), item.PaymentCurrency, item.CNYPrice.ToString("#0.0000"), item.DayRate.ToString("#0.0000"));
                     CTGGRCNYTotalPrice += item.CNYPrice;
                 }
                 _geView.GroupCTGGRFeeViews = groupCTGGRFeeViews;
 
-                _geView.GroupCTGGRFeeStr = string.Format(@"{0}人名币总费用:{1} CNY", CTGGRFeeStr,CTGGRCNYTotalPrice);
+                _geView.GroupCTGGRFeeStr = string.Format(@"{0}人名币总费用:{1} CNY", CTGGRFeeStr,CTGGRCNYTotalPrice.ToString("#0.00"));
                 #endregion
 
                 #region 机票预订费用
@@ -484,24 +485,24 @@ namespace OASystem.API.Controllers
                 groupAirFeeViews = await _sqlSugar.SqlQueryable<GroupAirFeeView>(groupAirFeeSql).ToListAsync();
 
                 string str = "";
+                List<dynamic> airClientPris = new List<dynamic>();
                 decimal AirCNYTotalPrice = 0.00M;
                 decimal JJCCNYTotalPrice = 0.00M, JJCPeopleNum = 0.00M, JJCAveragePrice = 0.00M;
                 decimal GWCCNYTotalPrice = 0.00M, GWCPeopleNum = 0.00M, GWCAveragePrice = 0.00M;
 
-                if (groupAirFeeViews.Count > 0)
-                {
-                    JJCCNYTotalPrice = groupAirFeeViews.Where(it => it.AirTypeName.Equals("经济舱")).Sum(it => it.CNYPrice);
-                    JJCPeopleNum = groupAirFeeViews.Where(it => it.AirTypeName.Equals("经济舱")).Sum(it => it.ClientNum);
-                    JJCAveragePrice = (JJCCNYTotalPrice / JJCPeopleNum).ConvertToDecimal1();
-                    GWCCNYTotalPrice = groupAirFeeViews.Where(it => it.AirTypeName.Equals("公务舱")).Sum(it => it.CNYPrice);
-                    GWCPeopleNum = groupAirFeeViews.Where(it => it.AirTypeName.Equals("公务舱")).Sum(it => it.ClientNum);
-                    GWCAveragePrice = (GWCCNYTotalPrice / GWCPeopleNum).ConvertToDecimal1();
-                }
+                //if (groupAirFeeViews.Count > 0)
+                //{
+                //    JJCCNYTotalPrice = groupAirFeeViews.Where(it => it.AirTypeName.Equals("经济舱")).Sum(it => it.CNYPrice);
+                //    JJCPeopleNum = groupAirFeeViews.Where(it => it.AirTypeName.Equals("经济舱")).Sum(it => it.ClientNum);
+                //    JJCAveragePrice = (JJCCNYTotalPrice / JJCPeopleNum).ConvertToDecimal1();
+                //    GWCCNYTotalPrice = groupAirFeeViews.Where(it => it.AirTypeName.Equals("公务舱")).Sum(it => it.CNYPrice);
+                //    GWCPeopleNum = groupAirFeeViews.Where(it => it.AirTypeName.Equals("公务舱")).Sum(it => it.ClientNum);
+                //    GWCAveragePrice = (GWCCNYTotalPrice / GWCPeopleNum).ConvertToDecimal1();
+                //}
                
                 int Index = 0;
                 foreach (var item in groupAirFeeViews)
                 {
-
                     if (item.AirId > 2924)
                     {
                         string itemClientName = "";
@@ -519,21 +520,32 @@ namespace OASystem.API.Controllers
                             if (clientIds.Length > 0)
                             {
                                 int[] output = Array.ConvertAll<string, int>(clientIds, delegate (string s) { return int.Parse(s); });
+
+                                if (output.Contains(-1))
+                                {
+                                    itemClientName += $@"行程单";
+                                    output = output.Where(val => val != -1).ToArray();
+                                }
+
                                 var clients = _clientDatas.Where(it => output.Contains(it.Id)).ToList();
-                                string clientPinYinName = "";
                                 decimal unitCost = 0.00M;
                                 unitCost = (item.PayMoney / item.ClientNum).ConvertToDecimal1();
 
                                 int clienIndex = 1;
                                 foreach (var client in clients)
                                 {
-                                    Index += 1;
+                                    airClientPris.Add(new {
+                                        CnName = client.LastName+client.FirstName,
+                                        EnName = client.Pinyin,
+                                        Price = unitCost,
+                                        AirType = item.AirTypeName
+                                    });
+
                                     string six = "";
                                     if (client.Sex == 0) six = "Mr";
                                     else if (client.Sex == 1) six = "Ms";
 
                                     itemClientName += string.Format(@"{0}.{1} {2};", clienIndex, client.LastName + client.FirstName, six);
-                                    clientPinYinName += string.Format(@"{0}.{1}出票价为:{2} CNY;", Index, client.Pinyin, unitCost);
                                     clienIndex++;
                                 }
                             }
@@ -566,15 +578,67 @@ namespace OASystem.API.Controllers
                     {
                         item.AuditGMDate = Convert.ToDateTime(item.AuditGMDate).ToString("yyyy-MM-dd HH:mm:ss");
                     }
+                    AirCNYTotalPrice += item.CNYPrice;
                 }
 
                 _geView.GroupAirFeeViews = groupAirFeeViews;
-                if (!string.IsNullOrEmpty(str))
+                if (airClientPris.Count > 0)
                 {
-                    str = string.Format(@"其中:{0}", str);
+                    var peoplePriStr = "";
+                    var airClientPris1 = airClientPris.GroupBy(item => item.CnName)
+                                                      .Select(group => group.First())
+                                                      .ToList();
+                    int airClientPrisIndex = 1;
+                    foreach (var item in airClientPris1)
+                    {
+                        decimal price = 0.00M;
+                        var prices = airClientPris.Where(it => it.CnName == item.CnName).ToList();
+                        foreach (var pri in prices)
+                        {
+                            price += pri.Price;
+                        }
+                        peoplePriStr += $@"{airClientPrisIndex}.{item.EnName}出票价为: { price.ToString("#0.00")} CNY;";
+
+                        airClientPrisIndex++;
+                    }
+
+                    if (!string.IsNullOrEmpty(peoplePriStr))
+                    {
+                        str = $@"其中:{peoplePriStr}";
+                    }
+
+                    //经济舱均价
+                    var airJJCPris = airClientPris.Where(it => it.AirType == "经济舱").ToList();
+                    if (airJJCPris.Count > 0)
+                    {
+                        decimal jjcTotalPrice = 0.00M;
+                        foreach (var item in airJJCPris)
+                        {
+                            jjcTotalPrice += item.Price;
+                        }
+                        decimal jjcPeopleNum = airJJCPris.GroupBy(item => item.CnName)
+                                                      .Select(group => group.First())
+                                                      .ToList().Count();;
+                        JJCAveragePrice = jjcTotalPrice / jjcPeopleNum;
+                    }
+
+                    //公务舱均价
+                    var airGWCPris = airClientPris.Where(it => it.AirType == "公务舱").ToList();
+                    if (airGWCPris.Count > 0)
+                    {
+                        decimal gwcTotalPrice = 0.00M;
+                        foreach (var item in airGWCPris)
+                        {
+                            gwcTotalPrice += item.Price;
+                        }
+                        decimal gwcPeopleNum = airGWCPris.GroupBy(item => item.CnName)
+                                                      .Select(group => group.First())
+                                                      .ToList().Count();
+                        GWCAveragePrice = gwcTotalPrice / gwcPeopleNum;
+                    }
                 }
 
-                _geView.GroupAirFeeStr = string.Format(@"人名币总费用:{0} CNY\r\n{1}\r\n经济舱均价为:{2}CNY/人;公务舱均价为:{3}CNY/人;", AirCNYTotalPrice, str, JJCAveragePrice, GWCAveragePrice);
+                _geView.GroupAirFeeStr = $@"人名币总费用:{AirCNYTotalPrice.ToString("#0.00")} CNY\r\n{str}\r\n经济舱均价为:{JJCAveragePrice.ToString("#0.00")}CNY/人;公务舱均价为:{GWCAveragePrice.ToString("#0.00")}CNY/人;";
                 #endregion
 
                 #region 签证费用
@@ -601,7 +665,6 @@ namespace OASystem.API.Controllers
                     string visaClients = item.VisaClient;
                     if (!string.IsNullOrEmpty(visaClients))
                     {
-
                         string[] clientIds = new string[] { };
                         if (visaClients.Contains(','))
                         {
@@ -761,13 +824,44 @@ namespace OASystem.API.Controllers
                 {
                     InsuranceCNYTotalPrice += item.CNYPrice;
 
+                    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)
+                        {
+                            int[] output = Array.ConvertAll<string, int>(clientIds, delegate (string s) { return int.Parse(s); });
+                            var clients = _clientDatas.Where(it => output.Contains(it.Id)).ToList();
+                            foreach (var client in clients)
+                            {
+                                itemClientName += $"{client.LastName + client.FirstName},";
+                            }
+                        }
+                    }
+                    if (itemClientName.Length > 0)
+                    {
+                        itemClientName = itemClientName.Substring(0, itemClientName.Length - 1);
+                    }
+                    item.ClientName = itemClientName;
+
                     if (!string.IsNullOrEmpty(item.AuditGMDate))
                     {
                         item.AuditGMDate = Convert.ToDateTime(item.AuditGMDate).ToString("yyyy-MM-dd HH:mm:ss");
                     }
                 }
                 _geView.GroupInsuranceFeeViews = groupInsuranceFeeViews;
-                _geView.GroupInsuranceFeeStr = string.Format(@"人名币总费用:{0} CNY", InsuranceCNYTotalPrice);
+                _geView.GroupInsuranceFeeStr = string.Format(@"人名币总费用:{0} CNY", InsuranceCNYTotalPrice.ToString("#0.00"));
                 #endregion
 
                 #region 其他款项费用 
@@ -832,7 +926,7 @@ namespace OASystem.API.Controllers
                 }
 
                 _geView.GroupDecreaseFeeViews = groupDecreaseFeeViews;
-                _geView.GroupDecreaseFeeStr = string.Format(@"人名币总费用:{0} CNY", DecreaseCNYTotalPrice);
+                _geView.GroupDecreaseFeeStr = string.Format(@"人名币总费用:{0} CNY", DecreaseCNYTotalPrice.ToString("#0.00"));
                 #endregion
 
                 _view.GroupExpenditure = _geView;

+ 14 - 0
OASystem/OASystem.Domain/Dtos/Financial/PostPayRequestByDateRangeDto.cs

@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Dtos.Financial
+{
+    public class PostPayRequestByDateRangeDto:PortDtoBase
+    {
+        public string beginDt { get; set; }
+        public string endDt { get; set; }
+    }
+}

+ 19 - 0
OASystem/OASystem.Domain/Dtos/Financial/PostSyntheticalReceivableByDateRangeDto.cs

@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Dtos.Financial
+{
+    public class PostSyntheticalReceivableByDateRangeDto:PortDtoBase
+    {
+        public string beginDt { get; set; }
+        public string endDt { get; set; }
+
+        /// <summary>
+        /// 请求类型:1:查询数据,2:生成Excel
+        /// </summary>
+        public int requestType { get; set; }
+    }
+}

+ 1 - 0
OASystem/OASystem.Domain/Dtos/Groups/GroupCostSavaDto.cs

@@ -1309,6 +1309,7 @@ namespace OASystem.Domain.Dtos.Groups
 
     public class GroupCostModulePromptDto
     {
+        public int UserId { get; set; }
         public int DiId { get; set; }
 
         /// <summary>

+ 4 - 4
OASystem/OASystem.Domain/Entities/Groups/Grp_HotelReservations.cs

@@ -98,7 +98,7 @@ namespace OASystem.Domain.Entities.Groups
         /// <summary>
         /// 单间数量
         /// </summary>
-        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(18,2)")]
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
         public int SingleRoomCount { get; set; }
         /// <summary>
         /// 单间单价
@@ -108,7 +108,7 @@ namespace OASystem.Domain.Entities.Groups
         /// <summary>
         /// 双间数量
         /// </summary>
-        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(18,2)")]
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
         public int DoubleRoomCount { get; set; }
         /// <summary>
         /// 双间单价
@@ -118,7 +118,7 @@ namespace OASystem.Domain.Entities.Groups
         /// <summary>
         /// 套房数量
         /// </summary>
-        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(18,2)")]
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
         public int SuiteRoomCount { get; set; }
         /// <summary>
         /// 套房单价
@@ -128,7 +128,7 @@ namespace OASystem.Domain.Entities.Groups
         /// <summary>
         /// 其他房型数量
         /// </summary>
-        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(18,2)")]
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
         public int OtherRoomCount { get; set; }
         /// <summary>
         /// 其他房型单价

+ 27 - 4
OASystem/OASystem.Domain/ViewModels/Financial/Fin_DailyFeePaymentView.cs

@@ -12,8 +12,8 @@ namespace OASystem.Domain.ViewModels.Financial
     /// <summary>
     /// 日付申请 View
     /// </summary>
-    public class Fin_DailyFeePaymentView:Fin_DailyFeePayment
-    {}
+    public class Fin_DailyFeePaymentView : Fin_DailyFeePayment
+    { }
 
 
     public class Fin_DailyFeePaymentPageCount
@@ -88,9 +88,9 @@ namespace OASystem.Domain.ViewModels.Financial
             {
                 string str = "未审核";
                 if (FAudit == 0) str = "未审核";
-                else if (FAudit == 1) 
+                else if (FAudit == 1)
                 {
-                    str = "已通过"; 
+                    str = "已通过";
                     FAuditName = "朱成梅";
                 }
                 else if (FAudit == 2)
@@ -329,4 +329,27 @@ namespace OASystem.Domain.ViewModels.Financial
     {
         public List<Fin_DailyFeePaymentPagePriceSubTypeView> SubDatas { get; set; }
     }
+
+    public class tree_Fin_DailyFeePaymentPageListView : Fin_DailyFeePaymentPageListView
+    {
+        public List<Fin_DailyFeePaymentContentInfolView> childList { get; set; }
+        public string priceTypeStr { get; set; }
+
+        public int transferTypeId { get; set; }
+        public string transferTypeIdStr { get; set; }
+        /// <summary>
+        /// 公转:62,私转:63
+        /// </summary>
+        public int transferParentId { get; set; }
+        public string transferParentIdStr { get; set; }
+    }
+
+    public class tree_Fin_DailyFeePaymentResult : tree_Fin_DailyFeePaymentPageListView 
+    {
+        public decimal gz { get; set; } = 0M;
+        public decimal sz { get; set; } = 0M;
+
+        public List<tree_Fin_DailyFeePaymentPageListView> dataList { get; set; }
+    }
+
 }

+ 106 - 2
OASystem/OASystem.Domain/ViewModels/Financial/Fin_ForeignReceivablesView.cs

@@ -10,14 +10,14 @@ namespace OASystem.Domain.ViewModels.Financial
     /// <summary>
     /// 团组应收款项 View
     /// </summary>
-    public class Fin_ForeignReceivablesView:Fin_ForeignReceivables
+    public class Fin_ForeignReceivablesView : Fin_ForeignReceivables
     {
     }
 
     /// <summary>
     /// 团组应收款项 info View
     /// </summary>
-    public class ForeignReceivablesInfoView 
+    public class ForeignReceivablesInfoView
     {
         /// <summary>
         /// 主键ID
@@ -237,5 +237,109 @@ namespace OASystem.Domain.ViewModels.Financial
 
 
 
+    #endregion
+
+    #region 应收报表
+
+    public class Excel_SyntheticalReceivableByDateRange{
+        public string No { get; set; }
+
+        /// <summary>
+        /// 团组名称
+        /// </summary>
+        public string TeamName { get; set; }
+
+        /// <summary>
+        /// 单位
+        /// </summary>
+        public string ClientUnit { get; set; }
+
+        /// <summary>
+        /// 出访时间
+        /// </summary>
+        public string VisitDate { get; set; }
+
+        /// <summary>
+        /// 应收
+        /// </summary>
+        public string Accounts { get; set; }
+
+        /// <summary>
+        /// 已收
+        /// </summary>
+        public string Received { get; set; }
+
+        /// <summary>
+        /// 余款
+        /// </summary>
+        public string Balance { get; set; }
+
+        /// <summary>
+        /// 收款进度
+        /// </summary>
+        public string Collection { get; set; }
+
+        public string Sign { get; set; }
+    }
+
+    public class PostSyntheticalReceivableByDateRangeResultView
+    {
+        public string total_fr { get; set; }
+        public string total_pr { get; set; }
+        public string total_balance { get; set; }
+
+        public List<PostSyntheticalReceivableByDateRangeView> dataList { get; set; }
+    }
+
+    public class PostSyntheticalReceivableByDateRangeView
+    {
+        public int No { get; set; }
+
+        /// <summary>
+        /// 团组Id
+        /// </summary>
+        public int diid { get; set; }
+
+        /// <summary>
+        /// 团组名称
+        /// </summary>
+        public string teamName { get; set; }
+
+        /// <summary>
+        /// 单位
+        /// </summary>
+        public string clientUnit { get; set; }
+
+        /// <summary>
+        /// 出访时间
+        /// </summary>
+        public string visitDate { get; set; }
+
+        /// <summary>
+        /// 应收
+        /// </summary>
+        public string frPrice { get; set; }
+
+        /// <summary>
+        /// 已收
+        /// </summary>
+        public string prPrice { get; set; }
+
+        /// <summary>
+        /// 余款
+        /// </summary>
+        public string balPrice { get; set; }
+
+        /// <summary>
+        /// 收款单位
+        /// </summary>
+        public string prClient { get; set; }
+
+        /// <summary>
+        /// 收款进度
+        /// </summary>
+        public string schedule { get; set; }
+    }
+
     #endregion
 }

+ 5 - 0
OASystem/OASystem.Domain/ViewModels/Groups/DelegationInfoView.cs

@@ -450,6 +450,11 @@ namespace OASystem.Domain.ViewModels.Groups
         /// 0否1是
         /// </summary>
         public int IsSure { get; set; }
+
+        /// <summary>
+        /// 流程管控Id
+        /// </summary>
+        public int GrpScheduleId { get; set; } = 0;
     }
 
     

+ 14 - 3
OASystem/OASystem.Domain/ViewModels/Groups/GroupCostParameterView.cs

@@ -20,15 +20,16 @@ namespace OASystem.Domain.ViewModels.Groups
     /// </summary>
     public class GroupCostModulePromptView
     {
-        public string CurrencyCode { get; set; }
-
-        public decimal Rate { get; set; }
 
         public List<GroupCostModulePromptInfo> ModulePromptInfos { get; set; }
     }
 
     public class GroupCostModulePromptInfo
     {
+        public string CurrencyCode { get; set; }
+
+        public decimal Rate { get; set; }
+
         /// <summary>
         /// 分段成本 A B
         /// </summary>
@@ -38,6 +39,16 @@ namespace OASystem.Domain.ViewModels.Groups
         public string CostTypeEndTime { get; set; }
         public int CostTypeNumber { get; set; }
 
+        /// <summary>
+        /// 单人成本
+        /// </summary>
+        public decimal IndividualCost { get; set; }
+
+        /// <summary>
+        /// 总成本
+        /// </summary>
+        public decimal TotalCost { get; set; }
+
         public object Data { get; set; }
     }
 }

+ 22 - 2
OASystem/OASystem.Infrastructure/Repositories/Groups/AirTicketResRepository.cs

@@ -236,8 +236,15 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     
                     foreach (var item in ClientArr)
                     {
-                        Crm_DeleClient DeleClient = _sqlSugar.Queryable<Crm_DeleClient>().Where(a => a.IsDel==0 && a.Id==int.Parse(item)).First();
-                        _AirTicketReservations[i].ClientNameStr+= DeleClient.Pinyin+',';
+                        if (item == "-1")
+                        {
+                            _AirTicketReservations[i].ClientNameStr += "行程单,";
+                        }
+                        else
+                        {
+                            Crm_DeleClient DeleClient = _sqlSugar.Queryable<Crm_DeleClient>().Where(a => a.IsDel == 0 && a.Id == int.Parse(item)).First();
+                            _AirTicketReservations[i].ClientNameStr += DeleClient.Pinyin + ',';
+                        }
                     }
                     if (_AirTicketReservations[i].ClientNameStr is not null)
                     {
@@ -427,6 +434,13 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     {
                         Grp_CreditCardPayment grp_CreditCard = _mapper.Map<Grp_CreditCardPayment>(dto.CardPaymentOpData);
 
+                        //PayDId == 刷卡 IsPay == 1
+                        if (dto.CardPaymentOpData.PayDId == 72)
+                        {
+                            grp_CreditCard.IsPay = 1;
+                        }
+
+
                         //获取新汇率  int diId,int CId, int currencyId
                         var rate = await fn(dto.AirTicketResOpData.DiId,85,dto.AirTicketResOpData.Currency);
 
@@ -636,6 +650,12 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         //C表操作
                         Grp_CreditCardPayment grp_CreditCard = _mapper.Map<Grp_CreditCardPayment>(dto.CardPaymentOpData);
 
+                        //PayDId == 刷卡 IsPay == 1
+                        if (grp_CreditCard.PayDId == 72)
+                        {
+                            grp_CreditCard.IsPay = 1;
+                        }
+
                         //获取新汇率  int diId,int CId, int currencyId
                         var rate = await fn(dto.AirTicketResOpData.DiId, 85, dto.AirTicketResOpData.Currency);
 

+ 26 - 1
OASystem/OASystem.Infrastructure/Repositories/Groups/DelegationInfoRepository.cs

@@ -220,7 +220,31 @@ namespace OASystem.Infrastructure.Repositories.Groups
         {
             Result result = new Result() { Code = -2, Msg = "未知错误" };
 
-            if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3) //web
+            if (dto.PortType == 1) {
+                string sql = string.Format(@"Select gdi.Id,SalesQuoteNo,TourCode,ssd.Id TeamTypeId, ssd.Name TeamType,ssd1.Id TeamLevId,ssd1.Name TeamLev,TeamName,ClientName,ClientUnit,VisitDate,VisitDays,VisitPNumber,su.CnName JietuanOperator,IsSure
+                  ,gs.Id as GrpScheduleId
+				  From  Grp_DelegationInfo gdi
+                  Inner Join Sys_SetData ssd On gdi.TeamDid = ssd.Id 
+                  Inner Join Sys_SetData ssd1 On gdi.TeamLevSId = ssd1.Id
+                  Left Join Sys_Users su On gdi.JietuanOperator = su.Id
+				  left Join Grp_Schedule gs On gdi.Id = gs.DiId
+                  Where gdi.IsDel = 0 
+                  Order By gdi.CreateTime Desc");
+
+                var _DelegationList = await _sqlSugar.SqlQueryable<DelegationListView>(sql).ToListAsync();
+
+                if (_DelegationList.Count > 0)
+                {
+                    result.Code = 0;
+                    result.Msg = "成功!";
+                    result.Data = _DelegationList;
+                }
+                else
+                {
+                    result.Msg = "暂无该团组信息";
+                }
+            }
+            else if (dto.PortType == 2 || dto.PortType == 3) //web
             {
                 string sql = string.Format(@"Select gdi.Id,SalesQuoteNo,TourCode,ssd.Id TeamTypeId, ssd.Name TeamType,ssd1.Id TeamLevId,ssd1.Name TeamLev,TeamName,ClientName,ClientUnit,VisitDate,VisitDays,VisitPNumber,su.CnName JietuanOperator,IsSure
                   From  Grp_DelegationInfo gdi
@@ -231,6 +255,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                   Order By gdi.CreateTime Desc");
 
                 var _DelegationList = await _sqlSugar.SqlQueryable<DelegationListView>(sql).ToListAsync();
+
                 if (_DelegationList.Count > 0)
                 {
                     result.Code = 0;

+ 22 - 0
OASystem/OASystem.Infrastructure/Repositories/Groups/InvitationOfficialActivitiesRepository.cs

@@ -58,6 +58,16 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         invitation.ConsumptionPatterns = grp_CreditCard.ConsumptionPatterns;
                         invitation.ConsumptionDate = grp_CreditCard.ConsumptionDate;
                         invitation.PayDId = grp_CreditCard.PayDId;
+                        invitation.ConsumptionPatterns = grp_CreditCard.ConsumptionPatterns;
+                        invitation.ConsumptionDate = grp_CreditCard.ConsumptionDate;
+                        invitation.BankNo = grp_CreditCard.BankNo;
+                        invitation.CardholderName = grp_CreditCard.CardholderName;
+                        invitation.CompanyBankNo = grp_CreditCard.CompanyBankNo;
+                        invitation.OtherBankName = grp_CreditCard.OtherBankName;
+                        invitation.OtherSideNo = grp_CreditCard.OtherSideNo;
+                        invitation.OtherSideName = grp_CreditCard.OtherSideName;
+                        invitation.PayMoney = grp_CreditCard.PayMoney;
+                        invitation.PaymentCurrency = grp_CreditCard.PaymentCurrency;
                         invitation.OrbitalPrivateTransfer = grp_CreditCard.OrbitalPrivateTransfer;
                         invitation.Payee = grp_CreditCard.Payee;
                         invitation.Address = res_InvitationOfficialActivityData.Address;
@@ -309,6 +319,11 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
                             Grp_CreditCardPayment C = new Grp_CreditCardPayment();
                             C.PayDId = dto.PayDId;
+                            if (C.PayDId == 72)
+                            {
+                                C.IsPay = 1;
+                            }
+
                             C.ConsumptionPatterns = dto.ConsumptionPatterns;
                             C.ConsumptionDate = dto.ConsumptionDate;
                             C.CTDId = dto.CTDId;
@@ -441,6 +456,11 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         Grp_CreditCardPayment grp_CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == grp_Invitation.Id && a.CTable == 81 && a.IsDel == 0);
                         if (grp_CreditCardPayment != null)
                         {
+                            if (dto.PayDId == 72)
+                            {
+                                grp_CreditCardPayment.IsPay = 1;
+                            }
+
                             grp_CreditCardPayment.PayMoney = dto.PayMoney;
                             grp_CreditCardPayment.PaymentCurrency = dto.PaymentCurrency;
                             grp_CreditCardPayment.Payee = dto.Payee;
@@ -469,6 +489,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
                                                         {
                                                             ConsumptionPatterns = dto.ConsumptionPatterns,
                                                             ConsumptionDate = dto.ConsumptionDate,
+                                                            PayDId = dto.PayDId,
+                                                            IsPay = grp_CreditCardPayment.IsPay,
                                                             CTDId = dto.CTDId,
                                                             BankNo = dto.BankNo,
                                                             CardholderName = dto.CardholderName,