|
@@ -34,6 +34,7 @@ using System.Globalization;
|
|
|
using static QRCoder.PayloadGenerator;
|
|
|
using Bookmark = Aspose.Words.Bookmark;
|
|
|
using Aspose.Words.Fields;
|
|
|
+using NPOI.POIFS.FileSystem;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
|
{
|
|
@@ -940,22 +941,26 @@ namespace OASystem.API.Controllers
|
|
|
.Where(exp.ToExpression())
|
|
|
.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;
|
|
|
+ List<CreditCardPaymentCurrencyPriceItem> ccpCurrencyPrices = new List<CreditCardPaymentCurrencyPriceItem>();
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 币种信息
|
|
|
+ */
|
|
|
+
|
|
|
+ var currencyItems = await _groupRepository.Query<Sys_SetData>(s => s.STid == 66 && s.IsDel == 0).ToListAsync();
|
|
|
|
|
|
- decimal EUR = 0;
|
|
|
- decimal PayEUR = 0;
|
|
|
- decimal BalanceEUR = 0;
|
|
|
- decimal YSFYEUR = 0;
|
|
|
+ /*
|
|
|
+ * 用户信息
|
|
|
+ */
|
|
|
|
|
|
+ var userItems = await _groupRepository.Query<Sys_Users>(s => s.IsDel == 0).ToListAsync();
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 处理详情数据
|
|
|
+ */
|
|
|
foreach (var entity in entityList)
|
|
|
{
|
|
|
Grp_CreditCardPaymentDetailView _detail = new Grp_CreditCardPaymentDetailView();
|
|
@@ -1009,13 +1014,13 @@ namespace OASystem.API.Controllers
|
|
|
/*
|
|
|
* 应付款金额
|
|
|
*/
|
|
|
- Sys_SetData sdPaymentCurrency_WaitPay = _groupRepository.Query<Sys_SetData>(s => s.Id == entity.PaymentCurrency).First();
|
|
|
+ Sys_SetData sdPaymentCurrency_WaitPay = currencyItems.Where(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;
|
|
|
+ _detail.WaitPay = entity.PayMoney.ConvertToDecimal1() + " " + PaymentCurrency_WaitPay;
|
|
|
|
|
|
/*
|
|
|
* 此次付款金额
|
|
@@ -1024,11 +1029,11 @@ namespace OASystem.API.Controllers
|
|
|
if (entity.PayPercentage == 0)
|
|
|
{
|
|
|
if (entity.PayThenMoney != 0)
|
|
|
- CurrPayStr = entity.PayThenMoney * entity.DayRate;
|
|
|
+ CurrPayStr = (entity.PayThenMoney * entity.DayRate).ConvertToDecimal1();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- CurrPayStr = entity.PayMoney * (decimal.Parse(entity.PayPercentage.ToString("#0.00")) / 100 * entity.DayRate);
|
|
|
+ CurrPayStr = (entity.PayMoney * (decimal.Parse(entity.PayPercentage.ToString("#0.00")) / 100 * entity.DayRate)).ConvertToDecimal1();
|
|
|
}
|
|
|
_detail.CurrPay = CurrPayStr.ToString("#0.00") + " CNY";
|
|
|
|
|
@@ -1039,15 +1044,15 @@ namespace OASystem.API.Controllers
|
|
|
if (entity.PayMoney - (CurrPayStr / entity.DayRate) < 0.01M)
|
|
|
BalanceStr = 0;
|
|
|
else
|
|
|
- BalanceStr = (entity.PayMoney - CurrPayStr / entity.DayRate);
|
|
|
+ BalanceStr = (entity.PayMoney - CurrPayStr / entity.DayRate).ConvertToDecimal1();
|
|
|
|
|
|
_detail.Balance = BalanceStr.ToString("#0.00") + " " + PaymentCurrency_WaitPay;
|
|
|
|
|
|
/*
|
|
|
* 申请人
|
|
|
*/
|
|
|
- string operatorName = "无";
|
|
|
- Sys_Users _opUser = _groupRepository.Query<Sys_Users>(s => s.Id == entity.CreateUserId).First();
|
|
|
+ string operatorName = " - ";
|
|
|
+ Sys_Users _opUser = userItems.Where(s => s.Id == entity.CreateUserId).First();
|
|
|
if (_opUser != null)
|
|
|
{
|
|
|
operatorName = _opUser.CnName;
|
|
@@ -1059,12 +1064,12 @@ namespace OASystem.API.Controllers
|
|
|
*/
|
|
|
string auditOperatorName = "Unknown";
|
|
|
if (entity.AuditGMOperate == 0)
|
|
|
- auditOperatorName = "无";
|
|
|
+ auditOperatorName = " - ";
|
|
|
else if (entity.AuditGMOperate == 4)
|
|
|
auditOperatorName = "自动审核";
|
|
|
else
|
|
|
{
|
|
|
- Sys_Users _adUser = _groupRepository.Query<Sys_Users>(s => s.Id == entity.AuditGMOperate).First();
|
|
|
+ Sys_Users _adUser = userItems.Where(s => s.Id == entity.AuditGMOperate).First();
|
|
|
if (_adUser != null)
|
|
|
{
|
|
|
auditOperatorName = _adUser.CnName;
|
|
@@ -1073,8 +1078,7 @@ namespace OASystem.API.Controllers
|
|
|
_detail.AuditOperatorName = auditOperatorName;
|
|
|
|
|
|
/*
|
|
|
- *
|
|
|
- * *超预算比例
|
|
|
+ * 超预算比例
|
|
|
*/
|
|
|
string overBudgetStr = "";
|
|
|
|
|
@@ -1090,41 +1094,69 @@ namespace OASystem.API.Controllers
|
|
|
/*
|
|
|
* 费用总计
|
|
|
*/
|
|
|
- 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)
|
|
|
+
|
|
|
+ ccpCurrencyPrices.Add(new CreditCardPaymentCurrencyPriceItem()
|
|
|
{
|
|
|
- EUR += entity.PayMoney;
|
|
|
- PayEUR += CurrPayStr;
|
|
|
- BalanceEUR += BalanceStr;
|
|
|
- YSFYEUR += CurrPayStr;
|
|
|
- }
|
|
|
+ CurrencyId = entity.PaymentCurrency,
|
|
|
+ CurrencyName = PaymentCurrency_WaitPay,
|
|
|
+ AmountPayable = entity.PayMoney,
|
|
|
+ ThisPayment = CurrPayStr,
|
|
|
+ BalancePayment = BalanceStr,
|
|
|
+ AuditedFunds = CurrPayStr
|
|
|
+ });
|
|
|
|
|
|
_detail.IsAuditGM = entity.IsAuditGM;
|
|
|
|
|
|
detailList.Add(_detail);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
_view.DetailList = new List<Grp_CreditCardPaymentDetailView>(detailList);
|
|
|
- _view.TotalStr1 = string.Format(@"应付款总金额:{0}CNY | {1}USD | {2}EUR", CNY, USD, EUR);
|
|
|
- _view.TotalStr2 = string.Format(@"此次付款总金额:{0}CNY | {1}USD | {2}EUR", PayCNY, PayUSD, PayEUR);
|
|
|
- _view.TotalStr3 = string.Format(@"目前剩余尾款总金额:{0}CNY | {1}USD | {2}EUR", BalanceCNY, BalanceUSD, BalanceEUR);
|
|
|
- _view.TotalStr4 = string.Format(@"已审费用总额:{0}CNY | {1}USD | {2}EUR", YSFYCNY, YSFYUSD, YSFYEUR);
|
|
|
+
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 下方描述处理
|
|
|
+ */
|
|
|
+
|
|
|
+ List<CreditCardPaymentCurrencyPriceItem> nonDuplicat = ccpCurrencyPrices.Where((x, i) => ccpCurrencyPrices.FindIndex(z => z.CurrencyId == x.CurrencyId) == i).ToList();//Lambda表达式去重
|
|
|
+
|
|
|
+ CreditCardPaymentCurrencyPriceItem ccpCurrencyPrice = nonDuplicat.Where(it => it.CurrencyId == 836).FirstOrDefault();
|
|
|
+ if (ccpCurrencyPrice != null)
|
|
|
+ {
|
|
|
+ int CNYIndex = nonDuplicat.IndexOf(ccpCurrencyPrice);
|
|
|
+ nonDuplicat.MoveItemAtIndexToFront(CNYIndex);
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ nonDuplicat.OrderBy(it => it.CurrencyId).ToList();
|
|
|
+ }
|
|
|
+ string amountPayableStr = string.Format(@"应付款总金额: ");
|
|
|
+ string thisPaymentStr = string.Format(@"此次付款总金额: ");
|
|
|
+ string balancePaymentStr = string.Format(@"目前剩余尾款总金额: ");
|
|
|
+ string auditedFundsStr = string.Format(@"已审费用总额: ");
|
|
|
+
|
|
|
+ foreach (var item in nonDuplicat)
|
|
|
+ {
|
|
|
+ var strs = ccpCurrencyPrices.Where(it => it.CurrencyId == item.CurrencyId).ToList();
|
|
|
+ if (strs.Count > 0)
|
|
|
+ {
|
|
|
+ decimal amountPayable = strs.Sum(it => it.AmountPayable);
|
|
|
+ decimal thisPayment = strs.Sum(it => it.ThisPayment);
|
|
|
+ decimal balancePayment = strs.Sum(it => it.BalancePayment);
|
|
|
+ decimal auditedFunds = strs.Sum(it => it.AuditedFunds);
|
|
|
+ amountPayableStr += string.Format(@"{0}{1} |", amountPayable.ToString("#0.00"), item.CurrencyName);
|
|
|
+ thisPaymentStr += string.Format(@"{0}{1} |", thisPayment.ToString("#0.00"), item.CurrencyName);
|
|
|
+ balancePaymentStr += string.Format(@"{0}{1} |", balancePayment.ToString("#0.00"), item.CurrencyName);
|
|
|
+ auditedFundsStr += string.Format(@"{0}{1} |", auditedFunds.ToString("#0.00"), item.CurrencyName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ _view.TotalStr1 = amountPayableStr.Substring(0, amountPayableStr.Length - 1);
|
|
|
+ _view.TotalStr2 = thisPaymentStr.Substring(0, thisPaymentStr.Length - 1);
|
|
|
+ _view.TotalStr3 = balancePaymentStr.Substring(0, balancePaymentStr.Length - 1);
|
|
|
+ _view.TotalStr4 = auditedFundsStr.Substring(0, auditedFundsStr.Length - 1);
|
|
|
|
|
|
|
|
|
var _view1 = new
|