|
@@ -12,6 +12,7 @@ using OASystem.Infrastructure.Repositories.Groups;
|
|
|
using static OpenAI.GPT3.ObjectModels.SharedModels.IOpenAiModels;
|
|
|
using System;
|
|
|
using OASystem.Domain.Entities.Customer;
|
|
|
+using System.Collections.Generic;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
|
{
|
|
@@ -188,15 +189,30 @@ namespace OASystem.API.Controllers
|
|
|
Where pr.IsDel = 0 and pr.Diid = {0}", _dto.DiId);
|
|
|
List<Gsd_ProceedsReceivedView> _prViews = await _sqlSugar.SqlQueryable<Gsd_ProceedsReceivedView>(_prSql).ToListAsync();
|
|
|
prTotalAmount = _prViews.Sum(it => it.Price);
|
|
|
- _giView.ProceedsReceiveds = _prViews;
|
|
|
+ _giView.ProceedsReceivedViews = _prViews;
|
|
|
_giView.ProceedsReceivedStr = string.Format(@"已收款合计:{0} CNY(人名币)", prTotalAmount.ConvertToDecimal1().ToString("#0.00"));
|
|
|
|
|
|
|
|
|
/*
|
|
|
* 超支费用
|
|
|
- * 未挪表
|
|
|
*/
|
|
|
-
|
|
|
+ decimal exTotalAmount = 0.00M;
|
|
|
+ string _ecSql = string.Format(@"Select gec.Id As GECId,gec.DiId As GECDiId,gec.PriceName,ccp.PayMoney,sd1.Name As PaymentCurrency,
|
|
|
+ ccp.RMBPrice As CNYPrice,ccp.DayRate,ccp.Payee,ccp.OrbitalPrivateTransfer,sd2.Name As PayWay,
|
|
|
+ sd3.Name As CardType,ccp.IsPay,u.CnName As Applicant
|
|
|
+ From Fin_GroupExtraCost gec
|
|
|
+ Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 81 And 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 gec.IsDel = 0 And ccp.IsAuditGM = 1 And ccp.IsPay = 1 And gec.DiId = {0}",_dto.DiId);
|
|
|
+
|
|
|
+ List<Gsd_ExtraCostsView> _ExtraCostsViews = await _sqlSugar.SqlQueryable<Gsd_ExtraCostsView>(_ecSql).ToListAsync();
|
|
|
+ exTotalAmount = _ExtraCostsViews.Sum(it => it.CNYPrice);
|
|
|
+
|
|
|
+ _giView.ExtraCostsViews = _ExtraCostsViews;
|
|
|
+ _giView.ExtraCostsStr = string.Format(@"人名币总费用:{0} CNY", exTotalAmount.ConvertToDecimal1());
|
|
|
/*
|
|
|
* 收款退还
|
|
|
*/
|
|
@@ -214,8 +230,6 @@ namespace OASystem.API.Controllers
|
|
|
And prom.DiId = {0}", _dto.DiId);
|
|
|
var _promDatas = await _sqlSugar.SqlQueryable<Gsd_PaymentRefundAndOtherMoneyDataSource1View>(_ropSql).ToListAsync();
|
|
|
|
|
|
-
|
|
|
-
|
|
|
foreach (var ropItem in _promDatas)
|
|
|
{
|
|
|
string thisCueencyCode = "Unknown";
|
|
@@ -264,7 +278,7 @@ namespace OASystem.API.Controllers
|
|
|
}
|
|
|
|
|
|
promTotalAmount = _promView.Sum(it => it.CNYPrice);
|
|
|
- _giView.PaymentRefundAndOtherMoneys = _promView;
|
|
|
+ _giView.PaymentRefundAndOtherMoneyViews = _promView;
|
|
|
_giView.PaymentRefundAndOtherMoneyStr = string.Format(@"人名币总费用:{0} CNY", promTotalAmount.ConvertToDecimal1().ToString("#0.00"));
|
|
|
|
|
|
decimal BalancePayment = frTotalAmount - prTotalAmount + promTotalAmount;
|
|
@@ -284,7 +298,7 @@ namespace OASystem.API.Controllers
|
|
|
hr.BreakfastPrice,sd4.Name As BreakfastCurrency,hr.Isoppay,hr.GovernmentRent,
|
|
|
sd5.Name As GovernmentRentCurrency,hr.CityTax,sd6.Name As CityTaxCurrency,
|
|
|
ccp.PayMoney,ccp.RMBPrice As CNYPrice,ccp.DayRate,ccp.Payee,ccp.OrbitalPrivateTransfer,
|
|
|
- sd2.Name As PayWay,sd3.Name As CardType,ccp.IsPay,u.CnName As OpName
|
|
|
+ sd2.Name As PayWay,sd3.Name As CardType,ccp.IsPay,u.CnName As Applicant
|
|
|
From Grp_HotelReservations hr
|
|
|
Left Join Grp_CreditCardPayment ccp On hr.Id = ccp.CId
|
|
|
Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id
|
|
@@ -308,12 +322,9 @@ namespace OASystem.API.Controllers
|
|
|
|
|
|
string currencyRateStr = "";
|
|
|
List<string> currencys = new List<string>();
|
|
|
- if (!string.IsNullOrEmpty(item.PaymentCurrency)) currencys.Add(item.PaymentCurrency);
|
|
|
-
|
|
|
if (!string.IsNullOrEmpty(item.BreakfastCurrency)) currencys.Add(item.BreakfastCurrency);
|
|
|
-
|
|
|
if (!string.IsNullOrEmpty(item.GovernmentRentCurrency)) currencys.Add(item.GovernmentRentCurrency);
|
|
|
-
|
|
|
+ if (!string.IsNullOrEmpty(item.CityTaxCurrency)) currencys.Add(item.CityTaxCurrency);
|
|
|
if (!string.IsNullOrEmpty(item.PaymentCurrency)) currencys.Add(item.PaymentCurrency);
|
|
|
|
|
|
currencyRateStr = await GeneralMethod.PostGroupRateByCTableAndCurrency(teamRateData, 76, currencys);
|
|
@@ -334,7 +345,7 @@ namespace OASystem.API.Controllers
|
|
|
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.RMBPrice As CNYPrice,ccp.Payee,ccp.AuditGMDate,
|
|
|
- ccp.OrbitalPrivateTransfer,sd1.Name As PayWay,ccp.IsPay,u.CnName As OpName
|
|
|
+ ccp.OrbitalPrivateTransfer,sd1.Name As PayWay,ccp.IsPay,u.CnName As Applicant
|
|
|
From Grp_CarTouristGuideGroundReservations ctggr
|
|
|
Left Join ( Select cggrc.CTGGRId,sd1.Name As PriceName,cggrc.Price,sd2.Name As PriceCurrency,
|
|
|
cggrc.PriceContent
|
|
@@ -375,7 +386,7 @@ namespace OASystem.API.Controllers
|
|
|
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.RMBPrice As CNYPrice,ccp.DayRate,ccp.Payee,ccp.AuditGMDate,
|
|
|
- ccp.OrbitalPrivateTransfer,sd2.Name As PayWay,sd3.Name As CardType,ccp.IsPay,u.CnName As OpName
|
|
|
+ ccp.OrbitalPrivateTransfer,sd2.Name As PayWay,sd3.Name As CardType,ccp.IsPay,u.CnName As Applicant
|
|
|
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
|
|
@@ -453,7 +464,7 @@ namespace OASystem.API.Controllers
|
|
|
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 OpName
|
|
|
+ sd3.Name As CardTypeName,ccp.IsPay,u.CnName As Applicant
|
|
|
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
|
|
@@ -479,15 +490,61 @@ namespace OASystem.API.Controllers
|
|
|
_geView.GroupVisaFeeStr = string.Format(@"人名币总费用:{0} CNY", VisaCNYTotalPirce.ConvertToDecimal1());
|
|
|
#endregion
|
|
|
|
|
|
- #region 邀请/公务活动费用 InvitationalService
|
|
|
+ #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.Payee,ccp.AuditGMDate,
|
|
|
+ ccp.OrbitalPrivateTransfer,sd2.Name As PayWay,ccp.IsPay,u.CnName As Applicant
|
|
|
+ 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 And ccp.IsAuditGM = 1 And ccp.IsPay = 1 And ioa.Diid = {0}",_dto.DiId);
|
|
|
+
|
|
|
+ groupInvitationalFeeViews = await _sqlSugar.SqlQueryable<GroupInvitationalFeeView>(groupInvitationalFeeSql).ToListAsync();
|
|
|
+
|
|
|
+ decimal InvitationalCNYTotalPrice = 0.00M;
|
|
|
+
|
|
|
+ foreach (var item in groupInvitationalFeeViews)
|
|
|
+ {
|
|
|
+ InvitationalCNYTotalPrice += item.CNYPrice;
|
|
|
+
|
|
|
+ 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);
|
|
|
#endregion
|
|
|
|
|
|
- #region 保险费用 insurance
|
|
|
+ #region 保险费用
|
|
|
List<GroupInsuranceFeeView> groupInsuranceFeeViews = new List<GroupInsuranceFeeView>();
|
|
|
string groupInsuranceFeeSql = string.Format(@"Select ic.Id As InsuranceId,ic.Diid As InsuranceDiId,ClientName,ccp.PayMoney,ccp.RMBPrice As CNYPrice,
|
|
|
sd1.Name As PayMoneyCurrency,ccp.Payee,ccp.AuditGMDate,ccp.OrbitalPrivateTransfer,
|
|
|
- sd2.Name As PayWay,ccp.IsPay,u.CnName As OpName
|
|
|
+ sd2.Name As PayWay,ccp.IsPay,u.CnName As Applicant
|
|
|
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
|
|
@@ -496,10 +553,10 @@ namespace OASystem.API.Controllers
|
|
|
Where ic.IsDel = 0 And ccp.IsAuditGM = 1 And ccp.IsPay = 1 And ic.DiId = {0}", _dto.DiId);
|
|
|
groupInsuranceFeeViews = await _sqlSugar.SqlQueryable<GroupInsuranceFeeView>(groupInsuranceFeeSql).ToListAsync();
|
|
|
|
|
|
- decimal insuranceCNYTotalPrice = 0.00M;
|
|
|
+ decimal InsuranceCNYTotalPrice = 0.00M;
|
|
|
foreach (var item in groupInsuranceFeeViews)
|
|
|
{
|
|
|
- insuranceCNYTotalPrice += item.CNYPrice;
|
|
|
+ InsuranceCNYTotalPrice += item.CNYPrice;
|
|
|
|
|
|
if (!string.IsNullOrEmpty(item.AuditGMDate))
|
|
|
{
|
|
@@ -507,17 +564,50 @@ namespace OASystem.API.Controllers
|
|
|
}
|
|
|
}
|
|
|
_geView.GroupInsuranceFeeViews = groupInsuranceFeeViews;
|
|
|
- _geView.GroupInsuranceFeeStr = string.Format(@"人名币总费用:{0} CNY", insuranceCNYTotalPrice);
|
|
|
+ _geView.GroupInsuranceFeeStr = string.Format(@"人名币总费用:{0} CNY", InsuranceCNYTotalPrice);
|
|
|
#endregion
|
|
|
|
|
|
- #region 其他款项费用 OtherMoney
|
|
|
+ #region 其他款项费用
|
|
|
+ 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.RMBPrice As CNYPrice,ccp.DayRate,ccp.Payee,ccp.AuditGMDate,ccp.OrbitalPrivateTransfer,
|
|
|
+ sd2.Name As PayWay,ccp.IsPay,u.CnName As Applicant
|
|
|
+ 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.IsAuditGM = 1 And ccp.IsPay = 1 And dp.Diid = {0}",_dto.DiId);
|
|
|
+ groupDecreaseFeeViews = await _sqlSugar.SqlQueryable<GroupDecreaseFeeView>(groupDecreaseFeeSql).ToListAsync();
|
|
|
+ decimal DecreaseCNYTotalPrice = 0.00M;
|
|
|
+ foreach (var item in groupDecreaseFeeViews)
|
|
|
+ {
|
|
|
+ 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);
|
|
|
#endregion
|
|
|
|
|
|
_view.GroupExpenditure = _geView;
|
|
|
#endregion
|
|
|
|
|
|
-
|
|
|
+ decimal _totalExpenditure = 0.00M; //总支出
|
|
|
+ decimal _amountReceivable = 0.00M; //应收金额
|
|
|
+ decimal _amountReceived = 0.00M; //已收金额
|
|
|
+ decimal _profit = 0.00M; //利润
|
|
|
+ _totalExpenditure = HotelCNYTotalPrice + CTGGRCNYTotalPrice + AirCNYTotalPrice + VisaCNYTotalPirce + InvitationalCNYTotalPrice +
|
|
|
+ InsuranceCNYTotalPrice + DecreaseCNYTotalPrice + exTotalAmount;
|
|
|
+ _amountReceivable = frTotalAmount;
|
|
|
+ _amountReceived = prTotalAmount;
|
|
|
+ _profit = _amountReceived - _totalExpenditure;
|
|
|
+ _view.FeeTotalStr = string.Format(@"当前总支出:{0} CNY\t应收金额:{1} CNY\t已收金额:{2} CNY\t利润(收入-支出):{3} CNY\t",
|
|
|
+ _totalExpenditure, _amountReceivable, _amountReceived, _profit);
|
|
|
return Ok(JsonView(true, "查询成功!", _view));
|
|
|
}
|
|
|
else
|