|
@@ -2,6 +2,7 @@
|
|
|
using Newtonsoft.Json.Serialization;
|
|
|
using OASystem.API.OAMethodLib;
|
|
|
using OASystem.Domain.Dtos.Groups;
|
|
|
+using OASystem.Domain.Entities.Business;
|
|
|
using OASystem.Domain.Entities.Groups;
|
|
|
using OASystem.Domain.ViewModels.Groups;
|
|
|
using OASystem.Infrastructure.Repositories.Groups;
|
|
@@ -396,7 +397,7 @@ namespace OASystem.API.Controllers
|
|
|
{
|
|
|
return Ok(JsonView(false, groupData.Msg));
|
|
|
}
|
|
|
- return Ok(JsonView(true,groupData.Msg,groupData.Data));
|
|
|
+ return Ok(JsonView(true, groupData.Msg, groupData.Data));
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -435,6 +436,261 @@ namespace OASystem.API.Controllers
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
+ #region 团组费用审核
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取团组费用审核
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="paras">参数Json字符串</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> PostSearchGrpCreditCardPayment(Search_GrpCreditCardPaymentDto _dto)
|
|
|
+ {
|
|
|
+ if (_dto.DiId < 1)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "团组Id为空"));
|
|
|
+ }
|
|
|
+ Grp_CreditCardPaymentView _view = new Grp_CreditCardPaymentView();
|
|
|
+
|
|
|
+ #region 团组基本信息
|
|
|
+
|
|
|
+ Grp_DelegationInfo _delegation = _groupRepository.Query<Grp_DelegationInfo>(s => s.Id == _dto.DiId).First();
|
|
|
+ if (_delegation == null)
|
|
|
+ {
|
|
|
+ _view.ClientName = _delegation.ClientName;
|
|
|
+ _view.DiId = _dto.DiId;
|
|
|
+ _view.TeamName = _delegation.TeamName;
|
|
|
+ _view.VisitCountry = _delegation.VisitCountry;
|
|
|
+ _view.VisitDate = _delegation.VisitStartDate.ToString("yyyy-MM-dd") + " ~ " + _delegation.VisitEndDate.ToString("yyyy-MM-dd");
|
|
|
+ _view.VisitDays = _delegation.VisitDays;
|
|
|
+ _view.VisitPNumber = _delegation.VisitPNumber;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "团组Id为空"));
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 费用清单
|
|
|
+
|
|
|
+ //缺少IF的语法糖 CTable
|
|
|
+ List<Grp_CreditCardPayment> entityList = _groupRepository
|
|
|
+ .Query<Grp_CreditCardPayment>(s => s.DIId == _dto.DiId && s.CTable == _dto.Label && s.IsAuditGM == _dto.AuditStatus && s.IsDel == 0 && s.CreateUserId > 0)
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ List<Grp_CreditCardPaymentDetailView> detailList = new List<Grp_CreditCardPaymentDetailView>();
|
|
|
+ decimal CNY = 0;
|
|
|
+ decimal PayCNY = 0;
|
|
|
+ decimal BalanceCNY = 0;
|
|
|
+ decimal YSFYCNY = 0;
|
|
|
+
|
|
|
+ decimal USD = 0;
|
|
|
+ decimal PayUSD = 0;
|
|
|
+ decimal BalanceUSD = 0;
|
|
|
+ decimal YSFYUSD = 0;
|
|
|
+
|
|
|
+ decimal EUR = 0;
|
|
|
+ decimal PayEUR = 0;
|
|
|
+ decimal BalanceEUR = 0;
|
|
|
+ decimal YSFYEUR = 0;
|
|
|
+
|
|
|
+ foreach (var entity in entityList)
|
|
|
+ {
|
|
|
+ Grp_CreditCardPaymentDetailView _detail = new Grp_CreditCardPaymentDetailView();
|
|
|
+
|
|
|
+ if (entity.CTable != 85) continue;
|
|
|
+
|
|
|
+ /*
|
|
|
+ * Bus名称
|
|
|
+ */
|
|
|
+ _detail.BusName = "";
|
|
|
+
|
|
|
+ /*
|
|
|
+ *费用所属
|
|
|
+ */
|
|
|
+ switch (entity.CTable)
|
|
|
+ {
|
|
|
+ case 85:
|
|
|
+ Grp_AirTicketReservations jpRes = _groupRepository.Query<Grp_AirTicketReservations>(s => s.Id == entity.CId).First();
|
|
|
+ if (jpRes != null)
|
|
|
+ {
|
|
|
+ string FlightsDescription = jpRes.FlightsDescription;
|
|
|
+ string PriceDescription = jpRes.PriceDescription;
|
|
|
+ _detail.PriceMsgContent = "航班号:" + jpRes.FlightsCode + "<br/>城市A-B:" + jpRes.FlightsCity + "<br/>航班描述:" + FlightsDescription.Replace("\r\n", "<br />") + "<br/>" + "价格描述:" + PriceDescription;
|
|
|
+ _detail.PriceNameContent = "(" + jpRes.FlightsCode + ")";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 79:
|
|
|
+ _detail.BusName = "待增加";
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 费用模块
|
|
|
+ */
|
|
|
+ Sys_SetData sdPriceName = _groupRepository.Query<Sys_SetData>(s => s.Id == entity.CTable).First();
|
|
|
+ if (sdPriceName != null)
|
|
|
+ {
|
|
|
+ _detail.PriceName = sdPriceName.Name;
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 应付款金额
|
|
|
+ */
|
|
|
+ Sys_SetData sdPaymentCurrency_WaitPay = _groupRepository.Query<Sys_SetData>(s => s.Id == entity.PaymentCurrency).First();
|
|
|
+ string PaymentCurrency_WaitPay = "Unknown";
|
|
|
+ if (sdPaymentCurrency_WaitPay != null)
|
|
|
+ {
|
|
|
+ PaymentCurrency_WaitPay = sdPaymentCurrency_WaitPay.Name;
|
|
|
+ }
|
|
|
+ _detail.WaitPay = entity.PayMoney.ToString("#0.00") + " " + PaymentCurrency_WaitPay;
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 此次付款金额
|
|
|
+ */
|
|
|
+ decimal CurrPayStr = 0;
|
|
|
+ if (entity.PayPercentage == 0)
|
|
|
+ {
|
|
|
+ if (entity.PayThenMoney != 0)
|
|
|
+ CurrPayStr = entity.PayThenMoney * decimal.Parse(entity.DayRate);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CurrPayStr = entity.PayMoney * (decimal.Parse(entity.PayPercentage.ToString("#0.00")) / 100 * decimal.Parse(entity.DayRate));
|
|
|
+ }
|
|
|
+ _detail.CurrPay = CurrPayStr.ToString("#0.00") + " CNY";
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 剩余尾款
|
|
|
+ */
|
|
|
+ decimal BalanceStr = 0;
|
|
|
+ if (entity.PayMoney - (CurrPayStr / decimal.Parse(entity.DayRate)) < 0.01M)
|
|
|
+ BalanceStr = 0;
|
|
|
+ else
|
|
|
+ BalanceStr = (entity.PayMoney - CurrPayStr / decimal.Parse(entity.DayRate));
|
|
|
+
|
|
|
+ _detail.Balance = BalanceStr.ToString("#0.00") + " " + PaymentCurrency_WaitPay;
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 申请人
|
|
|
+ */
|
|
|
+ string operatorName = "无";
|
|
|
+ Sys_Users _opUser = _groupRepository.Query<Sys_Users>(s => s.CreateUserId == entity.CreateUserId).First();
|
|
|
+ if (_opUser != null)
|
|
|
+ {
|
|
|
+ operatorName = _opUser.CnName;
|
|
|
+ }
|
|
|
+ _detail.OperatorName = operatorName;
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 审核人
|
|
|
+ */
|
|
|
+ string auditOperatorName = "Unknown";
|
|
|
+ if (entity.AuditGMOperate == 0)
|
|
|
+ auditOperatorName = "无";
|
|
|
+ else if (entity.AuditGMOperate == 4)
|
|
|
+ auditOperatorName = "自动审核";
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Sys_Users _adUser = _groupRepository.Query<Sys_Users>(s => s.CreateUserId == entity.AuditGMOperate).First();
|
|
|
+ if (_adUser != null)
|
|
|
+ {
|
|
|
+ auditOperatorName = _adUser.CnName;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _detail.AuditOperatorName = auditOperatorName;
|
|
|
+
|
|
|
+ /*
|
|
|
+ *
|
|
|
+ * *超预算比例
|
|
|
+ */
|
|
|
+ string overBudgetStr = "";
|
|
|
+
|
|
|
+ if (entity.ExceedBudget == -1)
|
|
|
+ overBudgetStr = sdPriceName.Name + "尚无预算";
|
|
|
+ else if (entity.ExceedBudget == 0)
|
|
|
+ overBudgetStr = "未超预算";
|
|
|
+ else
|
|
|
+ overBudgetStr = entity.ExceedBudget.ToString("P");
|
|
|
+ _detail.OverBudget = overBudgetStr;
|
|
|
+
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 费用总计
|
|
|
+ */
|
|
|
+
|
|
|
+
|
|
|
+ if (entity.PaymentCurrency == 48)
|
|
|
+ {
|
|
|
+ CNY += entity.PayMoney;
|
|
|
+ PayCNY += CurrPayStr;
|
|
|
+ BalanceCNY += BalanceStr;
|
|
|
+ YSFYCNY += CurrPayStr;
|
|
|
+ }
|
|
|
+ if (entity.PaymentCurrency == 49)
|
|
|
+ {
|
|
|
+ USD += entity.PayMoney;
|
|
|
+ PayUSD += CurrPayStr;
|
|
|
+ BalanceUSD += BalanceStr;
|
|
|
+ YSFYUSD += CurrPayStr;
|
|
|
+ }
|
|
|
+ if (entity.PaymentCurrency == 51)
|
|
|
+ {
|
|
|
+ EUR += entity.PayMoney;
|
|
|
+ PayEUR += CurrPayStr;
|
|
|
+ BalanceEUR += BalanceStr;
|
|
|
+ YSFYEUR += CurrPayStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ _detail.TotalStr1 = string.Format(@"应付款总金额:{0}CNY | {1}USD | {2}EUR", CNY, USD, EUR);
|
|
|
+ _detail.TotalStr2 = string.Format(@"此次付款总金额:{0}CNY | {1}USD | {2}EUR", PayCNY, PayUSD, PayEUR);
|
|
|
+ _detail.TotalStr3 = string.Format(@"目前剩余尾款总金额:{0}CNY | {1}USD | {2}EUR", BalanceCNY, BalanceUSD, BalanceEUR);
|
|
|
+ _detail.TotalStr4 = string.Format(@"已审费用总额:{0}CNY | {1}USD | {2}EUR", YSFYCNY, YSFYUSD, YSFYEUR);
|
|
|
+
|
|
|
+
|
|
|
+ detailList.Add(_detail);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+ _view.DetailList = new List<Grp_CreditCardPaymentDetailView>(detailList);
|
|
|
+
|
|
|
+ return Ok(JsonView(_view));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取团组费用审核
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="paras">参数Json字符串</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> PostAuditGrpCreditCardPayment(Edit_GrpCreditCardPaymentDto _dto)
|
|
|
+ {
|
|
|
+ Grp_CreditCardPayment _detail = _mapper.Map<Grp_CreditCardPayment>(_dto);
|
|
|
+ DateTime dtNow = DateTime.Now;
|
|
|
+ var result = await _grpScheduleRep._sqlSugar.Updateable<Grp_CreditCardPayment>()
|
|
|
+ .SetColumns(it => it.IsAuditGM == _dto.AuditCode)
|
|
|
+ .SetColumns(it => it.AuditGMOperate == _dto.User)
|
|
|
+ .SetColumns(it => it.AuditGMDate == dtNow)
|
|
|
+ .Where(s => s.Id == _dto.CreditId)
|
|
|
+ .ExecuteCommandAsync();
|
|
|
+ if (result > 0)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(true, "保存成功!"));
|
|
|
+ }
|
|
|
+
|
|
|
+ return Ok(JsonView(false, "保存失败!"));
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
#region 机票费用录入
|
|
|
/// <summary>
|
|
|
/// 机票录入当前登录人可操作团组
|