|
@@ -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;
|
|
@@ -106,42 +107,43 @@ namespace OASystem.API.Controllers
|
|
|
private readonly ForeignReceivablesRepository _ffrRep; //对外收款账单仓库
|
|
|
private readonly OpinionaireRepository _opinionaireRep; //对外收款账单仓库
|
|
|
|
|
|
- public GroupsController(ILogger<GroupsController> logger,
|
|
|
- IMapper mapper,
|
|
|
- SqlSugarClient sqlSugar,
|
|
|
- GrpScheduleRepository grpScheduleRep,
|
|
|
- DelegationInfoRepository groupRepository,
|
|
|
- TaskAssignmentRepository taskAssignmentRep,
|
|
|
- AirTicketResRepository airTicketResRep,
|
|
|
- DecreasePaymentsRepository decreasePaymentsRep,
|
|
|
- InvitationOfficialActivitiesRepository InvitationOfficialActivitiesRep,
|
|
|
- DelegationEnDataRepository delegationEnDataRep,
|
|
|
- EnterExitCostRepository enterExitCostRep,
|
|
|
- DelegationVisaRepository delegationVisaRep,
|
|
|
- MessageRepository message,
|
|
|
- VisaPriceRepository visaPriceRep,
|
|
|
- CarTouristGuideGroundRepository carTouristGuideGroundRep,
|
|
|
- CheckBoxsRepository checkBoxs,
|
|
|
- GroupCostRepository GroupCostRepository,
|
|
|
- CostTypeHotelNumberRepository CostTypeHotelNumberRepository,
|
|
|
- GroupCostParameterRepository GroupCostParameterRepository,
|
|
|
- HotelPriceRepository hotelPriceRep,
|
|
|
- CustomersRepository customersRep,
|
|
|
- SetDataRepository setDataRep,
|
|
|
- TourClientListRepository tourClientListRep,
|
|
|
- TeamRateRepository teamRateRep,
|
|
|
- IHubContext<ChatHub, IChatClient> hubContext,
|
|
|
- UsersRepository usersRep, IJuHeApiService juHeApi,
|
|
|
- InvertedListRepository invertedListRep,
|
|
|
- VisaFeeInfoRepository visaFeeInfoRep,
|
|
|
- TicketBlackCodeRepository ticketBlackCodeRep,
|
|
|
- HotelInquiryRepository hotelInquiryRep,
|
|
|
- ThreeCodeRepository threeCodeRepository,
|
|
|
- FeeAuditRepository feeAuditRep,
|
|
|
- VisaCommissionRepository visaCommissionRep,
|
|
|
- ForeignReceivablesRepository ffrRep,
|
|
|
- OpinionaireRepository opinionaireRep
|
|
|
- )
|
|
|
+ public GroupsController(
|
|
|
+ ILogger<GroupsController> logger,
|
|
|
+ IMapper mapper,
|
|
|
+ IHubContext<ChatHub, IChatClient> hubContext,
|
|
|
+ SqlSugarClient sqlSugar,
|
|
|
+ GrpScheduleRepository grpScheduleRep,
|
|
|
+ DelegationInfoRepository groupRepository,
|
|
|
+ TaskAssignmentRepository taskAssignmentRep,
|
|
|
+ AirTicketResRepository airTicketResRep,
|
|
|
+ DecreasePaymentsRepository decreasePaymentsRep,
|
|
|
+ InvitationOfficialActivitiesRepository InvitationOfficialActivitiesRep,
|
|
|
+ DelegationEnDataRepository delegationEnDataRep,
|
|
|
+ EnterExitCostRepository enterExitCostRep,
|
|
|
+ DelegationVisaRepository delegationVisaRep,
|
|
|
+ MessageRepository message,
|
|
|
+ VisaPriceRepository visaPriceRep,
|
|
|
+ CarTouristGuideGroundRepository carTouristGuideGroundRep,
|
|
|
+ CheckBoxsRepository checkBoxs,
|
|
|
+ GroupCostRepository GroupCostRepository,
|
|
|
+ CostTypeHotelNumberRepository CostTypeHotelNumberRepository,
|
|
|
+ GroupCostParameterRepository GroupCostParameterRepository,
|
|
|
+ HotelPriceRepository hotelPriceRep,
|
|
|
+ CustomersRepository customersRep,
|
|
|
+ SetDataRepository setDataRep,
|
|
|
+ TourClientListRepository tourClientListRep,
|
|
|
+ TeamRateRepository teamRateRep,
|
|
|
+ UsersRepository usersRep, IJuHeApiService juHeApi,
|
|
|
+ InvertedListRepository invertedListRep,
|
|
|
+ VisaFeeInfoRepository visaFeeInfoRep,
|
|
|
+ TicketBlackCodeRepository ticketBlackCodeRep,
|
|
|
+ HotelInquiryRepository hotelInquiryRep,
|
|
|
+ ThreeCodeRepository threeCodeRepository,
|
|
|
+ FeeAuditRepository feeAuditRep,
|
|
|
+ VisaCommissionRepository visaCommissionRep,
|
|
|
+ ForeignReceivablesRepository ffrRep,
|
|
|
+ OpinionaireRepository opinionaireRep
|
|
|
+ )
|
|
|
{
|
|
|
_logger = logger;
|
|
|
_mapper = mapper;
|
|
@@ -5278,27 +5280,27 @@ FROM
|
|
|
{
|
|
|
if (dto.DiId < 1)
|
|
|
{
|
|
|
- return Ok(JsonView(false, "请传入有效的DiId参数;"));
|
|
|
+ return Ok(JsonView(400, "请传入有效的DiId参数;", ""));
|
|
|
}
|
|
|
|
|
|
if (dto.ExportType < 1)
|
|
|
{
|
|
|
- return Ok(JsonView(false, "请传入有效的ExportType参数; 1 明细表 2 表格"));
|
|
|
+ return Ok(JsonView(400, "请传入有效的ExportType参数; 1 明细表 2 表格", ""));
|
|
|
}
|
|
|
|
|
|
if (dto.SubTypeId < 1)
|
|
|
{
|
|
|
- return Ok(JsonView(false, @"请传入有效的SubTypeId参数;
|
|
|
+ return Ok(JsonView(400, @"请传入有效的SubTypeId参数;
|
|
|
1 明细表 --> 1005(默认明细表) 1006(因公出国(境)经费测算明细表) 1007(四川省商务厅出国经费财政先行审核表)
|
|
|
2 表格 --> 1008(派员单位出(境)任务和预算审批意见表) 1009(省级单位出(境)经费报销单)
|
|
|
- 3 团组成员名单 1 团组成员名单"));
|
|
|
+ 3 团组成员名单 1 团组成员名单", ""));
|
|
|
}
|
|
|
|
|
|
var _EnterExitCosts = _sqlSugar.Queryable<Grp_EnterExitCost>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).First();
|
|
|
var _DayAndCosts = _sqlSugar.Queryable<Grp_DayAndCost>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).ToList();
|
|
|
if (_EnterExitCosts == null)
|
|
|
{
|
|
|
- return Ok(JsonView(false, "该团组未填写出入境费用;"));
|
|
|
+ return Ok(JsonView(400, "该团组未填写出入境费用;",""));
|
|
|
}
|
|
|
|
|
|
//数据源
|
|
@@ -5425,7 +5427,6 @@ FROM
|
|
|
airPriceStr += $" {_EnterExitCosts.AirTD.ToString("#0.00")} 元/人(头等舱)";
|
|
|
}
|
|
|
|
|
|
-
|
|
|
dic.Add("AirTotalStr", airTotalStr);
|
|
|
dic.Add("AirPriceStr", airPriceStr);
|
|
|
dic.Add("CityTranffic", _EnterExitCosts.CityTranffic.ToString("#0.00"));
|
|
@@ -5670,8 +5671,9 @@ FROM
|
|
|
AsposeHelper.removewatermark_v2180();
|
|
|
doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
|
|
|
string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
|
|
|
- return Ok(JsonView(true, "成功", new { Url = url }));
|
|
|
|
|
|
+ if (dto.PortType == 1 || dto.PortType == 3) return Ok(JsonView(true, "成功", new { Url = url }));
|
|
|
+ else if (dto.PortType == 2 ) return Ok(JsonView(true, "成功", url));
|
|
|
}
|
|
|
else if (dto.SubTypeId == 1006)//1006(因公出国(境)经费测算明细表)
|
|
|
{
|
|
@@ -5835,7 +5837,6 @@ FROM
|
|
|
table1.Rows.RemoveAt(i - 1);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
dic.Add("CityTranffic", _EnterExitCosts.CityTranffic.ToString("#0.00"));
|
|
|
|
|
|
string otherFeeStr = "";
|
|
@@ -5894,8 +5895,9 @@ FROM
|
|
|
string strFileName = $"{_DelegationInfo.TeamName}因公出国(境)经费测算明细表{DateTime.UtcNow.ToString("yyyyMMddHHmmss")}.docx";
|
|
|
doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
|
|
|
string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
|
|
|
- return Ok(JsonView(true, "成功", new { Url = url }));
|
|
|
|
|
|
+ if (dto.PortType == 1 || dto.PortType == 3) return Ok(JsonView(true, "成功", new { Url = url }));
|
|
|
+ else if (dto.PortType == 2 ) return Ok(JsonView(true, "成功", url));
|
|
|
}
|
|
|
else if (dto.SubTypeId == 1007) //1007(四川省商务厅出国经费财政先行审核表)
|
|
|
{
|
|
@@ -6135,7 +6137,8 @@ FROM
|
|
|
string strFileName = $"{_DelegationInfo.TeamName}-四川省商务厅出国经费财政先行审核表{DateTime.Now.ToString("yyyyMMddHHmmss")}.xls";
|
|
|
designer.Workbook.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
|
|
|
string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
|
|
|
- return Ok(JsonView(true, "成功", new { Url = url }));
|
|
|
+ if (dto.PortType == 1 || dto.PortType == 3) return Ok(JsonView(true, "成功", new { Url = url }));
|
|
|
+ else if (dto.PortType == 2) return Ok(JsonView(true, "成功", url));
|
|
|
}
|
|
|
else if (dto.SubTypeId == 1066) //成都市因公临时出国任务和预算审批意见表(外专培训团专用)
|
|
|
{
|
|
@@ -6315,7 +6318,9 @@ FROM
|
|
|
string strFileName = $"{_DelegationInfo.TeamName}-成都市因公临时出国任务和预算审批意见表(外专培训团专用).docx";
|
|
|
doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
|
|
|
string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
|
|
|
- return Ok(JsonView(true, "成功", new { Url = url }));
|
|
|
+
|
|
|
+ if (dto.PortType == 1 || dto.PortType == 3) return Ok(JsonView(true, "成功", new { Url = url }));
|
|
|
+ else if (dto.PortType == 2) return Ok(JsonView(true, "成功", url));
|
|
|
}
|
|
|
}
|
|
|
else if (dto.ExportType == 2) //表格
|
|
@@ -6397,7 +6402,9 @@ FROM
|
|
|
string strFileName = $"派员单位出(境)任务和预算审批意见表.docx";
|
|
|
doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
|
|
|
string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
|
|
|
- return Ok(JsonView(true, "成功", new { Url = url }));
|
|
|
+
|
|
|
+ if (dto.PortType == 1) return Ok(JsonView(true, "成功", new { Url = url }));
|
|
|
+ else if (dto.PortType == 2 || dto.PortType == 3) return Ok(JsonView(true, "成功", url));
|
|
|
|
|
|
}
|
|
|
else if (dto.SubTypeId == 1009)//1009(省级单位出(境)经费报销单)
|
|
@@ -6560,7 +6567,9 @@ FROM
|
|
|
string strFileName = $"省级单位出(境)经费报销单{DateTime.UtcNow.ToString("yyyyMMddHHmmss")}.docx";
|
|
|
doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
|
|
|
string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
|
|
|
- return Ok(JsonView(true, "成功", new { Url = url }));
|
|
|
+
|
|
|
+ if (dto.PortType == 1 || dto.PortType == 3) return Ok(JsonView(true, "成功", new { Url = url }));
|
|
|
+ else if (dto.PortType == 2) return Ok(JsonView(true, "成功", url));
|
|
|
}
|
|
|
}
|
|
|
else if (dto.ExportType == 3)
|
|
@@ -6569,7 +6578,7 @@ FROM
|
|
|
{
|
|
|
if (DeleClientList.Count < 1)
|
|
|
{
|
|
|
- return Ok(JsonView(false, "团组成员暂未录入!!!"));
|
|
|
+ return Ok(JsonView(false, "团组成员暂未录入!!!",""));
|
|
|
}
|
|
|
|
|
|
//获取模板
|
|
@@ -6618,15 +6627,17 @@ FROM
|
|
|
doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
|
|
|
|
|
|
string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
|
|
|
- return Ok(JsonView(true, "成功", new { Url = url }));
|
|
|
+
|
|
|
+ if (dto.PortType == 1 || dto.PortType == 3) return Ok(JsonView(true, "成功", new { Url = url }));
|
|
|
+ else if (dto.PortType == 2) return Ok(JsonView(true, "成功", url));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return Ok(JsonView(false, "操作失败!"));
|
|
|
+ return Ok(JsonView(400, "操作失败!", ""));
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- return Ok(JsonView(false, ex.Message));
|
|
|
+ return Ok(JsonView(400, ex.Message, ""));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -6988,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)
|
|
|
{
|
|
@@ -7006,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>
|
|
|
/// 签证费用删除
|
|
@@ -7081,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));
|
|
|
}
|
|
@@ -12243,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);
|
|
|
+
|
|
|
+ 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;
|
|
|
|
|
|
- int payDId = roomInfo?.PayDId ?? 0;
|
|
|
- pcfds.Add(new HotelReservations_PCFD_View()
|
|
|
+ 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导出", ""));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!_currency.ToUpper().Equals("CNY"))
|
|
|
+ {
|
|
|
+ _rate = _GroupCostParameter.Rate;
|
|
|
+ }
|
|
|
+
|
|
|
+ _rate = currInfo.Rate;
|
|
|
+ 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>();
|
|
|
+ #region 数据处理
|
|
|
|
|
|
- string doubleStr = item["DoubleRoomPrice"].ToString();
|
|
|
- bool containsDigitButNotZero2 = !doubleStr.StartsWith("0") && Regex.IsMatch(doubleStr, @"[1-9]");
|
|
|
- if (containsDigitButNotZero2) doubleDel = false;
|
|
|
+ foreach (var item in hrDtas)
|
|
|
+ {
|
|
|
+ var ccpInfo = ccpData.Where(it => it.DIId == _dto.DiId && it.CId == item.Id).First();
|
|
|
|
|
|
- string suiteStr = item["SuiteRoomPrice"].ToString();
|
|
|
- bool containsDigitButNotZero3 = !singleStr.StartsWith("0") && Regex.IsMatch(doubleStr, @"[1-9]");
|
|
|
- if (containsDigitButNotZero3) suiteDel = 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 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 roomCurr = currDatas.Find(it => it.Id == roomInfo?.Currency)?.Name ?? "";
|
|
|
|
|
|
- string dsStr = item["GovernmentRent"].ToString();
|
|
|
- bool containsDigitButNotZero6 = !dsStr.StartsWith("0") && Regex.IsMatch(dsStr, @"[1-9]");
|
|
|
- if (containsDigitButNotZero6) dsDel = 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
|
|
|
|
|
|
- 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;
|
|
|
+ #endregion
|
|
|
|
|
|
- string remarkStr = item["Remark"].ToString();
|
|
|
- if (!string.IsNullOrEmpty(remarkStr)) remarkDel = false;
|
|
|
+ //载入模板
|
|
|
+ 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>
|