Ver código fonte

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

yuanrf 8 meses atrás
pai
commit
86856dea4f

+ 45 - 17
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -1553,6 +1553,20 @@ namespace OASystem.API.Controllers
                             Grp_HotelReservations hotelReservations = _HotelReservations.Where(s => s.Id == entity.CId).FirstOrDefault();
                             if (hotelReservations != null)
                             {
+                                DateTime checkIn = Convert.ToDateTime(hotelReservations.CheckInDate),
+                                         checkOut = Convert.ToDateTime(hotelReservations.CheckOutDate);
+                                int hotel_days = (int)(checkOut - checkIn).TotalDays;
+
+                                string roomFeeStr = "";
+                                if (hotelReservations.SingleRoomPrice>0) 
+                                    roomFeeStr += $"<br/><span style='width:70px;display: inline-block;'></span>单间:{hotelReservations.SingleRoomPrice.ToString("#0.00")} * {hotelReservations.SingleRoomCount}";
+                                if (hotelReservations.DoubleRoomPrice > 0) 
+                                    roomFeeStr += $"<br/><span style='width:70px;display: inline-block;'></span>双人间:{hotelReservations.DoubleRoomPrice.ToString("#0.00")} * {hotelReservations.DoubleRoomCount}";
+                                if (hotelReservations.SuiteRoomPrice > 0) 
+                                    roomFeeStr += $"<br/><span style='width:70px;display: inline-block;'></span>套房:{hotelReservations.SuiteRoomPrice.ToString("#0.00")} * {hotelReservations.SuiteRoomCount}";
+                                if (hotelReservations.OtherRoomPrice > 0) 
+                                    roomFeeStr += $"<br/><span style='width:70px;display: inline-block;'></span>其他:{hotelReservations.OtherRoomPrice.ToString("#0.00")} * {hotelReservations.OtherRoomCount}";
+
                                 decimal governmentRentFee = 0.00M, cityTaxFee = 0.00M, breakfastFee = 0.00M, roomFee = 0.00M;
                                 string governmentRentBool = "否", cityTaxBool = "否", breakfastBool = "否", roomBool = "否";
                                 string governmentRentCode = "", governmentRentName = "", cityTaxCode = "", cityTaxName = "", breakfastCode = "", breakfastName = "", roomCode = "", roomName = "";
@@ -1625,34 +1639,48 @@ namespace OASystem.API.Controllers
                                     }
                                 }
 
-                                string hotelCostStr = "<span style='font-weight:800;'>成本信息</span><br/>";
+                                string hotelCostTitalStr = "<span style='font-weight:800;'>成本信息</span><br/>"; 
+                                string hotelCostStr = "";
+                                decimal hotelCsotTotal = 0.00M;
                                 if (groupCost != null)
                                 {
                                     if (int.TryParse(groupCost.Currency, out int currencyId)) groupCost.Currency = currencyItems.Find(s => s.Id == currencyId)?.Name ?? "-";
 
-                                    hotelCostStr += $"{groupCost.Currency}(汇率:{groupCost.Rate.ToString("#0.0000")})</br>";
+                                    hotelCostStr += $"{groupCost.Currency}(汇率:{groupCost.Rate.ToString("#0.0000")})<br/>";
                                 }
-                                var hotelCostDetails = groupCostDetails.Where(x => Convert.ToDateTime(x.Date) >= Convert.ToDateTime(hotelReservations.CheckInDate) && 
-                                                                                   Convert.ToDateTime(x.Date) <= Convert.ToDateTime(hotelReservations.CheckOutDate)).ToList();
+
+                                
+                                if (checkOut > checkIn) checkOut = checkOut.AddDays(-1);
+
+
+                                var hotelCostDetails = groupCostDetails.Where(x => Convert.ToDateTime(x.Date) >= checkIn && Convert.ToDateTime(x.Date) <= checkOut).ToList();
+                                string hotelCost_day = "";
                                 var hotelCostDetails1 = hotelCostDetails.GroupBy(x => x.Date);
                                 foreach (var item in hotelCostDetails1)
                                 {
-                                    hotelCostStr += @$"{item.First()?.Date ?? "-"}";
-                                    if (item.Sum(x => x.HotelSingleRoomFee) != 0) hotelCostStr += @$"   单间:{item.Sum(x => x.HotelSingleRoomFee).ToString("#0.00")}";
-                                    if (item.Sum(x => x.HotelDoubleRoomFee) != 0) hotelCostStr += @$"   1/2 双人间:{item.Sum(x => x.HotelDoubleRoomFee).ToString("#0.00")}";
-                                    if (item.Sum(x => x.HotelSuiteRoomFee) != 0) hotelCostStr += @$"   小套房/豪华套房:{item.Sum(x => x.HotelSuiteRoomFee).ToString("#0.00")}";
-                                    if (item.Sum(x => x.HotelSuiteFee) != 0) hotelCostStr += @$"   套房:{item.Sum(x => x.HotelSuiteFee).ToString("#0.00")}";
-                                    hotelCostStr += @$"</br>";
-
+                                    hotelCsotTotal += item.Sum(x => x.HotelSingleRoomFee) + item.Sum(x => x.HotelDoubleRoomFee) + item.Sum(x => x.HotelSuiteRoomFee) + item.Sum(x => x.HotelSuiteFee);
+                                    hotelCost_day += @$"{item.First()?.Date ?? "-"}";
+                                    if (item.Sum(x => x.HotelSingleRoomFee) != 0) hotelCost_day += @$"   单间:{item.Sum(x => x.HotelSingleRoomFee).ToString("#0.00")}"; 
+                                    if (item.Sum(x => x.HotelDoubleRoomFee) != 0) hotelCost_day += @$"   双人间:{item.Sum(x => x.HotelDoubleRoomFee).ToString("#0.00")}";
+                                    if (item.Sum(x => x.HotelSuiteRoomFee) != 0) hotelCost_day += @$"   小套房/豪华套房:{item.Sum(x => x.HotelSuiteRoomFee).ToString("#0.00")}";
+                                    if (item.Sum(x => x.HotelSuiteFee) != 0)  hotelCost_day += @$"   套房:{item.Sum(x => x.HotelSuiteFee).ToString("#0.00")}";
+                                    hotelCost_day += @$"</br>";
                                 }
-                                _detail.PriceMsgContent = $"{hotelCostStr}<br/>"+
+
+                                string hotelBreakfastStr = "",hotelGovernmentRentStr = "",hotelCityTaxStr="" ;
+                                if (breakfastFee > 0) hotelBreakfastStr = $"酒店早餐: {breakfastFee.ToString("#0.00")} {breakfastCode} {breakfastName} 当时汇率 {breakfastData?.Rate.ToString("#0.0000")} <br/>是否由地接代付:{breakfastBool}<br/><br/>";
+                                if (governmentRentFee > 0) hotelGovernmentRentStr = $"地税: {governmentRentFee.ToString("#0.00")} {governmentRentCode} {governmentRentName} 当时汇率 {governmentRentData?.Rate.ToString("#0.0000")} <br/>是否由地接代付:{governmentRentBool}<br/><br/>";
+                                if (cityTaxFee > 0) hotelCityTaxStr = $"城市税: {cityTaxFee.ToString("#0.00")} {cityTaxCode} {cityTaxName} 当时汇率 {cityTaxData?.Rate.ToString("#0.0000")} <br/>是否由地接代付:{cityTaxBool}<br/>";
+
+                                string hotelCostTotalStr = "";// $"&nbsp;&nbsp;成本合计:{hotelCsotTotal.ToString("#0.00")}<br/>";
+                                _detail.PriceMsgContent = $"{hotelCostTitalStr}{hotelCostStr}{hotelCostTotalStr}{hotelCost_day}<br/>"+
                                                           $"<span style='font-weight:800;'>{hotelReservations.HotelName} [{hotelReservations.CheckInDate} - {hotelReservations.CheckOutDate}]</span><br/>" +
                                                           $"信用卡金额:{_detail.WaitPay} ({hotelCurrncyName})<br/>" +
                                                           $"房间说明: {hotelReservations.Remark} <br/>" +
-                                                          $"房间费用: {roomFee.ToString("#0.00")} {roomCode} {roomName} 当时汇率 {roomData?.Rate.ToString("#0.0000")} <br/>是否由地接代付:{roomBool}<br/>" +
-                                                          $"酒店早餐: {breakfastFee.ToString("#0.00")} {breakfastCode} {breakfastName} 当时汇率 {breakfastData?.Rate.ToString("#0.0000")} <br/>是否由地接代付:{breakfastBool}<br/>" +
-                                                          $"地税: {governmentRentFee.ToString("#0.00")} {governmentRentCode} {governmentRentName} 当时汇率 {governmentRentData?.Rate.ToString("#0.0000")} <br/>是否由地接代付:{governmentRentBool}<br/>" +
-                                                          $"城市税: {cityTaxFee.ToString("#0.00")} {cityTaxCode} {cityTaxName} 当时汇率 {cityTaxData?.Rate.ToString("#0.0000")} <br/>是否由地接代付:{cityTaxBool}<br/>";
+                                                          $"房间费用: {roomCode} {roomName} 当时汇率 {roomData?.Rate.ToString("#0.0000")}{roomFeeStr}  <br/>是否由地接代付:{roomBool}<br/><br/>" +
+                                                          $"{hotelBreakfastStr}"+
+                                                          $"{hotelGovernmentRentStr}"+
+                                                          $"{hotelCityTaxStr}";
                                 _detail.PriceNameContent = hotelReservations.HotelName;
                             }
 
@@ -1754,7 +1782,7 @@ namespace OASystem.API.Controllers
                                             //case 91: opCostTypePrice = opCost.Sum(x => x.CarFee); break; //1075    午餐超支费用
                                             //case 91: opCostTypePrice = opCost.Sum(x => x.CarFee); break; //1076    晚餐超支费用
                                         }
-                                        opCostStr = $"&nbsp;&nbsp;/成本:{opCostTypePrice.ToString("#0.00")} {_groupCurrencyCode}(汇率:{_groupRate.ToString("#0.0000")})";
+                                        opCostStr = $"&nbsp;&nbsp;/&nbsp;&nbsp;成本:{opCostTypePrice.ToString("#0.00")} {_groupCurrencyCode}(汇率:{_groupRate.ToString("#0.0000")})";
                                     }
 
                                     #endregion

+ 1 - 0
OASystem/OASystem.Infrastructure/Repositories/Groups/FeeAuditRepository.cs

@@ -92,6 +92,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 bool isAutoAudit = true; //是否自动审核
                 DateTime checkIn = Convert.ToDateTime(hotelCostInfo.CheckInDate),
                          checkOut = Convert.ToDateTime(hotelCostInfo.CheckOutDate);
+                if (checkOut > checkIn) checkOut = checkOut.AddDays(-1); //房费计算,结束日期为前一天
                 var hotelCostInfos = costContents.Where(x => Convert.ToDateTime(x.Date) >= checkIn && Convert.ToDateTime(x.Date) <= checkOut).ToList();
                 if (hotelCostInfos.Count < 1) isAutoAudit = false;