|
@@ -5776,5 +5776,325 @@ Group by PriceType ", dto.diId);
|
|
|
return Ok(jw);
|
|
|
}
|
|
|
#endregion
|
|
|
+
|
|
|
+ #region 团组未审核数据
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ [HttpGet]
|
|
|
+ public async Task<IActionResult> GroupUnAuditFeeList(string beginDt,string endDt)
|
|
|
+ {
|
|
|
+ var jw = JsonView(false);
|
|
|
+
|
|
|
+ bool beginDtBool = DateTime.TryParse(beginDt, out DateTime _beginDt),
|
|
|
+ endDtBool = DateTime.TryParse(endDt, out DateTime _endDt);
|
|
|
+
|
|
|
+ if (!beginDtBool && !endDtBool)
|
|
|
+ {
|
|
|
+ jw.Msg = $"开始或者结束时间格式不正确!";
|
|
|
+ return Ok(jw);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ var _groupDatas = _sqlSugar.Queryable<Grp_DelegationInfo>()
|
|
|
+ .Where(x => x.IsDel == 0 &&
|
|
|
+ x.VisitDate >= _beginDt &&
|
|
|
+ x.VisitDate <= _endDt
|
|
|
+ )
|
|
|
+ .ToList();
|
|
|
+ var _groupIds = _groupDatas.Select(x => x.Id).ToList();
|
|
|
+ if (_groupIds.Count < 1)
|
|
|
+ {
|
|
|
+ jw.Msg = $"该时间段暂无出访的团组!";
|
|
|
+ return Ok(jw);
|
|
|
+ }
|
|
|
+
|
|
|
+ var _DailyFeePaymentResult = new tree_Group_DailyFeePaymentResult();
|
|
|
+ var dataList = new List<tree_Group_DailyFeePaymentPageListView>();
|
|
|
+
|
|
|
+ var _paymentDatas = _sqlSugar.Queryable<Grp_CreditCardPayment>()
|
|
|
+ .Where(x => x.IsDel == 0 &&
|
|
|
+ _groupIds.Contains(x.DIId) &&
|
|
|
+ x.IsAuditGM == 0
|
|
|
+ )
|
|
|
+ .ToList();
|
|
|
+ _DailyFeePaymentResult.gz = _paymentDatas.Where(it => it.OrbitalPrivateTransfer == 0).Sum(it => ((it.PayMoney * it.DayRate) / 100) * it.PayPercentage);
|
|
|
+ _DailyFeePaymentResult.sz = _paymentDatas.Where(it => it.OrbitalPrivateTransfer == 1).Sum(it => ((it.PayMoney * it.DayRate) / 100) * it.PayPercentage); ;
|
|
|
+
|
|
|
+ #region 相关基础数据源
|
|
|
+ var userDatas = _sqlSugar.Queryable<Sys_Users>().ToList();
|
|
|
+ var setDatas = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.IsDel == 0).ToList();
|
|
|
+ var countryFeeDatas = _sqlSugar.Queryable<Grp_NationalTravelFee>().Where(it => it.IsDel == 0).ToList();
|
|
|
+
|
|
|
+ var hotelDatas = _sqlSugar.Queryable<Grp_HotelReservations>()
|
|
|
+ .Where(it => it.IsDel == 0 && _groupIds.Contains(it.DiId))
|
|
|
+ .ToList();
|
|
|
+ var hotelContentDatas = _sqlSugar.Queryable<Grp_HotelReservationsContent>()
|
|
|
+ .Where(it => it.IsDel == 0 &&
|
|
|
+ it.IsPay == 0 &&
|
|
|
+ it.Price != 0 &&
|
|
|
+ _groupIds.Contains(it.DiId)
|
|
|
+ )
|
|
|
+ .ToList();
|
|
|
+ var opDatas = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>()
|
|
|
+ .Where(it => it.IsDel == 0 && _groupIds.Contains(it.DiId))
|
|
|
+ .ToList();
|
|
|
+ var visaDatas = _sqlSugar.Queryable<Grp_VisaInfo>()
|
|
|
+ .Where(it => it.IsDel == 0 && _groupIds.Contains(it.DIId))
|
|
|
+ .ToList();
|
|
|
+ var ioaDatas = _sqlSugar.Queryable<Grp_InvitationOfficialActivities>()
|
|
|
+ .Where(it => it.IsDel == 0 && _groupIds.Contains(it.DiId))
|
|
|
+ .ToList();
|
|
|
+ var insureDatas = _sqlSugar.Queryable<Grp_Customers>()
|
|
|
+ .Where(it => it.IsDel == 0 && _groupIds.Contains(it.DiId))
|
|
|
+ .ToList();
|
|
|
+ var airDatas = _sqlSugar.Queryable<Grp_AirTicketReservations>()
|
|
|
+ .Where(it => it.IsDel == 0 && _groupIds.Contains(it.DIId))
|
|
|
+ .ToList();
|
|
|
+ var otherMoneyDatas = _sqlSugar.Queryable<Grp_DecreasePayments>()
|
|
|
+ .Where(it => it.IsDel == 0 && _groupIds.Contains(it.DiId))
|
|
|
+ .ToList();
|
|
|
+ var refundPaymentDatas = _sqlSugar.Queryable<Fin_PaymentRefundAndOtherMoney>()
|
|
|
+ .Where(it => it.IsDel == 0 && _groupIds.Contains(it.DiId))
|
|
|
+ .ToList();
|
|
|
+ var extraCostDatas = _sqlSugar.Queryable<Fin_GroupExtraCost>()
|
|
|
+ .Where(it => it.IsDel == 0 && _groupIds.Contains(it.DiId))
|
|
|
+ .ToList();
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ foreach (var groupInfo in _groupDatas)
|
|
|
+ {
|
|
|
+ var childList = new List<Group_DailyFeePaymentContentInfolView>();
|
|
|
+
|
|
|
+ var groupPaymentDatas = _paymentDatas.Where(it => groupInfo.Id == it.DIId).ToList();
|
|
|
+ int rouNumber = 1;
|
|
|
+ foreach (var payInfo in groupPaymentDatas)
|
|
|
+ {
|
|
|
+ string priName = "-";
|
|
|
+
|
|
|
+ string orbitalPrivateTransfer = payInfo.OrbitalPrivateTransfer == 0 ? "公转" : payInfo.OrbitalPrivateTransfer == 1 ? "私转" : "-";
|
|
|
+ switch (payInfo.CTable)
|
|
|
+ {
|
|
|
+ case 76:
|
|
|
+ priName = $"[费用名称:{hotelDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.HotelName ?? ""}]";
|
|
|
+ break;
|
|
|
+ case 79:
|
|
|
+ var opData = opDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id);
|
|
|
+ if (opData != null)
|
|
|
+ {
|
|
|
+ string area = "";
|
|
|
+ bool b = int.TryParse(opData.Area, out int areaId);
|
|
|
+ if (b)
|
|
|
+ {
|
|
|
+ string area1 = countryFeeDatas.Find(it => it.Id == areaId)?.Country ?? "-";
|
|
|
+ area = $"{area1}({setDatas.Find(it => it.Id == opData.PriceType)?.Name ?? "-"})";
|
|
|
+ }
|
|
|
+ else area = opData.Area;
|
|
|
+
|
|
|
+ string opPriName = "-";
|
|
|
+ if (!string.IsNullOrEmpty(opData.PriceName)) opPriName = opData.PriceName;
|
|
|
+
|
|
|
+ area += $"({opPriName})";
|
|
|
+
|
|
|
+ if (payInfo.OrbitalPrivateTransfer == 0)
|
|
|
+ {
|
|
|
+ priName = $"【{orbitalPrivateTransfer}】【导游: {opData.ServiceGuide} 】[费用名称:{area}]";
|
|
|
+ }
|
|
|
+ else if (payInfo.OrbitalPrivateTransfer == 1)
|
|
|
+ {
|
|
|
+ priName = $"【{orbitalPrivateTransfer}】【导游:{opData.ServiceGuide}】[费用名称:{area}]";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 80:
|
|
|
+
|
|
|
+ string sql = string.Format("select b.Id,b.Pinyin,b.lastName,b.firstName,b.phone from Grp_TourClientList a, Crm_DeleClient b where a.clientid = b.id and a.isdel = 0 and a.diid = {0}", groupInfo.Id);
|
|
|
+ List<SimplClientInfo> arr = _sqlSugar.SqlQueryable<SimplClientInfo>(sql).ToList();
|
|
|
+
|
|
|
+ string visaClientName = visaDatas.Find(it => payInfo.DIId == it.DIId && payInfo.CId == it.Id)?.VisaClient ?? "";
|
|
|
+ string clientName = "-";
|
|
|
+ if (Regex.Match(visaClientName, @"\d+,?").Value.Length > 0)
|
|
|
+ {
|
|
|
+ string[] temparr = visaClientName.Split(',');
|
|
|
+ string fistrStr = temparr[0];
|
|
|
+ int count = temparr.Count();
|
|
|
+
|
|
|
+ int tempId;
|
|
|
+ bool success = int.TryParse(fistrStr, out tempId);
|
|
|
+ if (success)
|
|
|
+ {
|
|
|
+ SimplClientInfo tempInfo = arr.FirstOrDefault(s => s.Id == tempId);
|
|
|
+ if (tempInfo != null)
|
|
|
+ {
|
|
|
+ if (count > 1)
|
|
|
+ {
|
|
|
+ clientName = string.Format(@"{0}{1}等{2}人", tempInfo.LastName, tempInfo.FirstName, count);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ clientName = string.Format(@"{0}{1}", tempInfo.LastName, tempInfo.FirstName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ clientName = fistrStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ priName = $"[费用名称:{clientName}]";
|
|
|
+ break;
|
|
|
+ case 81:
|
|
|
+ priName = $"[费用名称:{ioaDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.Inviter ?? " -"}]";
|
|
|
+ break;
|
|
|
+ case 82:
|
|
|
+ priName = $"[费用名称:{insureDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.ClientName ?? " -"}]";
|
|
|
+ break;
|
|
|
+ case 85:
|
|
|
+ string flightsCode = airDatas.Find(it => payInfo.DIId == it.DIId && payInfo.CId == it.Id)?.FlightsCode ?? "-";
|
|
|
+ string airPayType = setDatas.Find(it => it.Id == payInfo.PayDId)?.Name ?? "-";
|
|
|
+ priName = $"{flightsCode}【{airPayType}】";
|
|
|
+ break;
|
|
|
+ case 98:
|
|
|
+ priName = $"[费用名称:{otherMoneyDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.PriceName ?? " -"}]";
|
|
|
+ break;
|
|
|
+ case 285:
|
|
|
+ priName = $"[费用名称:{refundPaymentDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.PriceName ?? " -"}]";
|
|
|
+ break;
|
|
|
+ case 1015:
|
|
|
+ priName = $"[费用名称:{extraCostDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.PriceName ?? " -"}]";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ priName = "";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ bool status1 = false;
|
|
|
+ if (_groupIds != null)
|
|
|
+ {
|
|
|
+ status1 = _groupIds.Contains(payInfo.Id);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (payInfo.CTable == 76)
|
|
|
+ {
|
|
|
+ var hotelContents = hotelContentDatas.Where(it => it.HrId == payInfo.CId);
|
|
|
+ List<Group_DailyFeePaymentContentInfolView> childInfos = new List<Group_DailyFeePaymentContentInfolView>();
|
|
|
+ foreach (var hotelContent in hotelContents)
|
|
|
+ {
|
|
|
+ string subPriceName = "";
|
|
|
+ if (hotelContent.PriceType == 1) subPriceName = "房费";
|
|
|
+ else if (hotelContent.PriceType == 2) subPriceName = "早餐";
|
|
|
+ else if (hotelContent.PriceType == 3) subPriceName = "地税";
|
|
|
+ else if (hotelContent.PriceType == 4) subPriceName = "城市税";
|
|
|
+
|
|
|
+ if (string.IsNullOrEmpty(subPriceName)) subPriceName = priName;
|
|
|
+ else subPriceName = $"{priName.Replace("]", "")}-{subPriceName}]";
|
|
|
+
|
|
|
+ string payeeStr1 = string.Format(@" {0},开户行:{1},银行卡号:{2} ",
|
|
|
+ string.IsNullOrEmpty(hotelContent.Payee) ? "-" : hotelContent.Payee,
|
|
|
+ string.IsNullOrEmpty(hotelContent.OtherBankName) ? "-" : hotelContent.OtherBankName,
|
|
|
+ string.IsNullOrEmpty(hotelContent.OtherSideNo) ? "-" : hotelContent.OtherSideNo);
|
|
|
+
|
|
|
+ decimal _PaymentAmount1 = hotelContent.Price;
|
|
|
+ decimal _CNYSubTotalAmount1 = _PaymentAmount1 * hotelContent.Rate;
|
|
|
+ _CNYSubTotalAmount1 = Convert.ToDecimal(_CNYSubTotalAmount1.ToString("#0.00"));
|
|
|
+
|
|
|
+ var childInfo1 = new Group_DailyFeePaymentContentInfolView()
|
|
|
+ {
|
|
|
+ IsChecked = status1,
|
|
|
+ Id = payInfo.Id,
|
|
|
+ HotelSubId = hotelContent.Id,
|
|
|
+ Payee = payeeStr1,
|
|
|
+ RowNumber = rouNumber,
|
|
|
+ Applicant = userDatas.Find(it => it.Id == payInfo.CreateUserId)?.CnName ?? "",
|
|
|
+ ApplicantDt = payInfo.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
|
|
|
+ PayType = setDatas.Find(it => it.Id == payInfo.PayDId)?.Name ?? "",
|
|
|
+ TransferMark = orbitalPrivateTransfer,
|
|
|
+ PriceName = subPriceName,
|
|
|
+ ModuleName = setDatas.Find(it => it.Id == payInfo.CTable)?.Name ?? "",
|
|
|
+ PayCurrCode = setDatas.Find(it => it.Id == hotelContent.Currency)?.Name ?? "",
|
|
|
+ PaymentAmount = _PaymentAmount1,
|
|
|
+ PayRate = hotelContent.Rate,
|
|
|
+ CNYSubTotalAmount = _CNYSubTotalAmount1,
|
|
|
+ AuditStatus = payInfo.IsAuditGM
|
|
|
+
|
|
|
+ };
|
|
|
+ string remaksDescription1 = $"【{childInfo1.PayType}】【{childInfo1.ModuleName}】{rouNumber}、[申请人:{childInfo1.Applicant}]{subPriceName}[收款方:{childInfo1.Payee}] {childInfo1.PayCurrCode} {_PaymentAmount1.ToString("#0.00")}、CNY:{childInfo1.CNYSubTotalAmount.ToString("#0.00")}(团组:{groupInfo.TeamName})";
|
|
|
+
|
|
|
+ childInfo1.RemaksDescription = remaksDescription1;
|
|
|
+ childInfos.Add(childInfo1);
|
|
|
+ rouNumber++;
|
|
|
+ }
|
|
|
+
|
|
|
+ childList.AddRange(childInfos);
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ string payeeStr = string.Format(@" {0},开户行:{1},银行卡号:{2} ",
|
|
|
+ string.IsNullOrEmpty(payInfo.Payee) ? "-" : payInfo.Payee,
|
|
|
+ string.IsNullOrEmpty(payInfo.OtherBankName) ? "-" : payInfo.OtherBankName,
|
|
|
+ string.IsNullOrEmpty(payInfo.OtherSideNo) ? "-" : payInfo.OtherSideNo);
|
|
|
+
|
|
|
+
|
|
|
+ decimal _PaymentAmount = (payInfo.PayMoney / 100) * payInfo.PayPercentage;
|
|
|
+ decimal _CNYSubTotalAmount = _PaymentAmount * payInfo.DayRate;
|
|
|
+ _CNYSubTotalAmount = Convert.ToDecimal(_CNYSubTotalAmount.ToString("#0.00"));
|
|
|
+ var childInfo = new Group_DailyFeePaymentContentInfolView()
|
|
|
+ {
|
|
|
+ IsChecked = status1,
|
|
|
+ Id = payInfo.Id,
|
|
|
+ Payee = payeeStr,
|
|
|
+ RowNumber = rouNumber,
|
|
|
+ Applicant = userDatas.Find(it => it.Id == payInfo.CreateUserId)?.CnName ?? "",
|
|
|
+ ApplicantDt = payInfo.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
|
|
|
+ PayType = setDatas.Find(it => it.Id == payInfo.PayDId)?.Name ?? "",
|
|
|
+ TransferMark = orbitalPrivateTransfer,
|
|
|
+ PriceName = priName,
|
|
|
+ ModuleName = setDatas.Find(it => it.Id == payInfo.CTable)?.Name ?? "",
|
|
|
+ PayCurrCode = setDatas.Find(it => it.Id == payInfo.PaymentCurrency)?.Name ?? "",
|
|
|
+ PaymentAmount = _PaymentAmount,
|
|
|
+ PayRate = payInfo.DayRate,
|
|
|
+ CNYSubTotalAmount = _CNYSubTotalAmount,
|
|
|
+ AuditStatus = payInfo.IsAuditGM
|
|
|
+ };
|
|
|
+
|
|
|
+ string remaksDescription = $"【{childInfo.PayType}】【{childInfo.ModuleName}】{rouNumber}、[申请人:{childInfo.Applicant}]{priName}[收款方:{childInfo.Payee}] {childInfo.PayCurrCode} {_PaymentAmount.ToString("#0.00")}、CNY:{childInfo.CNYSubTotalAmount.ToString("#0.00")}(团组:{groupInfo.TeamName})";
|
|
|
+
|
|
|
+ childInfo.RemaksDescription = remaksDescription;
|
|
|
+ childList.Add(childInfo);
|
|
|
+ rouNumber++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ CompanyInfo companyInfo = new CompanyInfo();
|
|
|
+ companyInfo = ExpenseCompanyByTeamId(groupInfo.TeamDid);
|
|
|
+ dataList.Add(new tree_Group_DailyFeePaymentPageListView()
|
|
|
+ {
|
|
|
+ Id = Guid.NewGuid().ToString("N"),
|
|
|
+ GroupName = groupInfo.TeamName,
|
|
|
+ CompanyId = companyInfo.Id,
|
|
|
+ ConpanyName = companyInfo.ConpanyName,
|
|
|
+ CNYTotalAmount = childList.Sum(it => it.CNYSubTotalAmount),
|
|
|
+ ChildList = childList,
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ _DailyFeePaymentResult.dataList = dataList;
|
|
|
+
|
|
|
+ jw.Code = StatusCodes.Status200OK;
|
|
|
+ jw.Msg = $"操作成功!";
|
|
|
+ jw.Data = _DailyFeePaymentResult;
|
|
|
+ return Ok(jw);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ #endregion
|
|
|
}
|
|
|
}
|