|
|
@@ -2294,6 +2294,1202 @@ ORDER BY
|
|
|
return Ok(JsonView(true, "成功", url));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 团组报表
|
|
|
+ /// Details
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="_dto">团组列表请求dto</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("PostGroupStatementDetails1")]
|
|
|
+ //[JsonConverter(typeof(DecimalConverter), 2)]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> PostGroupStatementDetails1()
|
|
|
+ {
|
|
|
+ /*
|
|
|
+ * 团组报表计算方式
|
|
|
+ * 当前总支出 = 团组支出.Sum() + 超支费用.Sum()
|
|
|
+ * 应收金额 = 应收表.Sum()
|
|
|
+ * 已收金额 = 已收表.Sum()
|
|
|
+ * 应收利润(应收-支出) = 应收金额 - 收款退还 - 当前总支出
|
|
|
+ * 已收利润(已收-支出) = 已收金额 - 收款退还 - 当前总支出
|
|
|
+ *
|
|
|
+ */
|
|
|
+
|
|
|
+ GroupStatementDetailsView _view = new GroupStatementDetailsView();
|
|
|
+
|
|
|
+ var _dto = new { DiId = 2477 , isAudit =true};
|
|
|
+
|
|
|
+ #region 费用类型 币种,转账,客户信息
|
|
|
+
|
|
|
+ List<Sys_SetData> _setDatas = await _sqlSugar.Queryable<Sys_SetData>().Where(it => it.IsDel == 0).ToListAsync();
|
|
|
+ var _clientDatas = await _sqlSugar.Queryable<Crm_DeleClient>()
|
|
|
+ .Where(it => it.IsDel == 0)
|
|
|
+ .Select(x => new Crm_DeleClient { Id = x.Id, FirstName = x.FirstName, LastName = x.LastName, Sex = x.Sex })
|
|
|
+ .ToListAsync();
|
|
|
+ foreach (var item in _clientDatas) EncryptionProcessor.DecryptProperties(item);
|
|
|
+
|
|
|
+ var groupInfo = await _sqlSugar.Queryable<Grp_DelegationInfo>().Where(x => x.Id == _dto.DiId).FirstAsync();
|
|
|
+ var visitDate = groupInfo.VisitDate;
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 团组收入
|
|
|
+
|
|
|
+ GroupIncomeView _giView = new GroupIncomeView();
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 应收报表
|
|
|
+ * 增加方式=实际报价时 费用必须审核才能进入团组报表
|
|
|
+ */
|
|
|
+ decimal frTotalAmount = 0.00M;//应收总金额
|
|
|
+ string _frSql = string.Format(@" Select fr.Id,fr.AddingWay,fr.Status,u.CnName As Auditor,fr.AuditTime,fr.Diid,fr.PriceName,fr.Price,fr.Count,fr.Unit,fr.Currency,
|
|
|
+ sd.Name As CurrencyCode,sd.Remark As CurrencyName,fr.Rate,fr.ItemSumPrice,fr.CreateTime
|
|
|
+ From Fin_ForeignReceivables fr
|
|
|
+ Left Join Sys_SetData sd On fr.Currency = sd.Id
|
|
|
+ Left Join Sys_Users u On fr.Auditor = u.Id
|
|
|
+ Where fr.IsDel = 0 And fr.Diid = {0} Order By CreateTime", _dto.DiId);
|
|
|
+ List<Gsd_ForeignReceivablesView> _frViews = await _sqlSugar.SqlQueryable<Gsd_ForeignReceivablesView>(_frSql).ToListAsync();
|
|
|
+
|
|
|
+
|
|
|
+ //List<Gsd_ForeignReceivablesView> _frViews = new List<Gsd_ForeignReceivablesView>();
|
|
|
+ //if (_frViews1.Count > 0)
|
|
|
+ //{
|
|
|
+ // _frViews.AddRange(_frViews1.Where(x => x.AddingWay != 2).ToList());
|
|
|
+ // _frViews.AddRange(_frViews1.Where(x => x.AddingWay == 2 && x.Status == 1).ToList());
|
|
|
+ //}
|
|
|
+
|
|
|
+ _frViews.ForEach(x =>
|
|
|
+ {
|
|
|
+ string namePrefix = string.Empty;
|
|
|
+ if (x.AddingWay == 0) namePrefix = $"账单模块-";
|
|
|
+ else if (x.AddingWay == 1) namePrefix = $"成本预算模块-";
|
|
|
+ else if (x.AddingWay == 2) namePrefix = $"实际报价-";
|
|
|
+ x.PriceName = $"{namePrefix}{x.PriceName}";
|
|
|
+ });
|
|
|
+
|
|
|
+ frTotalAmount = _frViews.Sum(it => it.ItemSumPrice);
|
|
|
+ _giView.Receivables = _frViews;
|
|
|
+ _giView.ReceivableStr = string.Format(@"应收款合计:{0} CNY(人民币)", frTotalAmount.ConvertToDecimal1().ToString("#0.00"));
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 已收报表
|
|
|
+ */
|
|
|
+ decimal prTotalAmount = 0.00M;//已收总金额
|
|
|
+ string _prSql = string.Format(@"Select pr.Id,pr.Diid,pr.SectionTime As SectionTimeDt,pr.Price,pr.Currency,
|
|
|
+ sd1.Name As CurrencyCode,sd1.Remark As CurrencyName,pr.Client,
|
|
|
+ pr.ReceivablesType,sd2.Name As ReceivablesTypeName,pr.Remark,pr.CreateTime
|
|
|
+ From Fin_ProceedsReceived pr
|
|
|
+ Left Join Sys_SetData sd1 On pr.Currency = sd1.Id
|
|
|
+ Left Join Sys_SetData sd2 On pr.ReceivablesType = sd2.Id
|
|
|
+ Where pr.IsDel = 0 and pr.Diid = {0} Order By CreateTime", _dto.DiId);
|
|
|
+ List<Gsd_ProceedsReceivedView> _prViews = await _sqlSugar.SqlQueryable<Gsd_ProceedsReceivedView>(_prSql).ToListAsync();
|
|
|
+ prTotalAmount = _prViews.Sum(it => it.Price);
|
|
|
+ _giView.ProceedsReceivedViews = _prViews;
|
|
|
+ _giView.ProceedsReceivedStr = string.Format(@$"应收合计:{frTotalAmount:#0.00} CNY 已收款合计:{prTotalAmount.ConvertToDecimal1():#0.00} CNY");
|
|
|
+
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 超支费用
|
|
|
+ */
|
|
|
+ decimal exTotalAmount = 0.00M;
|
|
|
+ // string ecSql = string.Format(@"Select gec.Id As GECId,gec.DiId As GECDiId,gec.PriceName,(gec.PriceSum * gec.Coefficient) As PayMoney,sd1.Name As PaymentCurrency,
|
|
|
+ // (gec.PriceSum * gec.Coefficient * ccp.DayRate) As CNYPrice,ccp.DayRate,ccp.Payee,ccp.OrbitalPrivateTransfer,sd2.Name As PayWay,
|
|
|
+ // sd3.Name As CardType,ccp.IsPay,u.CnName As Applicant,gec.CreateTime
|
|
|
+ //From OA2023DB.dbo.Fin_GroupExtraCost gec
|
|
|
+ //Left Join Grp_CreditCardPayment ccp On gec.Id = ccp.CId
|
|
|
+ // Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id
|
|
|
+ // Left Join Sys_SetData sd2 On ccp.PayDId = sd2.Id
|
|
|
+ // Left Join Sys_SetData sd3 On ccp.CTDId = sd3.Id
|
|
|
+ // Left Join Sys_Users u On ccp.CreateUserId = u.Id
|
|
|
+ //Where ccp.IsDel = 0 And ccp.CTable = 1015 {1} And ccp.DiId = {0} Order By CreateTime", _dto.DiId, _dto.isAudit ? "And ccp.IsAuditGM = 1 And ccp.IsPay = 1 " : " ");
|
|
|
+
|
|
|
+ // List<Gsd_ExtraCostsView> _ExtraCostsViews = await _sqlSugar.SqlQueryable<Gsd_ExtraCostsView>(ecSql).ToListAsync();
|
|
|
+
|
|
|
+ // #region 超支费用 - 模拟数据
|
|
|
+
|
|
|
+ // //if (_ExtraCostsViews.Count < 1)
|
|
|
+ // //{
|
|
|
+ // // _ExtraCostsViews.Add(new Gsd_ExtraCostsView()
|
|
|
+ // // {
|
|
|
+ // // GECId = 0,
|
|
|
+ // // GECDiId = 2334,
|
|
|
+ // // PriceName = "模拟数据-超支费用名称",
|
|
|
+ // // PayMoney = 1000.00M,
|
|
|
+ // // PaymentCurrency = "CNY",
|
|
|
+ // // DayRate = 1.0000M,
|
|
|
+ // // CNYPrice = 1000.00M,
|
|
|
+ // // Payee = "模拟数据-超支费用收款方",
|
|
|
+ // // OrbitalPrivateTransfer = 1,
|
|
|
+ // // PayWay = "刷卡",
|
|
|
+ // // CardType = "招行卡",
|
|
|
+ // // IsPay = 1,
|
|
|
+ // // Applicant = "刘华举"
|
|
|
+ // // });
|
|
|
+ // // _ExtraCostsViews.Add(new Gsd_ExtraCostsView()
|
|
|
+ // // {
|
|
|
+ // // GECId = 0,
|
|
|
+ // // GECDiId = 2334,
|
|
|
+ // // PriceName = "模拟数据-超支费用名称",
|
|
|
+ // // PayMoney = 1000.00M,
|
|
|
+ // // PaymentCurrency = "CNY",
|
|
|
+ // // DayRate = 1.0000M,
|
|
|
+ // // CNYPrice = 1000.00M,
|
|
|
+ // // Payee = "模拟数据-超支费用收款方",
|
|
|
+ // // OrbitalPrivateTransfer = 1,
|
|
|
+ // // PayWay = "刷卡",
|
|
|
+ // // CardType = "招行卡",
|
|
|
+ // // IsPay = 1,
|
|
|
+ // // Applicant = "刘华举"
|
|
|
+ // // });
|
|
|
+ // //}
|
|
|
+ // #endregion
|
|
|
+
|
|
|
+
|
|
|
+ // exTotalAmount = _ExtraCostsViews.Sum(it => it.CNYPrice);
|
|
|
+
|
|
|
+ // _giView.ExtraCostsViews = _ExtraCostsViews;
|
|
|
+ // _giView.ExtraCostsStr = string.Format(@"人民币总费用:{0} CNY", exTotalAmount.ConvertToDecimal1().ToString("#0.00"));
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 收款退还
|
|
|
+ */
|
|
|
+ decimal promTotalAmount = 0.00M;// 收款退还总金额
|
|
|
+ List<Gsd_PaymentRefundAndOtherMoneyView> _promView = new List<Gsd_PaymentRefundAndOtherMoneyView>();
|
|
|
+
|
|
|
+ //删除了 And prom.PriceType = 1
|
|
|
+ string _ropSql = string.Format(@"Select u.CnName As Appliction,prom.Id As PrId,prom.DiId As PrDiId,prom.Price As PrPrice,
|
|
|
+ prom.PriceName AS PrPriceName,prom.CurrencyId As PrCurrencyId,
|
|
|
+ prom.PayType As PrPayType,prom.PriceType As PrPriceType,
|
|
|
+ ccp.RMBPrice * ccp.DayRate As RMBPrice,ccp.*,prom.CreateTime As PrCreateTime
|
|
|
+ From Fin_PaymentRefundAndOtherMoney prom
|
|
|
+ Left Join Grp_CreditCardPayment ccp On prom.DiId = ccp.DIId And prom.Id = ccp.CId
|
|
|
+ Left Join Sys_Users u On ccp.CreateUserId = u.Id
|
|
|
+ Where prom.IsDel = 0
|
|
|
+ And prom.PayType = 1
|
|
|
+ And ccp.CTable = 285
|
|
|
+ {1}
|
|
|
+ And prom.DiId = {0} Order By PrCreateTime", _dto.DiId, _dto.isAudit ? "And ccp.IsAuditGM = 1" : " ");
|
|
|
+ var _promDatas = await _sqlSugar.SqlQueryable<Gsd_PaymentRefundAndOtherMoneyDataSource1View>(_ropSql).ToListAsync();
|
|
|
+
|
|
|
+ foreach (var ropItem in _promDatas)
|
|
|
+ {
|
|
|
+ string thisCueencyCode = "Unknown";
|
|
|
+ string thisCueencyName = "Unknown";
|
|
|
+ var currency = _setDatas.Where(it => it.Id == ropItem.PaymentCurrency).FirstOrDefault();
|
|
|
+ if (currency != null)
|
|
|
+ {
|
|
|
+ thisCueencyCode = currency.Name;
|
|
|
+ thisCueencyName = currency.Remark;
|
|
|
+ }
|
|
|
+
|
|
|
+ string orbitalPrivateTransferStr = "Unknown";
|
|
|
+ var orbitalPrivateTransfer = _setDatas.Where(it => it.Id == ropItem.OrbitalPrivateTransfer).FirstOrDefault();
|
|
|
+ if (orbitalPrivateTransfer != null)
|
|
|
+ {
|
|
|
+ orbitalPrivateTransferStr = orbitalPrivateTransfer.Name;
|
|
|
+ }
|
|
|
+
|
|
|
+ string payStr = "Unknown";
|
|
|
+ var pay = _setDatas.Where(it => it.Id == ropItem.PayDId).FirstOrDefault();
|
|
|
+ if (pay != null)
|
|
|
+ {
|
|
|
+ payStr = pay.Name;
|
|
|
+ }
|
|
|
+
|
|
|
+ Gsd_PaymentRefundAndOtherMoneyView gsd_PaymentRefund = new Gsd_PaymentRefundAndOtherMoneyView()
|
|
|
+ {
|
|
|
+ Id = ropItem.Id,
|
|
|
+ DiId = ropItem.DIId,
|
|
|
+ PriceName = ropItem.PrPriceName,
|
|
|
+ PayCurrencyCode = thisCueencyCode,
|
|
|
+ PayCurrencyName = thisCueencyName,
|
|
|
+ Price = ropItem.PrPrice,
|
|
|
+ CNYPrice = ropItem.PayMoney * ropItem.DayRate,
|
|
|
+ ThisRate = ropItem.DayRate,
|
|
|
+ Payee = ropItem.Payee,
|
|
|
+ PayTime = ropItem.AuditGMDate,
|
|
|
+ OrbitalPrivateTransfer = ropItem.OrbitalPrivateTransfer,
|
|
|
+ PayType = payStr,
|
|
|
+ IsPay = ropItem.IsPay,
|
|
|
+ Applicant = ropItem.Appliction
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+ _promView.Add(gsd_PaymentRefund);
|
|
|
+ }
|
|
|
+
|
|
|
+ #region 收款退还 - 模拟数据
|
|
|
+
|
|
|
+ //if (_promView.Count < 1)
|
|
|
+ //{
|
|
|
+ // _promView.Add(new Gsd_PaymentRefundAndOtherMoneyView()
|
|
|
+ // {
|
|
|
+ // Id = 0,
|
|
|
+ // DiId = 2334,
|
|
|
+ // PriceName = "模拟数据-费用名称",
|
|
|
+ // PayCurrencyCode = "CNY",
|
|
|
+ // PayCurrencyName = "人民币",
|
|
|
+ // Price = 1000.00M,
|
|
|
+ // CNYPrice = 1000.00M,
|
|
|
+ // ThisRate = 1.00M,
|
|
|
+ // Payee = "模拟数据-收款方",
|
|
|
+ // PayTime = "2023-01-01 15:20:01",
|
|
|
+ // OrbitalPrivateTransfer = 1,
|
|
|
+ // PayType = "刷卡",
|
|
|
+ // IsPay = 1,
|
|
|
+ // Applicant = "刘华举"
|
|
|
+ // });
|
|
|
+ // _promView.Add(new Gsd_PaymentRefundAndOtherMoneyView()
|
|
|
+ // {
|
|
|
+ // Id = 0,
|
|
|
+ // DiId = 2334,
|
|
|
+ // PriceName = "模拟数据-费用名称",
|
|
|
+ // PayCurrencyCode = "CNY",
|
|
|
+ // PayCurrencyName = "人民币",
|
|
|
+ // Price = 1000.00M,
|
|
|
+ // CNYPrice = 1000.00M,
|
|
|
+ // ThisRate = 1.00M,
|
|
|
+ // Payee = "模拟数据-收款方",
|
|
|
+ // PayTime = "2023-01-01 15:20:01",
|
|
|
+ // OrbitalPrivateTransfer = 1,
|
|
|
+ // PayType = "刷卡",
|
|
|
+ // IsPay = 1,
|
|
|
+ // Applicant = "刘华举"
|
|
|
+ // });
|
|
|
+ //}
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ promTotalAmount = _promView.Sum(it => it.CNYPrice);
|
|
|
+ _giView.PaymentRefundAndOtherMoneyViews = _promView;
|
|
|
+ _giView.PaymentRefundAndOtherMoneyStr = string.Format(@"人民币总费用:{0} CNY", promTotalAmount.ConvertToDecimal1().ToString("#0.00"));
|
|
|
+
|
|
|
+ decimal BalancePayment = frTotalAmount - prTotalAmount + promTotalAmount;
|
|
|
+ _view.GroupIncome = _giView;
|
|
|
+ _view.GroupIncomeStr = string.Format(@"<span style='color:red;'>剩余尾款:{0} CNY(包含了收款退还费用数据)</span>", BalancePayment.ConvertToDecimal1().ToString("#0.00"));
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 团组支出
|
|
|
+ GroupExpenditureView _geView = new GroupExpenditureView();
|
|
|
+
|
|
|
+ #region 酒店预定费用
|
|
|
+ List<GroupHotelFeeView> groupHotelFeeViews = new List<GroupHotelFeeView>();
|
|
|
+
|
|
|
+ //ccp.RMBPrice As CNYPrice
|
|
|
+ //(((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100) As CNYPrice
|
|
|
+ string hotelFeeSql = string.Format(@"
|
|
|
+SELECT
|
|
|
+ hr.Id AS HrId,
|
|
|
+ hr.DiId AS HrDiId,
|
|
|
+ hr.City,
|
|
|
+ hr.HotelName,
|
|
|
+ hr.CheckInDate,
|
|
|
+ hr.CheckOutDate,
|
|
|
+ hr.CardPrice AS RoomPrice,
|
|
|
+ sd1.Name AS PaymentCurrency,
|
|
|
+ hr.SingleRoomPrice,
|
|
|
+ hr.SingleRoomCount,
|
|
|
+ hr.DoubleRoomPrice,
|
|
|
+ hr.DoubleRoomCount,
|
|
|
+ hr.SuiteRoomPrice,
|
|
|
+ hr.SuiteRoomCount,
|
|
|
+ hr.OtherRoomPrice,
|
|
|
+ hr.OtherRoomCount,
|
|
|
+ hr.BreakfastPrice,
|
|
|
+ sd4.Name AS BreakfastCurrency,
|
|
|
+ hr.Isoppay,
|
|
|
+ hr.GovernmentRent,
|
|
|
+ sd5.Name AS GovernmentRentCurrency,
|
|
|
+ hr.CityTax,
|
|
|
+ sd6.Name AS CityTaxCurrency,
|
|
|
+ ccp.PayMoney,
|
|
|
+ (
|
|
|
+ ((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100
|
|
|
+ ) AS CNYPrice,
|
|
|
+ ccp.PayPercentage,
|
|
|
+ ccp.DayRate,
|
|
|
+ ccp.Payee,
|
|
|
+ ccp.OrbitalPrivateTransfer,
|
|
|
+ sd2.Name AS PayWay,
|
|
|
+ sd3.Name AS CardType,
|
|
|
+ ccp.IsPay,
|
|
|
+ u.CnName AS Applicant
|
|
|
+FROM
|
|
|
+ Grp_HotelReservations hr
|
|
|
+ INNER JOIN Grp_CreditCardPayment ccp ON hr.Id = ccp.CId
|
|
|
+ LEFT JOIN Sys_SetData sd1 ON ccp.PaymentCurrency = sd1.Id
|
|
|
+ LEFT JOIN Sys_SetData sd2 ON ccp.PayDId = sd2.Id
|
|
|
+ LEFT JOIN Sys_SetData sd3 ON ccp.CTDId = sd3.Id
|
|
|
+ LEFT JOIN Sys_Users u ON ccp.CreateUserId = u.Id
|
|
|
+ LEFT JOIN Sys_SetData sd4 ON hr.BreakfastCurrency = sd4.Id
|
|
|
+ LEFT JOIN Sys_SetData sd5 ON hr.GovernmentRentCurrency = sd5.Id
|
|
|
+ LEFT JOIN Sys_SetData sd6 ON hr.CityTaxCurrency = sd6.Id
|
|
|
+WHERE
|
|
|
+ hr.IsDel = 0
|
|
|
+ AND ccp.IsDel = 0
|
|
|
+ AND ccp.CTable = 76 {1}
|
|
|
+ AND ccp.PayMoney <> 0
|
|
|
+ AND hr.DiId = {0}
|
|
|
+ORDER BY
|
|
|
+ CheckInDate Asc", _dto.DiId, _dto.isAudit ? "AND (ccp.IsAuditGM = 1 Or ccp.IsAuditGM = 3)" : " ");
|
|
|
+
|
|
|
+ groupHotelFeeViews = await _sqlSugar.SqlQueryable<GroupHotelFeeView>(hotelFeeSql).ToListAsync();
|
|
|
+
|
|
|
+ List<int> hotelSubIds = groupHotelFeeViews.Select(it => it.HrId).ToList();
|
|
|
+
|
|
|
+ var groupHotelContentFeeViews = await _sqlSugar.Queryable<Grp_HotelReservationsContent>().Where(it => hotelSubIds.Contains(it.HrId)).ToListAsync();
|
|
|
+
|
|
|
+ decimal HotelCNYTotalPrice = 0.00M;
|
|
|
+
|
|
|
+ var teamRateData = await _teamRateRep.PostGroupRateInfoByDiId(_dto.DiId);
|
|
|
+ foreach (var item in groupHotelFeeViews)
|
|
|
+ {
|
|
|
+ if (groupHotelContentFeeViews.Count > 0)
|
|
|
+ {
|
|
|
+
|
|
|
+ string paymentStr = string.Empty;
|
|
|
+
|
|
|
+ var roomData = groupHotelContentFeeViews.Find(it => it.HrId == item.HrId && it.PriceType == 1); //房费
|
|
|
+
|
|
|
+
|
|
|
+ item.RoomPrice = roomData?.Price ?? 0.00M;
|
|
|
+ if (item.RoomPrice != 0)
|
|
|
+ {
|
|
|
+ if (roomData.IsPay == 0) paymentStr += $"房费:未付款<br/>";
|
|
|
+
|
|
|
+ item.RoomPriceCurrency = _setDatas.Find(it => it.Id == roomData?.Currency)?.Name;
|
|
|
+ string feeMark1 = roomData?.OrbitalPrivateTransfer == 0 ? "公转" : "私转";
|
|
|
+ string isFeeMark1 = roomData?.IsOppay == 1 ? "是" : "否";
|
|
|
+ item.RoomInfoTips = @$"当时汇率:{roomData?.Rate.ToString("#0.0000")} <br/>
|
|
|
+ 收款方:{roomData?.Payee}<br/>
|
|
|
+ 费用标识:{feeMark1} <br/>
|
|
|
+ 支付方式:{_setDatas.Find(it => it.Id == roomData?.PayDId)?.Name} <br/>
|
|
|
+ 卡类型:{_setDatas.Find(it => it.Id == roomData?.CTDId)?.Name}<br/>
|
|
|
+ 是否由地接支付:{isFeeMark1} <br/>";
|
|
|
+ }
|
|
|
+
|
|
|
+ var breakfastData = groupHotelContentFeeViews.Find(it => it.HrId == item.HrId && it.PriceType == 2); //早餐
|
|
|
+
|
|
|
+ item.BreakfastPrice = breakfastData?.Price ?? 0.00M;
|
|
|
+
|
|
|
+ if (item.BreakfastPrice != 0)
|
|
|
+ {
|
|
|
+ if (breakfastData.IsPay == 0) paymentStr += $"早餐:未付款<br/>";
|
|
|
+
|
|
|
+ item.BreakfastCurrency = _setDatas.Find(it => it.Id == breakfastData?.Currency)?.Name;
|
|
|
+ string feeMark2 = breakfastData?.OrbitalPrivateTransfer == 0 ? "公转" : "私转";
|
|
|
+ string isFeeMark2 = breakfastData?.IsOppay == 1 ? "是" : "否";
|
|
|
+ item.BreakfastInfoTips = @$"当时汇率:{breakfastData?.Rate.ToString("#0.0000")} <br/>
|
|
|
+ 收款方:{breakfastData?.Payee}<br/>
|
|
|
+ 费用标识:{feeMark2} <br/>
|
|
|
+ 支付方式:{_setDatas.Find(it => it.Id == roomData?.PayDId)?.Name} <br/>
|
|
|
+ 卡类型:{_setDatas.Find(it => it.Id == roomData?.CTDId)?.Name} <br/>
|
|
|
+ 是否由地接支付:{isFeeMark2} <br/>";
|
|
|
+ }
|
|
|
+
|
|
|
+ var landTaxData = groupHotelContentFeeViews.Find(it => it.HrId == item.HrId && it.PriceType == 3); //地税
|
|
|
+
|
|
|
+ item.GovernmentRent = landTaxData?.Price ?? 0.00M;
|
|
|
+
|
|
|
+ if (item.GovernmentRent != 0)
|
|
|
+ {
|
|
|
+ if (landTaxData.IsPay == 0) paymentStr += $"地税:未付款<br/>";
|
|
|
+
|
|
|
+ item.GovernmentRentCurrency = _setDatas.Find(it => it.Id == landTaxData?.Currency)?.Name;
|
|
|
+ string feeMark3 = landTaxData?.OrbitalPrivateTransfer == 0 ? "公转" : "私转";
|
|
|
+ string isFeeMark3 = landTaxData?.IsOppay == 1 ? "是" : "否";
|
|
|
+ item.GovernmentRentTips = @$"当时汇率:{landTaxData?.Rate.ToString("#0.0000")} <br/>
|
|
|
+ 收款方:{landTaxData?.Payee}<br/>
|
|
|
+ 费用标识:{feeMark3} <br/>
|
|
|
+ 支付方式:{_setDatas.Find(it => it.Id == landTaxData?.PayDId)?.Name} <br/>
|
|
|
+ 卡类型:{_setDatas.Find(it => it.Id == landTaxData?.CTDId)?.Name} <br/>
|
|
|
+ 是否由地接支付:{isFeeMark3} <br/>";
|
|
|
+ }
|
|
|
+
|
|
|
+ var cityTaxData = groupHotelContentFeeViews.Find(it => it.HrId == item.HrId && it.PriceType == 4); //城市税
|
|
|
+
|
|
|
+ item.CityTax = cityTaxData?.Price ?? 0.00M;
|
|
|
+
|
|
|
+ if (item.CityTax != 0)
|
|
|
+ {
|
|
|
+ if (cityTaxData.IsPay == 0) paymentStr += $"城市税:未付款<br/>";
|
|
|
+ item.CityTaxCurrency = _setDatas.Find(it => it.Id == cityTaxData?.Currency)?.Name;
|
|
|
+ string feeMark4 = cityTaxData?.OrbitalPrivateTransfer == 0 ? "公转" : "私转";
|
|
|
+ string isFeeMark4 = landTaxData?.IsOppay == 1 ? "是" : "否";
|
|
|
+ item.CityTaxTips = @$"当时汇率:{cityTaxData?.Rate.ToString("#0.0000")} <br/>
|
|
|
+ 收款方:{cityTaxData?.Payee}<br/>
|
|
|
+ 费用标识:{feeMark4} <br/>
|
|
|
+ 支付方式:{_setDatas.Find(it => it.Id == cityTaxData?.PayDId)?.Name} <br/>
|
|
|
+ 卡类型:{_setDatas.Find(it => it.Id == cityTaxData?.CTDId)?.Name} <br/>
|
|
|
+ 是否由地接支付:{isFeeMark4} <br/>";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(paymentStr))
|
|
|
+ {
|
|
|
+ item.IsPay = 2;
|
|
|
+ item.PayTips = paymentStr;
|
|
|
+ }
|
|
|
+ //item.CNYPrice = roomData?.Price ?? 0.00M * roomData?.Rate ?? 0.00M +
|
|
|
+ // breakfastData?.Price ?? 0.00M * breakfastData?.Rate ?? 0.00M +
|
|
|
+ // landTaxData?.Price ?? 0.00M * landTaxData?.Rate ?? 0.00M +
|
|
|
+ // cityTaxData?.Price ?? 0.00M * cityTaxData?.Rate ?? 0.00M;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ decimal roomPrice = (item.SingleRoomCount * item.SingleRoomPrice) +
|
|
|
+ (item.DoubleRoomCount * item.DoubleRoomPrice) +
|
|
|
+ (item.SuiteRoomCount * item.SuiteRoomPrice) +
|
|
|
+ (item.OtherRoomCount * item.OtherRoomPrice);
|
|
|
+ //item.RoomPrice = item.CardPrice;
|
|
|
+ item.RoomPriceCurrency = item.PaymentCurrency;
|
|
|
+ }
|
|
|
+
|
|
|
+ HotelCNYTotalPrice += item.CNYPrice;
|
|
|
+ item.PayMoney = item.PayMoney.ConvertToDecimal1();
|
|
|
+ item.CNYPrice = item.CNYPrice.ConvertToDecimal1();
|
|
|
+ }
|
|
|
+
|
|
|
+ _geView.GroupHotelFeeViews = groupHotelFeeViews;
|
|
|
+ _geView.GroupHotelFeeStr = string.Format(@"人民币总费用:{0} CNY", HotelCNYTotalPrice.ToString("#0.00"));
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 地接费用
|
|
|
+
|
|
|
+ List<GroupCTGGRFeeView> groupCTGGRFeeViews = new List<GroupCTGGRFeeView>();
|
|
|
+ string CTGGRFeeSql = string.Empty;
|
|
|
+ if (visitDate > Convert.ToDateTime("2024-04-17"))
|
|
|
+ {
|
|
|
+ CTGGRFeeSql = string.Format(@"Select ctggr.Id As CTGGRId,ctggr.DiId As CTGGRDiId,ctggr.PriceName As Area,ctggrc.*,ctggrc.Price As PayMoney,
|
|
|
+ sd2.name As PaymentCurrency,ccp.PayPercentage,
|
|
|
+ (ctggrc.Price * (ccp.PayPercentage / 100)) As AmountPaid,
|
|
|
+ (ctggrc.Price - ctggrc.Price * (ccp.PayPercentage / 100)) As BalancePayment,
|
|
|
+ ccp.DayRate,(ctggrc.Price * (ccp.PayPercentage / 100) * ccp.DayRate) As CNYPrice,ccp.Payee,ccp.AuditGMDate,
|
|
|
+ ccp.OrbitalPrivateTransfer,sd1.Name As PayWay,ccp.IsPay,u.CnName As Applicant,ctggr.CreateTime
|
|
|
+ From Grp_CarTouristGuideGroundReservations ctggr
|
|
|
+ Left Join ( Select cggrc.CTGGRId,sd1.Name As PriceName,cggrc.Price*cggrc.Count As Price,sd2.Name As PriceCurrency,
|
|
|
+ cggrc.DatePrice,cggrc.PriceContent
|
|
|
+ From Grp_CarTouristGuideGroundReservationsContent cggrc
|
|
|
+ Left Join Sys_SetData sd1 On cggrc.SId = sd1.Id
|
|
|
+ Left Join Sys_SetData sd2 On cggrc.Currency = sd2.Id
|
|
|
+ Where cggrc.ISdel = 0 And cggrc.Price != 0.00
|
|
|
+ ) ctggrc On ctggr.Id = ctggrc.CTGGRId
|
|
|
+ Left Join Grp_CreditCardPayment ccp On ccp.IsDel = 0 And ccp.CTable = 79 And ctggr.Id = ccp.CId
|
|
|
+ Left Join Sys_SetData sd1 On ccp.PayDId = sd1.Id
|
|
|
+ Left Join Sys_SetData sd2 On ccp.PaymentCurrency = sd2.Id
|
|
|
+ Left Join Sys_Users u On ccp.CreateUserId = u.Id
|
|
|
+ Where ctggr.IsDel = 0 {1} And ctggr.DiId = {0}
|
|
|
+ Order By CreateTime", _dto.DiId, _dto.isAudit ? "And (ccp.IsAuditGM = 1 OR ccp.IsAuditGM = 3)" : " ");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CTGGRFeeSql = string.Format(@"Select ctggr.Id As CTGGRId,ctggr.DiId As CTGGRDiId,ctggr.PriceName As Area,
|
|
|
+ ccp.PayMoney,sd2.name As PaymentCurrency,ccp.PayPercentage,
|
|
|
+ (ccp.PayMoney * (ccp.PayPercentage / 100)) As AmountPaid,
|
|
|
+ (ccp.PayMoney -ccp.PayMoney * (ccp.PayPercentage / 100)) As BalancePayment,
|
|
|
+ ccp.DayRate,(ccp.PayMoney * (ccp.PayPercentage / 100) * ccp.DayRate) As CNYPrice,
|
|
|
+ ccp.Payee,ccp.AuditGMDate,
|
|
|
+ ccp.OrbitalPrivateTransfer,sd1.Name As PayWay,ccp.IsPay,u.CnName As Applicant,ctggr.CreateTime
|
|
|
+ From Grp_CarTouristGuideGroundReservations ctggr
|
|
|
+ Left Join Grp_CreditCardPayment ccp On ccp.IsDel = 0 And ccp.CTable = 79 And ctggr.Id = ccp.CId
|
|
|
+ Left Join Sys_SetData sd1 On ccp.PayDId = sd1.Id
|
|
|
+ Left Join Sys_SetData sd2 On ccp.PaymentCurrency = sd2.Id
|
|
|
+ Left Join Sys_Users u On ccp.CreateUserId = u.Id
|
|
|
+ Where ctggr.IsDel = 0 {1} And ctggr.DiId = {0}
|
|
|
+ Order By CreateTime", _dto.DiId, _dto.isAudit ? "And (ccp.IsAuditGM = 1 OR ccp.IsAuditGM = 3)" : " ");
|
|
|
+ }
|
|
|
+
|
|
|
+ groupCTGGRFeeViews = await _sqlSugar.SqlQueryable<GroupCTGGRFeeView>(CTGGRFeeSql).ToListAsync();
|
|
|
+
|
|
|
+ string CTGGRFeeStr = "";
|
|
|
+ decimal CTGGRCNYTotalPrice = 0.00M;
|
|
|
+
|
|
|
+ //按1 地区,2 币种,3 汇率 分组计算
|
|
|
+ var groupCTGGRFeeDatas = groupCTGGRFeeViews.GroupBy(it => it.Area);
|
|
|
+
|
|
|
+ foreach (var ctggfr in groupCTGGRFeeDatas)
|
|
|
+ {
|
|
|
+ var ctggfr_curr = ctggfr.GroupBy(it => it.PaymentCurrency);
|
|
|
+
|
|
|
+ if (ctggfr_curr.Count() > 0)
|
|
|
+ {
|
|
|
+ foreach (var curr in ctggfr_curr)
|
|
|
+ {
|
|
|
+
|
|
|
+ var ctggfr_rate = curr.GroupBy(it => it.DayRate);
|
|
|
+
|
|
|
+ if (ctggfr_rate.Count() > 0)
|
|
|
+ {
|
|
|
+ foreach (var rate in ctggfr_rate)
|
|
|
+ {
|
|
|
+ CTGGRFeeStr += string.Format(@$"{ctggfr.Key} 总费用:{rate.Sum(it => it.AmountPaid).ToString("#0.00")}
|
|
|
+ {rate.FirstOrDefault()?.PaymentCurrency}(人民币:
|
|
|
+ {rate.Sum(it => Convert.ToDecimal(it.CNYPrice.ToString("#0.00"))).ToString("#0.00")} CNY 当时支付汇率:
|
|
|
+ {rate.FirstOrDefault()?.DayRate.ToString("#0.0000")})\r\n");
|
|
|
+ CTGGRCNYTotalPrice += rate.Sum(it => Convert.ToDecimal(it.CNYPrice.ToString("#0.00")));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CTGGRFeeStr += string.Format(@$"{ctggfr.Key} 总费用:{curr.Sum(it => it.AmountPaid).ToString("#0.00")}
|
|
|
+ {curr.FirstOrDefault()?.PaymentCurrency}(人民币:
|
|
|
+ {curr.Sum(it => Convert.ToDecimal(it.CNYPrice.ToString("#0.00"))).ToString("#0.00")} CNY 当时支付汇率:
|
|
|
+ {curr.FirstOrDefault()?.DayRate.ToString("#0.0000")})\r\n");
|
|
|
+ CTGGRCNYTotalPrice += curr.Sum(it => Convert.ToDecimal(it.CNYPrice.ToString("#0.00")));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CTGGRFeeStr += string.Format(@$"{ctggfr.Key} 总费用:{ctggfr.Sum(it => it.AmountPaid).ToString("#0.00")}
|
|
|
+ {ctggfr.FirstOrDefault()?.PaymentCurrency}(人民币:
|
|
|
+ {ctggfr.Sum(it => Convert.ToDecimal(it.CNYPrice.ToString("#0.00"))).ToString("#0.00")} CNY 当时支付汇率:
|
|
|
+ {ctggfr.FirstOrDefault()?.DayRate.ToString("#0.0000")})\r\n");
|
|
|
+ CTGGRCNYTotalPrice += ctggfr.Sum(it => Convert.ToDecimal(it.CNYPrice.ToString("#0.00")));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach (var item in groupCTGGRFeeViews)
|
|
|
+ {
|
|
|
+ if (!string.IsNullOrEmpty(item.AuditGMDate))
|
|
|
+ {
|
|
|
+ item.AuditGMDate = Convert.ToDateTime(item.AuditGMDate).ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (item.DatePrice != null)
|
|
|
+ {
|
|
|
+ item.PriceName = $"{item.PriceName}({Convert.ToDateTime(item.DatePrice).ToString("yyyy-MM-dd")})";
|
|
|
+ }
|
|
|
+
|
|
|
+ //CTGGRFeeStr += string.Format(@"{0} 总费用:{1} {2}(人民币:{3} CNY 当时支付汇率:{4})\r\n",
|
|
|
+ // item.Area, item.AmountPaid.ConvertToDecimal1().ToString("#0.00"), item.PaymentCurrency, item.CNYPrice.ToString("#0.0000"), item.DayRate.ToString("#0.0000"));
|
|
|
+ //CTGGRCNYTotalPrice += item.CNYPrice;
|
|
|
+ }
|
|
|
+ _geView.GroupCTGGRFeeViews = groupCTGGRFeeViews;
|
|
|
+
|
|
|
+ _geView.GroupCTGGRFeeStr = string.Format(@"{0}人民币总费用:{1} CNY", CTGGRFeeStr, CTGGRCNYTotalPrice.ToString("#0.00"));
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 机票预订费用
|
|
|
+ //(((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100) As CNYPrice
|
|
|
+ //ccp.RMBPrice As CNYPrice
|
|
|
+ List<GroupAirFeeView> groupAirFeeViews = new List<GroupAirFeeView>();
|
|
|
+ string groupAirFeeSql = string.Format(@"Select atr.Id As AirId,atr.DIId As AirDiId,atr.FlightsCode,atr.FlightsCity,sd4.Name As AirTypeName,
|
|
|
+ atr.FlightsDate,atr.FlightsTime,atr.ClientName,atr.ClientNum,ccp.PayMoney,
|
|
|
+ sd1.Name As PayMoneyCurrency,(((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100) As CNYPrice,ccp.DayRate,ccp.Payee,ccp.AuditGMDate,
|
|
|
+ ccp.OrbitalPrivateTransfer,sd2.Name As PayWay,sd3.Name As CardType,ccp.IsPay,u.CnName As Applicant,atr.CreateTime,
|
|
|
+ atr.CType
|
|
|
+ From Grp_AirTicketReservations atr
|
|
|
+ Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 85 And atr.Id = ccp.CId
|
|
|
+ Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id
|
|
|
+ Left Join Sys_SetData sd2 On ccp.PayDId = sd2.Id
|
|
|
+ Left Join Sys_SetData sd3 On ccp.CTDId = sd3.Id
|
|
|
+ Left Join Sys_SetData sd4 On atr.CType = sd4.Id
|
|
|
+ Left Join Sys_Users u On ccp.CreateUserId = u.Id
|
|
|
+ Where atr.IsDel = 0 {1} And atr.DiId = {0} Order By CreateTime", _dto.DiId, _dto.isAudit ? "And ccp.IsAuditGM = 1" : " ");
|
|
|
+ groupAirFeeViews = await _sqlSugar.SqlQueryable<GroupAirFeeView>(groupAirFeeSql).ToListAsync();
|
|
|
+
|
|
|
+ string str = "";
|
|
|
+ List<dynamic> airClientPris = new List<dynamic>();
|
|
|
+ decimal AirCNYTotalPrice = 0.00M;
|
|
|
+ decimal JJCCNYTotalPrice = 0.00M, JJCPeopleNum = 0.00M, JJCAveragePrice = 0.00M;
|
|
|
+ decimal GWCCNYTotalPrice = 0.00M, GWCPeopleNum = 0.00M, GWCAveragePrice = 0.00M;
|
|
|
+
|
|
|
+ //if (groupAirFeeViews.Count > 0)
|
|
|
+ //{
|
|
|
+ // JJCCNYTotalPrice = groupAirFeeViews.Where(it => it.AirTypeName.Equals("经济舱")).Sum(it => it.CNYPrice);
|
|
|
+ // JJCPeopleNum = groupAirFeeViews.Where(it => it.AirTypeName.Equals("经济舱")).Sum(it => it.ClientNum);
|
|
|
+ // JJCAveragePrice = (JJCCNYTotalPrice / JJCPeopleNum).ConvertToDecimal1();
|
|
|
+ // GWCCNYTotalPrice = groupAirFeeViews.Where(it => it.AirTypeName.Equals("公务舱")).Sum(it => it.CNYPrice);
|
|
|
+ // GWCPeopleNum = groupAirFeeViews.Where(it => it.AirTypeName.Equals("公务舱")).Sum(it => it.ClientNum);
|
|
|
+ // GWCAveragePrice = (GWCCNYTotalPrice / GWCPeopleNum).ConvertToDecimal1();
|
|
|
+ //}
|
|
|
+
|
|
|
+ int Index = 0;
|
|
|
+ foreach (var item in groupAirFeeViews)
|
|
|
+ {
|
|
|
+ if (item.AirId > 2924)
|
|
|
+ {
|
|
|
+ string itemClientName = "";
|
|
|
+ if (!string.IsNullOrEmpty(item.ClientName))
|
|
|
+ {
|
|
|
+ System.Text.RegularExpressions.Match m_EnName = Regex.Match(item.ClientName, @"[A-Za-z]+");
|
|
|
+ System.Text.RegularExpressions.Match m_ZHName = Regex.Match(item.ClientName, @"[\u4e00-\u9fa5]");
|
|
|
+
|
|
|
+ if (m_EnName.Success || m_ZHName.Success)
|
|
|
+ {
|
|
|
+ itemClientName = item.ClientName;
|
|
|
+
|
|
|
+ decimal unitCost = 0.00M;
|
|
|
+ AirCNYTotalPrice += item.CNYPrice;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ string[] clientIds = new string[] { };
|
|
|
+ if (item.ClientName.Contains(','))
|
|
|
+ {
|
|
|
+ clientIds = item.ClientName.Split(',');
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ clientIds = new string[] { item.ClientName };
|
|
|
+ }
|
|
|
+ if (clientIds.Length > 0)
|
|
|
+ {
|
|
|
+ int[] output = Array.ConvertAll<string, int>(clientIds, delegate (string s) { return int.Parse(s); });
|
|
|
+
|
|
|
+ if (output.Contains(-1))
|
|
|
+ {
|
|
|
+ itemClientName += $@"行程单";
|
|
|
+ output = output.Where(val => val != -1).ToArray();
|
|
|
+ }
|
|
|
+
|
|
|
+ var clients = _clientDatas.Where(it => output.Contains(it.Id)).ToList();
|
|
|
+ decimal unitCost = 0.00M;
|
|
|
+ unitCost = (item.PayMoney / item.ClientNum).ConvertToDecimal1();
|
|
|
+
|
|
|
+ int clienIndex = 1;
|
|
|
+ foreach (var client in clients)
|
|
|
+ {
|
|
|
+
|
|
|
+ airClientPris.Add(new
|
|
|
+ {
|
|
|
+ CnName = client.LastName + client.FirstName,
|
|
|
+ EnName = client.Pinyin,
|
|
|
+ Price = unitCost,
|
|
|
+ AirType = item.AirTypeName
|
|
|
+ });
|
|
|
+
|
|
|
+ string six = "";
|
|
|
+ if (client.Sex == 0) six = "Mr";
|
|
|
+ else if (client.Sex == 1) six = "Ms";
|
|
|
+
|
|
|
+ itemClientName += string.Format(@"{0}.{1} {2};", clienIndex, client.LastName + client.FirstName, six);
|
|
|
+ clienIndex++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ item.ClientName = itemClientName;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ string clientPinYinName = "";
|
|
|
+ decimal unitCost = 0.00M;
|
|
|
+ int cNum = item.ClientNum == 0 ? 1 : item.ClientNum;
|
|
|
+ unitCost = (item.PayMoney / cNum).ConvertToDecimal1();
|
|
|
+
|
|
|
+ Regex r = new Regex("[0-9]");
|
|
|
+ string name1 = item.ClientName;
|
|
|
+ name1 = r.Replace(name1, "");
|
|
|
+ string[] clientNames = name1.Split('.');
|
|
|
+ for (int i = 0; i < item.ClientNum; i++)
|
|
|
+ {
|
|
|
+ string name = "";
|
|
|
+ if (clientNames.Length > 0)
|
|
|
+ {
|
|
|
+ int index = i + 1;
|
|
|
+ if (index < clientNames.Length)
|
|
|
+ {
|
|
|
+ name = clientNames[index].Replace("MR", "").Replace("MS", "").Trim();
|
|
|
+ if (!string.IsNullOrEmpty(name))
|
|
|
+ {
|
|
|
+ airClientPris.Add(new
|
|
|
+ {
|
|
|
+ CnName = name,
|
|
|
+ EnName = name,
|
|
|
+ Price = unitCost,
|
|
|
+ AirType = item.AirTypeName
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //if (name.Length > 0)
|
|
|
+ //{
|
|
|
+ // string nameLastStr = name[name.Length - 1].ToString();
|
|
|
+ // if (nameLastStr.IsNumeric())
|
|
|
+ // {
|
|
|
+ // name = name.Substring(0, name.Length - 1).Trim();
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ clientPinYinName += string.Format(@"{0}.{1}出票价为:{2} CNY;", Index + 1, name, unitCost.ToString("#0.00"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(item.AuditGMDate))
|
|
|
+ {
|
|
|
+ item.AuditGMDate = Convert.ToDateTime(item.AuditGMDate).ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
+ }
|
|
|
+ AirCNYTotalPrice += item.CNYPrice;
|
|
|
+ }
|
|
|
+
|
|
|
+ _geView.GroupAirFeeViews = groupAirFeeViews;
|
|
|
+ if (airClientPris.Count > 0)
|
|
|
+ {
|
|
|
+ var peoplePriStr = "";
|
|
|
+ var airClientPris1 = airClientPris.GroupBy(item => item.CnName)
|
|
|
+ .Select(group => group.First())
|
|
|
+ .ToList();
|
|
|
+ int airClientPrisIndex = 1;
|
|
|
+ foreach (var item in airClientPris1)
|
|
|
+ {
|
|
|
+ decimal price = 0.00M;
|
|
|
+ var prices = airClientPris.Where(it => it.CnName == item.CnName).ToList();
|
|
|
+ foreach (var pri in prices)
|
|
|
+ {
|
|
|
+ price += pri.Price;
|
|
|
+ }
|
|
|
+ peoplePriStr += $@"{airClientPrisIndex}.{item.EnName}出票价为: {price.ToString("#0.00")} CNY;";
|
|
|
+
|
|
|
+ airClientPrisIndex++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(peoplePriStr))
|
|
|
+ {
|
|
|
+ str = $@"其中:{peoplePriStr}";
|
|
|
+ }
|
|
|
+
|
|
|
+ //经济舱均价
|
|
|
+ var airJJCPris = airClientPris.Where(it => it.AirType == "经济舱").ToList();
|
|
|
+ if (airJJCPris.Count > 0)
|
|
|
+ {
|
|
|
+ decimal jjcTotalPrice = 0.00M;
|
|
|
+ foreach (var item in airJJCPris)
|
|
|
+ {
|
|
|
+ jjcTotalPrice += item.Price;
|
|
|
+ }
|
|
|
+ decimal jjcPeopleNum = airJJCPris.GroupBy(item => item.CnName)
|
|
|
+ .Select(group => group.First())
|
|
|
+ .ToList().Count;
|
|
|
+ JJCAveragePrice = jjcTotalPrice / jjcPeopleNum;
|
|
|
+ }
|
|
|
+
|
|
|
+ //公务舱均价
|
|
|
+ var airGWCPris = airClientPris.Where(it => it.AirType == "公务舱").ToList();
|
|
|
+ if (airGWCPris.Count > 0)
|
|
|
+ {
|
|
|
+ decimal gwcTotalPrice = 0.00M;
|
|
|
+ foreach (var item in airGWCPris)
|
|
|
+ {
|
|
|
+ gwcTotalPrice += item.Price;
|
|
|
+ }
|
|
|
+ decimal gwcPeopleNum = airGWCPris.GroupBy(item => item.CnName)
|
|
|
+ .Select(group => group.First())
|
|
|
+ .ToList().Count;
|
|
|
+ GWCAveragePrice = gwcTotalPrice / gwcPeopleNum;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ _geView.GroupAirFeeStr = $@"人民币总费用:{AirCNYTotalPrice.ToString("#0.00")} CNY\r\n{str}\r\n经济舱均价为:{JJCAveragePrice.ToString("#0.00")}CNY/人;公务舱均价为:{GWCAveragePrice.ToString("#0.00")}CNY/人;";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 签证费用
|
|
|
+
|
|
|
+ List<GroupVisaFeeView> groupVisaFeeViews = new List<GroupVisaFeeView>();
|
|
|
+ string groupVisaFeeSql = string.Format(@"Select vi.Id As VisaId,vi.DIId As VisaDiId,vi.VisaClient,ccp.PayMoney,sd1.Name As PayMoneyCurrency,
|
|
|
+ ccp.DayRate,ccp.Payee,ccp.AuditGMDate,ccp.OrbitalPrivateTransfer,sd2.Name As PayWay,
|
|
|
+ sd3.Name As CardTypeName,ccp.IsPay,u.CnName As Applicant,vi.CreateTime,
|
|
|
+(((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100) As CNYPrice
|
|
|
+ From Grp_VisaInfo vi
|
|
|
+ Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 80 And vi.Id = ccp.CId
|
|
|
+ Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id
|
|
|
+ Left Join Sys_SetData sd2 On ccp.PayDId = sd2.Id
|
|
|
+ Left Join Sys_SetData sd3 On ccp.CTDId = sd3.Id
|
|
|
+ Left Join Sys_Users u On ccp.CreateUserId = u.Id
|
|
|
+ Where vi.IsDel = 0 {1} And vi.DIId = {0} Order By CreateTime", _dto.DiId, _dto.isAudit ? "And ccp.IsAuditGM = 1" : " ");
|
|
|
+
|
|
|
+ groupVisaFeeViews = await _sqlSugar.SqlQueryable<GroupVisaFeeView>(groupVisaFeeSql).ToListAsync();
|
|
|
+
|
|
|
+ decimal VisaCNYTotalPirce = 0.00M;
|
|
|
+
|
|
|
+ foreach (var item in groupVisaFeeViews)
|
|
|
+ {
|
|
|
+ string itemClientName = "";
|
|
|
+ string visaClients = item.VisaClient;
|
|
|
+ if (!string.IsNullOrEmpty(visaClients))
|
|
|
+ {
|
|
|
+ string[] clientIds = new string[] { };
|
|
|
+ if (visaClients.Contains(','))
|
|
|
+ {
|
|
|
+ clientIds = visaClients.Split(',');
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ clientIds = new string[] { visaClients };
|
|
|
+ }
|
|
|
+
|
|
|
+ if (clientIds.Length > 0)
|
|
|
+ {
|
|
|
+ List<int> clientIds1 = new List<int>() { };
|
|
|
+ foreach (var clientIdStr in clientIds)
|
|
|
+ {
|
|
|
+ if (clientIdStr.IsNumeric())
|
|
|
+ {
|
|
|
+ clientIds1.Add(int.Parse(clientIdStr));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (clientIds1.Count > 0)
|
|
|
+ {
|
|
|
+ var clients = _clientDatas.Where(it => clientIds1.Contains(it.Id)).ToList();
|
|
|
+ foreach (var client in clients)
|
|
|
+ {
|
|
|
+ itemClientName += $"{client.LastName + client.FirstName},";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ itemClientName = visaClients;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (itemClientName.Length > 0)
|
|
|
+ {
|
|
|
+ itemClientName = itemClientName.Substring(0, itemClientName.Length - 1);
|
|
|
+ }
|
|
|
+ item.VisaClient = itemClientName;
|
|
|
+ VisaCNYTotalPirce += item.CNYPrice;
|
|
|
+ if (!string.IsNullOrEmpty(item.AuditGMDate))
|
|
|
+ {
|
|
|
+ item.AuditGMDate = Convert.ToDateTime(item.AuditGMDate).ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ _geView.GroupVisaFeeViews = groupVisaFeeViews;
|
|
|
+ _geView.GroupVisaFeeStr = string.Format(@"人民币总费用:{0} CNY", VisaCNYTotalPirce.ConvertToDecimal1().ToString("#.00"));
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 邀请/公务活动 CTable = 81
|
|
|
+
|
|
|
+ List<GroupInvitationalFeeView> groupInvitationalFeeViews = new List<GroupInvitationalFeeView>();
|
|
|
+ string groupInvitationalFeeSql = string.Format(@"Select ioa.Id As IOAId,ioa.DiId As IOADiId,ioa.InviterArea,ioa.Inviter,ioa.InviteTime,
|
|
|
+ ioa.InviteCost,sd3.Name As InviteCurrency,ioa.SendCost,sd4.Name As SendCurrency,ioa.EventsCost,
|
|
|
+ sd5.Name As EventsCurrency,ioa.TranslateCost,sd6.Name As TranslateCurrency,ccp.PayMoney,
|
|
|
+ sd7.Name As PaymentCurrency,ccp.RMBPrice As CNYPrice,
|
|
|
+ (((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100) As CNYPrice2,ccp.Payee,ccp.AuditGMDate,
|
|
|
+ ccp.OrbitalPrivateTransfer,sd2.Name As PayWay,ccp.IsPay,u.CnName As Applicant,ioa.CreateTime
|
|
|
+ From Grp_InvitationOfficialActivities ioa
|
|
|
+ Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 81 And ioa.Id = ccp.CId
|
|
|
+ Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id
|
|
|
+ Left Join Sys_SetData sd2 On ccp.PayDId = sd2.Id
|
|
|
+ Left Join Sys_SetData sd3 On ioa.InviteCurrency = sd3.Id
|
|
|
+ Left Join Sys_SetData sd4 On ioa.SendCurrency = sd4.Id
|
|
|
+ Left Join Sys_SetData sd5 On ioa.EventsCurrency = sd5.Id
|
|
|
+ Left Join Sys_SetData sd6 On ioa.TranslateCurrency = sd6.Id
|
|
|
+ Left Join Sys_SetData sd7 On ccp.PaymentCurrency = sd7.Id
|
|
|
+ Left Join Sys_Users u On ccp.CreateUserId = u.Id
|
|
|
+ Where ioa.IsDel = 0 {1} And ioa.Diid = {0} Order By CreateTime", _dto.DiId, _dto.isAudit ? "And ccp.IsAuditGM = 1" : " ");
|
|
|
+
|
|
|
+ groupInvitationalFeeViews = await _sqlSugar.SqlQueryable<GroupInvitationalFeeView>(groupInvitationalFeeSql).ToListAsync();
|
|
|
+
|
|
|
+ #region 邀请/公务活动 - 模拟数据
|
|
|
+ //if (groupInvitationalFeeViews.Count < 1)
|
|
|
+ //{
|
|
|
+ // groupInvitationalFeeViews.Add(new GroupInvitationalFeeView()
|
|
|
+ // {
|
|
|
+ // IOAId = 0,
|
|
|
+ // IOADiId = 2334,
|
|
|
+ // InviterArea = "模拟数据-邀请方地区",
|
|
|
+ // Inviter = "模拟数据-邀请方",
|
|
|
+ // InviteTime = "2023-10-10",
|
|
|
+ // InviteCost = 100.00M,
|
|
|
+ // InviteCurrency = "EUR",
|
|
|
+ // SendCost = 100.00M,
|
|
|
+ // SendCurrency = "EUR",
|
|
|
+ // EventsCost = 10000.00M,
|
|
|
+ // EventsCurrency = "EUR",
|
|
|
+ // TranslateCost = 300.00M,
|
|
|
+ // TranslateCurrency = "EUR",
|
|
|
+ // PayMoney = 10500.00M,
|
|
|
+ // PaymentCurrency = "EUR",
|
|
|
+ // CNYPrice = 76765.50M,
|
|
|
+ // Payee = "模拟数据-收款方",
|
|
|
+ // AuditGMDate = "2023-12-05",
|
|
|
+ // OrbitalPrivateTransfer = 1,
|
|
|
+ // PayWay = "刷卡",
|
|
|
+ // IsPay = 1,
|
|
|
+ // Applicant = "刘华举"
|
|
|
+ // });
|
|
|
+ // groupInvitationalFeeViews.Add(new GroupInvitationalFeeView()
|
|
|
+ // {
|
|
|
+ // IOAId = 0,
|
|
|
+ // IOADiId = 2334,
|
|
|
+ // InviterArea = "模拟数据-邀请方地区",
|
|
|
+ // Inviter = "模拟数据-邀请方",
|
|
|
+ // InviteTime = "2023-10-10",
|
|
|
+ // InviteCost = 100.00M,
|
|
|
+ // InviteCurrency = "EUR",
|
|
|
+ // SendCost = 100.00M,
|
|
|
+ // SendCurrency = "EUR",
|
|
|
+ // EventsCost = 10000.00M,
|
|
|
+ // EventsCurrency = "EUR",
|
|
|
+ // TranslateCost = 300.00M,
|
|
|
+ // TranslateCurrency = "EUR",
|
|
|
+ // PayMoney = 10500.00M,
|
|
|
+ // PaymentCurrency = "EUR",
|
|
|
+ // CNYPrice = 76765.50M,
|
|
|
+ // Payee = "模拟数据-收款方",
|
|
|
+ // AuditGMDate = "2023-12-05",
|
|
|
+ // OrbitalPrivateTransfer = 1,
|
|
|
+ // PayWay = "刷卡",
|
|
|
+ // IsPay = 1,
|
|
|
+ // Applicant = "刘华举"
|
|
|
+ // });
|
|
|
+ //}
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ decimal InvitationalCNYTotalPrice = 0.00M;
|
|
|
+
|
|
|
+ foreach (var item in groupInvitationalFeeViews)
|
|
|
+ {
|
|
|
+ InvitationalCNYTotalPrice += item.CNYPrice2;
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(item.AuditGMDate))
|
|
|
+ {
|
|
|
+ item.AuditGMDate = Convert.ToDateTime(item.AuditGMDate).ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
+ }
|
|
|
+
|
|
|
+ string currencyRateStr = "";
|
|
|
+ List<string> currencys = new List<string>();
|
|
|
+ if (!string.IsNullOrEmpty(item.InviteCurrency)) currencys.Add(item.InviteCurrency);
|
|
|
+ if (!string.IsNullOrEmpty(item.SendCurrency)) currencys.Add(item.SendCurrency);
|
|
|
+ if (!string.IsNullOrEmpty(item.EventsCurrency)) currencys.Add(item.EventsCurrency);
|
|
|
+ if (!string.IsNullOrEmpty(item.TranslateCurrency)) currencys.Add(item.TranslateCurrency);
|
|
|
+ if (!string.IsNullOrEmpty(item.PaymentCurrency)) currencys.Add(item.PaymentCurrency);
|
|
|
+
|
|
|
+ currencyRateStr = await GeneralMethod.PostGroupRateByCTableAndCurrency(teamRateData, 81, currencys);
|
|
|
+
|
|
|
+ item.CurrencyRateStr = currencyRateStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ _geView.GroupInvitationalFeeViews = groupInvitationalFeeViews;
|
|
|
+ _geView.GroupInvitationalFeeStr = string.Format(@"人民币总费用:{0} CNY", InvitationalCNYTotalPrice.ToString("#.00"));
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 保险费用
|
|
|
+ List<GroupInsuranceFeeView> groupInsuranceFeeViews = new List<GroupInsuranceFeeView>();
|
|
|
+ string groupInsuranceFeeSql = string.Format(@"Select ic.Id As InsuranceId,ic.Diid As InsuranceDiId,ClientName,ccp.PayMoney,ccp.PayMoney * ccp.DayRate As CNYPrice,
|
|
|
+ sd1.Name As PayMoneyCurrency,ccp.Payee,ccp.AuditGMDate,ccp.OrbitalPrivateTransfer,
|
|
|
+ sd2.Name As PayWay,ccp.IsPay,u.CnName As Applicant,ic.CreateTime
|
|
|
+ From Grp_Customers ic
|
|
|
+ Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 82 And ic.Id = ccp.CId
|
|
|
+ Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id
|
|
|
+ Left Join Sys_SetData sd2 On ccp.PayDId = sd2.Id
|
|
|
+ Left Join Sys_Users u On ccp.CreateUserId = u.Id
|
|
|
+ Where ic.IsDel = 0 {1} And ic.DiId = {0} Order By CreateTime", _dto.DiId, _dto.isAudit ? "And ccp.IsAuditGM = 1" : " ");
|
|
|
+ groupInsuranceFeeViews = await _sqlSugar.SqlQueryable<GroupInsuranceFeeView>(groupInsuranceFeeSql).ToListAsync();
|
|
|
+
|
|
|
+ decimal InsuranceCNYTotalPrice = 0.00M;
|
|
|
+ foreach (var item in groupInsuranceFeeViews)
|
|
|
+ {
|
|
|
+ InsuranceCNYTotalPrice += item.CNYPrice;
|
|
|
+
|
|
|
+ string itemClientName = "";
|
|
|
+ string insClients = item.ClientName;
|
|
|
+ if (!string.IsNullOrEmpty(insClients))
|
|
|
+ {
|
|
|
+ //System.Text.RegularExpressions.Match m_EnName = Regex.Match(item.ClientName, @"[A-Za-z]+");
|
|
|
+ //System.Text.RegularExpressions.Match m_ZHName = Regex.Match(item.ClientName, @"[\u4e00-\u9fa5]");
|
|
|
+
|
|
|
+ //if (m_EnName.Success || m_ZHName.Success)
|
|
|
+ //{
|
|
|
+ // itemClientName = insClients;
|
|
|
+ // continue;
|
|
|
+ //}
|
|
|
+
|
|
|
+ string[] clientIds = new string[] { };
|
|
|
+ if (insClients.Contains(','))
|
|
|
+ {
|
|
|
+ clientIds = insClients.Split(',');
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ clientIds = new string[] { insClients };
|
|
|
+ }
|
|
|
+
|
|
|
+ if (clientIds.Length > 0)
|
|
|
+ {
|
|
|
+ List<int> output = new List<int>();
|
|
|
+ foreach (var clientId in clientIds)
|
|
|
+ {
|
|
|
+ if (clientId.IsNumeric())
|
|
|
+ {
|
|
|
+ output.Add(int.Parse(clientId));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (output.Count > 0)
|
|
|
+ {
|
|
|
+ var clients = _clientDatas.Where(it => output.Contains(it.Id)).ToList();
|
|
|
+ foreach (var client in clients)
|
|
|
+ {
|
|
|
+ itemClientName += $"{client.LastName + client.FirstName},";
|
|
|
+ }
|
|
|
+ if (itemClientName.Length > 0)
|
|
|
+ {
|
|
|
+ itemClientName = itemClientName.Substring(0, itemClientName.Length - 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ itemClientName = insClients;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ item.ClientName = itemClientName;
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(item.AuditGMDate))
|
|
|
+ {
|
|
|
+ item.AuditGMDate = Convert.ToDateTime(item.AuditGMDate).ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _geView.GroupInsuranceFeeViews = groupInsuranceFeeViews;
|
|
|
+ _geView.GroupInsuranceFeeStr = string.Format(@"人民币总费用:{0} CNY", InsuranceCNYTotalPrice.ToString("#0.00"));
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 其他款项费用 98
|
|
|
+ List<GroupDecreaseFeeView> groupDecreaseFeeViews = new List<GroupDecreaseFeeView>();
|
|
|
+ string groupDecreaseFeeSql = string.Format(@"Select dp.Id As DPId,dp.DiId As DPDiId,dp.PriceName,ccp.PayMoney,sd1.Name As PayMoneyCurrency,
|
|
|
+ (((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100) As CNYPrice,
|
|
|
+ ccp.DayRate,ccp.Payee,ccp.AuditGMDate,ccp.OrbitalPrivateTransfer,
|
|
|
+ sd2.Name As PayWay,ccp.IsPay,u.CnName As Applicant,dp.CreateTime
|
|
|
+ From Grp_DecreasePayments dp
|
|
|
+ Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 98 And dp.Id = ccp.CId
|
|
|
+ Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id
|
|
|
+ Left Join Sys_SetData sd2 On ccp.PayDId = sd2.Id
|
|
|
+ Left Join Sys_Users u On ccp.CreateUserId = u.Id
|
|
|
+ Where dp.IsDel = 0 And ccp.Ctable = 98 {1} And dp.Diid = {0}
|
|
|
+ Order By CreateTime", _dto.DiId, _dto.isAudit ? "And ccp.IsAuditGM = 1" : " ");
|
|
|
+ groupDecreaseFeeViews = await _sqlSugar.SqlQueryable<GroupDecreaseFeeView>(groupDecreaseFeeSql).ToListAsync();
|
|
|
+
|
|
|
+ #region 保险费用 - 模拟数据
|
|
|
+
|
|
|
+ //if (groupDecreaseFeeViews.Count < 1)
|
|
|
+ //{
|
|
|
+ // groupDecreaseFeeViews.Add(new GroupDecreaseFeeView()
|
|
|
+ // {
|
|
|
+ // DPId = 0,
|
|
|
+ // DPDiId = 2334,
|
|
|
+ // PriceName = "模拟数据-费用名称",
|
|
|
+ // PayMoney = 1000.00M,
|
|
|
+ // PayMoneyCurrency = "CNY",
|
|
|
+ // DayRate = 1.0000M,
|
|
|
+ // CNYPrice = 1.0000M,
|
|
|
+ // AuditGMDate = "2023-12-10 12:13:00",
|
|
|
+ // Payee = "模拟数据-付款方",
|
|
|
+ // OrbitalPrivateTransfer = 1,
|
|
|
+ // PayWay = "现金",
|
|
|
+ // IsPay = 1,
|
|
|
+ // Applicant = "刘华举"
|
|
|
+ // });
|
|
|
+ // groupDecreaseFeeViews.Add(new GroupDecreaseFeeView()
|
|
|
+ // {
|
|
|
+ // DPId = 0,
|
|
|
+ // DPDiId = 2334,
|
|
|
+ // PriceName = "模拟数据-费用名称",
|
|
|
+ // PayMoney = 1000.00M,
|
|
|
+ // PayMoneyCurrency = "CNY",
|
|
|
+ // DayRate = 1.0000M,
|
|
|
+ // CNYPrice = 1.0000M,
|
|
|
+ // AuditGMDate = "2023-12-10 12:13:00",
|
|
|
+ // Payee = "模拟数据-付款方",
|
|
|
+ // OrbitalPrivateTransfer = 1,
|
|
|
+ // PayWay = "现金",
|
|
|
+ // IsPay = 1,
|
|
|
+ // Applicant = "刘华举"
|
|
|
+ // });
|
|
|
+ //}
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ decimal DecreaseCNYTotalPrice = 0.00M;
|
|
|
+ foreach (var item in groupDecreaseFeeViews)
|
|
|
+ {
|
|
|
+ item.CNYPrice = Convert.ToDecimal(item.CNYPrice.ToString("#0.00"));
|
|
|
+ DecreaseCNYTotalPrice += item.CNYPrice;
|
|
|
+
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(item.AuditGMDate))
|
|
|
+ {
|
|
|
+ item.AuditGMDate = Convert.ToDateTime(item.AuditGMDate).ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ _geView.GroupDecreaseFeeViews = groupDecreaseFeeViews;
|
|
|
+ _geView.GroupDecreaseFeeStr = string.Format(@"人民币总费用:{0} CNY", DecreaseCNYTotalPrice.ToString("#0.00"));
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 公司内部操作人员提成
|
|
|
+
|
|
|
+ var royaltyDatas = await _sqlSugar
|
|
|
+ .Queryable<Fin_RoyaltyConfirm, Sys_Users, Sys_Users>((rc, u1, u2) =>
|
|
|
+ new JoinQueryInfos(
|
|
|
+ JoinType.Left, rc.UserId == u1.Id,
|
|
|
+ JoinType.Left, rc.CreateUserId == u2.Id
|
|
|
+ ))
|
|
|
+ .Where((rc, u1, u2) => rc.IsDel == 0 && rc.TeamId == _dto.DiId && rc.IsConfirm == 1)
|
|
|
+ .Select((rc, u1, u2) => new GroupRoyaltyFeeInfo()
|
|
|
+ {
|
|
|
+ GroupId = rc.TeamId,
|
|
|
+ OverviewInfo = rc.Temp,
|
|
|
+ DetailedInfo = rc.ChiArr,
|
|
|
+ Amount = rc.Price,
|
|
|
+ IsConfirm = rc.IsConfirm,
|
|
|
+ IsSeed = rc.IsSeed,
|
|
|
+ RoyaltyUserName = u1.CnName,
|
|
|
+ CreateUserName = u2.CnName,
|
|
|
+ CreateTime = rc.CreateTime
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+ decimal royaltyCNYTotalPrice = royaltyDatas.Sum(x => x.Amount);
|
|
|
+ _geView.GroupRoyaltyFeeViews = _mapper.Map<List<GroupRoyaltyFeeView>>(royaltyDatas);
|
|
|
+ _geView.GroupRoyaltyFeeStr = string.Format(@"人民币总费用:{0} CNY", royaltyCNYTotalPrice.ToString("#0.00"));
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ _view.GroupExpenditure = _geView;
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 团组报表计算方式
|
|
|
+ * 当前总支出 = 团组支出.Sum() + 超支费用.Sum()
|
|
|
+ * 应收金额 = 应收表.Sum()
|
|
|
+ * 已收金额 = 已收表.Sum()
|
|
|
+ * 应收利润(应收-支出) = 应收金额 - 收款退还 - 当前总支出
|
|
|
+ * 已收利润(已收-支出) = 已收金额 - 收款退还 - 当前总支出
|
|
|
+ *
|
|
|
+ */
|
|
|
+ decimal _totalExpenditure = 0.00M; //总支出
|
|
|
+ decimal _amountReceivable = 0.00M; //应收金额
|
|
|
+ decimal _amountReceived = 0.00M; //已收金额
|
|
|
+ decimal _receivableProfit = 0.00M; //应收利润
|
|
|
+ decimal _receivedProfit = 0.00M; //已收利润
|
|
|
+ _totalExpenditure = HotelCNYTotalPrice + CTGGRCNYTotalPrice + AirCNYTotalPrice + VisaCNYTotalPirce + InvitationalCNYTotalPrice +
|
|
|
+ InsuranceCNYTotalPrice + DecreaseCNYTotalPrice + exTotalAmount + royaltyCNYTotalPrice;
|
|
|
+ _amountReceivable = frTotalAmount;
|
|
|
+ _amountReceived = prTotalAmount;
|
|
|
+ _receivableProfit = _amountReceivable - promTotalAmount - _totalExpenditure;
|
|
|
+ _receivedProfit = _amountReceived - promTotalAmount - _totalExpenditure;
|
|
|
+ _view.FeeTotalStr = string.Format(@$"<span>
|
|
|
+ <span>当前总支出:{_totalExpenditure.ToString("#0.00")} CNY</span>
|
|
|
+ <span style='padding-left:10px;color: Green;'>应收金额:{_amountReceivable.ToString("#0.00")} CNY</span>
|
|
|
+ <span style='padding-left:10px;color: Green;'>已收金额:{_amountReceived.ToString("#0.00")} CNY</span>
|
|
|
+ <span style='padding-left:10px;color: Green;'>应收利润(应收-支出):{_receivableProfit.ToString("#0.00")} CNY</span>
|
|
|
+ <span style='padding-left:10px;color: Green;'>已收利润(已收-支出):{_receivedProfit.ToString("#0.00")} CNY</span>
|
|
|
+ </span>");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ return Ok(JsonView(true, "查询成功!", _view));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
private void StatementExportExcelSetCell(WorkbookDesigner designer, Worksheet sheet, DataTable dt, Style style, string judgeLable, int startIndex, string startRange, string endRange)
|
|
|
{
|
|
|
if (designer == null) return;
|