Browse Source

修改op费用填写查询返回参数

wangh 1 year ago
parent
commit
33fe726f33

+ 23 - 0
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -3484,6 +3484,29 @@ namespace OASystem.API.Controllers
                 return Ok(JsonView(false, ex.Message));
             }
         }
+        /// <summary>
+        /// 计算酒店付款总金额
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> HotelConversionAmounts(HotelReservationsCNYDto dto)
+        {
+            try
+            {
+                Result groupData = await _hotelPriceRep.HotelConversionAmounts(dto);
+                if (groupData.Code != 0)
+                {
+                    return Ok(JsonView(false, groupData.Msg));
+                }
+                return Ok(JsonView(true, groupData.Msg, groupData.Data));
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, ex.Message));
+            }
+        }
         #endregion
 
 

+ 2 - 0
OASystem/OASystem.Domain/AutoMappers/_baseMappingProfile.cs

@@ -128,6 +128,8 @@ namespace OASystem.Domain.AutoMappers
 
             #region op费用
             CreateMap<OpCarTouristGuideGroundDto, Grp_CarTouristGuideGroundReservations>();
+            CreateMap<Grp_CreditCardPayment, CarTouristCreditCardPaymentView>();
+            CreateMap<Grp_CarTouristGuideGroundReservationsContent, CarTouristGuideGroundReservationsContentView>();
             #endregion
             #region 成本
             CreateMap<Grp_GroupCostDto, Grp_GroupCost>();

+ 1 - 1
OASystem/OASystem.Domain/Dtos/Groups/CarTouristGuideGroundDto.cs

@@ -114,7 +114,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// </summary>
         public int CTGGRId { get; set; }
         /// <summary>
-        /// 费用表示
+        /// 费用标识
         /// </summary>
         public int OrbitalPrivateTransfer { get; set; }
         /// <summary>

+ 48 - 0
OASystem/OASystem.Domain/Dtos/Groups/HotelReservationsDto.cs

@@ -21,6 +21,10 @@ namespace OASystem.Domain.Dtos.Groups
     {
         public int Id { get; set; }
     }
+
+    /// <summary>
+    /// 编辑,新增参数
+    /// </summary>
     public class OpHotelReservationsData
     {
         /// <summary>
@@ -181,6 +185,14 @@ namespace OASystem.Domain.Dtos.Groups
         public string Remark { get; set; }
         //C表参数
         /// <summary>
+        /// 付款金额
+        /// </summary>
+        public decimal PayMoney { get; set; }
+        /// <summary>
+        /// 付款币种 数据类型Id
+        /// </summary>
+        public int PaymentCurrency { get; set; }
+        /// <summary>
         /// 支付方式
         /// </summary>
         public int PayDId { get; set; }
@@ -236,4 +248,40 @@ namespace OASystem.Domain.Dtos.Groups
         /// </summary>
         public string CRemark { get; set; }
     }
+
+    public class HotelReservationsCNYDto 
+    {
+        /// <summary>
+        /// 类型ID
+        /// </summary>
+        public int CTable { get; set; }
+        /// <summary>
+        /// 团组Id
+        /// </summary>
+        public int DiId { get; set; }
+        /// <summary>
+        /// 信用卡金额
+        /// </summary>
+        public decimal CardPrice { get; set; }
+        /// <summary>
+        /// 信用卡金额币种
+        /// </summary>
+        public int CardPriceCurrency { get; set; }
+        /// <summary>
+        /// 地税
+        /// </summary>
+        public decimal GovernmentRent { get; set; }
+        /// <summary>
+        /// 地税币种
+        /// </summary>
+        public int GovernmentRentCurrency { get; set; }
+        /// <summary>
+        /// 城市税
+        /// </summary>
+        public decimal CityTax { get; set; }
+        /// <summary>
+        /// 城市税币种
+        /// </summary>
+        public int CityTaxCurrency { get; set; }
+    }
 }

+ 71 - 0
OASystem/OASystem.Domain/ViewModels/Groups/CarTouristCreditCardPaymentView.cs

@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.ViewModels.Groups
+{
+    public class CarTouristCreditCardPaymentView
+    {
+        /// <summary>
+        /// 支付方式
+        /// </summary>
+        public int PayDId { get; set; }
+        /// <summary>
+        /// 支付方式
+        /// </summary>
+        public string PayName { get; set; }
+        /// <summary>
+        /// 付款金额
+        /// </summary>
+        public decimal PayMoney { get; set; }
+        /// <summary>
+        /// 付款币种 数据类型Id
+        /// </summary>
+        public int PaymentCurrency { get; set; }
+        /// <summary>
+        /// 付款币种 文本
+        /// </summary>
+        public string PaymentCurrencyName { get; set; }
+        /// <summary>
+        /// 此次付款百分比
+        /// </summary>
+        public decimal PayPercentage { get; set; }
+        /// <summary>
+        /// 收款方
+        /// </summary>
+        public string Payee { get; set; }
+
+        /// <summary>
+        /// 费用标识
+        /// </summary>
+        public int OrbitalPrivateTransfer { get; set; }
+
+        /// <summary>
+        /// 费用标识文本
+        /// </summary>
+        public string OrbitalPrivateTransferStr { get; set; }
+    }
+
+    public class CarTouristGuideGroundReservationsContentView
+    {
+        public int Id { get; set; }
+        /// <summary>
+        /// 费用项目明细Id
+        /// </summary>
+        public int SId { get; set; }
+        /// <summary>
+        /// 费用项目明细
+        /// </summary>
+        public string SidName { get; set; }
+        /// <summary>
+        /// 金额
+        /// </summary>
+        public decimal Price { get; set; }
+        /// <summary>
+        /// 费用明细
+        /// </summary>
+        public string PriceContent { get; set; }
+    }
+}

+ 9 - 0
OASystem/OASystem.Domain/ViewModels/Groups/HotelReservationsByDiIdView.cs

@@ -332,4 +332,13 @@ namespace OASystem.Domain.ViewModels.Groups
         public int OrbitalPrivateTransferStr { get; set; }
 
     }
+    /// <summary>
+    /// 返回付款金额
+    /// </summary>
+    public class HotelReservationsView
+    {
+        public decimal Price { get; set; }
+        public int CurrencyId { get; set; }
+        public string CurrencyName { get; set; }
+    }
 }

+ 23 - 10
OASystem/OASystem.Infrastructure/Repositories/Groups/CarTouristGuideGroundRepository.cs

@@ -6,6 +6,7 @@ using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.Entities.Resource;
 using OASystem.Domain.ViewModels.Groups;
 using OASystem.Infrastructure.Tools;
+using System.Collections.Generic;
 
 namespace OASystem.Infrastructure.Repositories.Groups
 {
@@ -132,7 +133,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 string sql = string.Format(@"select * from Grp_DelegationInfo where Id in({0}) and IsDel={1}", DiId, 0);
 
                 //团组下拉框
-                List<Grp_DelegationInfo> grp_Delegations = _sqlSugar.SqlQueryable<Grp_DelegationInfo>(sql).ToList();
+                List<Grp_DelegationInfo> _Delegations = _sqlSugar.SqlQueryable<Grp_DelegationInfo>(sql).ToList();
+                List<ShareGroupInfoIIView> grp_Delegations = _mapper.Map<List<ShareGroupInfoIIView>>(_Delegations);
                 //支付方式
                 List<Sys_SetData> Payment = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 14 && a.IsDel == 0).ToList();
                 List<SetDataInfoView> _Payment = _mapper.Map<List<SetDataInfoView>>(Payment);
@@ -170,12 +172,23 @@ namespace OASystem.Infrastructure.Repositories.Groups
             {
                
                 List<Grp_CarTouristGuideGroundReservationsContent> grp_CarTouristsContent = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservationsContent>().Where(a=>a.IsDel==0 && a.CTGGRId==dto.Id).ToList();
-                Grp_CreditCardPayment _CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == dto.Id && a.IsDel == 0 && a.CTable == 79);
-                Grp_CarTouristGuideGroundReservations grp_CarTouristGuideGround= _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>().First(a => a.Id == dto.Id && a.IsDel == 0);
+                List<CarTouristGuideGroundReservationsContentView> carTouristGuides = _mapper.Map<List<CarTouristGuideGroundReservationsContentView>>(grp_CarTouristsContent);
+                foreach (var item in carTouristGuides)
+                {
+                    item.SidName= _sqlSugar.Queryable<Sys_SetData>().First(a => a.Id == item.SId).Name;
+                }
+                Grp_CreditCardPayment CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == dto.Id && a.IsDel == 0 && a.CTable == 79);
+                CarTouristCreditCardPaymentView _CreditCardPayment = _mapper.Map<CarTouristCreditCardPaymentView>(CreditCardPayment);
+                if (_CreditCardPayment!=null)
+                {
+                    _CreditCardPayment.PayName = _sqlSugar.Queryable<Sys_SetData>().First(a => a.Id == _CreditCardPayment.PayDId).Name;
+                    _CreditCardPayment.PaymentCurrencyName = _sqlSugar.Queryable<Sys_SetData>().First(a => a.Id == _CreditCardPayment.PaymentCurrency).Name;
+                    if (_CreditCardPayment.OrbitalPrivateTransfer==0) _CreditCardPayment.OrbitalPrivateTransferStr = "公转";
+                    else _CreditCardPayment.OrbitalPrivateTransferStr = "私转";
+                }
                 var data = new
                 {
-                    CarTouristsContent = grp_CarTouristsContent,
-                    CarTourists = grp_CarTouristGuideGround,
+                    CarTouristsContent = carTouristGuides,
                     CreditCardPayment = _CreditCardPayment,
                 };
                 return result = new Result() { Code = 0, Msg = "查询成功", Data = data };
@@ -233,9 +246,9 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 {
                     string sql = string.Format(@"select t.*,s.Name as CurrencyStr,c.IsAuditGM,c.PayPercentage,c.PayMoney from 
                                                 Grp_CarTouristGuideGroundReservations t
-                                                left Join Grp_CreditCardPayment c on CTable=79 and c.CId=t.Id
+                                                left Join Grp_CreditCardPayment c on CTable=79 and c.CId=t.Id  and c.isdel=0
                                                 left Join Sys_SetData s on s.Id=c.PaymentCurrency {0}
-                                                order by CreateTime desc", sqlWhere);
+                                                order by c.IsAuditGM,c.PayPercentage desc", sqlWhere);
                     List<Grp_CarTouristGuideGroundView> infoViews = _sqlSugar.SqlQueryable<Grp_CarTouristGuideGroundView>(sql).ToList();
                     foreach (var item in infoViews)
                     {
@@ -248,10 +261,10 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 else if (dto.PortType == 2 || dto.PortType == 3)
                 {
                     string sql = string.Format(@"Select * From (	
-                                            Select row_number() over (order by t.Id Desc) as RowNumber,t.*,s.Name as CurrencyStr,c.IsAuditGM,c.PayPercentage
+                                            Select row_number() over (order by c.IsAuditGM,c.PayPercentage desc) as RowNumber,t.*,s.Name as CurrencyStr,c.IsAuditGM,c.PayPercentage
                                             from 
                                             Grp_CarTouristGuideGroundReservations t
-                                            left Join Grp_CreditCardPayment c on CTable=79 and c.CId=t.Id
+                                            Join Grp_CreditCardPayment c on CTable=79 and c.CId=t.Id  and c.isdel=0
                                             left Join Sys_SetData s on s.Id=c.PaymentCurrency {0}
                                             ) temp Where RowNumber Between {1} and {2}", sqlWhere, startIndex, endIndex);
 
@@ -264,7 +277,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     string CountSql = string.Format(@"Select COUNT(1) as Count From (	
                                                         select t.*,s.Name as CurrencyStr,c.IsAuditGM,c.PayPercentage from 
                                                         Grp_CarTouristGuideGroundReservations t
-                                                        left Join Grp_CreditCardPayment c on CTable=79 and c.CId=t.Id
+                                                        Join Grp_CreditCardPayment c on CTable=79 and c.CId=t.Id  and c.isdel=0
                                                         left Join Sys_SetData s on s.Id=t.CId {0}
                                                         ) temp ", sqlWhere);
                     DataCount dataCount = _sqlSugar.SqlQueryable<DataCount>(CountSql).First();

+ 36 - 16
OASystem/OASystem.Infrastructure/Repositories/Groups/HotelPriceRepository.cs

@@ -21,6 +21,28 @@ namespace OASystem.Infrastructure.Repositories.Groups
             this._mapper = mapper;
         }
 
+        public async Task<Result> HotelConversionAmounts(HotelReservationsCNYDto dto)
+        {
+            Result result = new Result() { Code = -2, Msg = "未知错误" };
+            try
+            {
+                HotelReservationsView reservationsView=new HotelReservationsView();
+                if ((dto.CardPriceCurrency == dto.GovernmentRentCurrency || dto.GovernmentRent == 0)
+                 && (dto.CardPriceCurrency == dto.CityTaxCurrency || dto.CityTax== 0))
+                {
+                    reservationsView.CurrencyId = dto.CardPriceCurrency;
+                    reservationsView.Price=Convert.ToDecimal((dto.CardPrice+dto.GovernmentRent+dto.CityTax).ToString("F2"));
+                    reservationsView.CurrencyName = _sqlSugar.Queryable<Sys_SetData>().First(a => a.Id == dto.CardPriceCurrency).Name;
+                }
+                return result=new Result() { Code = 0, Msg = "查询成功",Data= reservationsView };
+            }
+            catch (Exception ex)
+            {
+                return result = new Result() { Code = -2, Msg = "未知错误" };
+                throw;
+            }
+        }
+
         public async Task<Result> HotelReservationsByDiId(HotelReservationsByDiIdDto dto)
         {
             Result result = new Result() { Code = -2, Msg = "未知错误" };
@@ -48,10 +70,10 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     string sql = string.Format(@"select h.Id,s1.Name as GuestType,h.ReservationsNo,h.HotelName,h.CheckInDate,
                                                 h.CheckOutDate,c.PayMoney,s.Name as PaymentCurrency,u.CnName as CreateUserName,c.IsAuditGM,h.CreateTime,h.Attachment
                                                 From Grp_HotelReservations h 
-                                                Join Grp_CreditCardPayment c on h.Id=c.CId and c.CTable=76 and c.IsDel=0
-                                                left Join Sys_SetData s on  c.PaymentCurrency=s.Id and s.IsDel=0
-                                                left Join Sys_SetData s1 on h.GTId=s1.Id and s1.IsDel=0
-                                                left Join Sys_Users u on u.Id=h.CreateUserId and u.isdel=0 {0}", sqlWhere);
+                                                Join Grp_CreditCardPayment c on h.Id=c.CId and c.CTable=76 and c.isdel=0
+                                                left Join Sys_SetData s on  c.PaymentCurrency=s.Id  
+                                                left Join Sys_SetData s1 on h.GTId=s1.Id 
+                                                left Join Sys_Users u on u.Id=h.CreateUserId {0} order by c.IsAuditGM,c.PayPercentage desc", sqlWhere);
                     List<HotelReservationsByDiIdView> hotelDataList = _sqlSugar.SqlQueryable<HotelReservationsByDiIdView>(sql).ToList();
                     foreach (var item in hotelDataList)
                     {
@@ -66,13 +88,13 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 else if (dto.PortType == 2 || dto.PortType == 3)
                 {
                     string sql = string.Format(@"Select * From (	
-                                                Select row_number() over (order by h.Id Desc) as RowNumber,h.Id,s1.Name as GuestType,h.ReservationsNo,h.HotelName,h.CheckInDate,
+                                                Select row_number() over (order by c.IsAuditGM,c.PayPercentage desc) as RowNumber,h.Id,s1.Name as GuestType,h.ReservationsNo,h.HotelName,h.CheckInDate,
                                                 h.CheckOutDate,c.PayMoney,s.Name as PaymentCurrency,u.CnName as CreateUserName,c.IsAuditGM,h.CreateTime,h.Attachment
                                                  From Grp_HotelReservations h 
-                                                Join Grp_CreditCardPayment c on h.Id=c.CId and c.CTable=76 and c.IsDel=0
-                                                left Join Sys_SetData s on  c.PaymentCurrency=s.Id and s.IsDel=0
-                                                left Join Sys_SetData s1 on h.GTId=s1.Id and s1.IsDel=0
-                                                left Join Sys_Users u on u.Id=h.CreateUserId and u.isdel=0  {0}
+                                                Join Grp_CreditCardPayment c on h.Id=c.CId and c.CTable=76 and c.isdel=0
+                                                left Join Sys_SetData s on  c.PaymentCurrency=s.Id 
+                                                left Join Sys_SetData s1 on h.GTId=s1.Id 
+                                                left Join Sys_Users u on u.Id=h.CreateUserId   {0}
                                                 ) temp Where RowNumber Between {1} and {2}", sqlWhere, startIndex, endIndex);
 
                     List<HotelReservationsByDiIdView> hotelDataList = _sqlSugar.SqlQueryable<HotelReservationsByDiIdView>(sql).ToList();
@@ -82,16 +104,15 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         else if (item.IsAuditGM == 1) item.IsAuditGMStr = "已通过";
                         else if (item.IsAuditGM == 2) item.IsAuditGMStr = "未通过";
                         else if (item.IsAuditGM == 3) item.IsAuditGMStr = "自动审核";
-
                     }
                     string CountSql = string.Format(@"Select COUNT(1) as Count From (	
                                                         Select h.Id,s1.Name as GuestType,h.ReservationsNo,h.HotelName,h.CheckInDate,
                                                         h.CheckOutDate,c.PayMoney,s.Name as PaymentCurrency,u.CnName as CreateUserName,c.IsAuditGM,h.CreateTime,h.Attachment
                                                         From Grp_HotelReservations h 
-                                                        Join Grp_CreditCardPayment c on h.Id=c.CId and c.CTable=76 and c.IsDel=0
-                                                        left Join Sys_SetData s on  c.PaymentCurrency=s.Id and s.IsDel=0
-                                                        left Join Sys_SetData s1 on h.GTId=s1.Id and s1.IsDel=0
-                                                        left Join Sys_Users u on u.Id=h.CreateUserId and u.isdel=0  {0}
+                                                        Join Grp_CreditCardPayment c on h.Id=c.CId and c.CTable=76 and c.isdel=0
+                                                        left Join Sys_SetData s on  c.PaymentCurrency=s.Id 
+                                                        left Join Sys_SetData s1 on h.GTId=s1.Id 
+                                                        left Join Sys_Users u on u.Id=h.CreateUserId  {0}
                                                         ) temp", sqlWhere);
                     DataCount dataCount = _sqlSugar.SqlQueryable<DataCount>(CountSql).First();
                    
@@ -129,7 +150,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 HotelReservationsByIdView _hotelReservations = _mapper.Map<HotelReservationsByIdView>(hotelReservationsById);
                 if (_hotelReservations!=null)
                 {
-                    
                     Sys_SetData GTId = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == hotelReservationsById.GTId);
                     if (GTId != null) _hotelReservations.GtIdStr = GTId.Name;
                     
@@ -240,7 +260,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
             }
         }
 
-        public Task<Result> OpHotelReservations(OpHotelReservationsData dto)
+        public async Task<Result> OpHotelReservations(OpHotelReservationsData dto)
         {
             throw new NotImplementedException();
         }

+ 3 - 3
OASystem/OASystem.Infrastructure/Repositories/Groups/VisaPriceRepository.cs

@@ -79,7 +79,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 int endIndex = startIndex + dto.PageSize - 1;
                 if (dto.PortType==1)
                 {
-                    string sql = string.Format(@"select *,(select IsAuditGM from Grp_CreditCardPayment where CTable=80 and CId=v.Id) IsAuditGM,
+                    string sql = string.Format(@"select *,(select IsAuditGM from Grp_CreditCardPayment where CTable=80 and CId=v.Id and IsDel=0) IsAuditGM,
                                                 (select Name from Sys_SetData where isdel=0 and v.VisaCurrency=Id) VisaCurrencyStr from
                                                 Grp_VisaInfo v {0} order by CreateTime desc",sqlWhere);
                     List<VisaInfoView> infoViews = _sqlSugar.SqlQueryable<VisaInfoView>(sql).ToList();
@@ -90,7 +90,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     string sql = string.Format(@"Select * From (	
                                             Select row_number() over (order by v.Id Desc) as RowNumber,v.*,c.IsAuditGM,s.Name as VisaCurrencyStr
                                             From Grp_VisaInfo v
-                                            left Join Grp_CreditCardPayment c On v.Id = c.CId and CTable=80
+                                            left Join Grp_CreditCardPayment c On v.Id = c.CId and CTable=80 and c.isdel=0
                                             Left Join Sys_SetData s On v.VisaCurrency = s.Id {0}
                                             ) temp Where RowNumber Between {1} and {2}", sqlWhere, startIndex, endIndex);
 
@@ -99,7 +99,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     string CountSql = string.Format(@"Select COUNT(1) as Count From (	
                                             Select v.*,c.IsAuditGM,s.Name as VisaCurrencyStr
                                             From Grp_VisaInfo v
-                                            left Join Grp_CreditCardPayment c On v.Id = c.CId and CTable=80
+                                            left Join Grp_CreditCardPayment c On v.Id = c.CId and CTable=80  and c.isdel=0
                                             Left Join Sys_SetData s On v.VisaCurrency = s.Id {0}
                                             ) temp", sqlWhere);
                     DataCount dataCount = _sqlSugar.SqlQueryable<DataCount>(CountSql).First();