|
|
@@ -15,6 +15,7 @@ using OASystem.Infrastructure.Repositories.System;
|
|
|
using OASystem.Infrastructure.Tools;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
+using System.Globalization;
|
|
|
using System.Linq;
|
|
|
using System.Runtime.Intrinsics.Arm;
|
|
|
using System.Text;
|
|
|
@@ -47,26 +48,85 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
sqlWhere += string.Format(@" And ccp.IsPay = {0} ", dto.IsPaySign);
|
|
|
}
|
|
|
|
|
|
+ // 其他款项-查看团组全部费用UserIds
|
|
|
+ var permUserIds = new List<int>() {
|
|
|
+ 400, // 李允
|
|
|
+ };
|
|
|
+
|
|
|
+ var typeIds = new List<int>() {
|
|
|
+ 302, // 成都-会务活动
|
|
|
+ 691, // 四川-会务活动
|
|
|
+ 762, // 四川-赛事项目收入
|
|
|
+ 1047,// 成都-赛事项目收入
|
|
|
+ 1539,// 纽茵-会务活动
|
|
|
+ 1548 // 重庆-会务活动
|
|
|
+ };
|
|
|
+
|
|
|
+ var isSpecialType = await _sqlSugar.Queryable<Grp_DelegationInfo>().AnyAsync(x => x.IsDel == 0 && x.Id == dto.DiId && typeIds.Contains(x.TeamDid));
|
|
|
+
|
|
|
+ if (!isSpecialType || !permUserIds.Contains(dto.UserId))
|
|
|
+ {
|
|
|
+ sqlWhere += string.Format(@" AND gdp.CreateUserId IN({0})", dto.UserId);
|
|
|
+ }
|
|
|
+
|
|
|
//雷怡 2024-5-8 15:14 新增View字段 CreateTime
|
|
|
- string sql = string.Format(@" Select gdp.Id,gdp.DiId,gdp.PriceName,gdp.FeeTotal,sd1.[Name] as Currency,gdp.FilePath,su.CnName as CreateUserName,
|
|
|
- ccp.IsAuditGM as isAudit,ccp.IsPay,gdp.CreateTime
|
|
|
+ string sql = string.Format(@"Select gdp.Id,gdp.DiId,
|
|
|
+ CASE
|
|
|
+ WHEN gdp.PaymentPercent <> 100
|
|
|
+ THEN gdp.PriceName
|
|
|
+ + '('
|
|
|
+ + gdp.PaymentType
|
|
|
+ + ')'
|
|
|
+ -- + ' '
|
|
|
+ -- + CAST(CAST(gdp.PaymentPercent AS INT) AS VARCHAR(10))
|
|
|
+ -- + '%)'
|
|
|
+ ELSE gdp.PriceName
|
|
|
+ END AS PriceName,
|
|
|
+ -- gdp.FeeTotal,
|
|
|
+ gdp.PaymentType,
|
|
|
+ gdp.PaymentPercent,
|
|
|
+ gdp.ActualPaymentAmount FeeTotal,
|
|
|
+ sd1.[Name] as Currency,gdp.FilePath,su.CnName as CreateUserName,ccp.IsAuditGM as isAudit,ccp.IsPay,gdp.CreateTime
|
|
|
From Grp_DecreasePayments as gdp With(Nolock) Left Join Grp_CreditCardPayment as ccp With(Nolock) On gdp.Id = ccp.CId
|
|
|
Left Join Sys_SetData as sd1 On gdp.Currency = sd1.Id
|
|
|
Left Join Sys_Users as su On gdp.CreateUserId = su.Id
|
|
|
- Where gdp.DiId = {0} And ccp.CTable = 98 {2} And ccp.IsDel = 0 And gdp.IsDel = 0 And gdp.CreateUserId in ({1}) ", dto.DiId, dto.UserId, sqlWhere);
|
|
|
- List<DecreasePaymentsView> _DecreasePayments = await _sqlSugar.SqlQueryable<DecreasePaymentsView>(sql).ToListAsync();
|
|
|
+ Where gdp.DiId = {0} And ccp.CTable = 98 {1} And ccp.IsDel = 0 And gdp.IsDel = 0 ", dto.DiId, sqlWhere);
|
|
|
+ var _DecreasePayments = await _sqlSugar.SqlQueryable<DecreasePaymentsView>(sql).ToListAsync();
|
|
|
|
|
|
return new JsonView() { Code = 200, Msg = MsgTips.Succeed, Data = _DecreasePayments };
|
|
|
}
|
|
|
|
|
|
- public async Task<JsonView> DecreasePaymentsSelect(DecreasePaymentsDto dto)
|
|
|
+ /// <summary>
|
|
|
+ /// 获取付款方式配置(STid = 138)
|
|
|
+ /// </summary>
|
|
|
+ public async Task<List<PaymentTypeView>> GetPaymentTypesAsync()
|
|
|
{
|
|
|
+ const int PaymentSettingStId = 138;
|
|
|
+
|
|
|
+ var paymentTypes = await _sqlSugar
|
|
|
+ .Queryable<Sys_SetData>()
|
|
|
+ .Where(x => x.STid == PaymentSettingStId && x.IsDel == 0)
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
+ return paymentTypes.Select(x =>
|
|
|
+ {
|
|
|
+ var y = new PaymentTypeView()
|
|
|
+ {
|
|
|
+ PaymentType = x.Name,
|
|
|
+ PaymentPercent = x.Remark.SafeParseDecimal(),
|
|
|
+ };
|
|
|
+
|
|
|
+ return y;
|
|
|
+ }).ToList();
|
|
|
+ }
|
|
|
|
|
|
+ public async Task<JsonView> DecreasePaymentsSelect(DecreasePaymentsDto dto)
|
|
|
+ {
|
|
|
#region 团组下拉框
|
|
|
var isGm = AppSettingsHelper
|
|
|
.Get<int>("DecreasePaymentsSelectIsGm")
|
|
|
.Contains(dto.UserId);
|
|
|
- List<DecreasePaymentGroupView> _Delegations = new List<DecreasePaymentGroupView>();
|
|
|
+ var _Delegations = new List<DecreasePaymentGroupView>();
|
|
|
|
|
|
if (isGm && dto.CTId != 81)
|
|
|
{
|
|
|
@@ -75,7 +135,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
|
|
|
if (!isGm)
|
|
|
{
|
|
|
- List<Grp_GroupsTaskAssignment> grp_GroupsTaskAssignment = Query<Grp_GroupsTaskAssignment>(a => a.IsDel == 0 && a.UId == dto.UserId && a.CTId == dto.CTId).ToList();
|
|
|
+ var grp_GroupsTaskAssignment = Query<Grp_GroupsTaskAssignment>(a => a.IsDel == 0 && a.UId == dto.UserId && a.CTId == dto.CTId).ToList();
|
|
|
string DiId = "";
|
|
|
if (grp_GroupsTaskAssignment.Count > 0)
|
|
|
{
|
|
|
@@ -136,13 +196,15 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
|
|
|
#region 其他下拉框查询
|
|
|
|
|
|
- //支付方式
|
|
|
- List<Sys_SetData> Payment = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 14 && a.IsDel == 0).ToList();
|
|
|
- List<SetDataInfoView> _Payment = _mapper.Map<List<SetDataInfoView>>(Payment);
|
|
|
+ var setdata = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.IsDel == 0).ToList();
|
|
|
+
|
|
|
+ // 支付方式
|
|
|
+ var payment = setdata.Where(a => a.STid == 14).ToList();
|
|
|
+ var _payment = _mapper.Map<List<SetDataInfoView>>(payment);
|
|
|
|
|
|
- //供应商 supplier
|
|
|
- List<Sys_SetData> supplier = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 21 && a.IsDel == 0).ToList();
|
|
|
- List<SetDataInfoView> _supplier = _mapper.Map<List<SetDataInfoView>>(supplier);
|
|
|
+ // 供应商
|
|
|
+ var supplier = setdata.Where(a => a.STid == 21).ToList();
|
|
|
+ var _supplier = _mapper.Map<List<SetDataInfoView>>(supplier);
|
|
|
if (_supplier.Count > 0)
|
|
|
{
|
|
|
var d1 = _supplier.Find(it => it.Name.Equals("策划 公司"));
|
|
|
@@ -162,43 +224,63 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- List<dynamic> _supplierArea = new List<dynamic>() {
|
|
|
+ var _supplierArea = new List<dynamic>() {
|
|
|
new { id=1,name = "国内" },
|
|
|
new { id=2,name = "国外" },
|
|
|
};
|
|
|
|
|
|
+ // 付款方式
|
|
|
+ var _paymentOptions = await GetPaymentTypesAsync();
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
var data = new
|
|
|
{
|
|
|
- payment = _Payment,
|
|
|
+ payment = _payment,
|
|
|
groupName = _Delegations,
|
|
|
supplier = _supplier,
|
|
|
- supplierArea = _supplierArea
|
|
|
+ supplierArea = _supplierArea,
|
|
|
+ paymentOptions = _paymentOptions,
|
|
|
};
|
|
|
return new JsonView() { Code = 200, Msg = MsgTips.Succeed, Data = data };
|
|
|
-
|
|
|
}
|
|
|
|
|
|
public async Task<JsonView> OpDecreasePayments(DecreasePaymentsOpDto dto)
|
|
|
{
|
|
|
+ // 输入验证
|
|
|
+ if (dto == null) return new JsonView { Code = 400, Msg = "参数不能为空" };
|
|
|
+
|
|
|
BeginTran();
|
|
|
int id = 0;
|
|
|
var grp_Decrease = _mapper.Map<Grp_DecreasePayments>(dto);
|
|
|
var recheck = true;
|
|
|
|
|
|
-
|
|
|
//处理费用总计
|
|
|
if (grp_Decrease.FeeTotal == 0.00M)
|
|
|
{
|
|
|
- grp_Decrease.FeeTotal = grp_Decrease.Price * grp_Decrease.Price;
|
|
|
+ grp_Decrease.FeeTotal = grp_Decrease.Quantity * grp_Decrease.Price;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 处理未选择付款类型
|
|
|
+ if (string.IsNullOrEmpty(dto.PaymentType))
|
|
|
+ {
|
|
|
+ grp_Decrease.PaymentType = "全款";
|
|
|
+ grp_Decrease.PaymentPercent = 100m;
|
|
|
}
|
|
|
|
|
|
- List<TeamRateDescAddCurrencyIdView> teamRates = await _teamRateRep.PostGroupTeamRateItemByDiIdAndCTableId(1, dto.DiId, 98);
|
|
|
+ // 处理此次 付款金额
|
|
|
+ grp_Decrease.ActualPaymentAmount = grp_Decrease.FeeTotal * grp_Decrease.PaymentPercent / 100m;
|
|
|
+
|
|
|
+ // 获取汇率(复用查询)
|
|
|
+ var teamRates = await _teamRateRep.PostGroupTeamRateItemByDiIdAndCTableId(1, dto.DiId, 98);
|
|
|
var teamRate = teamRates.Where(it => it.CurrencyId == grp_Decrease.Currency).FirstOrDefault();
|
|
|
if (teamRate == null)
|
|
|
{
|
|
|
- return new JsonView() { Code = 400, Msg = $"添加失败!团组汇率未设置{_sqlSugar.Queryable<Sys_SetData>().First(it => it.IsDel == 0 && it.Id == grp_Decrease.Currency)?.Name ?? ""}该币种汇率!" };
|
|
|
+ var currencyName = await _sqlSugar.Queryable<Sys_SetData>()
|
|
|
+ .Where(it => it.IsDel == 0 && it.Id == grp_Decrease.Currency)
|
|
|
+ .Select(it => it.Name)
|
|
|
+ .FirstAsync() ?? "";
|
|
|
+ return new JsonView { Code = 400, Msg = $"添加失败!团组汇率未设置{currencyName}该币种汇率!" };
|
|
|
}
|
|
|
|
|
|
if (dto.Status == 1)//添加
|
|
|
@@ -208,67 +290,104 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
|
|
|
#region C表赋值
|
|
|
|
|
|
- Grp_CreditCardPayment C = new Grp_CreditCardPayment();
|
|
|
- C.PayDId = dto.PayDId;
|
|
|
- C.ConsumptionPatterns = "";
|
|
|
- C.ConsumptionDate = "";
|
|
|
- C.CTDId = 0;
|
|
|
- C.BankNo = "";
|
|
|
- C.CardholderName = "";
|
|
|
- C.PayMoney = grp_Decrease.FeeTotal;
|
|
|
- C.PaymentCurrency = grp_Decrease.Currency;
|
|
|
-
|
|
|
- C.CompanyBankNo = "";
|
|
|
- C.OtherBankName = dto.OtherBankName;
|
|
|
- C.OtherSideNo = dto.OtherSideNo;
|
|
|
- C.OtherSideName = dto.OtherSideName;
|
|
|
- C.Remark = "";
|
|
|
- C.CreateUserId = grp_Decrease.CreateUserId;
|
|
|
- C.MFOperator = 0;
|
|
|
- C.MFOperatorDate = "";
|
|
|
- C.IsAuditDM = 0;
|
|
|
- C.AuditDMOperate = 0;
|
|
|
- C.AuditDMDate = "";
|
|
|
- C.IsAuditMF = 0;
|
|
|
- C.AuditMFOperate = 0;
|
|
|
- C.AuditMFDate = "";
|
|
|
- C.IsAuditGM = 0;
|
|
|
- C.AuditGMOperate = 21;
|
|
|
- C.AuditGMDate = "";
|
|
|
+ var ccp = new Grp_CreditCardPayment
|
|
|
+ {
|
|
|
+ PayDId = dto.PayDId,
|
|
|
+ ConsumptionPatterns = "",
|
|
|
+ ConsumptionDate = "",
|
|
|
+ CTDId = 0,
|
|
|
+ BankNo = "",
|
|
|
+ CardholderName = "",
|
|
|
+ PayMoney = grp_Decrease.ActualPaymentAmount,
|
|
|
+ PaymentCurrency = grp_Decrease.Currency,
|
|
|
+ CompanyBankNo = "",
|
|
|
+ OtherBankName = dto.OtherBankName,
|
|
|
+ OtherSideNo = dto.OtherSideNo,
|
|
|
+ OtherSideName = dto.OtherSideName,
|
|
|
+ Remark = "",
|
|
|
+ CreateUserId = grp_Decrease.CreateUserId,
|
|
|
+ MFOperator = 0,
|
|
|
+ MFOperatorDate = "",
|
|
|
+ IsAuditDM = 0,
|
|
|
+ AuditDMOperate = 0,
|
|
|
+ AuditDMDate = "",
|
|
|
+ IsAuditMF = 0,
|
|
|
+ AuditMFOperate = 0,
|
|
|
+ AuditMFDate = "",
|
|
|
+ IsAuditGM = 0,
|
|
|
+ AuditGMOperate = 21,
|
|
|
+ AuditGMDate = "",
|
|
|
+ DIId = grp_Decrease.DiId,
|
|
|
+ CId = id,
|
|
|
+ CTable = 98,
|
|
|
+ PayPercentage = 100,
|
|
|
+ PayThenMoney = 0,
|
|
|
+ PayPercentageOld = 0,
|
|
|
+ PayThenMoneyOld = 0,
|
|
|
+ UpdateDate = "",
|
|
|
+ Payee = dto.SupplierName,
|
|
|
+ OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer,
|
|
|
+ ExceedBudget = 0,
|
|
|
+ };
|
|
|
|
|
|
//2025-04-07 第四次更改 PayDId == 72(刷卡) IsPay == 1
|
|
|
- if (C.PayDId == 72) C.IsPay = 1;
|
|
|
- else C.IsPay = 0;
|
|
|
-
|
|
|
- C.DIId = grp_Decrease.DiId;
|
|
|
- C.CId = id;
|
|
|
- C.CTable = 98;
|
|
|
- C.PayPercentage = 100;
|
|
|
- C.PayThenMoney = 0;
|
|
|
- C.PayPercentageOld = 0;
|
|
|
- C.PayThenMoneyOld = 0;
|
|
|
- C.UpdateDate = "";
|
|
|
- C.Payee = dto.SupplierName;
|
|
|
- C.OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer;
|
|
|
- C.ExceedBudget = 0;
|
|
|
- //C.RMBPrice = 0.00f;
|
|
|
+ if (ccp.PayDId == 72) ccp.IsPay = 1;
|
|
|
+ else ccp.IsPay = 0;
|
|
|
|
|
|
if (teamRate.CurrencyCode.Equals("CNY"))
|
|
|
{
|
|
|
- C.DayRate = 1.0000M;
|
|
|
- C.RMBPrice = C.PayMoney;
|
|
|
+ ccp.DayRate = 1.0000M;
|
|
|
+ ccp.RMBPrice = ccp.PayMoney;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- C.DayRate = teamRate.Rate;
|
|
|
- C.RMBPrice = C.PayMoney * C.DayRate;
|
|
|
+ ccp.DayRate = teamRate.Rate;
|
|
|
+ ccp.RMBPrice = ccp.PayMoney * ccp.DayRate;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
- int cId = await _sqlSugar.Insertable(C).ExecuteReturnIdentityAsync();
|
|
|
+ int cId = await _sqlSugar.Insertable(ccp).ExecuteReturnIdentityAsync();
|
|
|
if (cId > 1)
|
|
|
{
|
|
|
+ #region 付款类型为预付款时,添加尾款信息
|
|
|
+
|
|
|
+ if (grp_Decrease.PaymentType.Contains("预付款"))
|
|
|
+ {
|
|
|
+ var balancePercent = 100m - grp_Decrease.PaymentPercent;
|
|
|
+ grp_Decrease.PaymentType = "尾款";
|
|
|
+ grp_Decrease.PaymentPercent = balancePercent;
|
|
|
+ grp_Decrease.ActualPaymentAmount = grp_Decrease.FeeTotal * balancePercent / 100m;
|
|
|
+
|
|
|
+ var balanceId = await AddAsyncReturnId(grp_Decrease);
|
|
|
+ if (balanceId < 1)
|
|
|
+ {
|
|
|
+ RollbackTran();
|
|
|
+ return new JsonView() { Code = 200, Msg = $"{grp_Decrease.PriceName}尾款信息添加失败!" };
|
|
|
+ }
|
|
|
+
|
|
|
+ ccp.CId = balanceId;
|
|
|
+ ccp.PayMoney = grp_Decrease.ActualPaymentAmount;
|
|
|
+ if (teamRate.CurrencyCode.Equals("CNY"))
|
|
|
+ {
|
|
|
+ ccp.DayRate = 1.0000M;
|
|
|
+ ccp.RMBPrice = ccp.PayMoney;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ccp.DayRate = teamRate.Rate;
|
|
|
+ ccp.RMBPrice = ccp.PayMoney * ccp.DayRate;
|
|
|
+ }
|
|
|
+
|
|
|
+ var balanceCId = await _sqlSugar.Insertable(ccp).ExecuteReturnIdentityAsync();
|
|
|
+ if (balanceCId < 1)
|
|
|
+ {
|
|
|
+ RollbackTran();
|
|
|
+ return new JsonView() { Code = 200, Msg = $"{grp_Decrease.PriceName}尾款信息添加失败!" };
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
|
|
|
#region 策划部内容同步添加至资料库
|
|
|
//var userInfo = _sqlSugar.Queryable<Sys_Users>()
|
|
|
@@ -382,86 +501,9 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
#endregion
|
|
|
|
|
|
#region 会务成本自动审核处理
|
|
|
- var hwids = _sqlSugar.Queryable<Sys_SetData>()
|
|
|
- .Where(x => x.IsDel == 0 && x.STid == 10 && x.Name.Contains("会务活动"))
|
|
|
- .Select(x => x.Id)
|
|
|
- .ToList();
|
|
|
-
|
|
|
- var groupTypeIsTrue = _sqlSugar.Queryable<Grp_DelegationInfo>()
|
|
|
- .Where(x => x.Id == dto.DiId && x.IsDel == 0)
|
|
|
- .Any(x => hwids.Contains(x.TeamDid));
|
|
|
|
|
|
- if (groupTypeIsTrue)
|
|
|
- {
|
|
|
- var main = _sqlSugar.Queryable<Grp_ConferenceAffairsCost>()
|
|
|
- .First(x => x.Diid == dto.DiId && x.IsDel == 0);
|
|
|
-
|
|
|
- if (main != null)
|
|
|
- {
|
|
|
- var chiArr = _sqlSugar.Queryable<Grp_ConferenceAffairsCostChild>()
|
|
|
- .Where(x => x.Diid == dto.DiId && x.ConferenceAffairsCostId == main.Id && x.IsDel == 0)
|
|
|
- .ToList();
|
|
|
- var find = chiArr.FirstOrDefault(x => x.PriceName == dto.PriceName && x.ReviewStatus == 1);
|
|
|
- var isAuto = false;
|
|
|
-
|
|
|
- //存在已审的会务成本
|
|
|
- if (find != null)
|
|
|
- {
|
|
|
-
|
|
|
- //检索历史金额
|
|
|
- var histyPrice = _sqlSugar.Queryable<Grp_DecreasePayments>()
|
|
|
- .LeftJoin<Grp_CreditCardPayment>((x, a) => a.IsDel == 0 && a.CTable == 98 && a.CId == x.Id)
|
|
|
- .Where((x, a) => x.IsDel == 0 && x.DiId == dto.DiId && x.PriceName == dto.PriceName && x.Id != grp_Decrease.Id)
|
|
|
- .Select((x, a) => new
|
|
|
- {
|
|
|
- x.FeeTotal,
|
|
|
- x.Currency,
|
|
|
- a.DayRate,
|
|
|
- a.RMBPrice,
|
|
|
- x.DiId,
|
|
|
- x.PriceName,
|
|
|
- x.Price,
|
|
|
- x.Quantity,
|
|
|
- })
|
|
|
- .ToList();
|
|
|
-
|
|
|
- //币种不同情况
|
|
|
- if (true)
|
|
|
- {
|
|
|
- //币种全转换为人民币
|
|
|
- var rate = teamRates.Where(it => it.CurrencyId == grp_Decrease.Currency).FirstOrDefault();
|
|
|
- if (rate != null)
|
|
|
- {
|
|
|
- grp_Decrease.FeeTotal *= rate.Rate;
|
|
|
- }
|
|
|
-
|
|
|
- var ConferenceAffairsCostFeeTotal = 0.00M;
|
|
|
- ConferenceAffairsCostFeeTotal = find.Count * find.CostPrice * find.Rate;
|
|
|
-
|
|
|
- var histyPriceValue = histyPrice.Sum(x => x.FeeTotal * x.DayRate);
|
|
|
- if (ConferenceAffairsCostFeeTotal > histyPriceValue)
|
|
|
- {
|
|
|
- isAuto = ConferenceAffairsCostFeeTotal - histyPriceValue >= grp_Decrease.FeeTotal;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (isAuto)
|
|
|
- {
|
|
|
-
|
|
|
- var execCount = _sqlSugar.Updateable<Grp_CreditCardPayment>()
|
|
|
- .SetColumns(a => new Grp_CreditCardPayment
|
|
|
- {
|
|
|
- IsAuditGM = 3, //自动审核通过
|
|
|
- AuditGMOperate = 4,
|
|
|
- AuditGMDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
|
|
|
- })
|
|
|
- .Where(a => a.CId == grp_Decrease.Id && a.CTable == 98 && a.DIId == grp_Decrease.DiId)
|
|
|
- .ExecuteCommand();
|
|
|
- recheck = false;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ var auditRes = await AutoAuditConferenceCostAsync(grp_Decrease, teamRates);
|
|
|
+ recheck = auditRes.isRecheck;
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
@@ -475,9 +517,42 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
}
|
|
|
else if (dto.Status == 2)
|
|
|
{
|
|
|
- //已审核、已支付 不可修改
|
|
|
+ // 已审核、已支付 不可修改
|
|
|
var grp_CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == grp_Decrease.Id && a.CTable == 98 && a.CId == grp_Decrease.Id && a.IsDel == 0);
|
|
|
|
|
|
+ // 修改 付款类型验证 尾款时不能修改为非尾款
|
|
|
+ var editValid = _sqlSugar.Queryable<Grp_DecreasePayments>()
|
|
|
+ .Where(a => a.Id == grp_Decrease.Id && a.IsDel == 0)
|
|
|
+ .Select(a => new
|
|
|
+ {
|
|
|
+ a.PaymentType,
|
|
|
+ a.PaymentPercent,
|
|
|
+ a.Price,
|
|
|
+ a.Quantity,
|
|
|
+ a.PriceName,
|
|
|
+ a.FeeTotal,
|
|
|
+ })
|
|
|
+ .First();
|
|
|
+ if (editValid.PaymentType.Contains("尾款"))
|
|
|
+ {
|
|
|
+ // 原付款类型为尾款时,修改时必须包含尾款且付款比例、价格信息不变
|
|
|
+ if (!dto.PaymentType.Contains("尾款"))
|
|
|
+ {
|
|
|
+ return new JsonView() { Code = 400, Msg = $"尾款信息不可修改为非尾款选项!" };
|
|
|
+ }
|
|
|
+
|
|
|
+ if (editValid.PriceName != dto.PriceName)
|
|
|
+ {
|
|
|
+ return new JsonView() { Code = 400, Msg = $"尾款信息的费用名称不可修改,若要修改请前往预付款修改!" };
|
|
|
+ }
|
|
|
+
|
|
|
+ //if (editValid.PriceName != dto.PriceName || editValid.Price != dto.Price || editValid.Quantity != dto.Quantity ||
|
|
|
+ // editValid.FeeTotal != dto.FeeTotal || editValid.PaymentPercent != dto.PaymentPercent)
|
|
|
+ //{
|
|
|
+ // return new JsonView() { Code = 400, Msg = $"尾款信息的价格、数量、费用总计、付款比例不可修改,若要修改请前往预付款修改对应信息!" };
|
|
|
+ //}
|
|
|
+ }
|
|
|
+
|
|
|
if (grp_CreditCardPayment == null) return new JsonView() { Code = 400, Msg = MsgTips.Fail };
|
|
|
|
|
|
var isAuditGM = grp_CreditCardPayment.IsAuditGM;
|
|
|
@@ -500,6 +575,9 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
Price = grp_Decrease.Price,
|
|
|
Quantity = grp_Decrease.Quantity,
|
|
|
FeeTotal = grp_Decrease.FeeTotal,
|
|
|
+ PaymentType = grp_Decrease.PaymentType,
|
|
|
+ PaymentPercent = grp_Decrease.PaymentPercent,
|
|
|
+ ActualPaymentAmount = grp_Decrease.ActualPaymentAmount,
|
|
|
Currency = grp_Decrease.Currency,
|
|
|
FilePath = grp_Decrease.FilePath,
|
|
|
OTAOrderNo = grp_Decrease.OTAOrderNo,
|
|
|
@@ -512,12 +590,12 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
if (teamRate.CurrencyCode.Equals("CNY"))
|
|
|
{
|
|
|
grp_CreditCardPayment.DayRate = 1.0000M;
|
|
|
- grp_CreditCardPayment.RMBPrice = grp_CreditCardPayment.PayMoney;
|
|
|
+ grp_CreditCardPayment.RMBPrice = grp_Decrease.ActualPaymentAmount;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
grp_CreditCardPayment.DayRate = teamRate.Rate;
|
|
|
- grp_CreditCardPayment.RMBPrice = grp_CreditCardPayment.PayMoney * grp_CreditCardPayment.DayRate;
|
|
|
+ grp_CreditCardPayment.RMBPrice = grp_Decrease.ActualPaymentAmount * grp_CreditCardPayment.DayRate;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -525,7 +603,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
int isPay = 0;
|
|
|
if (dto.PayDId == 72) isPay = 1;
|
|
|
|
|
|
- int CTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>()
|
|
|
+ int cTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>()
|
|
|
.Where(a => a.Id == grp_CreditCardPayment.Id)
|
|
|
.SetColumns(a => new Grp_CreditCardPayment
|
|
|
{
|
|
|
@@ -534,7 +612,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
OtherBankName = dto.OtherBankName,
|
|
|
PayDId = dto.PayDId,
|
|
|
IsPay = isPay,
|
|
|
- PayMoney = grp_Decrease.FeeTotal,
|
|
|
+ PayMoney = grp_Decrease.ActualPaymentAmount,
|
|
|
PaymentCurrency = grp_Decrease.Currency,
|
|
|
Payee = dto.SupplierName,
|
|
|
OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer,
|
|
|
@@ -544,8 +622,164 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
})
|
|
|
.ExecuteCommandAsync();
|
|
|
|
|
|
- if (CTable > 0)
|
|
|
+ if (cTable > 0)
|
|
|
{
|
|
|
+ #region 付款类型为预付款时,添加尾款信息
|
|
|
+
|
|
|
+ if (grp_Decrease.PaymentType.Contains("预付款"))
|
|
|
+ {
|
|
|
+ // 检查尾款信息是否存在,存在则更新,不存在则添加
|
|
|
+ var balanceInfo = await _sqlSugar.Queryable<Grp_DecreasePayments>()
|
|
|
+ .Where(x => x.DiId == grp_Decrease.DiId && x.PriceName == grp_Decrease.PriceName && x.PaymentType.Contains("尾款") && x.IsDel == 0)
|
|
|
+ .FirstAsync();
|
|
|
+
|
|
|
+ var balancePercent = 100m - grp_Decrease.PaymentPercent;
|
|
|
+ var paymentTypeName = "尾款";
|
|
|
+ var paymentPercent = balancePercent;
|
|
|
+ var actualPaymentAmount = grp_Decrease.FeeTotal * balancePercent / 100m;
|
|
|
+
|
|
|
+ if (balanceInfo != null) // 更新尾款信息
|
|
|
+ {
|
|
|
+ bool balanceRes = await UpdateAsync(a => a.Id == balanceInfo.Id, a => new Grp_DecreasePayments
|
|
|
+ {
|
|
|
+ DiId = grp_Decrease.DiId,
|
|
|
+ SupplierArea = grp_Decrease.SupplierArea,
|
|
|
+ SupplierTypeId = grp_Decrease.SupplierTypeId,
|
|
|
+ SupplierName = grp_Decrease.SupplierName,
|
|
|
+ SupplierContact = grp_Decrease.SupplierContact,
|
|
|
+ SupplierContactNumber = grp_Decrease.SupplierContactNumber,
|
|
|
+ SupplierSocialAccount = grp_Decrease.SupplierSocialAccount,
|
|
|
+ SupplierEmail = grp_Decrease.SupplierEmail,
|
|
|
+ SupplierAddress = grp_Decrease.SupplierAddress,
|
|
|
+ PriceName = grp_Decrease.PriceName,
|
|
|
+ Price = grp_Decrease.Price,
|
|
|
+ Quantity = grp_Decrease.Quantity,
|
|
|
+ FeeTotal = grp_Decrease.FeeTotal,
|
|
|
+ PaymentType = paymentTypeName,
|
|
|
+ PaymentPercent = paymentPercent,
|
|
|
+ ActualPaymentAmount = actualPaymentAmount,
|
|
|
+ Currency = grp_Decrease.Currency,
|
|
|
+ FilePath = grp_Decrease.FilePath,
|
|
|
+ OTAOrderNo = grp_Decrease.OTAOrderNo,
|
|
|
+ Remark = grp_Decrease.Remark,
|
|
|
+ });
|
|
|
+
|
|
|
+ if (!balanceRes)
|
|
|
+ {
|
|
|
+ RollbackTran();
|
|
|
+ return new JsonView() { Code = 200, Msg = $"{grp_Decrease.PriceName}尾款信息更新失败!" };
|
|
|
+ }
|
|
|
+
|
|
|
+ var DayRate = 0.00m;
|
|
|
+ var RMBPrice = 0.00m;
|
|
|
+ if (teamRate != null)
|
|
|
+ {
|
|
|
+ if (teamRate.CurrencyCode.Equals("CNY"))
|
|
|
+ {
|
|
|
+ DayRate = 1.0000M;
|
|
|
+ RMBPrice = actualPaymentAmount;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ DayRate = teamRate.Rate;
|
|
|
+ RMBPrice = actualPaymentAmount * DayRate;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ int balanceCTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>()
|
|
|
+ .Where(a => a.DIId == balanceInfo.DiId && a.CTable == 98 && a.CId == balanceInfo.Id)
|
|
|
+ .SetColumns(a => new Grp_CreditCardPayment
|
|
|
+ {
|
|
|
+
|
|
|
+ OtherSideName = dto.OtherSideName,
|
|
|
+ OtherSideNo = dto.OtherSideNo,
|
|
|
+ OtherBankName = dto.OtherBankName,
|
|
|
+ PayDId = dto.PayDId,
|
|
|
+ IsPay = isPay,
|
|
|
+ PayMoney = actualPaymentAmount,
|
|
|
+ PaymentCurrency = grp_Decrease.Currency,
|
|
|
+ Payee = dto.SupplierName,
|
|
|
+ OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer,
|
|
|
+ DayRate = DayRate,
|
|
|
+ RMBPrice = RMBPrice,
|
|
|
+ })
|
|
|
+ .ExecuteCommandAsync();
|
|
|
+
|
|
|
+ if (balanceCTable < 1)
|
|
|
+ {
|
|
|
+ RollbackTran();
|
|
|
+ return new JsonView() { Code = 200, Msg = $"{grp_Decrease.PriceName}尾款信息更新失败!" };
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else // 添加尾款信息
|
|
|
+ {
|
|
|
+ grp_Decrease.PaymentType = paymentTypeName;
|
|
|
+ grp_Decrease.PaymentPercent = paymentPercent;
|
|
|
+ grp_Decrease.ActualPaymentAmount = actualPaymentAmount;
|
|
|
+
|
|
|
+ var balanceId = await AddAsyncReturnId(grp_Decrease);
|
|
|
+ if (balanceId < 1)
|
|
|
+ {
|
|
|
+ RollbackTran();
|
|
|
+ return new JsonView() { Code = 200, Msg = $"{grp_Decrease.PriceName}尾款信息添加失败!" };
|
|
|
+ }
|
|
|
+
|
|
|
+ grp_CreditCardPayment.CId = balanceId;
|
|
|
+ grp_CreditCardPayment.PayMoney = grp_Decrease.ActualPaymentAmount;
|
|
|
+ if (teamRate.CurrencyCode.Equals("CNY"))
|
|
|
+ {
|
|
|
+ grp_CreditCardPayment.DayRate = 1.0000M;
|
|
|
+ grp_CreditCardPayment.RMBPrice = grp_CreditCardPayment.PayMoney;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ grp_CreditCardPayment.DayRate = teamRate.Rate;
|
|
|
+ grp_CreditCardPayment.RMBPrice = grp_CreditCardPayment.PayMoney * grp_CreditCardPayment.DayRate;
|
|
|
+ }
|
|
|
+
|
|
|
+ var balanceCId = await _sqlSugar.Insertable(grp_CreditCardPayment).ExecuteReturnIdentityAsync();
|
|
|
+ if (balanceCId < 1)
|
|
|
+ {
|
|
|
+ RollbackTran();
|
|
|
+ return new JsonView() { Code = 200, Msg = $"{grp_Decrease.PriceName}尾款信息添加失败!" };
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 付款类型更改为全款时,删除同名称尾款信息
|
|
|
+ if (grp_Decrease.PaymentType.Contains("全款"))
|
|
|
+ {
|
|
|
+ var balanceInfo = await _sqlSugar.Queryable<Grp_DecreasePayments>()
|
|
|
+ .Where(x => x.DiId == grp_Decrease.DiId && x.PriceName == grp_Decrease.PriceName && x.PaymentType.Contains("尾款") && x.IsDel == 0)
|
|
|
+ .FirstAsync();
|
|
|
+
|
|
|
+ if (balanceInfo != null) {
|
|
|
+
|
|
|
+ bool balanceRes = await UpdateAsync(a => a.Id == balanceInfo.Id,
|
|
|
+ a => new Grp_DecreasePayments
|
|
|
+ {
|
|
|
+ IsDel = 1,
|
|
|
+ DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
|
|
|
+ DeleteUserId = dto.CreateUserId,
|
|
|
+ Remark = $"{balanceInfo.Remark};由预付款更改为全款时,自动删除:{grp_Decrease.PriceName}尾款信息"
|
|
|
+ });
|
|
|
+
|
|
|
+ int balanceCTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>()
|
|
|
+ .Where(a => a.DIId == balanceInfo.DiId && a.CTable == 98 && a.CId == balanceInfo.Id)
|
|
|
+ .SetColumns(a => new Grp_CreditCardPayment
|
|
|
+ {
|
|
|
+ IsDel = 1,
|
|
|
+ DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
|
|
|
+ DeleteUserId = dto.CreateUserId,
|
|
|
+ Remark = $"{balanceInfo.Remark};由预付款更改为全款时,自动删除:{grp_Decrease.PriceName}尾款信息"
|
|
|
+ })
|
|
|
+ .ExecuteCommandAsync();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
#region 世运会自动审核处理
|
|
|
if (dto.DiId == 2590)
|
|
|
{
|
|
|
@@ -629,100 +863,126 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
#endregion
|
|
|
|
|
|
#region 会务成本自动审核处理
|
|
|
- var hwids = _sqlSugar.Queryable<Sys_SetData>()
|
|
|
- .Where(x => x.IsDel == 0 && x.STid == 10 && x.Name.Contains("会务活动"))
|
|
|
- .Select(x => x.Id)
|
|
|
- .ToList();
|
|
|
|
|
|
- var groupTypeIsTrue = _sqlSugar.Queryable<Grp_DelegationInfo>()
|
|
|
- .Where(x => x.Id == dto.DiId && x.IsDel == 0)
|
|
|
- .Any(x => hwids.Contains(x.TeamDid));
|
|
|
+ var auditRes = await AutoAuditConferenceCostAsync(grp_Decrease, teamRates);
|
|
|
+ recheck = auditRes.isRecheck;
|
|
|
|
|
|
- if (groupTypeIsTrue)
|
|
|
- {
|
|
|
- var main = _sqlSugar.Queryable<Grp_ConferenceAffairsCost>()
|
|
|
- .First(x => x.Diid == dto.DiId && x.IsDel == 0);
|
|
|
+ #endregion
|
|
|
|
|
|
- if (main != null)
|
|
|
- {
|
|
|
- var chiArr = _sqlSugar.Queryable<Grp_ConferenceAffairsCostChild>()
|
|
|
- .Where(x => x.Diid == dto.DiId && x.ConferenceAffairsCostId == main.Id && x.IsDel == 0)
|
|
|
- .ToList();
|
|
|
- var find = chiArr.FirstOrDefault(x => x.PriceName == dto.PriceName && x.ReviewStatus == 1);
|
|
|
- var isAuto = false;
|
|
|
-
|
|
|
- //存在已审的会务成本
|
|
|
- if (find != null)
|
|
|
- {
|
|
|
+ CommitTran();
|
|
|
|
|
|
- //检索历史金额
|
|
|
- var histyPrice = _sqlSugar.Queryable<Grp_DecreasePayments>()
|
|
|
- .LeftJoin<Grp_CreditCardPayment>((x, a) => a.IsDel == 0 && a.CTable == 98 && a.CId == x.Id)
|
|
|
- .Where((x, a) => x.IsDel == 0 && x.DiId == dto.DiId && x.PriceName == dto.PriceName && x.Id != grp_Decrease.Id)
|
|
|
- .Select((x, a) => new
|
|
|
- {
|
|
|
- x.FeeTotal,
|
|
|
- x.Currency,
|
|
|
- a.DayRate,
|
|
|
- a.RMBPrice,
|
|
|
- x.DiId,
|
|
|
- x.PriceName,
|
|
|
- x.Price,
|
|
|
- x.Quantity,
|
|
|
- })
|
|
|
- .ToList();
|
|
|
-
|
|
|
- if (true)
|
|
|
- {
|
|
|
- //币种全转换为人民币
|
|
|
- var rate = teamRates.Where(it => it.CurrencyId == grp_Decrease.Currency).FirstOrDefault();
|
|
|
- if (rate != null)
|
|
|
- {
|
|
|
- grp_Decrease.FeeTotal *= rate.Rate;
|
|
|
- }
|
|
|
+ var data = new { ccpId = grp_CreditCardPayment.Id, sign = 2, dataId = grp_Decrease.Id, recheck };
|
|
|
|
|
|
- var ConferenceAffairsCostFeeTotal = 0.00M;
|
|
|
- ConferenceAffairsCostFeeTotal = find.Count * find.CostPrice * find.Rate;
|
|
|
+ return new JsonView() { Code = 200, Msg = "修改成功!", Data = data };
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- var histyPriceValue = histyPrice.Sum(x => x.FeeTotal * x.DayRate);
|
|
|
- if (ConferenceAffairsCostFeeTotal > histyPriceValue)
|
|
|
- {
|
|
|
- isAuto = ConferenceAffairsCostFeeTotal - histyPriceValue >= grp_Decrease.FeeTotal;
|
|
|
- }
|
|
|
+ RollbackTran();
|
|
|
+ return new JsonView() { Code = 400, Msg = MsgTips.Fail };
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
- }
|
|
|
+ /// <summary>
|
|
|
+ /// 会务成本自动审核
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="paymentInfo"></param>
|
|
|
+ /// <param name="teamRates"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private async Task<(bool isAudit, bool isRecheck)> AutoAuditConferenceCostAsync(Grp_DecreasePayments paymentInfo, List<TeamRateDescAddCurrencyIdView> teamRates)
|
|
|
+ {
|
|
|
+ var hwids = _sqlSugar.Queryable<Sys_SetData>()
|
|
|
+ .Where(x => x.IsDel == 0 && x.STid == 10 && x.Name.Contains("会务活动"))
|
|
|
+ .Select(x => x.Id)
|
|
|
+ .ToList();
|
|
|
|
|
|
- if (isAuto)
|
|
|
- {
|
|
|
+ var groupTypeIsTrue = _sqlSugar.Queryable<Grp_DelegationInfo>()
|
|
|
+ .Where(x => x.Id == paymentInfo.DiId && x.IsDel == 0)
|
|
|
+ .Any(x => hwids.Contains(x.TeamDid));
|
|
|
|
|
|
- var execCount = _sqlSugar.Updateable<Grp_CreditCardPayment>()
|
|
|
- .SetColumns(a => new Grp_CreditCardPayment
|
|
|
- {
|
|
|
- IsAuditGM = 3, //自动审核通过
|
|
|
- AuditGMOperate = 4,
|
|
|
- AuditGMDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
|
|
|
- })
|
|
|
- .Where(a => a.CId == grp_Decrease.Id && a.CTable == 98 && a.DIId == grp_Decrease.DiId)
|
|
|
- .ExecuteCommand();
|
|
|
- recheck = false;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ if (groupTypeIsTrue)
|
|
|
+ {
|
|
|
+ var main = _sqlSugar.Queryable<Grp_ConferenceAffairsCost>().First(x => x.Diid == paymentInfo.DiId && x.IsDel == 0);
|
|
|
|
|
|
- #endregion
|
|
|
+ if (main != null)
|
|
|
+ {
|
|
|
+ var chiArr = _sqlSugar.Queryable<Grp_ConferenceAffairsCostChild>()
|
|
|
+ .Where(x => x.Diid == paymentInfo.DiId && x.ConferenceAffairsCostId == main.Id && x.IsDel == 0)
|
|
|
+ .ToList();
|
|
|
+ var find = chiArr.FirstOrDefault(x => x.PriceName == paymentInfo.PriceName && x.ReviewStatus == 1);
|
|
|
+ var isAuto = false;
|
|
|
|
|
|
- CommitTran();
|
|
|
+ //存在已审的会务成本
|
|
|
+ if (find != null)
|
|
|
+ {
|
|
|
+ //检索历史金额
|
|
|
+ var histyPrice = _sqlSugar.Queryable<Grp_DecreasePayments>()
|
|
|
+ .LeftJoin<Grp_CreditCardPayment>((x, a) => a.IsDel == 0 && a.CTable == 98 && a.CId == x.Id)
|
|
|
+ .Where((x, a) => x.IsDel == 0 && x.DiId == paymentInfo.DiId && x.PriceName == paymentInfo.PriceName &&
|
|
|
+ !x.PaymentType.Contains("尾款") && x.Id != paymentInfo.Id)
|
|
|
+ .Select((x, a) => new
|
|
|
+ {
|
|
|
+ x.FeeTotal,
|
|
|
+ x.Currency,
|
|
|
+ a.DayRate,
|
|
|
+ a.RMBPrice,
|
|
|
+ x.DiId,
|
|
|
+ x.PriceName,
|
|
|
+ x.Price,
|
|
|
+ x.Quantity,
|
|
|
+ })
|
|
|
+ .ToList();
|
|
|
|
|
|
- var data = new { ccpId = grp_CreditCardPayment.Id, sign = 2, dataId = grp_Decrease.Id, recheck };
|
|
|
+ //币种全转换为人民币
|
|
|
+ var rate = teamRates.Where(it => it.CurrencyId == paymentInfo.Currency).FirstOrDefault();
|
|
|
+ if (rate != null)
|
|
|
+ {
|
|
|
+ paymentInfo.FeeTotal *= rate.Rate;
|
|
|
+ }
|
|
|
|
|
|
- return new JsonView() { Code = 200, Msg = "修改成功!", Data = data };
|
|
|
+ var ConferenceAffairsCostFeeTotal = 0.00M;
|
|
|
+ ConferenceAffairsCostFeeTotal = find.Count * find.CostPrice * find.Rate;
|
|
|
+
|
|
|
+ var histyPriceValue = histyPrice.Sum(x => x.FeeTotal * x.DayRate);
|
|
|
+ if (ConferenceAffairsCostFeeTotal > histyPriceValue)
|
|
|
+ {
|
|
|
+ isAuto = ConferenceAffairsCostFeeTotal - histyPriceValue >= paymentInfo.FeeTotal;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isAuto)
|
|
|
+ {
|
|
|
+ var execCount = _sqlSugar.Updateable<Grp_CreditCardPayment>()
|
|
|
+ .SetColumns(a => new Grp_CreditCardPayment
|
|
|
+ {
|
|
|
+ IsAuditGM = 3, //自动审核通过
|
|
|
+ AuditGMOperate = 4,
|
|
|
+ AuditGMDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
|
|
|
+ })
|
|
|
+ .Where(a => a.CId == paymentInfo.Id && a.CTable == 98 && a.DIId == paymentInfo.DiId)
|
|
|
+ .ExecuteCommand();
|
|
|
+
|
|
|
+ // 处理尾款审核
|
|
|
+ var balanceAuditInfo = _sqlSugar.Queryable<Grp_DecreasePayments>()
|
|
|
+ .Where(x => x.DiId == paymentInfo.DiId && x.IsDel == 0 && x.PriceName == paymentInfo.PriceName && x.PaymentType.Contains("尾款"))
|
|
|
+ .First();
|
|
|
+ if (balanceAuditInfo != null)
|
|
|
+ {
|
|
|
+ var balanceAudit = _sqlSugar.Updateable<Grp_CreditCardPayment>()
|
|
|
+ .SetColumns(a => new Grp_CreditCardPayment
|
|
|
+ {
|
|
|
+ IsAuditGM = 3, //自动审核通过
|
|
|
+ AuditGMOperate = 4,
|
|
|
+ AuditGMDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
|
|
|
+ })
|
|
|
+ .Where(a => a.CId == balanceAuditInfo.Id && a.CTable == 98 && a.DIId == balanceAuditInfo.DiId)
|
|
|
+ .ExecuteCommand();
|
|
|
+ }
|
|
|
+ return (true, false);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- RollbackTran();
|
|
|
- return new JsonView() { Code = 400, Msg = MsgTips.Fail };
|
|
|
+ return (false,true);
|
|
|
}
|
|
|
|
|
|
public async Task<Result> PostGroupNameAndEasy(DecreasePaymentsDto dto)
|
|
|
@@ -733,7 +993,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
#region 团组下拉框
|
|
|
|
|
|
|
|
|
- List<Grp_GroupsTaskAssignment> grp_GroupsTaskAssignment = Query<Grp_GroupsTaskAssignment>(a => a.IsDel == 0 && a.UId == dto.UserId && a.CTId == dto.CTId).ToList();
|
|
|
+ var grp_GroupsTaskAssignment = Query<Grp_GroupsTaskAssignment>(a => a.IsDel == 0 && a.UId == dto.UserId && a.CTId == dto.CTId).ToList();
|
|
|
|
|
|
string DiId = "";
|
|
|
foreach (var item in grp_GroupsTaskAssignment)
|
|
|
@@ -750,7 +1010,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
}
|
|
|
|
|
|
string sql = string.Format(@"select Id,TourCode,TeamName,ClientName,VisitStartDate,VisitEndDate,VisitCountry,VisitDays,VisitPNumber from Grp_DelegationInfo where Id in({0}) and IsDel={1}", DiId, 0);
|
|
|
- List<DelegationEasyView> grp_Delegations = _sqlSugar.SqlQueryable<DelegationEasyView>(sql).ToList();
|
|
|
+ var grp_Delegations = _sqlSugar.SqlQueryable<DelegationEasyView>(sql).ToList();
|
|
|
if (grp_Delegations.Count != 0)
|
|
|
{
|
|
|
int count = grp_Delegations.Count;
|
|
|
@@ -758,7 +1018,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
if (totalPage == 0) totalPage = 1;
|
|
|
else totalPage = (int)Math.Ceiling((double)totalPage);
|
|
|
|
|
|
- List<DelegationEasyView> delegationEasyViews = new List<DelegationEasyView>();
|
|
|
+ var delegationEasyViews = new List<DelegationEasyView>();
|
|
|
for (int i = 0; i < dto.PageSize; i++)
|
|
|
{
|
|
|
var RowIndex = i + (dto.PageIndex - 1) * dto.PageSize;
|
|
|
@@ -790,7 +1050,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
return result = new Result() { Code = -2, Msg = "程序错误" };
|
|
|
- throw;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -817,6 +1076,9 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
dp.Price,
|
|
|
dp.Quantity,
|
|
|
dp.FeeTotal,
|
|
|
+ dp.PaymentType,
|
|
|
+ dp.PaymentPercent,
|
|
|
+ dp.ActualPaymentAmount,
|
|
|
dp.Currency,
|
|
|
dp.FilePath,
|
|
|
dp.OTAOrderNo,
|