Browse Source

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

yuanrf 1 year ago
parent
commit
48e0334182

+ 15 - 5
OASystem/OASystem.Api/Controllers/BusinessController.cs

@@ -43,7 +43,8 @@ namespace OASystem.API.Controllers
 
         #region 团组信息 
         /// <summary>
-        ///  团组信息 团组详情
+        ///  团组信息 
+        ///  团组简略详情 
         /// </summary>
         /// <param name="dto">团组info请求dto</param>
         /// <returns></returns>
@@ -51,13 +52,22 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostShareGroupInfo(ShareGroupInfoDto dto)
         {
-            var groupData = await _groupRep.PostShareGroupInfo(dto);
-            if (groupData.Code != 0)
+            try
             {
-                return Ok(JsonView(false, groupData.Msg));
+                var groupData = await _groupRep.PostShareGroupInfo(dto);
+                if (groupData.Code != 0)
+                {
+                    return Ok(JsonView(false, groupData.Msg));
+                }
+
+                return Ok(JsonView(groupData.Data));
             }
+            catch (Exception ex)
+            {
 
-            return Ok(JsonView(groupData.Data));
+                return Ok(JsonView(false, ex.Message));
+            }
+            
         }
 
         /// <summary>

+ 434 - 184
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -34,6 +34,10 @@ using System.Globalization;
 using static QRCoder.PayloadGenerator;
 using Bookmark = Aspose.Words.Bookmark;
 using Aspose.Words.Fields;
+using NPOI.POIFS.FileSystem;
+using Microsoft.AspNetCore.Mvc.ViewEngines;
+using OASystem.Domain.ViewModels.QiYeWeChat;
+using OASystem.Domain.Entities.Financial;
 
 namespace OASystem.API.Controllers
 {
@@ -908,238 +912,485 @@ namespace OASystem.API.Controllers
         /// </summary>
         /// <param name="paras">参数Json字符串</param>
         /// <returns></returns>
+
         [HttpPost]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostSearchGrpCreditCardPayment(Search_GrpCreditCardPaymentDto _dto)
         {
-            #region  参数验证
-            if (_dto.UserId < 1) return Ok(JsonView(false, "员工Id为空"));
-            if (_dto.PageId < 1) return Ok(JsonView(false, "页面Id为空"));
-            if (_dto.DiId < 1) return Ok(JsonView(false, "团组Id为空"));
+            try
+            {
+                #region  参数验证
+                if (_dto.UserId < 1) return Ok(JsonView(false, "员工Id为空"));
+                if (_dto.PageId < 1) return Ok(JsonView(false, "页面Id为空"));
+                if (_dto.DiId < 1) return Ok(JsonView(false, "团组Id为空"));
 
-            PageFunAuthViewBase pageFunAuthView = new PageFunAuthViewBase();
+                PageFunAuthViewBase pageFunAuthView = new PageFunAuthViewBase();
 
-            #region 页面操作权限验证
-            pageFunAuthView = await GeneralMethod.PostUserPageFuncDatas(_dto.UserId,_dto.PageId);
+                #region 页面操作权限验证
+                pageFunAuthView = await GeneralMethod.PostUserPageFuncDatas(_dto.UserId, _dto.PageId);
 
-            if (pageFunAuthView.CheckAuth == 0) return Ok(JsonView(false, "您没有查看权限"));
-            #endregion
-            
-            #endregion
+                if (pageFunAuthView.CheckAuth == 0) return Ok(JsonView(false, "您没有查看权限"));
+                #endregion
 
-            Grp_CreditCardPaymentView _view = new Grp_CreditCardPaymentView();
+                #endregion
 
-            #region 费用清单
-            var exp = Expressionable.Create<Grp_CreditCardPayment>();
-            exp.AndIF(_dto.AuditStatus != -1, it => it.IsAuditGM == _dto.AuditStatus);
-            exp.AndIF(_dto.Label != -1, it => it.CTable == _dto.Label);
+                Grp_CreditCardPaymentView _view = new Grp_CreditCardPaymentView();
 
-            List<Grp_CreditCardPayment> entityList = _groupRepository
-                .Query<Grp_CreditCardPayment>(s => s.DIId == _dto.DiId && s.IsDel == 0 && s.CreateUserId > 0)
-                .Where(exp.ToExpression())
-                .ToList();
+                #region 费用清单
+                var exp = Expressionable.Create<Grp_CreditCardPayment>();
+                exp.AndIF(_dto.AuditStatus != -1, it => it.IsAuditGM == _dto.AuditStatus);
+                exp.AndIF(_dto.Label != -1, it => it.CTable == _dto.Label);
 
-            List<Grp_CreditCardPaymentDetailView> detailList = new List<Grp_CreditCardPaymentDetailView>();
-            decimal CNY = 0;
-            decimal PayCNY = 0;
-            decimal BalanceCNY = 0;
-            decimal YSFYCNY = 0;
+                List<Grp_CreditCardPayment> entityList = _groupRepository
+                    .Query<Grp_CreditCardPayment>(s => s.DIId == _dto.DiId && s.IsDel == 0 && s.CreateUserId > 0)
+                    .Where(exp.ToExpression())
+                    .ToList();
 
-            decimal USD = 0;
-            decimal PayUSD = 0;
-            decimal BalanceUSD = 0;
-            decimal YSFYUSD = 0;
 
-            decimal EUR = 0;
-            decimal PayEUR = 0;
-            decimal BalanceEUR = 0;
-            decimal YSFYEUR = 0;
+                List<Grp_CreditCardPaymentDetailView> detailList = new List<Grp_CreditCardPaymentDetailView>();
 
-            foreach (var entity in entityList)
-            {
-                Grp_CreditCardPaymentDetailView _detail = new Grp_CreditCardPaymentDetailView();
+                List<CreditCardPaymentCurrencyPriceItem> ccpCurrencyPrices = new List<CreditCardPaymentCurrencyPriceItem>();
 
-                _detail.Id = entity.Id;
+                /*
+                 * 76://酒店预订
+                 */
+
+                List<Grp_HotelReservations> _HotelReservations = await _groupRepository
+                                                                       .Query<Grp_HotelReservations>(s => s.DiId == _dto.DiId && s.IsDel == 0)
+                                                                       .ToListAsync();
 
                 /*
-                 * Bus名称
+                 * 79://车/导游地接
                  */
-                _detail.BusName = "";
+                List<Grp_CarTouristGuideGroundReservations> _CarTouristGuideGroundReservations = await _groupRepository
+                                                                                                       .Query<Grp_CarTouristGuideGroundReservations>(s => s.DiId == _dto.DiId && s.IsDel == 0)
+                                                                                                       .ToListAsync();
+                List<Grp_CarTouristGuideGroundReservationsContent> _CarTouristGuideGroundReservationsContent = await _groupRepository
+                                                                     .Query<Grp_CarTouristGuideGroundReservationsContent>(s => s.DiId == _dto.DiId && s.IsDel == 0)
+                                                                     .ToListAsync();
+
 
                 /*
-                 *费用所属
+                 * 80: //签证
                  */
-                switch (entity.CTable)
-                {
-                    case 85:
-                        Grp_AirTicketReservations jpRes = _groupRepository.Query<Grp_AirTicketReservations>(s => s.Id == entity.CId).First();
-                        if (jpRes != null)
-                        {
-                            string FlightsDescription = jpRes.FlightsDescription;
-                            string PriceDescription = jpRes.PriceDescription;
-                            _detail.PriceMsgContent = "航班号:" + jpRes.FlightsCode + "<br/>城市A-B:" + jpRes.FlightsCity + "<br/>航班描述:" + FlightsDescription.Replace("\r\n", "<br />") + "<br/>" + "价格描述:" + PriceDescription;
-                            _detail.PriceNameContent = "(" + jpRes.FlightsCode + ")";
-                        }
-                        break;
-                    case 79:
-                        _detail.BusName = "待增加";
-                        break;
-                    case 98:
-                        Grp_DecreasePayments gdpRes = _groupRepository.Query<Grp_DecreasePayments>(s => s.Id == entity.CId).First();
-                        if (gdpRes != null)
-                        {
-                            _detail.PriceMsgContent = "备注:" + gdpRes.Remark;
-                            _detail.PriceNameContent = gdpRes.PriceName;
-                        }
-                        break;
-                    default:
-                        break;
-                }
+
+                List<Grp_VisaInfo> _VisaInfos = await _groupRepository
+                                                      .Query<Grp_VisaInfo>(s => s.DIId == _dto.DiId && s.IsDel == 0)
+                                                      .ToListAsync();
+
 
                 /*
-                 * 费用模块
+                 *81: //邀请/公务活动
                  */
-                Sys_SetData sdPriceName = _groupRepository.Query<Sys_SetData>(s => s.Id == entity.CTable).First();
-                if (sdPriceName != null)
-                {
-                    _detail.PriceName = sdPriceName.Name;
-                }
+
+                List<Grp_InvitationOfficialActivities> _InvitationOfficialActivities = await _groupRepository
+                                                                                             .Query<Grp_InvitationOfficialActivities>(s => s.DiId == _dto.DiId && s.IsDel == 0)
+                                                                                             .ToListAsync();
 
                 /*
-                 * 应付款金额	
+                 * 82: //团组客户保险
                  */
-                Sys_SetData sdPaymentCurrency_WaitPay = _groupRepository.Query<Sys_SetData>(s => s.Id == entity.PaymentCurrency).First();
-                string PaymentCurrency_WaitPay = "Unknown";
-                if (sdPaymentCurrency_WaitPay != null)
-                {
-                    PaymentCurrency_WaitPay = sdPaymentCurrency_WaitPay.Name;
-                }
-                _detail.WaitPay = entity.PayMoney.ToString("#0.00") + " " + PaymentCurrency_WaitPay;
 
                 /*
-                 * 此次付款金额
+                 *  Label = 98 其他款项
                  */
-                decimal CurrPayStr = 0;
-                if (entity.PayPercentage == 0)
-                {
-                    if (entity.PayThenMoney != 0)
-                        CurrPayStr = entity.PayThenMoney * entity.DayRate;
-                }
-                else
-                {
-                    CurrPayStr = entity.PayMoney * (decimal.Parse(entity.PayPercentage.ToString("#0.00")) / 100 * entity.DayRate);
-                }
-                _detail.CurrPay = CurrPayStr.ToString("#0.00") + " CNY";
 
+                List<Grp_DecreasePayments> _DecreasePayments = await _groupRepository
+                                                                    .Query<Grp_DecreasePayments>(s => s.DiId == _dto.DiId && s.IsDel == 0)
+                                                                    .ToListAsync();
                 /*
-                 * 剩余尾款
+                 *  Lable = 85 机票预订
+                 */
+
+                List<Grp_AirTicketReservations> p_AirTicketReservations = await _groupRepository
+                                                                                .Query<Grp_AirTicketReservations>(s => s.DIId == _dto.DiId && s.IsDel == 0)
+                                                                                .ToListAsync();
+
+                /*
+                 * 98 机票预定
+                 */
+
+                List<Grp_AirTicketReservations> _AirTicketReservations = await _groupRepository.Query<Grp_AirTicketReservations>(s => s.DIId == _dto.DiId && s.IsDel == 0).ToListAsync();
+
+                /*
+                 *  285://收款退还
+                 */
+                List<Fin_PaymentRefundAndOtherMoney> _PaymentRefundAndOtherMoneys= await _groupRepository
+                                                                                .Query<Fin_PaymentRefundAndOtherMoney>(s => s.DiId == _dto.DiId && s.IsDel == 0)
+                                                                                .ToListAsync();
+
+                List<Grp_Customers> _Customers = await _groupRepository.Query<Grp_Customers>(s => s.DiId == _dto.DiId && s.IsDel == 0) .ToListAsync();
+                /*
+                 * 币种信息
                  */
-                decimal BalanceStr = 0;
-                if (entity.PayMoney - (CurrPayStr / entity.DayRate) < 0.01M)
-                    BalanceStr = 0;
-                else
-                    BalanceStr = (entity.PayMoney - CurrPayStr / entity.DayRate);
 
-                _detail.Balance = BalanceStr.ToString("#0.00") + " " + PaymentCurrency_WaitPay;
+                var currencyItems = await _groupRepository.Query<Sys_SetData>(s => s.STid == 66 && s.IsDel == 0).ToListAsync();
 
                 /*
-                 * 申请人
+                 * 车/导游地接 费用类型
                  */
-                string operatorName = "无";
-                Sys_Users _opUser = _groupRepository.Query<Sys_Users>(s => s.Id == entity.CreateUserId).First();
-                if (_opUser != null)
+
+                var carFeeTypeItems = await _groupRepository.Query<Sys_SetData>(s => s.STid == 17 && s.IsDel == 0).ToListAsync();
+
+                /*
+                 * 用户信息
+                 */
+
+                var userItems = await _groupRepository.Query<Sys_Users>(s => s.IsDel == 0).ToListAsync();
+
+                /*
+                    * 费用模块
+                    */
+                Sys_SetData sdPriceName = _groupRepository.Query<Sys_SetData>(s => s.Id == _dto.Label).First();
+                string priceModule = string.Empty;
+                if (sdPriceName != null)
                 {
-                    operatorName = _opUser.CnName;
+                    priceModule = sdPriceName.Name;
                 }
-                _detail.OperatorName = operatorName;
 
                 /*
-                * 审核人
-                */
-                string auditOperatorName = "Unknown";
-                if (entity.AuditGMOperate == 0)
-                    auditOperatorName = "无";
-                else if (entity.AuditGMOperate == 4)
-                    auditOperatorName = "自动审核";
-                else
+                 * 处理详情数据 
+                 */
+                foreach (var entity in entityList)
                 {
-                    Sys_Users _adUser = _groupRepository.Query<Sys_Users>(s => s.Id == entity.AuditGMOperate).First();
-                    if (_adUser != null)
+                    Grp_CreditCardPaymentDetailView _detail = new Grp_CreditCardPaymentDetailView();
+
+                    _detail.Id = entity.Id;
+
+                    _detail.PriceName = priceModule;
+
+                    /*
+                     * 应付款金额	
+                     */
+                    Sys_SetData sdPaymentCurrency_WaitPay = currencyItems.Where(s => s.Id == entity.PaymentCurrency).FirstOrDefault();
+                    string PaymentCurrency_WaitPay = "Unknown";
+                    string hotelCurrncyCode = "Unknown";
+                    string hotelCurrncyName = "Unknown";
+                    if (sdPaymentCurrency_WaitPay != null)
+                    {
+                        PaymentCurrency_WaitPay = sdPaymentCurrency_WaitPay.Name;
+                        hotelCurrncyCode = sdPaymentCurrency_WaitPay.Name;
+                        hotelCurrncyName = sdPaymentCurrency_WaitPay.Remark;
+                    }
+                    _detail.WaitPay = entity.PayMoney.ConvertToDecimal1() + " " + PaymentCurrency_WaitPay;
+
+                    /*
+                     * 此次付款金额
+                     */
+                    decimal CurrPayStr = 0;
+                    if (entity.PayPercentage == 0)
                     {
-                        auditOperatorName = _adUser.CnName;
+                        if (entity.PayThenMoney != 0)
+                            CurrPayStr = (entity.PayThenMoney * entity.DayRate).ConvertToDecimal1();
                     }
+                    else
+                    {
+                        CurrPayStr = (entity.PayMoney * (decimal.Parse(entity.PayPercentage.ToString("#0.00")) / 100 * entity.DayRate)).ConvertToDecimal1();
+                    }
+                    _detail.CurrPay = CurrPayStr.ToString("#0.00") + " CNY";
+
+                    /*
+                     * 剩余尾款
+                     */
+                    decimal BalanceStr = 0;
+                    if (entity.PayMoney - (CurrPayStr / entity.DayRate) < 0.01M)
+                        BalanceStr = 0;
+                    else
+                        BalanceStr = (entity.PayMoney - CurrPayStr / entity.DayRate).ConvertToDecimal1();
+
+                    _detail.Balance = BalanceStr.ToString("#0.00") + " " + PaymentCurrency_WaitPay;
+
+
+
+                    /*
+                     * Bus名称
+                     */
+                    _detail.BusName = "待增加";
+
+                    /*
+                     *费用所属
+                     */
+                    switch (entity.CTable)
+                    {
+
+                        case 76://酒店预订
+                            Grp_HotelReservations hotelReservations = _HotelReservations.Where(s => s.Id == entity.CId).FirstOrDefault();
+                            if (hotelReservations != null)
+                            {
+                                _detail.PriceMsgContent = "信用卡金额:" + _detail.WaitPay + " " + hotelCurrncyCode + "(" + hotelCurrncyName + ")<br/>" +
+                                                          "房间说明:" + hotelReservations.Remark;
+                                _detail.PriceNameContent = hotelReservations.HotelName;
+                            }
+
+                            break;
+                        case 79://车/导游地接
+                            Grp_CarTouristGuideGroundReservations touristGuideGroundReservations = _CarTouristGuideGroundReservations.Where(s => s.Id == entity.CId).FirstOrDefault();
+                            if (touristGuideGroundReservations != null)
+                            {
+                                if (!string.IsNullOrEmpty(touristGuideGroundReservations.BusName))
+                                {
+                                    _detail.BusName = touristGuideGroundReservations.BusName;
+                                }
+
+                                
+                                _detail.PriceNameContent = touristGuideGroundReservations.Area;
+
+                                List<Grp_CarTouristGuideGroundReservationsContent> touristGuideGroundReservationsContents = _CarTouristGuideGroundReservationsContent
+                                    .Where(s => s.CTGGRId == touristGuideGroundReservations.Id && s.IsDel == 0 && s.Price != 0).ToList();
+
+                                string priceMsg = string.Empty;
+                                foreach (var item in touristGuideGroundReservationsContents)
+                                {
+                                    string typeName = "Unknown";
+                                    string carCurrencyCode = "Unknown";
+                                    string carCurrencyName = "Unknown";
+                                    var carTypeData = carFeeTypeItems.Where(s => s.Id == item.SId && s.IsDel == 0).FirstOrDefault();
+                                    if (carTypeData != null) typeName = carTypeData.Name;
+
+
+                                    var currencyData = currencyItems.Where(s => s.Id == item.Currency && s.IsDel == 0).FirstOrDefault();
+                                    if (currencyData != null) {
+                                        carCurrencyCode = currencyData.Name;
+                                        carCurrencyName = currencyData.Remark;
+                                    }
+
+                                    priceMsg += typeName + ":" + item.Price.ToString("#0.00") + " " + carCurrencyCode + "(" + carCurrencyName + ")<br/>" +
+                                                "明细:" + item.PriceContent + "<br/>" +
+                                                "备注:" + item.Remark + "<br/><br/>";
+                                }
+
+
+                                _detail.PriceMsgContent = priceMsg;
+                            }
+
+                            break;
+                        case 80: //签证
+                            Grp_VisaInfo visaInfo = _VisaInfos.Where(s => s.Id == entity.CId).FirstOrDefault();
+                            if (visaInfo != null)
+                            {
+                                _detail.PriceNameContent = visaInfo.VisaClient;
+                                _detail.PriceMsgContent = "备注:" + visaInfo.Remark;
+                            }
+
+                            break;
+                        case 81: //邀请/公务活动
+
+                            Grp_InvitationOfficialActivities invitationOfficialActivities = _InvitationOfficialActivities.Where(s => s.Id == entity.CId).FirstOrDefault();
+                            if (invitationOfficialActivities != null)
+                            {
+
+                                string ioaCurrencyCode = "Unknown";
+                                string ioaCurrencyName= "Unknown";
+
+                                var currencyData = currencyItems.Where(s => s.Id == invitationOfficialActivities.Currency && s.IsDel == 0).FirstOrDefault();
+                                if (currencyData != null)
+                                {
+                                    ioaCurrencyCode = currencyData.Name;
+                                    ioaCurrencyName = currencyData.Remark;
+                                }
+
+                                _detail.PriceNameContent = invitationOfficialActivities.InviterArea;
+                                _detail.PriceMsgContent = "邀请费用:" + invitationOfficialActivities.InviteCosts + " "+ ioaCurrencyCode + "("+ ioaCurrencyName+ ")<br/>" +
+                                                          "活动费用:- <br/>" +
+                                                          "备注:" + invitationOfficialActivities.Remark + "<br/>";
+
+                            }
+
+                            break;
+                        case 82: //团组客户保险
+
+                            Grp_Customers customers = _Customers.Where(s => s.Id == entity.Id && s.IsDel == 0).FirstOrDefault();
+                            if (customers != null)
+                            {
+                                _detail.PriceNameContent = customers.ClientName;
+                                _detail.PriceMsgContent = "备注:" + customers.Remark + "<br/>";
+                            }
+
+                            break;
+                        case 85: //机票预订
+                            Grp_AirTicketReservations jpRes = _AirTicketReservations.Where(s => s.Id == entity.CId).FirstOrDefault();
+                            if (jpRes != null)
+                            {
+                                string FlightsDescription = jpRes.FlightsDescription;
+                                string PriceDescription = jpRes.PriceDescription;
+                                _detail.PriceMsgContent = "航班号:" + jpRes.FlightsCode + "<br/>城市A-B:" + jpRes.FlightsCity + "<br/>航班描述:" + FlightsDescription.Replace("\r\n", "<br />") + "<br/>" + "价格描述:" + PriceDescription;
+                                _detail.PriceNameContent = "(" + jpRes.FlightsCode + ")";
+                            }
+                            break;
+                        case 98://其他款项
+                            Grp_DecreasePayments gdpRes = _DecreasePayments.Where(s => s.Id == entity.CId).FirstOrDefault();
+                            if (gdpRes != null)
+                            {
+                                _detail.PriceMsgContent = "备注:" + gdpRes.Remark;
+                                _detail.PriceNameContent = gdpRes.PriceName;
+                            }
+                            break;
+                        case 285://收款退还 
+                            Fin_PaymentRefundAndOtherMoney refundAndOtherMoney = _PaymentRefundAndOtherMoneys.Where(s => s.Id == entity.CId).FirstOrDefault();
+                            if (refundAndOtherMoney != null)
+                            {
+                                _detail.PriceMsgContent = "备注:" + refundAndOtherMoney.Remark;
+                                _detail.PriceNameContent = refundAndOtherMoney.PriceName;
+                            }
+
+                            break;
+                        case 751://酒店早餐
+                          
+                            break;
+                        default:
+                            break;
+                    }
+
+                    /*
+                     * 申请人
+                     */
+                    string operatorName = " - ";
+                    Sys_Users _opUser = userItems.Where(s => s.Id == entity.CreateUserId).FirstOrDefault();
+                    if (_opUser != null)
+                    {
+                        operatorName = _opUser.CnName;
+                    }
+                    _detail.OperatorName = operatorName;
+
+                    /*
+                    * 审核人
+                    */
+                    string auditOperatorName = "Unknown";
+                    if (entity.AuditGMOperate == 0)
+                        auditOperatorName = " - ";
+                    else if (entity.AuditGMOperate == 4)
+                        auditOperatorName = "自动审核";
+                    else
+                    {
+                        Sys_Users _adUser = userItems.Where(s => s.Id == entity.AuditGMOperate).FirstOrDefault();
+                        if (_adUser != null)
+                        {
+                            auditOperatorName = _adUser.CnName;
+                        }
+                    }
+                    _detail.AuditOperatorName = auditOperatorName;
+
+                    /*
+                     * 超预算比例
+                     */
+                    string overBudgetStr = "";
+
+                    if (entity.ExceedBudget == -1)
+                        overBudgetStr = sdPriceName.Name + "尚无预算";
+                    else if (entity.ExceedBudget == 0)
+                        overBudgetStr = "未超预算";
+                    else
+                        overBudgetStr = entity.ExceedBudget.ToString("P");
+                    _detail.OverBudget = overBudgetStr;
+
+
+                    /*
+                     * 费用总计
+                     */
+                    ccpCurrencyPrices.Add(new CreditCardPaymentCurrencyPriceItem()
+                    {
+                        CurrencyId = entity.PaymentCurrency,
+                        CurrencyName = PaymentCurrency_WaitPay,
+                        AmountPayable = entity.PayMoney,
+                        ThisPayment = CurrPayStr,
+                        BalancePayment = BalanceStr,
+                        AuditedFunds = CurrPayStr
+                    });
+
+                    _detail.IsAuditGM = entity.IsAuditGM;
+
+                    detailList.Add(_detail);
                 }
-                _detail.AuditOperatorName = auditOperatorName;
 
-                /*
-                 * 
-                 * *超预算比例
-                 */
-                string overBudgetStr = "";
+                #endregion
 
-                if (entity.ExceedBudget == -1)
-                    overBudgetStr = sdPriceName.Name + "尚无预算";
-                else if (entity.ExceedBudget == 0)
-                    overBudgetStr = "未超预算";
-                else
-                    overBudgetStr = entity.ExceedBudget.ToString("P");
-                _detail.OverBudget = overBudgetStr;
+                _view.DetailList = new List<Grp_CreditCardPaymentDetailView>(detailList);
 
 
                 /*
-                 * 费用总计
+                 * 下方描述处理
                  */
 
+                List<CreditCardPaymentCurrencyPriceItem> nonDuplicat = ccpCurrencyPrices.Where((x, i) => ccpCurrencyPrices.FindIndex(z => z.CurrencyId == x.CurrencyId) == i).ToList();//Lambda表达式去重 
 
-                if (entity.PaymentCurrency == 48)
+                CreditCardPaymentCurrencyPriceItem ccpCurrencyPrice = nonDuplicat.Where(it => it.CurrencyId == 836).FirstOrDefault();
+                if (ccpCurrencyPrice != null)
                 {
-                    CNY += entity.PayMoney;
-                    PayCNY += CurrPayStr;
-                    BalanceCNY += BalanceStr;
-                    YSFYCNY += CurrPayStr;
+                    int CNYIndex = nonDuplicat.IndexOf(ccpCurrencyPrice);
+                    nonDuplicat.MoveItemAtIndexToFront(CNYIndex);
+
                 }
-                if (entity.PaymentCurrency == 49)
+                else
                 {
-                    USD += entity.PayMoney;
-                    PayUSD += CurrPayStr;
-                    BalanceUSD += BalanceStr;
-                    YSFYUSD += CurrPayStr;
+                    nonDuplicat.OrderBy(it => it.CurrencyId).ToList();
                 }
-                if (entity.PaymentCurrency == 51)
+                string amountPayableStr = string.Format(@"应付款总金额: ");
+                string thisPaymentStr = string.Format(@"此次付款总金额: ");
+                string balancePaymentStr = string.Format(@"目前剩余尾款总金额: ");
+                string auditedFundsStr = string.Format(@"已审费用总额: ");
+
+                foreach (var item in nonDuplicat)
                 {
-                    EUR += entity.PayMoney;
-                    PayEUR += CurrPayStr;
-                    BalanceEUR += BalanceStr;
-                    YSFYEUR += CurrPayStr;
-                }
+                    var strs = ccpCurrencyPrices.Where(it => it.CurrencyId == item.CurrencyId).ToList();
+                    if (strs.Count > 0)
+                    {
+                        decimal amountPayable = strs.Sum(it => it.AmountPayable);
+                        
+                        decimal balancePayment = strs.Sum(it => it.BalancePayment);
+                        amountPayableStr += string.Format(@"{0}{1}&nbsp;|", amountPayable.ToString("#0.00"), item.CurrencyName);
 
-                _detail.IsAuditGM = entity.IsAuditGM;
+                        //单独处理此次付款金额
+                        if (item.CurrencyId == 836) //人名币
+                        {
+                            decimal thisPayment = ccpCurrencyPrices.Sum(it => it.ThisPayment);
+                            thisPaymentStr += string.Format(@"{0}{1}&nbsp;|", thisPayment.ToString("#0.00"), item.CurrencyName);
+                        }
+                        else
+                        {
+                            thisPaymentStr += string.Format(@"{0}{1}&nbsp;|","0.00", item.CurrencyName);
+                        }
 
-                detailList.Add(_detail);
+                        balancePaymentStr += string.Format(@"{0}{1}&nbsp;|", balancePayment.ToString("#0.00"), item.CurrencyName);
 
-            }
+                        //单独处理已审核费用
+                        if (item.CurrencyId == 836) //人名币
+                        {
 
-            #endregion
+                            decimal auditedFunds = ccpCurrencyPrices.Sum(it => it.AuditedFunds);
+                            auditedFundsStr += string.Format(@"{0}{1}&nbsp;|", auditedFunds.ToString("#0.00"), item.CurrencyName);
+                        }
+                        else
+                        {
+                            auditedFundsStr += string.Format(@"{0}{1}&nbsp;|", "0.00", item.CurrencyName);
+                        }
 
-            _view.DetailList = new List<Grp_CreditCardPaymentDetailView>(detailList);
-            _view.TotalStr1 = string.Format(@"应付款总金额:{0}CNY&nbsp;|&nbsp;{1}USD&nbsp;|&nbsp;{2}EUR", CNY, USD, EUR);
-            _view.TotalStr2 = string.Format(@"此次付款总金额:{0}CNY&nbsp;|&nbsp;{1}USD&nbsp;|&nbsp;{2}EUR", PayCNY, PayUSD, PayEUR);
-            _view.TotalStr3 = string.Format(@"目前剩余尾款总金额:{0}CNY&nbsp;|&nbsp;{1}USD&nbsp;|&nbsp;{2}EUR", BalanceCNY, BalanceUSD, BalanceEUR);
-            _view.TotalStr4 = string.Format(@"已审费用总额:{0}CNY&nbsp;|&nbsp;{1}USD&nbsp;|&nbsp;{2}EUR", YSFYCNY, YSFYUSD, YSFYEUR);
+                    }
+                }
 
+                _view.TotalStr1 = amountPayableStr.Substring(0, amountPayableStr.Length - 1);
+                _view.TotalStr2 = thisPaymentStr.Substring(0, thisPaymentStr.Length - 1);
+                _view.TotalStr3 = balancePaymentStr.Substring(0, balancePaymentStr.Length - 1);
+                _view.TotalStr4 = auditedFundsStr.Substring(0, auditedFundsStr.Length - 1);
+
+
+                var _view1 = new
+                {
+                    PageFuncAuth = pageFunAuthView,
+                    Data = _view
+                };
 
-            var _view1 = new
+                return Ok(JsonView(_view1));
+            }
+            catch (Exception ex)
             {
-                PageFuncAuth = pageFunAuthView,
-                Data = _view
-            };
 
-            return Ok(JsonView(_view1));
+                return Ok(JsonView(false, ex.Message));
+            }
         }
 
 
         /// <summary>
-        /// 费用审核
+        /// 费用审核 
         /// 修改团组费用审核状态
         /// </summary>
         /// <param name="_dto">参数Json字符串</param>
@@ -1153,7 +1404,6 @@ namespace OASystem.API.Controllers
             if (_dto.PageId < 1) return Ok(JsonView(false, "页面Id为空"));
             #endregion
 
-
             #region 页面操作权限验证
             PageFunAuthViewBase pageFunAuthView = new PageFunAuthViewBase();
 
@@ -1180,20 +1430,20 @@ namespace OASystem.API.Controllers
                 if (result < 1)
                 {
                     rst = -1;
+                    _groupRepository.RollbackTran();
+                    return Ok(JsonView(false, "操作失败并回滚!"));
                 }
                 else
                 {
-                    _groupRepository.RollbackTran();
-                    return Ok(JsonView(false, "保存失败并回滚!"));
                 }
             }
             _groupRepository.CommitTran();
             if (rst == 0)
             {
-                return Ok(JsonView(true, "保存成功!"));
+                return Ok(JsonView(true, "操作成功!"));
             }
 
-            return Ok(JsonView(false, "保存失败!"));
+            return Ok(JsonView(false, "操作失败!"));
         }
 
         #endregion
@@ -3469,10 +3719,10 @@ namespace OASystem.API.Controllers
             {
                 _sqlSugar.BeginTran();
                 isTrue = await _GroupCostRepository.
-                    SaveGroupCostList(Grp_groups,dto.Diid); //列表
-                isTrue = await _checkBoxs.SaveCheckBoxs(Grp_CheckBoxs,dto.Diid); //选中项
-                isTrue = await _CostTypeHotelNumberRepository.SaveHotelNumber(Grp_HotelNumber,dto.Userid,dto.Diid); //酒店房间数量
-                isTrue = await _GroupCostParameterRepository.SaveAsync(Grp_CostParameters , dto.Userid ,dto.Diid); //系数
+                    SaveGroupCostList(Grp_groups, dto.Diid); //列表
+                isTrue = await _checkBoxs.SaveCheckBoxs(Grp_CheckBoxs, dto.Diid); //选中项
+                isTrue = await _CostTypeHotelNumberRepository.SaveHotelNumber(Grp_HotelNumber, dto.Userid, dto.Diid); //酒店房间数量
+                isTrue = await _GroupCostParameterRepository.SaveAsync(Grp_CostParameters, dto.Userid, dto.Diid); //系数
 
                 _sqlSugar.CommitTran();
                 jw = JsonView(true, "保存成功!", isTrue);
@@ -3766,8 +4016,8 @@ namespace OASystem.API.Controllers
                     }
                     throw;
                 }
-               
-                
+
+
             }
             catch (Exception ex)
             {
@@ -3794,12 +4044,12 @@ namespace OASystem.API.Controllers
                 if (!string.IsNullOrEmpty(h.DetermineNo))
                 {
                     string strFileName = "HotelStatement/";
-                    Grp_DelegationInfo dele= _sqlSugar.Queryable<Grp_DelegationInfo>().First(a => a.Id == h.DiId && a.IsDel == 0);
+                    Grp_DelegationInfo dele = _sqlSugar.Queryable<Grp_DelegationInfo>().First(a => a.Id == h.DiId && a.IsDel == 0);
                     if (dele != null)
                         strFileName += dele.TourCode;
 
-                    
-                     //载入模板
+
+                    //载入模板
                     string sss = AppSettingsHelper.Get("WordBasePath") + "Template/酒店预订模板.doc";
 
                     Document doc = new Document(sss);
@@ -3810,7 +4060,7 @@ namespace OASystem.API.Controllers
 
                         //这里可以创建个DataTable循环添加书签的值,这里提示一下就不多做修改了
                         //入住卷预定号码
-                       
+
                         if (doc.Range.Bookmarks["VNO"] != null)
                         {
                             Bookmark mark = doc.Range.Bookmarks["VNO"];
@@ -3873,7 +4123,7 @@ namespace OASystem.API.Controllers
                             {
                                 mark.Text = h.HotelFax;
                             }
-                            
+
                         }
                         //入住时间
                         if (doc.Range.Bookmarks["CIn"] != null)
@@ -3907,7 +4157,7 @@ namespace OASystem.API.Controllers
                         if (doc.Range.Bookmarks["NOTE"] != null)
                         {
                             Bookmark mark = doc.Range.Bookmarks["NOTE"];
-                            Sys_SetData ss = _sqlSugar.Queryable<Sys_SetData>().First(a=>a.Id==h.ReservationsWebsite);
+                            Sys_SetData ss = _sqlSugar.Queryable<Sys_SetData>().First(a => a.Id == h.ReservationsWebsite);
                             if (ss != null)
                                 mark.Text = ss.Name;
                         }
@@ -3949,20 +4199,20 @@ namespace OASystem.API.Controllers
 
                         strFileName += "VOUCHER.doc";
 
-                        var fileDir = AppSettingsHelper.Get("WordBasePath")+ strFileName;
+                        var fileDir = AppSettingsHelper.Get("WordBasePath") + strFileName;
                         doc.Save(fileDir);
                         string Url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/" + strFileName;
                         return Ok(JsonView(true, "成功!", Url));
 
                         //保存为doc,并打开 
-                        
+
                     }
                     catch (Exception ex)
                     {
 
                         throw;
                     }
-                    
+
                 }
                 else
                 {
@@ -3973,7 +4223,7 @@ namespace OASystem.API.Controllers
             {
                 return Ok(JsonView(false, "酒店确定号码未填写,无法生成Voucher!"));
             }
-            
+
         }
 
 
@@ -4423,8 +4673,8 @@ namespace OASystem.API.Controllers
                         return Ok(JsonView(false, "失败!"));
                     }
                 }
-                
-                
+
+
             }
             catch (Exception ex)
             {

+ 3 - 3
OASystem/OASystem.Api/OAMethodLib/GeneralMethod.cs

@@ -144,7 +144,7 @@ namespace OASystem.API.OAMethodLib
             PageFunAuthViewBase pageFunAuth = new PageFunAuthViewBase();
 
             List<UserPageFuncView> userPageFuncDatas = new List<UserPageFuncView>();
-            string sql = string.Format(@"Select Distinct ua.UId As UserId, u.CnName As UserName, pa.ModuleId,pa.ModuleName,pa.PageId,pa.PageName,pa.PageIsEnable,
+            string sql = string.Format(@"Select ua.UId As UserId, u.CnName As UserName, pa.ModuleId,pa.ModuleName,pa.PageId,pa.PageName,pa.PageIsEnable,
 					                     pa.PagePhoneIsEnable,pa.FuncId,pa.FuncName,pa.FuncIsEnable
 					                     From Sys_UserAuthority ua
 					                     Left Join Sys_Users u On ua.UId = u.Id
@@ -155,8 +155,8 @@ namespace OASystem.API.OAMethodLib
 						                     Left Join Sys_SystemMenuPermission smp On smaf.SmId = smp.Id
 						                     Left Join Sys_SetData sd On sd.STid = 5 And smp.Mid = sd.Id
 						                     Left Join Sys_PageFunctionPermission pfp On smaf.FId = pfp.Id
-						                     Where smaf.IsDel = 0 And smp.IsDel = 0 And pfp.IsDel = 0 And sd.IsDel = 0
-					                     ) As pa On ua.SmId = pa.PageId
+						                     Where smaf.IsDel = 0 And smp.IsDel = 0 And pfp.IsDel = 0 And sd.IsDel = 0 And smp.IsEnable = 1
+					                     ) As pa On ua.SmId = pa.PageId And ua.FId = pa.FuncId
 					                     Where ua.IsDel = 0 And ua.UId = {0} And pa.PageId = {1}
 					                     Order By ModuleId,PageId,FuncId Asc", userId, PageId);
 

+ 24 - 0
OASystem/OASystem.Api/OAMethodLib/PayrollComputation.cs

@@ -1118,6 +1118,30 @@ namespace OASystem.API.OAMethodLib
             return subDecimal;
         }
 
+        /// <summary>
+        /// decimal 保留两位小数 不四舍五入
+        /// </summary>
+        /// <param name="number"></param>
+        /// <returns></returns>
+        public static decimal ConvertToDecimal1(this decimal myDecimal)
+        {
+            var subDecimal = Math.Floor(myDecimal * 100) / 100;//保留两位小数,直接截取
+            return subDecimal;
+        }
+
+        /// <summary>
+        /// 列表的成员移动到列表的前面
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="list"></param>
+        /// <param name="index"></param>
+        public static void MoveItemAtIndexToFront<T>(this List<T> list, int index)
+        {
+            T item = list[index];
+            list.RemoveAt(index);
+            list.Insert(0, item);
+        }
+
         /// <summary>
         /// 获取请假类型
         /// </summary>

+ 1 - 1
OASystem/OASystem.Domain/Entities/Financial/Fin_PaymentRefundAndOtherMoney.cs

@@ -7,7 +7,7 @@ using System.Threading.Tasks;
 namespace OASystem.Domain.Entities.Financial
 {
     /// <summary>
-    /// 收款退还与其他款项
+    /// 收款退还
     /// </summary>
     [SugarTable("Fin_PaymentRefundAndOtherMoney")]
     public class Fin_PaymentRefundAndOtherMoney : EntityBase

+ 1 - 0
OASystem/OASystem.Domain/Entities/Groups/Grp_DecreasePayments.cs

@@ -8,6 +8,7 @@ namespace OASystem.Domain.Entities.Groups
 {
     /// <summary>
     /// 团组增减款项表
+    /// --其他款项
     /// </summary>
     [SugarTable("Grp_DecreasePayments")]
     public class Grp_DecreasePayments: EntityBase

+ 1 - 1
OASystem/OASystem.Domain/Entities/System/Sys_SystemMenuAndFunction.cs

@@ -7,7 +7,7 @@
     public class Sys_SystemMenuAndFunction:EntityBase
     {
         /// <summary>
-        /// 页面权限Id
+        /// 页面Id
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "int")]
         public int SmId { get; set; }

+ 50 - 2
OASystem/OASystem.Domain/ViewModels/Groups/DelegationInfoView.cs

@@ -17,10 +17,10 @@ namespace OASystem.Domain.ViewModels.Groups
     public class DelegationInfoView : Grp_DelegationInfo { }
 
     /// <summary>
-    /// 接团信息详情 共享
+    /// 接团信息详情 共享 Web
     /// 返回视图
     /// </summary>
-    public class ShareGroupInfoView
+    public class Web_ShareGroupInfoView
     {
         /// <summary>
         /// 主键Id
@@ -69,6 +69,54 @@ namespace OASystem.Domain.ViewModels.Groups
 
     }
 
+    /// <summary>
+    /// 接团信息详情 共享 Web
+    /// 返回视图
+    /// </summary>
+    public class IOSOrAndroid_ShareGroupInfoView
+    {
+        /// <summary>
+        /// 主键Id
+        /// </summary>
+        public int Id { get; set; }
+
+        /// <summary>
+        /// 团号
+        /// </summary>
+        public string? TourCode { get; set; }
+
+        /// <summary>
+        /// 客户名称
+        /// </summary>
+        public string? ClientName { get; set; }
+
+        /// <summary>
+        /// 出访国家
+        /// </summary>
+        public string? VisitCountry { get; set; }
+
+        /// <summary>
+        /// 出团开始日期 
+        /// </summary>
+        public DateTime VisitStartDate { get; set; }
+
+        /// <summary>
+        /// 出团结束日期 
+        /// </summary>
+        public DateTime VisitEndDate { get; set; }
+
+        /// <summary>
+        /// 出行天数
+        /// </summary>
+        public int VisitDays { get; set; }
+
+        /// <summary>
+        /// 出行人数
+        /// </summary>
+        public int VisitPNumber { get; set; }
+
+    }
+
     /// <summary>
     /// 接团信息详情 共享
     /// 返回视图

+ 34 - 35
OASystem/OASystem.Domain/ViewModels/Groups/Grp_CreditCardPaymentView.cs

@@ -92,41 +92,6 @@ namespace OASystem.Domain.ViewModels.Groups
 
     public class Grp_CreditCardPaymentView
     {
-        /// <summary>
-        /// 团组编号
-        /// </summary>
-        public int DiId { get; set; }
-
-        /// <summary>
-        /// 团组名称
-        /// </summary>
-        public string TeamName { get; set; }
-
-        /// <summary>
-        /// 客户名称
-        /// </summary>
-        public string ClientName { get; set; }
-
-        /// <summary>
-        /// 访问国家
-        /// </summary>
-        public string VisitCountry { get; set; }
-
-        /// <summary>
-        /// 访问起止日期
-        /// </summary>
-        public string VisitDate { get; set; }
-
-        /// <summary>
-        /// 天数
-        /// </summary>
-        public int VisitDays { get; set; }
-
-        /// <summary>
-        /// 人数
-        /// </summary>
-        public int VisitPNumber { get; set; }
-
         /// <summary>
         /// 审核列表
         /// </summary>
@@ -203,4 +168,38 @@ namespace OASystem.Domain.ViewModels.Groups
 
         
     }
+
+    public class CreditCardPaymentCurrencyPriceItem
+    {
+        /// <summary>
+        /// 币种Id
+        /// </summary>
+        public int CurrencyId { get; set; }
+
+        /// <summary>
+        /// 币种Name
+        /// </summary>
+        public string CurrencyName { get; set; }
+
+        /// <summary>
+        /// 应付金额
+        /// </summary>
+        public decimal AmountPayable { get; set; }
+
+        /// <summary>
+        /// 此次付款
+        /// 基本为CNY
+        /// </summary>
+        public decimal ThisPayment { get; set; }
+
+        /// <summary>
+        /// 剩余尾款
+        /// </summary>
+        public decimal BalancePayment { get; set; }
+
+        /// <summary>
+        /// 已审款项
+        /// </summary>
+        public decimal AuditedFunds { get; set; }
+    }
 }

+ 3 - 2
OASystem/OASystem.Infrastructure/Repositories/Financial/PaymentRefundAndOtherMoneyRepository.cs

@@ -98,7 +98,8 @@ namespace OASystem.Infrastructure.Repositories.Financial
             if (_PaymentRefundAndOtherMoneyInfo != null)
             {
                 Grp_CreditCardPayment _CreditCardPayment = new Grp_CreditCardPayment() {
-                    Id = _PaymentRefundAndOtherMoneyInfo.Id,
+                    CId = _PaymentRefundAndOtherMoneyInfo.Id,
+                    DIId = _PaymentRefundAndOtherMoneyInfo.DiId,
                     DeleteUserId = dto.UserId,
                     DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                     IsDel = 1
@@ -107,7 +108,7 @@ namespace OASystem.Infrastructure.Repositories.Financial
 
                 var ccp_del = await _sqlSugar.Updateable(_CreditCardPayment)
                                      .UpdateColumns(it => new { it.DeleteUserId, it.DeleteTime, it.IsDel })
-                                     .WhereColumns(it => new { it.Id })
+                                     .WhereColumns(it => new { it.CId,it.DIId })
                                      .ExecuteCommandAsync();
             }
 

+ 33 - 9
OASystem/OASystem.Infrastructure/Repositories/Groups/DelegationInfoRepository.cs

@@ -51,28 +51,52 @@ namespace OASystem.Infrastructure.Repositories.Groups
         {
             Result result = new Result() { Code = -2, Msg = "未知错误" };
 
-            if (dto.PortType == 1 || dto.PortType == 2) //Web Or Android
-            {
-                string sql = string.Format(@"Select Id,TeamName,TourCode,ClientName,VisitCountry,VisitStartDate,VisitEndDate,VisitDays,VisitPNumber 
+            string sql = string.Format(@"Select Id,TeamName,TourCode,ClientName,VisitCountry,VisitStartDate,VisitEndDate,VisitDays,VisitPNumber 
                                              From Grp_DelegationInfo Where Id = {0} And IsDel = 0", dto.Id);
 
-                var _DelegationInfo = await _sqlSugar.SqlQueryable<ShareGroupInfoView>(sql).FirstAsync();
+            if (dto.PortType == 1) //Web
+            {
+                var _DelegationInfo = await _sqlSugar.SqlQueryable<Web_ShareGroupInfoView>(sql).FirstAsync();
                 if (_DelegationInfo != null)
                 {
-                    if (_DelegationInfo.VisitCountry.Contains("|"))
+                    if (!string.IsNullOrEmpty(_DelegationInfo.VisitCountry))
                     {
-                        _DelegationInfo.VisitCountry = _DelegationInfo.VisitCountry.Replace("|", "、");
+                        if (_DelegationInfo.VisitCountry.Contains("|"))
+                        {
+                            _DelegationInfo.VisitCountry = _DelegationInfo.VisitCountry.Replace("|", "、");
+                        }
                     }
+                    else _DelegationInfo.VisitCountry = " - ";
+
+                    result.Data = _DelegationInfo;
+                }
+                else result.Msg = "暂无该团组信息";
+            }
+            else if (dto.PortType == 2 || dto.PortType == 3) //IOS Or Android
+            {
+                var _DelegationInfo = await _sqlSugar.SqlQueryable<IOSOrAndroid_ShareGroupInfoView>(sql).FirstAsync();
+                if (_DelegationInfo != null)
+                {
+                    if (!string.IsNullOrEmpty(_DelegationInfo.VisitCountry))
+                    {
+                        if (_DelegationInfo.VisitCountry.Contains("|"))
+                        {
+                            _DelegationInfo.VisitCountry = _DelegationInfo.VisitCountry.Replace("|", "、");
+                        }
+                    }
+                    else _DelegationInfo.VisitCountry = " - ";
 
-                    result.Code = 0;
-                    result.Msg = "成功!";
                     result.Data = _DelegationInfo;
                 }
                 else result.Msg = "暂无该团组信息";
+
             }
+            else result.Msg = "请输入正确的端口号。1 Web 2 Android 3 IOS";
 
-            return result;
+            result.Code = 0;
+            result.Msg = "成功!";
 
+            return result;
         }
 
         #endregion