|
@@ -42,6 +42,7 @@ using System.IO;
|
|
|
using System.IO.Compression;
|
|
|
using System.Net.Http;
|
|
|
using System.Reflection.PortableExecutable;
|
|
|
+using System.Security.Cryptography;
|
|
|
using Ubiety.Dns.Core;
|
|
|
using static NPOI.POIFS.Crypt.CryptoFunctions;
|
|
|
using static OASystem.API.OAMethodLib.JWTHelper;
|
|
@@ -6998,7 +6999,6 @@ FROM
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
public async Task<IActionResult> QueryVisaByDiId(VisaPriceDto dto)
|
|
|
{
|
|
|
-
|
|
|
Result groupData = await _visaPriceRep.PostVisaByDiId(dto);
|
|
|
if (groupData.Code != 0)
|
|
|
{
|
|
@@ -7016,19 +7016,12 @@ FROM
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
public async Task<IActionResult> QueryVisaById(PostVisaByIdDto dto)
|
|
|
{
|
|
|
- try
|
|
|
- {
|
|
|
- Result groupData = await _visaPriceRep.PostVisaById(dto);
|
|
|
- if (groupData.Code != 0)
|
|
|
- {
|
|
|
- return Ok(JsonView(false, groupData.Msg));
|
|
|
- }
|
|
|
- return Ok(JsonView(true, groupData.Msg, groupData.Data));
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
+ Result groupData = await _visaPriceRep.PostVisaById(dto);
|
|
|
+ if (groupData.Code != 0)
|
|
|
{
|
|
|
- return Ok(JsonView(false, ex.Message));
|
|
|
+ return Ok(JsonView(false, groupData.Msg));
|
|
|
}
|
|
|
+ return Ok(JsonView(true, groupData.Msg, groupData.Data));
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 签证费用删除
|
|
@@ -7091,12 +7084,23 @@ FROM
|
|
|
List<Sys_SetData> BankCard = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 15 && a.IsDel == 0).ToList();
|
|
|
List<SetDataInfoView> _BankCard = _mapper.Map<List<SetDataInfoView>>(BankCard);
|
|
|
|
|
|
+ //代办费类型
|
|
|
+ var agencyFeeTypeData = new List<dynamic>() {
|
|
|
+ new { id = 0 , Text = "未选择" },
|
|
|
+ new { id = 1 , Text = "小公务" },
|
|
|
+ new { id = 2 , Text = "大公务" },
|
|
|
+ };
|
|
|
+
|
|
|
+ //签证费用标准国家Data
|
|
|
+ var visaCountryFeeData = _sqlSugar.Queryable<Res_CountryFeeCost>().Where(x => x.IsDel == 0).Select(x => new { x.Id, Country = x.VisaCountry }).ToList();
|
|
|
var data = new
|
|
|
{
|
|
|
Payment = _Payment,
|
|
|
CurrencyList = _CurrencyList,
|
|
|
PassengerType = _PassengerType,
|
|
|
- BankCard = _BankCard
|
|
|
+ BankCard = _BankCard,
|
|
|
+ AgencyFeeType = agencyFeeTypeData,
|
|
|
+ CountryFeeData = visaCountryFeeData
|
|
|
};
|
|
|
return Ok(JsonView(true, "查询成功!", data));
|
|
|
}
|
|
@@ -12253,219 +12257,515 @@ ORDER by gctggrc.id DESC
|
|
|
|
|
|
#endregion
|
|
|
decimal _rate = 1.00M;
|
|
|
- string _currency = "";
|
|
|
+ string _currency = string.Empty;
|
|
|
|
|
|
var currDatas = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.STid == 66).ToList();
|
|
|
- List<Grp_HotelReservations> hrDtas = await _sqlSugar.Queryable<Grp_HotelReservations>().Where(it => it.IsDel == 0 && it.DiId == _dto.DiId).ToListAsync();
|
|
|
+ var hrDtas = _sqlSugar.Queryable<Grp_HotelReservations>().Where(it => it.IsDel == 0 && it.DiId == _dto.DiId).ToList();
|
|
|
if (hrDtas.Count < 1) return Ok(JsonView(StatusCodes.Status400BadRequest, "酒店预订费用未录入,不支持预定成本Excel导出", ""));
|
|
|
-
|
|
|
- Grp_GroupCostParameter _GroupCostParameter = await _sqlSugar.Queryable<Grp_GroupCostParameter>().Where(it => it.IsDel == 0 && it.DiId == _dto.DiId).FirstAsync();
|
|
|
- if (_GroupCostParameter == null) return Ok(JsonView(StatusCodes.Status400BadRequest, "团组成本费用未录入,不支持预定成本Excel导出", ""));
|
|
|
- if (string.IsNullOrEmpty(_GroupCostParameter.Currency))
|
|
|
+ var hotelSubData = _sqlSugar.Queryable<Grp_HotelReservationsContent>().Where(it => it.IsDel == 0 && it.DiId == _dto.DiId).ToList();
|
|
|
+ var ccpData = _sqlSugar.Queryable<Grp_CreditCardPayment>().Where(it => it.IsDel == 0 && it.DIId == _dto.DiId && it.CTable == 76).ToList();
|
|
|
+
|
|
|
+ var _GroupCostParameter = _sqlSugar.Queryable<Grp_GroupCostParameter>().Where(it => it.IsDel == 0 && it.DiId == _dto.DiId).First();
|
|
|
+ //if (_GroupCostParameter == null) return Ok(JsonView(StatusCodes.Status400BadRequest, "团组成本费用未录入,不支持预定成本Excel导出", ""));
|
|
|
+ if (_GroupCostParameter == null)
|
|
|
{
|
|
|
- return Ok(JsonView(StatusCodes.Status400BadRequest, "团组成本费用“币种为录入”未录入,不支持预定成本Excel导出", ""));
|
|
|
- }
|
|
|
- _currency = _GroupCostParameter.Currency;
|
|
|
+ //return Ok(JsonView(StatusCodes.Status400BadRequest, "团组成本费用“币种为录入”未录入,不支持预定成本Excel导出", ""));
|
|
|
+ bool isIntType = int.TryParse(_currency, out int currId);
|
|
|
+ if (isIntType)
|
|
|
+ {
|
|
|
+ _currency = currDatas.Find(it => it.Id == currId)?.Name ?? "";
|
|
|
+ }
|
|
|
|
|
|
- bool isIntType = int.TryParse(_currency, out int currId);
|
|
|
- if (isIntType)
|
|
|
- {
|
|
|
- _currency = currDatas.Find(it => it.Id == currId)?.Name ?? "";
|
|
|
+ var teamRate = await _teamRateRep.PostGroupTeamRateItemByDiIdAndCTableId(1, _dto.DiId, 76);
|
|
|
|
|
|
- }
|
|
|
+ var currInfo = teamRate.Find(it => it.CurrencyCode.Equals(_currency));
|
|
|
+ if (currInfo == null)
|
|
|
+ {
|
|
|
|
|
|
- var teamRate = await _teamRateRep.PostGroupTeamRateItemByDiIdAndCTableId(1, _dto.DiId, 76);
|
|
|
+ //return Ok(JsonView(StatusCodes.Status400BadRequest, $"团组汇率-->酒店模块 {_currency} 币种未设置汇率,不支持预定成本Excel导出", ""));
|
|
|
|
|
|
- var currInfo = teamRate.Find(it => it.CurrencyCode.Equals(_currency));
|
|
|
- if (currInfo == null)
|
|
|
- {
|
|
|
- return Ok(JsonView(StatusCodes.Status400BadRequest, $"团组汇率-->酒店模块 {_currency} 币种未设置汇率,不支持预定成本Excel导出", ""));
|
|
|
+ }
|
|
|
+ else _rate = currInfo.Rate;
|
|
|
|
|
|
- }
|
|
|
+ if (!string.IsNullOrEmpty(_currency) && !_currency.ToUpper().Equals("CNY"))
|
|
|
+ {
|
|
|
+ _rate = _GroupCostParameter.Rate;
|
|
|
+ }
|
|
|
|
|
|
- if (!_currency.ToUpper().Equals("CNY"))
|
|
|
- {
|
|
|
- _rate = _GroupCostParameter.Rate;
|
|
|
- }
|
|
|
|
|
|
- _rate = currInfo.Rate;
|
|
|
- hrDtas = hrDtas.OrderBy(it => it.CheckInDate).ToList();
|
|
|
- string strFileName = "HotelStatement/";
|
|
|
+ hrDtas = hrDtas.OrderBy(it => it.CheckInDate).ToList();
|
|
|
+ string strFileName = "HotelStatement/";
|
|
|
|
|
|
- string guestNames = ""; //格式Mr.xxx Ms.xxx
|
|
|
- List<HotelReservations_PCFD_View> pcfds = new List<HotelReservations_PCFD_View>();
|
|
|
- var hotelSubData = _sqlSugar.Queryable<Grp_HotelReservationsContent>().Where(it => it.IsDel == 0 && it.DiId == _dto.DiId).ToList();
|
|
|
- var ccpData = _sqlSugar.Queryable<Grp_CreditCardPayment>().Where(it => it.IsDel == 0 && it.DIId == _dto.DiId && it.CTable == 76).ToList();
|
|
|
- #region 数据处理
|
|
|
+ string guestNames = ""; //格式Mr.xxx Ms.xxx
|
|
|
+ List<HotelReservations_PCFD_View> pcfds = new List<HotelReservations_PCFD_View>();
|
|
|
+ var rateDatas = new List<dynamic>();
|
|
|
+ #region 数据处理
|
|
|
|
|
|
- foreach (var item in hrDtas)
|
|
|
- {
|
|
|
- var ccpInfo = ccpData.Where(it => it.DIId == _dto.DiId && it.CId == item.Id).First();
|
|
|
+ foreach (var item in hrDtas)
|
|
|
+ {
|
|
|
+ var ccpInfo = ccpData.Where(it => it.DIId == _dto.DiId && it.CId == item.Id).First();
|
|
|
|
|
|
- var roomInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 1).FirstOrDefault(); //房费
|
|
|
- var breakfastInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 2).FirstOrDefault(); //早餐
|
|
|
- var governmentRentInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 3).FirstOrDefault(); //地税
|
|
|
- var cityTaxInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 4).FirstOrDefault(); //城市税
|
|
|
+ var roomInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 1).FirstOrDefault(); //房费
|
|
|
+ var breakfastInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 2).FirstOrDefault(); //早餐
|
|
|
+ var governmentRentInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 3).FirstOrDefault(); //地税
|
|
|
+ var cityTaxInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 4).FirstOrDefault(); //城市税
|
|
|
|
|
|
|
|
|
- string roomCurr = currDatas.Find(it => it.Id == roomInfo?.Currency)?.Name ?? "";
|
|
|
+ if (ccpInfo == null || roomInfo == null || breakfastInfo == null || governmentRentInfo == null || cityTaxInfo == null)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
- string singleRoomFeeStr = string.Empty,
|
|
|
- doubleRoomFeeStr = string.Empty,
|
|
|
- suiteRoomFeeStr = string.Empty,
|
|
|
- otherRoomFeeStr = string.Empty,
|
|
|
- payMoneyStr = string.Empty,
|
|
|
- cardPriceStr = string.Empty;
|
|
|
- if (roomCurr.Equals(_currency))
|
|
|
- {
|
|
|
- singleRoomFeeStr = $"{item.SingleRoomPrice.ToString("#0.00")} {_currency}";
|
|
|
- doubleRoomFeeStr = $"{item.DoubleRoomPrice.ToString("#0.00")} {_currency}";
|
|
|
- suiteRoomFeeStr = $"{item.SuiteRoomPrice.ToString("#0.00")} {_currency}";
|
|
|
- otherRoomFeeStr = $"{item.OtherRoomPrice.ToString("#0.00")} {_currency}";
|
|
|
- payMoneyStr = $"{ccpInfo.PayMoney.ToString("#0.00")} {_currency}";
|
|
|
- cardPriceStr = $"{item.CardPrice.ToString("#0.00")} {_currency}";
|
|
|
+ string roomCurr = currDatas.Find(it => it.Id == roomInfo?.Currency)?.Name ?? "";
|
|
|
+ if (string.IsNullOrEmpty(_currency)) _currency = $"CNY";
|
|
|
+
|
|
|
+ string singleRoomFeeStr = string.Empty,
|
|
|
+ doubleRoomFeeStr = string.Empty,
|
|
|
+ suiteRoomFeeStr = string.Empty,
|
|
|
+ otherRoomFeeStr = string.Empty,
|
|
|
+ payMoneyStr = string.Empty,
|
|
|
+ cardPriceStr = string.Empty;
|
|
|
+ if (roomCurr.Equals("CNY"))
|
|
|
+ {
|
|
|
+ rateDatas.Add(new { code = "CNY", rate = 1.0000 });
|
|
|
+ singleRoomFeeStr = $"{item.SingleRoomPrice.ToString("#0.00")} {roomCurr}";
|
|
|
+ doubleRoomFeeStr = $"{item.DoubleRoomPrice.ToString("#0.00")} {roomCurr}";
|
|
|
+ suiteRoomFeeStr = $"{item.SuiteRoomPrice.ToString("#0.00")} {roomCurr}";
|
|
|
+ otherRoomFeeStr = $"{item.OtherRoomPrice.ToString("#0.00")} {roomCurr}";
|
|
|
+ payMoneyStr = $"{ccpInfo.PayMoney.ToString("#0.00")} {currDatas.Find(it => it.Id == ccpInfo?.PaymentCurrency)?.Name ?? ""}";
|
|
|
+ cardPriceStr = $"{item.CardPrice.ToString("#0.00")} {currDatas.Find(it => it.Id == item.CardPriceCurrency)?.Name ?? ""}";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //singleRoomFeeStr = $"{((item.SingleRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.SingleRoomPrice.ToString("#0.00")} {roomCurr}";
|
|
|
+ //doubleRoomFeeStr = $"{((item.DoubleRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.DoubleRoomPrice.ToString("#0.00")} {roomCurr}";
|
|
|
+ //suiteRoomFeeStr = $"{((item.SuiteRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.SuiteRoomPrice.ToString("#0.00")} {roomCurr}";
|
|
|
+ //otherRoomFeeStr = $"{((item.OtherRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.OtherRoomPrice.ToString("#0.00")} {roomCurr}";
|
|
|
+ //payMoneyStr = $"{((ccpInfo.PayMoney * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{ccpInfo.PayMoney.ToString("#0.00")} {roomCurr}";
|
|
|
+ //cardPriceStr = $"{((item.CardPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.CardPrice.ToString("#0.00")} {roomCurr}";
|
|
|
+ singleRoomFeeStr = $"{item.SingleRoomPrice.ToString("#0.00")} {roomCurr}\r\n{((item.SingleRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}";
|
|
|
+ doubleRoomFeeStr = $"{item.DoubleRoomPrice.ToString("#0.00")} {roomCurr}\r\n{((item.DoubleRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}";
|
|
|
+ suiteRoomFeeStr = $"{item.SuiteRoomPrice.ToString("#0.00")} {roomCurr}\r\n{((item.SuiteRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}";
|
|
|
+ otherRoomFeeStr = $"{item.OtherRoomPrice.ToString("#0.00")} {roomCurr}\r\n{((item.OtherRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}";
|
|
|
+ rateDatas.Add(new { code = roomCurr, rate = roomInfo.Rate });
|
|
|
+ var ccpPaymentCurrency = currDatas.Find(it => it.Id == ccpInfo?.PaymentCurrency)?.Name ?? "";
|
|
|
+ if (ccpPaymentCurrency.Equals("CNY"))
|
|
|
+ {
|
|
|
+ payMoneyStr = $"{ccpInfo.PayMoney.ToString("#0.00")} CNY";
|
|
|
+ cardPriceStr = $"{item.CardPrice.ToString("#0.00")} CNY";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ rateDatas.Add(new { code = ccpPaymentCurrency, rate = ccpInfo.DayRate });
|
|
|
+ payMoneyStr = $"{ccpInfo.PayMoney.ToString("#0.00")} {ccpPaymentCurrency}\r\n{((ccpInfo.PayMoney * ccpInfo.DayRate) / _rate).ToString("#0.00")} CNY";
|
|
|
+ }
|
|
|
+
|
|
|
+ var hotelcardPriceCurrency = currDatas.Find(it => it.Id == item?.CardPriceCurrency)?.Name ?? "";
|
|
|
+ if (hotelcardPriceCurrency.Equals("CNY"))
|
|
|
+ {
|
|
|
+ cardPriceStr = $"{item.CardPrice.ToString("#0.00")} CNY";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ cardPriceStr = $"{item.CardPrice.ToString("#0.00")} {hotelcardPriceCurrency}\r\n{((item.CardPrice * roomInfo.Rate) / _rate).ToString("#0.00")} CNY";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ string breakfastPriceStr = string.Empty,
|
|
|
+ breakfastCurrency = currDatas.Find(it => it.Id == item.BreakfastCurrency)?.Name ?? "",
|
|
|
+ governmentRentStr = string.Empty,
|
|
|
+ governmentRentCurrency = currDatas.Find(it => it.Id == item.GovernmentRentCurrency)?.Name ?? "",
|
|
|
+ cityTaxStr = string.Empty,
|
|
|
+ cityTaxStrCurrency = currDatas.Find(it => it.Id == item.CityTaxCurrency)?.Name ?? "";
|
|
|
+
|
|
|
+ var breakfastCurrency1 = currDatas.Find(it => it.Id == breakfastInfo?.Currency)?.Name;
|
|
|
+ if (!string.IsNullOrEmpty(breakfastCurrency1))
|
|
|
+ {
|
|
|
+ if (breakfastCurrency1.Equals("CNY"))
|
|
|
+ {
|
|
|
+ breakfastPriceStr = $"{breakfastInfo?.Price.ToString("#0.00")} {breakfastCurrency1}";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ rateDatas.Add(new { code = breakfastCurrency1, rate = breakfastInfo.Rate });
|
|
|
+ var breakfastPriceCny = breakfastInfo.Price * breakfastInfo.Rate;
|
|
|
+ breakfastPriceStr = $"{breakfastInfo?.Price.ToString("#0.00")} {breakfastCurrency1}\r\n{breakfastPriceCny.ToString("#0.00")} CNY";
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else breakfastPriceStr = $"{breakfastInfo?.Price.ToString("#0.00")} {breakfastCurrency1}";
|
|
|
+
|
|
|
+ var governmentRentCurrency1 = currDatas.Find(it => it.Id == governmentRentInfo?.Currency)?.Name;
|
|
|
+ if (!string.IsNullOrEmpty(governmentRentCurrency1))
|
|
|
+ {
|
|
|
+ if (governmentRentCurrency.Equals("CNY"))
|
|
|
+ {
|
|
|
+ governmentRentStr = $"{governmentRentInfo?.Price.ToString("#0.00")} {governmentRentCurrency1}";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ rateDatas.Add(new { code = governmentRentCurrency1, rate = governmentRentInfo.Rate });
|
|
|
+ var governmentRentCny = governmentRentInfo.Price * governmentRentInfo.Rate;
|
|
|
+ governmentRentStr = $"{governmentRentInfo?.Price.ToString("#0.00")} {governmentRentCurrency1}\r\n{governmentRentCny.ToString("#0.00")} CNY";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else governmentRentStr = $"{governmentRentInfo?.Price.ToString("#0.00")} {governmentRentCurrency1}";
|
|
|
+
|
|
|
+ var cityTaxStrCurrency1 = currDatas.Find(it => it.Id == cityTaxInfo?.Currency)?.Name;
|
|
|
+ if (!string.IsNullOrEmpty(cityTaxStrCurrency1))
|
|
|
+ {
|
|
|
+ if (cityTaxStrCurrency1.Equals("CNY"))
|
|
|
+ {
|
|
|
+ cityTaxStr = $"{cityTaxInfo?.Price.ToString("#0.00")} {cityTaxStrCurrency1}";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ rateDatas.Add(new { code = cityTaxStrCurrency1, rate = cityTaxInfo.Rate });
|
|
|
+ var cityTaxCny = cityTaxInfo.Price * cityTaxInfo.Rate;
|
|
|
+ cityTaxStr = $"{cityTaxInfo?.Price.ToString("#0.00")} {cityTaxStrCurrency1}\r\n{cityTaxCny.ToString("#0.00")} CNY";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else cityTaxStr = $"{cityTaxInfo?.Price.ToString("#0.00")} {cityTaxStrCurrency1}";
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ int payDId = roomInfo?.PayDId ?? 0;
|
|
|
+ pcfds.Add(new HotelReservations_PCFD_View()
|
|
|
+ {
|
|
|
+ City = item.City,
|
|
|
+ HotelName = item.HotelName,
|
|
|
+ Date = $"{item.CheckInDate} - {item.CheckOutDate}",
|
|
|
+ // SingleRoomCount = item.SingleRoomCount,
|
|
|
+ SingleRoomPrice = singleRoomFeeStr,
|
|
|
+ // DoubleRoomCount = item.DoubleRoomCount,
|
|
|
+ DoubleRoomPrice = doubleRoomFeeStr,
|
|
|
+ //SuiteRoomCount = item.SuiteRoomCount,
|
|
|
+ SuiteRoomPrice = suiteRoomFeeStr,
|
|
|
+ OtherRoomPrice = otherRoomFeeStr,
|
|
|
+ //OtherRoomCount = item.OtherRoomCount,
|
|
|
+
|
|
|
+ BreakfastPrice = breakfastPriceStr,
|
|
|
+ GovernmentRent = governmentRentStr,
|
|
|
+ CityTax = cityTaxStr,
|
|
|
+
|
|
|
+ RoomExplanation = item.RoomExplanation,
|
|
|
+ PayTypeName = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.Id == payDId).First()?.Name ?? "",
|
|
|
+ PayTime = roomInfo?.ConsumptionDate,
|
|
|
+ BankNo = roomInfo?.BankNo,
|
|
|
+ PayMoney = payMoneyStr,
|
|
|
+ //PayMoneys = ccpInfo.PayMoney.ToString("#0.00"),
|
|
|
+ ConsumptionPatterns = roomInfo?.ConsumptionPatterns,
|
|
|
+ CardPrice = cardPriceStr,
|
|
|
+ Remark = ccpInfo.Remark
|
|
|
+
|
|
|
+ });
|
|
|
}
|
|
|
- else
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //载入模板
|
|
|
+ WorkbookDesigner designer = new WorkbookDesigner();
|
|
|
+ designer.Workbook = new Workbook(AppSettingsHelper.Get("ExcelBasePath") + "Template/酒店预订成本.xls");
|
|
|
+
|
|
|
+ var groupInfo = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.Id == _dto.DiId).First();
|
|
|
+ var userInfo = _sqlSugar.Queryable<Sys_Users>().Where(it => it.Id == hrDtas[0].CreateUserId).First();
|
|
|
+ designer.SetDataSource("TourNo", groupInfo.TourCode);
|
|
|
+
|
|
|
+ var rateDatas1 = rateDatas.Distinct();
|
|
|
+ var rateStr = string.Empty;
|
|
|
+ foreach (var item in rateDatas1)
|
|
|
{
|
|
|
- singleRoomFeeStr = $"{((item.SingleRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.SingleRoomPrice.ToString("#0.00")} {roomCurr}";
|
|
|
- doubleRoomFeeStr = $"{((item.DoubleRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.DoubleRoomPrice.ToString("#0.00")} {roomCurr}";
|
|
|
- suiteRoomFeeStr = $"{((item.SuiteRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.SuiteRoomPrice.ToString("#0.00")} {roomCurr}";
|
|
|
- otherRoomFeeStr = $"{((item.OtherRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.OtherRoomPrice.ToString("#0.00")} {roomCurr}";
|
|
|
- payMoneyStr = $"{((ccpInfo.PayMoney * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{ccpInfo.PayMoney.ToString("#0.00")} {roomCurr}";
|
|
|
- cardPriceStr = $"{((item.CardPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.CardPrice.ToString("#0.00")} {roomCurr}";
|
|
|
+ rateStr += $"{item.code} {item.rate.ToString("#0.0000")} \t\t";
|
|
|
}
|
|
|
- string breakfastPriceStr = string.Empty,
|
|
|
- breakfastCurrency = currDatas.Find(it => it.Id == item.BreakfastCurrency)?.Name ?? "",
|
|
|
- governmentRentStr = string.Empty,
|
|
|
- governmentRentCurrency = currDatas.Find(it => it.Id == item.GovernmentRentCurrency)?.Name ?? "",
|
|
|
- cityTaxStrStr = string.Empty,
|
|
|
- cityTaxStrCurrency = currDatas.Find(it => it.Id == item.CityTaxCurrency)?.Name ?? "";
|
|
|
|
|
|
- breakfastPriceStr = $"{breakfastInfo?.Price.ToString("#0.00")} {currDatas.Find(it => it.Id == breakfastInfo?.Currency)?.Name}";
|
|
|
- governmentRentStr = $"{governmentRentInfo?.Price.ToString("#0.00")} {currDatas.Find(it => it.Id == governmentRentInfo?.Currency)?.Name}";
|
|
|
- cityTaxStrStr = $"{cityTaxInfo?.Price.ToString("#0.00")} {currDatas.Find(it => it.Id == cityTaxInfo?.Currency)?.Name}";
|
|
|
+ designer.SetDataSource("TeamName", $"酒店模块汇率:{rateStr}");
|
|
|
+ designer.SetDataSource("Opertor", userInfo.CnName);
|
|
|
|
|
|
- int payDId = roomInfo?.PayDId ?? 0;
|
|
|
- pcfds.Add(new HotelReservations_PCFD_View()
|
|
|
+ DataTable dt = CommonFun.GetDataTableFromIList<HotelReservations_PCFD_View>(pcfds);
|
|
|
+ dt.TableName = "ViewMyHotelReservations";
|
|
|
+ designer.SetDataSource(dt);
|
|
|
+ designer.Process();
|
|
|
+
|
|
|
+ string fileName = $"HotelReservation/{groupInfo.TeamName.Replace("/", "").Replace(@"\", "").Trim()}_酒店预订成本_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xls";
|
|
|
+ string serverPath = AppSettingsHelper.Get("ExcelBasePath") + fileName;
|
|
|
+
|
|
|
+ designer.Workbook.Save(serverPath);
|
|
|
+ string rst = AppSettingsHelper.Get("ExcelBaseUrl") + AppSettingsHelper.Get("ExcelFtpPath") + fileName;
|
|
|
+
|
|
|
+ #region 删除指定行
|
|
|
+
|
|
|
+ bool singleDel = true, doubleDel = true, suiteDel = true, otherDel = true, zcDel = true, dsDel = true, cssDel = true, cpDel = true, remarkDel = true;
|
|
|
+ int singleIndex = dt.Columns["SingleRoomPrice"].Ordinal,
|
|
|
+ doubleIndex = dt.Columns["DoubleRoomPrice"].Ordinal,
|
|
|
+ suiteIndex = dt.Columns["SuiteRoomPrice"].Ordinal,
|
|
|
+ otherIndex = dt.Columns["OtherRoomPrice"].Ordinal,
|
|
|
+ zcIndex = dt.Columns["BreakfastPrice"].Ordinal,
|
|
|
+ dsIndex = dt.Columns["GovernmentRent"].Ordinal,
|
|
|
+ cssIndex = dt.Columns["CityTax"].Ordinal,
|
|
|
+ cpIndex = dt.Columns["ConsumptionPatterns"].Ordinal,
|
|
|
+ remarkIndex = dt.Columns["Remark"].Ordinal;
|
|
|
+ //删除指定列
|
|
|
+ foreach (DataRow item in dt.Rows)
|
|
|
{
|
|
|
- City = item.City,
|
|
|
- HotelName = item.HotelName,
|
|
|
- Date = $"{item.CheckInDate} - {item.CheckOutDate}",
|
|
|
- // SingleRoomCount = item.SingleRoomCount,
|
|
|
- SingleRoomPrice = singleRoomFeeStr,
|
|
|
- // DoubleRoomCount = item.DoubleRoomCount,
|
|
|
- DoubleRoomPrice = doubleRoomFeeStr,
|
|
|
- //SuiteRoomCount = item.SuiteRoomCount,
|
|
|
- SuiteRoomPrice = suiteRoomFeeStr,
|
|
|
- OtherRoomPrice = otherRoomFeeStr,
|
|
|
- //OtherRoomCount = item.OtherRoomCount,
|
|
|
-
|
|
|
- BreakfastPrice = breakfastPriceStr,
|
|
|
- GovernmentRent = governmentRentStr,
|
|
|
- CityTax = cityTaxStrStr,
|
|
|
-
|
|
|
- RoomExplanation = item.RoomExplanation,
|
|
|
- PayTypeName = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.Id == payDId).First()?.Name ?? "",
|
|
|
- PayTime = roomInfo?.ConsumptionDate,
|
|
|
- BankNo = roomInfo?.BankNo,
|
|
|
- PayMoney = payMoneyStr,
|
|
|
- //PayMoneys = ccpInfo.PayMoney.ToString("#0.00"),
|
|
|
- ConsumptionPatterns = roomInfo?.ConsumptionPatterns,
|
|
|
- CardPrice = cardPriceStr,
|
|
|
- Remark = ccpInfo.Remark
|
|
|
+ string singleStr = item["SingleRoomPrice"].ToString();
|
|
|
+ bool containsDigitButNotZero1 = !singleStr.StartsWith("0") && Regex.IsMatch(singleStr, @"[1-9]");
|
|
|
+ if (containsDigitButNotZero1) singleDel = false;
|
|
|
+ singleIndex = dt.Columns["SingleRoomPrice"].Ordinal;
|
|
|
|
|
|
- });
|
|
|
- }
|
|
|
+ string doubleStr = item["DoubleRoomPrice"].ToString();
|
|
|
+ bool containsDigitButNotZero2 = !doubleStr.StartsWith("0") && Regex.IsMatch(doubleStr, @"[1-9]");
|
|
|
+ if (containsDigitButNotZero2) doubleDel = false;
|
|
|
|
|
|
- #endregion
|
|
|
+ string suiteStr = item["SuiteRoomPrice"].ToString();
|
|
|
+ bool containsDigitButNotZero3 = !singleStr.StartsWith("0") && Regex.IsMatch(doubleStr, @"[1-9]");
|
|
|
+ if (containsDigitButNotZero3) suiteDel = false;
|
|
|
|
|
|
- //载入模板
|
|
|
- WorkbookDesigner designer = new WorkbookDesigner();
|
|
|
- designer.Workbook = new Workbook(AppSettingsHelper.Get("ExcelBasePath") + "Template/酒店预订成本.xls");
|
|
|
+ string otherStr = item["OtherRoomPrice"].ToString();
|
|
|
+ bool containsDigitButNotZero4 = !otherStr.StartsWith("0") && Regex.IsMatch(otherStr, @"[1-9]");
|
|
|
+ if (containsDigitButNotZero4) otherDel = false;
|
|
|
|
|
|
- var groupInfo = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.Id == _dto.DiId).First();
|
|
|
- var userInfo = _sqlSugar.Queryable<Sys_Users>().Where(it => it.Id == hrDtas[0].CreateUserId).First();
|
|
|
- designer.SetDataSource("TourNo", groupInfo.TourCode);
|
|
|
- designer.SetDataSource("TeamName", $"{groupInfo.TeamName} 团组成本币种:{_currency} 团组汇率-->酒店模块汇率:{_rate.ToString("#0.0000")}");
|
|
|
- designer.SetDataSource("Opertor", userInfo.CnName);
|
|
|
+ string zcStr = item["BreakfastPrice"].ToString();
|
|
|
+ bool containsDigitButNotZero5 = !zcStr.StartsWith("0") && Regex.IsMatch(zcStr, @"[1-9]");
|
|
|
+ if (containsDigitButNotZero5) zcDel = false;
|
|
|
|
|
|
- DataTable dt = CommonFun.GetDataTableFromIList<HotelReservations_PCFD_View>(pcfds);
|
|
|
- dt.TableName = "ViewMyHotelReservations";
|
|
|
- designer.SetDataSource(dt);
|
|
|
- designer.Process();
|
|
|
+ string dsStr = item["GovernmentRent"].ToString();
|
|
|
+ bool containsDigitButNotZero6 = !dsStr.StartsWith("0") && Regex.IsMatch(dsStr, @"[1-9]");
|
|
|
+ if (containsDigitButNotZero6) dsDel = false;
|
|
|
|
|
|
- string fileName = $"HotelReservation/{groupInfo.TeamName.Replace("/", "").Replace(@"\", "").Trim()}_酒店预订成本_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xls";
|
|
|
- string serverPath = AppSettingsHelper.Get("ExcelBasePath") + fileName;
|
|
|
+ string cssStr = item["CityTax"].ToString();
|
|
|
+ bool containsDigitButNotZero7 = !cssStr.StartsWith("0") && Regex.IsMatch(cssStr, @"[1-9]");
|
|
|
+ if (containsDigitButNotZero7) cssDel = false;
|
|
|
|
|
|
- designer.Workbook.Save(serverPath);
|
|
|
- string rst = AppSettingsHelper.Get("ExcelBaseUrl") + AppSettingsHelper.Get("ExcelFtpPath") + fileName;
|
|
|
-
|
|
|
- #region 删除指定行
|
|
|
-
|
|
|
- bool singleDel = true, doubleDel = true, suiteDel = true, otherDel = true, zcDel = true, dsDel = true, cssDel = true, cpDel = true, remarkDel = true;
|
|
|
- int singleIndex = dt.Columns["SingleRoomPrice"].Ordinal,
|
|
|
- doubleIndex = dt.Columns["DoubleRoomPrice"].Ordinal,
|
|
|
- suiteIndex = dt.Columns["SuiteRoomPrice"].Ordinal,
|
|
|
- otherIndex = dt.Columns["OtherRoomPrice"].Ordinal,
|
|
|
- zcIndex = dt.Columns["BreakfastPrice"].Ordinal,
|
|
|
- dsIndex = dt.Columns["GovernmentRent"].Ordinal,
|
|
|
- cssIndex = dt.Columns["CityTax"].Ordinal,
|
|
|
- cpIndex = dt.Columns["ConsumptionPatterns"].Ordinal,
|
|
|
- remarkIndex = dt.Columns["Remark"].Ordinal;
|
|
|
- //删除指定列
|
|
|
- foreach (DataRow item in dt.Rows)
|
|
|
+ string cpStr = item["ConsumptionPatterns"].ToString();
|
|
|
+ if (!string.IsNullOrEmpty(cpStr)) cpDel = false;
|
|
|
+
|
|
|
+ string remarkStr = item["Remark"].ToString();
|
|
|
+ if (!string.IsNullOrEmpty(remarkStr)) remarkDel = false;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ DeleteColumn(serverPath, remarkIndex, remarkDel);
|
|
|
+ DeleteColumn(serverPath, cpIndex, cpDel);
|
|
|
+ DeleteColumn(serverPath, dsIndex, dsDel);
|
|
|
+ DeleteColumn(serverPath, cssIndex, cssDel);
|
|
|
+ DeleteColumn(serverPath, zcIndex, zcDel);
|
|
|
+ DeleteColumn(serverPath, otherIndex, otherDel);
|
|
|
+ DeleteColumn(serverPath, suiteIndex, suiteDel);
|
|
|
+ DeleteColumn(serverPath, doubleIndex, doubleDel);
|
|
|
+ DeleteColumn(serverPath, singleIndex, singleDel);
|
|
|
+ #endregion
|
|
|
+ //只保留第一个表格
|
|
|
+ DeleteSheet(serverPath);
|
|
|
+
|
|
|
+ return Ok(JsonView(true, "操作成功", url = rst));
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- string singleStr = item["SingleRoomPrice"].ToString();
|
|
|
- bool containsDigitButNotZero1 = !singleStr.StartsWith("0") && Regex.IsMatch(singleStr, @"[1-9]");
|
|
|
- if (containsDigitButNotZero1) singleDel = false;
|
|
|
- singleIndex = dt.Columns["SingleRoomPrice"].Ordinal;
|
|
|
+ _currency = _GroupCostParameter.Currency;
|
|
|
+ bool isIntType = int.TryParse(_currency, out int currId);
|
|
|
+ if (isIntType)
|
|
|
+ {
|
|
|
+ _currency = currDatas.Find(it => it.Id == currId)?.Name ?? "";
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ var teamRate = await _teamRateRep.PostGroupTeamRateItemByDiIdAndCTableId(1, _dto.DiId, 76);
|
|
|
+
|
|
|
+ var currInfo = teamRate.Find(it => it.CurrencyCode.Equals(_currency));
|
|
|
+ if (currInfo == null)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(StatusCodes.Status400BadRequest, $"团组汇率-->酒店模块 {_currency} 币种未设置汇率,不支持预定成本Excel导出", ""));
|
|
|
|
|
|
- string doubleStr = item["DoubleRoomPrice"].ToString();
|
|
|
- bool containsDigitButNotZero2 = !doubleStr.StartsWith("0") && Regex.IsMatch(doubleStr, @"[1-9]");
|
|
|
- if (containsDigitButNotZero2) doubleDel = false;
|
|
|
+ }
|
|
|
|
|
|
- string suiteStr = item["SuiteRoomPrice"].ToString();
|
|
|
- bool containsDigitButNotZero3 = !singleStr.StartsWith("0") && Regex.IsMatch(doubleStr, @"[1-9]");
|
|
|
- if (containsDigitButNotZero3) suiteDel = false;
|
|
|
+ if (!_currency.ToUpper().Equals("CNY"))
|
|
|
+ {
|
|
|
+ _rate = _GroupCostParameter.Rate;
|
|
|
+ }
|
|
|
|
|
|
- string otherStr = item["OtherRoomPrice"].ToString();
|
|
|
- bool containsDigitButNotZero4 = !otherStr.StartsWith("0") && Regex.IsMatch(otherStr, @"[1-9]");
|
|
|
- if (containsDigitButNotZero4) otherDel = false;
|
|
|
+ _rate = currInfo.Rate;
|
|
|
+ hrDtas = hrDtas.OrderBy(it => it.CheckInDate).ToList();
|
|
|
+ string strFileName = "HotelStatement/";
|
|
|
|
|
|
- string zcStr = item["BreakfastPrice"].ToString();
|
|
|
- bool containsDigitButNotZero5 = !zcStr.StartsWith("0") && Regex.IsMatch(zcStr, @"[1-9]");
|
|
|
- if (containsDigitButNotZero5) zcDel = false;
|
|
|
+ string guestNames = ""; //格式Mr.xxx Ms.xxx
|
|
|
+ List<HotelReservations_PCFD_View> pcfds = new List<HotelReservations_PCFD_View>();
|
|
|
+ #region 数据处理
|
|
|
+
|
|
|
+ foreach (var item in hrDtas)
|
|
|
+ {
|
|
|
+ var ccpInfo = ccpData.Where(it => it.DIId == _dto.DiId && it.CId == item.Id).First();
|
|
|
|
|
|
- string dsStr = item["GovernmentRent"].ToString();
|
|
|
- bool containsDigitButNotZero6 = !dsStr.StartsWith("0") && Regex.IsMatch(dsStr, @"[1-9]");
|
|
|
- if (containsDigitButNotZero6) dsDel = false;
|
|
|
+ var roomInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 1).FirstOrDefault(); //房费
|
|
|
+ var breakfastInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 2).FirstOrDefault(); //早餐
|
|
|
+ var governmentRentInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 3).FirstOrDefault(); //地税
|
|
|
+ var cityTaxInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 4).FirstOrDefault(); //城市税
|
|
|
|
|
|
- string cssStr = item["CityTax"].ToString();
|
|
|
- bool containsDigitButNotZero7 = !cssStr.StartsWith("0") && Regex.IsMatch(cssStr, @"[1-9]");
|
|
|
- if (containsDigitButNotZero7) cssDel = false;
|
|
|
|
|
|
- string cpStr = item["ConsumptionPatterns"].ToString();
|
|
|
- if (!string.IsNullOrEmpty(cpStr)) cpDel = false;
|
|
|
+ string roomCurr = currDatas.Find(it => it.Id == roomInfo?.Currency)?.Name ?? "";
|
|
|
|
|
|
- string remarkStr = item["Remark"].ToString();
|
|
|
- if (!string.IsNullOrEmpty(remarkStr)) remarkDel = false;
|
|
|
+ string singleRoomFeeStr = string.Empty,
|
|
|
+ doubleRoomFeeStr = string.Empty,
|
|
|
+ suiteRoomFeeStr = string.Empty,
|
|
|
+ otherRoomFeeStr = string.Empty,
|
|
|
+ payMoneyStr = string.Empty,
|
|
|
+ cardPriceStr = string.Empty;
|
|
|
+ if (roomCurr.Equals(_currency))
|
|
|
+ {
|
|
|
+ singleRoomFeeStr = $"{item.SingleRoomPrice.ToString("#0.00")} {_currency}";
|
|
|
+ doubleRoomFeeStr = $"{item.DoubleRoomPrice.ToString("#0.00")} {_currency}";
|
|
|
+ suiteRoomFeeStr = $"{item.SuiteRoomPrice.ToString("#0.00")} {_currency}";
|
|
|
+ otherRoomFeeStr = $"{item.OtherRoomPrice.ToString("#0.00")} {_currency}";
|
|
|
+ payMoneyStr = $"{ccpInfo.PayMoney.ToString("#0.00")} {_currency}";
|
|
|
+ cardPriceStr = $"{item.CardPrice.ToString("#0.00")} {_currency}";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ singleRoomFeeStr = $"{((item.SingleRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.SingleRoomPrice.ToString("#0.00")} {roomCurr}";
|
|
|
+ doubleRoomFeeStr = $"{((item.DoubleRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.DoubleRoomPrice.ToString("#0.00")} {roomCurr}";
|
|
|
+ suiteRoomFeeStr = $"{((item.SuiteRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.SuiteRoomPrice.ToString("#0.00")} {roomCurr}";
|
|
|
+ otherRoomFeeStr = $"{((item.OtherRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.OtherRoomPrice.ToString("#0.00")} {roomCurr}";
|
|
|
+ payMoneyStr = $"{((ccpInfo.PayMoney * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{ccpInfo.PayMoney.ToString("#0.00")} {roomCurr}";
|
|
|
+ cardPriceStr = $"{((item.CardPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.CardPrice.ToString("#0.00")} {roomCurr}";
|
|
|
+ }
|
|
|
+ string breakfastPriceStr = string.Empty,
|
|
|
+ breakfastCurrency = currDatas.Find(it => it.Id == item.BreakfastCurrency)?.Name ?? "",
|
|
|
+ governmentRentStr = string.Empty,
|
|
|
+ governmentRentCurrency = currDatas.Find(it => it.Id == item.GovernmentRentCurrency)?.Name ?? "",
|
|
|
+ cityTaxStrStr = string.Empty,
|
|
|
+ cityTaxStrCurrency = currDatas.Find(it => it.Id == item.CityTaxCurrency)?.Name ?? "";
|
|
|
+
|
|
|
+ breakfastPriceStr = $"{breakfastInfo?.Price.ToString("#0.00")} {currDatas.Find(it => it.Id == breakfastInfo?.Currency)?.Name}";
|
|
|
+ governmentRentStr = $"{governmentRentInfo?.Price.ToString("#0.00")} {currDatas.Find(it => it.Id == governmentRentInfo?.Currency)?.Name}";
|
|
|
+ cityTaxStrStr = $"{cityTaxInfo?.Price.ToString("#0.00")} {currDatas.Find(it => it.Id == cityTaxInfo?.Currency)?.Name}";
|
|
|
+
|
|
|
+ int payDId = roomInfo?.PayDId ?? 0;
|
|
|
+ pcfds.Add(new HotelReservations_PCFD_View()
|
|
|
+ {
|
|
|
+ City = item.City,
|
|
|
+ HotelName = item.HotelName,
|
|
|
+ Date = $"{item.CheckInDate} - {item.CheckOutDate}",
|
|
|
+ // SingleRoomCount = item.SingleRoomCount,
|
|
|
+ SingleRoomPrice = singleRoomFeeStr,
|
|
|
+ // DoubleRoomCount = item.DoubleRoomCount,
|
|
|
+ DoubleRoomPrice = doubleRoomFeeStr,
|
|
|
+ //SuiteRoomCount = item.SuiteRoomCount,
|
|
|
+ SuiteRoomPrice = suiteRoomFeeStr,
|
|
|
+ OtherRoomPrice = otherRoomFeeStr,
|
|
|
+ //OtherRoomCount = item.OtherRoomCount,
|
|
|
+
|
|
|
+ BreakfastPrice = breakfastPriceStr,
|
|
|
+ GovernmentRent = governmentRentStr,
|
|
|
+ CityTax = cityTaxStrStr,
|
|
|
+
|
|
|
+ RoomExplanation = item.RoomExplanation,
|
|
|
+ PayTypeName = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.Id == payDId).First()?.Name ?? "",
|
|
|
+ PayTime = roomInfo?.ConsumptionDate,
|
|
|
+ BankNo = roomInfo?.BankNo,
|
|
|
+ PayMoney = payMoneyStr,
|
|
|
+ //PayMoneys = ccpInfo.PayMoney.ToString("#0.00"),
|
|
|
+ ConsumptionPatterns = roomInfo?.ConsumptionPatterns,
|
|
|
+ CardPrice = cardPriceStr,
|
|
|
+ Remark = ccpInfo.Remark
|
|
|
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //载入模板
|
|
|
+ WorkbookDesigner designer = new WorkbookDesigner();
|
|
|
+ designer.Workbook = new Workbook(AppSettingsHelper.Get("ExcelBasePath") + "Template/酒店预订成本.xls");
|
|
|
+
|
|
|
+ var groupInfo = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.Id == _dto.DiId).First();
|
|
|
+ var userInfo = _sqlSugar.Queryable<Sys_Users>().Where(it => it.Id == hrDtas[0].CreateUserId).First();
|
|
|
+ designer.SetDataSource("TourNo", groupInfo.TourCode);
|
|
|
+ designer.SetDataSource("TeamName", $"{groupInfo.TeamName} 团组成本币种:{_currency} 团组汇率-->酒店模块汇率:{_rate.ToString("#0.0000")}");
|
|
|
+ designer.SetDataSource("Opertor", userInfo.CnName);
|
|
|
+
|
|
|
+ DataTable dt = CommonFun.GetDataTableFromIList<HotelReservations_PCFD_View>(pcfds);
|
|
|
+ dt.TableName = "ViewMyHotelReservations";
|
|
|
+ designer.SetDataSource(dt);
|
|
|
+ designer.Process();
|
|
|
+
|
|
|
+ string fileName = $"HotelReservation/{groupInfo.TeamName.Replace("/", "").Replace(@"\", "").Trim()}_酒店预订成本_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xls";
|
|
|
+ string serverPath = AppSettingsHelper.Get("ExcelBasePath") + fileName;
|
|
|
+
|
|
|
+ designer.Workbook.Save(serverPath);
|
|
|
+ string rst = AppSettingsHelper.Get("ExcelBaseUrl") + AppSettingsHelper.Get("ExcelFtpPath") + fileName;
|
|
|
+
|
|
|
+ #region 删除指定行
|
|
|
+
|
|
|
+ bool singleDel = true, doubleDel = true, suiteDel = true, otherDel = true, zcDel = true, dsDel = true, cssDel = true, cpDel = true, remarkDel = true;
|
|
|
+ int singleIndex = dt.Columns["SingleRoomPrice"].Ordinal,
|
|
|
+ doubleIndex = dt.Columns["DoubleRoomPrice"].Ordinal,
|
|
|
+ suiteIndex = dt.Columns["SuiteRoomPrice"].Ordinal,
|
|
|
+ otherIndex = dt.Columns["OtherRoomPrice"].Ordinal,
|
|
|
+ zcIndex = dt.Columns["BreakfastPrice"].Ordinal,
|
|
|
+ dsIndex = dt.Columns["GovernmentRent"].Ordinal,
|
|
|
+ cssIndex = dt.Columns["CityTax"].Ordinal,
|
|
|
+ cpIndex = dt.Columns["ConsumptionPatterns"].Ordinal,
|
|
|
+ remarkIndex = dt.Columns["Remark"].Ordinal;
|
|
|
+ //删除指定列
|
|
|
+ foreach (DataRow item in dt.Rows)
|
|
|
+ {
|
|
|
+ string singleStr = item["SingleRoomPrice"].ToString();
|
|
|
+ bool containsDigitButNotZero1 = !singleStr.StartsWith("0") && Regex.IsMatch(singleStr, @"[1-9]");
|
|
|
+ if (containsDigitButNotZero1) singleDel = false;
|
|
|
+ singleIndex = dt.Columns["SingleRoomPrice"].Ordinal;
|
|
|
+
|
|
|
+ string doubleStr = item["DoubleRoomPrice"].ToString();
|
|
|
+ bool containsDigitButNotZero2 = !doubleStr.StartsWith("0") && Regex.IsMatch(doubleStr, @"[1-9]");
|
|
|
+ if (containsDigitButNotZero2) doubleDel = false;
|
|
|
+
|
|
|
+ string suiteStr = item["SuiteRoomPrice"].ToString();
|
|
|
+ bool containsDigitButNotZero3 = !singleStr.StartsWith("0") && Regex.IsMatch(doubleStr, @"[1-9]");
|
|
|
+ if (containsDigitButNotZero3) suiteDel = false;
|
|
|
+
|
|
|
+ string otherStr = item["OtherRoomPrice"].ToString();
|
|
|
+ bool containsDigitButNotZero4 = !otherStr.StartsWith("0") && Regex.IsMatch(otherStr, @"[1-9]");
|
|
|
+ if (containsDigitButNotZero4) otherDel = false;
|
|
|
+
|
|
|
+ string zcStr = item["BreakfastPrice"].ToString();
|
|
|
+ bool containsDigitButNotZero5 = !zcStr.StartsWith("0") && Regex.IsMatch(zcStr, @"[1-9]");
|
|
|
+ if (containsDigitButNotZero5) zcDel = false;
|
|
|
+
|
|
|
+ string dsStr = item["GovernmentRent"].ToString();
|
|
|
+ bool containsDigitButNotZero6 = !dsStr.StartsWith("0") && Regex.IsMatch(dsStr, @"[1-9]");
|
|
|
+ if (containsDigitButNotZero6) dsDel = false;
|
|
|
+
|
|
|
+ string cssStr = item["CityTax"].ToString();
|
|
|
+ bool containsDigitButNotZero7 = !cssStr.StartsWith("0") && Regex.IsMatch(cssStr, @"[1-9]");
|
|
|
+ if (containsDigitButNotZero7) cssDel = false;
|
|
|
+
|
|
|
+ string cpStr = item["ConsumptionPatterns"].ToString();
|
|
|
+ if (!string.IsNullOrEmpty(cpStr)) cpDel = false;
|
|
|
+
|
|
|
+ string remarkStr = item["Remark"].ToString();
|
|
|
+ if (!string.IsNullOrEmpty(remarkStr)) remarkDel = false;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ DeleteColumn(serverPath, remarkIndex, remarkDel);
|
|
|
+ DeleteColumn(serverPath, cpIndex, cpDel);
|
|
|
+ DeleteColumn(serverPath, dsIndex, dsDel);
|
|
|
+ DeleteColumn(serverPath, cssIndex, cssDel);
|
|
|
+ DeleteColumn(serverPath, zcIndex, zcDel);
|
|
|
+ DeleteColumn(serverPath, otherIndex, otherDel);
|
|
|
+ DeleteColumn(serverPath, suiteIndex, suiteDel);
|
|
|
+ DeleteColumn(serverPath, doubleIndex, doubleDel);
|
|
|
+ DeleteColumn(serverPath, singleIndex, singleDel);
|
|
|
+ #endregion
|
|
|
+ //只保留第一个表格
|
|
|
+ DeleteSheet(serverPath);
|
|
|
+
|
|
|
+ return Ok(JsonView(true, "操作成功", url = rst));
|
|
|
}
|
|
|
|
|
|
- DeleteColumn(serverPath, remarkIndex, remarkDel);
|
|
|
- DeleteColumn(serverPath, cpIndex, cpDel);
|
|
|
- DeleteColumn(serverPath, dsIndex, dsDel);
|
|
|
- DeleteColumn(serverPath, cssIndex, cssDel);
|
|
|
- DeleteColumn(serverPath, zcIndex, zcDel);
|
|
|
- DeleteColumn(serverPath, otherIndex, otherDel);
|
|
|
- DeleteColumn(serverPath, suiteIndex, suiteDel);
|
|
|
- DeleteColumn(serverPath, doubleIndex, doubleDel);
|
|
|
- DeleteColumn(serverPath, singleIndex, singleDel);
|
|
|
- #endregion
|
|
|
- //只保留第一个表格
|
|
|
- DeleteSheet(serverPath);
|
|
|
|
|
|
- return Ok(JsonView(true, "操作成功", url = rst));
|
|
|
+ return Ok(JsonView(false));
|
|
|
}
|
|
|
|
|
|
/// <summary>
|