Files
zszq-trs/YLErpDAL/Modules/ReportModule/SettlementReportModule/SettlementReportFotShanXiService.cs
T
张名锐 4449bd5824 feat(swap): 更新互换估值功能并优化数据模型
- 添加互换估值V1配置常量以支持新版本
- 将PeriodAmount和DividendAmount字段改为可空decimal类型
- 更新字段注释说明预付金利率和利息的计算方式
- 修改净额结算金额定义,排除期初和追加预付金本金
- 在报表服务中添加安全求和操作防止空值异常
- 增加多个汇总字段包括股息、保证金利息等统计
- 重构预付金处理逻辑,改用加权平均计算方式
- 新增加权保证金利率和利息计算辅助方法
- 调整前端表格列顺序,优化交易编号显示位置
- 更新数值格式化器以支持空值处理和精度控制
- 添加文档列顺序恢复功能确保表格一致性
2026-07-14 09:46:54 +08:00

535 lines
28 KiB
C#

using BaseOUDAL;
using OfficeOpenXml;
using OfficeOpenXml.Style;
using Org.BouncyCastle.Ocsp;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Web;
using YieldChain.Helpers;
using YLErp.BLL;
using YLErp.BLL.EodSettlement;
using YLErp.Configuration;
using YLErp.Core.Helpers;
using YLErp.DBModels;
using YLErp.Enums;
using YLErp.Helpers;
using YLErp.Model;
using YLErp.Modules.ClientModule;
using YLErp.Modules.DataCacheModule;
using YLErp.Modules.SwapModule;
using YLErp.Office;
using YLErp.QdpModule;
namespace YLErp.Modules.ReportModule.SettlementReportModule
{
/// <summary>
/// 山西固收结算报告
/// </summary>
public class SettlementReportFotShanXiService : YLBaseService
{
public SettlementReportFotShanXiService(OptUserInfo userInfo) : base(userInfo)
{
}
public ClientDingShiReport_ShanXi GetReportData(DingShiReportEmail emailData, IEnumerable<int> userAssetUnits, string template = "")
{
var report = new ClientDingShiReport_ShanXi() { ReportFrom = emailData.From, ReportEnd = emailData.To };
report.client = DataCacheProvider.GetClientDataSource().GetData(emailData.ClientId);
report.CurUserName = emailData.CurUserName;
report.OptUserInfo = this.UserInfo;
report.ClientBank = new ClientDBContext().bankcard.Where(x => x.ApprovalOrder < 1 && x.ClientId == emailData.ClientId && x.ValidState != "InValid").ToList();
var swapEodPositionService = new SwapEodPositionService(this);
#region 账户状况
if (emailData.SendContent.Contains("账户状况"))
{
var IsGap = false;
var IsOuter = false;
if (emailData.ReportType == "ClientBalanceGap")
{
IsGap = true;
}
if (emailData.ReportType == "GetOuterMargin")
{
IsOuter = true;
}
report.FundReportModel = GetFundReport(emailData,IsGap,IsOuter);
}
#endregion
if (emailData.SendContent.Contains("互换估值"))
{
var eodReq = new ClientSwapPositionRequest
{
ClientId = emailData.ClientId,
BookId = emailData.BookId,
ValueDate = emailData.To,
ValueDateFrom = emailData.From,
page = 1,
rows = 10000,
StructureType = "普通债券类收益互换"
};
report.EodSwapPositions = swapEodPositionService.SearchEodPositionList(eodReq).rows.ToList();
}
if (emailData.SendContent.Contains("互换持仓明细"))
{
var eodReq = new ClientSwapPositionRequest { ClientId = emailData.ClientId, ValueDate = emailData.To, ValueDateFrom = emailData.From, page = 1, rows = 10000 };
report.SwapPositions = swapEodPositionService.SearchPositionList(eodReq).rows.ToList();
}
if (emailData.SendContent.Contains("互换交易流水"))
{
var eodReq = new ClientSwapPositionRequest { ClientId = emailData.ClientId, ValueDate = emailData.To, ValueDateFrom = emailData.From, page = 1, rows = 10000 };
report.clientSwapPositions = new SwapFlowEventService(UserInfo).SearchPositionFlowEvent(eodReq).rows.ToList();
}
if (emailData.SendContent.Contains("资金明细"))
{
var eereq = new EntryExitReq() { ClientId = emailData.ClientId, HappenDateStart = emailData.From, HappenDateEnd = emailData.To, ParentFlag = emailData.ParentFlag };
report.ClientCashInCashOutExtendList = SearchListExtendOnly(eereq);
}
if (emailData.SendContent.Contains("质押记录"))
{
var productReq = new clientcashincashout_productReq() { ClientId = emailData.ClientId, ValueDate = emailData.To, ParentFlag = emailData.ParentFlag };
report.clientcashincashout_productLinq = SearchListOnlyForMarketReport(productReq);
}
//txt报告特殊处理用到
var desc = DBCacheManager.Single.GetStr(CacheTable.DingShiDesc, template: template);
if (string.IsNullOrWhiteSpace(desc))
{
desc = DBCacheManager.Single.GetStr(CacheTable.DingShiDesc);
}
var descList = Regex.Split(desc, "</p>", RegexOptions.IgnoreCase).Where(x => !string.IsNullOrWhiteSpace(x)).ToList();
var newDescList = new List<string>();
descList.ForEach(x =>
{
x = Regex.Replace(x, "<[^>]+>", "");
x = Regex.Replace(x, "&[^;]+;", "");
newDescList.Add(x);
});
report.downloadFilePath = emailData.DownloadFilePath;
report.descList = newDescList;
report.desc = desc;//string.Join("\n", newDescList);
if (string.IsNullOrWhiteSpace(emailData.Title))
{
emailData.Title = DBCacheManager.Single.GetStr(CacheTable.ClientBalanceReportTiltle, template: template);
}
report.Title = ReplaceWildcard(emailData.Title, report);
return report;
}
/// <summary>
/// 发送邮件
/// </summary>
/// <param name="emailData"></param>
/// <param name="report"></param>
/// <param name="template"></param>
/// <param name="pdfHtml"></param>
/// <param name="txtHtml"></param>
/// <param name="IsSkipCheckMarginCall"></param>
/// <param name="recevier"></param>
/// <returns></returns>
public (EmailTradeConfirmResultType status, string message) SendSettlementReports(DingShiReportEmail emailData, ClientDingShiReport_ShanXi report, string template, bool IsSkipCheckMarginCall = false, List<string> recevier = null)
{
LogFactory.GetLogger().Info("开始发邮件[info]SendSettlementReports");
string message = null;
var attachFiles = new List<string>();
List<string> fileTypes=new List<string>();
emailData.FileTypes.ForEach(type =>
{
if (type.@checked)
{
fileTypes.Add(type.type.ToLower());
}
});
if (fileTypes.Contains("pdf"))
{
var filepath = GenerateFileEntry(report, "pdf");
if (!string.IsNullOrEmpty(filepath))
{
attachFiles.Add(filepath);
}
if (fileTypes.Contains("excel"))
{
filepath = filepath.Replace(".pdf",".xlsx");
attachFiles.Add(filepath);
}
}
else
{
var filepath = GenerateFileEntry(report, "excel");
if (!string.IsNullOrEmpty(filepath))
{
attachFiles.Add(filepath);
}
}
// 要向该客户的所有订阅了邮件通知的人员发送邮件
var emails = ClientDataQueryService.GetClientEmails(report.client.id, false, recevier,true);
var status = EmailTradeConfirmResultType.Succeed;
if (emails.All(o => string.IsNullOrWhiteSpace(o)))
{
status = EmailTradeConfirmResultType.NoEmailSetting;
}
else
{
emails = emails.Where(o => !string.IsNullOrWhiteSpace(o));
var title = report.Title;
var detail = emailData.Detail;
detail = ReplaceWildcard(detail, report);
var mailFrom = DBCacheManager.Single.GetStr(CacheTable.TradeMarketSendUser, template);
if (string.IsNullOrWhiteSpace(mailFrom))
{
mailFrom = DBCacheManager.Single.GetStr(CacheTable.TradeMarketSendUser);
}
LogFactory.GetLogger().Info("开始发邮件[info]SendSettlementReports_start");
message = EmailHelper.SendMail(string.Join(";", emails), title, detail, true, attachFiles, emailData.CCEmail, mailFrom);
LogFactory.GetLogger().Info($"开始发邮件[info]SendSettlementReports_end {message}");
if (!string.IsNullOrEmpty(message))
{
status = EmailTradeConfirmResultType.EmailSentFailed;
}
}
return (status, message);
}
/// <summary>
/// 生成附件
/// </summary>
/// <param name="report"></param>
/// <param name="type"></param>
/// <param name="html"></param>
/// <returns></returns>
public string GenerateFileEntry(ClientDingShiReport_ShanXi report, string type)
{
var filepath = GenerateReportExcel(report, type.ToLower() == "pdf");
return filepath;
}
public string GenerateReportExcel(ClientDingShiReport_ShanXi report,bool needToPdf)
{
var tempFolder = OtcAppContext.MapPath("~/App_Docs/Temp/结算报告");
tempFolder = MosPathHelper.Combine(tempFolder, "");
var targetPath = string.IsNullOrEmpty(report.downloadFilePath) ? Path.Combine(tempFolder, report.ReportEnd.ToString("yyyyMMdd")) : report.downloadFilePath;
if (!Directory.Exists(targetPath))
{
Directory.CreateDirectory(targetPath);
}
var clientName = report.client.Name;
var fileName = $"{clientName}_每日估值报告_{report.ReportEnd:yyyyMMdd}";
var targetFileName = Path.Combine(targetPath, $"{fileName}.xlsx");
var excelDeclareModel = new ExcelDeclareModel()
{
Company = PS.Config.CompanyFullName,// PS.Config.Company.ToString() + "风险管理有限公司",
CurDay = DateTime.Now.Date.ToString("yyyy年MM月dd日"),
CurTime = DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss"),
CurUser = string.IsNullOrEmpty(report.CurUserName) ? OptUser.UserName : report.CurUserName,
Name = report.client.Name,
Number = report.client.Number,
ReportEnd = report.ReportEnd.ToString("yyyy年MM月dd日"),
ReportFrom = report.ReportFrom.ToString("yyyy年MM月dd日") == "0001年01月01日" ? "" : report.ReportFrom.ToString("yyyy年MM月dd日"),
Title = report.Title,
DescList=report.descList,
Desc=report.desc
};
var modelDict = new Dictionary<string, object>();
if (report.FundReportModel != null)
{
report.FundReportModel.ExcelDeclareModel = excelDeclareModel;
modelDict.Add("账户状况", report.FundReportModel);
}
if (report.EodSwapPositions != null)
{
modelDict.Add("互换估值", new
{
// 明细列表供模板渲染;以下 *Sum 字段用于“互换估值”页签合计行。
EodSwapPositions = report.EodSwapPositions,
// 持仓规模、期间收益和利息/分红类金额合计。
PosiNotionalValueSum= report.EodSwapPositions.Sum(x => x.position.PosiNotionalValue),
PeriodAmountSum= report.EodSwapPositions.Sum(x => x.PeriodAmount) ?? 0m,
DividendAmountSum = report.EodSwapPositions.Sum(x => x.DividendAmount) ?? 0m,
InterestAmountSum= report.EodSwapPositions.Sum(x => x.InterestAmount),
PosiFeePendingSum = report.EodSwapPositions.Sum(x => x.position.PosiFeePending),
PosiProfitSum= report.EodSwapPositions.Sum(x => x.position.PosiProfitSum),
// 保证金相关收益和保证金占用金额合计。
MarginInterestAmountSum = report.EodSwapPositions.Sum(x => x.MarginInterestAmount),
OpenMarginAmountSum = report.EodSwapPositions.Sum(x => x.OpenMarginAmount),
AdditionalMarginAmountSum = report.EodSwapPositions.Sum(x => x.AdditionalMarginAmount),
// 净结算金额为日终估值口径;TRS价值在净结算金额基础上叠加期初/追加保证金。
NetSettmentAmountSum= report.EodSwapPositions.Sum(x => x.NetSettmentAmount),
TrsValueSum = report.EodSwapPositions.Sum(x => x.TrsValue),
});
}
if (report.SwapPositions != null)
{
modelDict.Add("互换持仓明细", report.SwapPositions);
}
if (report.clientSwapPositions != null)
{
modelDict.Add("互换交易流水", new
{
ClientSwapPositions = report.clientSwapPositions,
TradeFeeSum= report.clientSwapPositions.Sum(x => x.TradeFee),
TradingFeeSum= report.clientSwapPositions.Sum(x => x.TradingFee),
PosiPnlSum = report.clientSwapPositions.Sum(x => x.PosiPnl),
DividendInSum= report.clientSwapPositions.Sum(x => x.FlowEvent.DividendIn),
InterestAmountSum= report.clientSwapPositions.Sum(x => x.FlowEvent.InterestClosePnL),
InterestFeeSum= report.clientSwapPositions.Sum(x => x.FlowEvent.InterestFee),
NetSettmentAmountSum = report.clientSwapPositions.Sum(x => x.NetSettmentAmount),
});
}
if (report.ClientCashInCashOutExtendList != null)
{
modelDict.Add("资金明细",
new
{
ClientCashInCashOutList = report.ClientCashInCashOutExtendList,
MoneyToShowSum = report.ClientCashInCashOutExtendList.Sum(x => x.MoneyToShow),
MoneyInOutSum = report.ClientCashInCashOutExtendList.Sum(x => x.MoneyInOut),
MoneyPriceSum = report.ClientCashInCashOutExtendList.Sum(x => x.MoneyPrice),
MoneyUnwindExerSum = report.ClientCashInCashOutExtendList.Sum(x => x.MoneyUnwindExer),
MoneyOtherSum = report.ClientCashInCashOutExtendList.Sum(x => x.MoneyOther)
});
}
if (report.clientcashincashout_productLinq != null)
{
modelDict.Add("质押记录", report.clientcashincashout_productLinq);
}
var sourcePath = OtcAppContext.MapPath("~/App_Docs/导出模板");
string sourceFileName = Path.Combine(sourcePath, $"结算报告模板.xlsx");
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
var pdffile = ExcelTemplate.GeneratePDFFromExeclTemplate(sourcePath, sourceFileName, modelDict, targetPath, targetFileName
, shouldDeleteSheet: true, needToPdf: false, callback: sheets =>
{
FormatSwapValuationDisplayCells(sheets, report.EodSwapPositions);
});
if (needToPdf)
{
var targetPdfFileName = FileHelper.ReplaceExtension(targetFileName, ".pdf");
ConvertToPdfHelper.ConvertPDFByApi(HttpUtility.UrlEncode(targetFileName), HttpUtility.UrlEncode(targetPdfFileName));
return targetPdfFileName;
}
return Path.Combine(targetPath, targetFileName);
}
/// <summary>
/// 部分 Office 版本会将可选小数格式(例如 <c>#,##0.##</c>)错误显示为 <c>20,000.</c>。
/// 互换估值中的这些列是展示字段,不参与 Excel 公式计算,因此在模板替换完成后写为已格式化文本,
/// 既保留去尾零口径,也避免留下孤立的小数点。
/// </summary>
private static void FormatSwapValuationDisplayCells(IEnumerable<ExcelWorksheet> sheets, IEnumerable<EodSwapPositionResponse> positions)
{
var worksheet = sheets.FirstOrDefault(x => x.Name == "互换估值");
var positionList = positions?.ToList() ?? new List<EodSwapPositionResponse>();
if (worksheet == null || !positionList.Any())
{
return;
}
const int dataStartRow = 2;
for (var index = 0; index < positionList.Count; index++)
{
var row = dataStartRow + index;
var item = positionList[index];
SetTrimmedExcelText(worksheet.Cells[row, 8], item.position.PosiNotionalValue, 2);
SetTrimmedExcelText(worksheet.Cells[row, 9], item.position.PosiQuantity, 9);
SetTrimmedExcelText(worksheet.Cells[row, 10], item.PeriodAmount, 2);
SetTrimmedExcelText(worksheet.Cells[row, 11], item.DividendAmount, 2);
SetTrimmedExcelText(worksheet.Cells[row, 13], item.InitYtm, 4, percent: true);
}
var totalRow = dataStartRow + positionList.Count;
SetTrimmedExcelText(worksheet.Cells[totalRow, 8], positionList.Sum(x => x.position.PosiNotionalValue), 2);
SetTrimmedExcelText(worksheet.Cells[totalRow, 10], positionList.Sum(x => x.PeriodAmount) ?? 0m, 2);
SetTrimmedExcelText(worksheet.Cells[totalRow, 11], positionList.Sum(x => x.DividendAmount) ?? 0m, 2);
}
private static void SetTrimmedExcelText(ExcelRange cell, decimal? value, int decimalPlaces, bool percent = false)
{
if (!value.HasValue)
{
cell.Value = null;
return;
}
var displayValue = percent ? value.Value * 100m : value.Value;
var format = "#,##0." + new string('#', decimalPlaces);
var text = displayValue.ToString(format, CultureInfo.InvariantCulture).TrimEnd('.');
cell.Value = percent ? text + "%" : text;
cell.Style.Numberformat.Format = "@";
}
/// <summary>
/// 财务状况
/// </summary>
/// <param name="emailData"></param>
/// <param name="IsGap"></param>
/// <param name="IsOuter"></param>
/// <returns></returns>
private FundReportModel GetFundReport(DingShiReportEmail emailData,bool IsGap,bool IsOuter)
{
var clientBalance = ClientBalanceUtility.GetClientBanlances(new List<int> { emailData.ClientId }, emailData.From, emailData.To, IsClientBalanceGap: IsGap, IsGetOuterMarginGap: IsOuter, ParentFlag: emailData.ParentFlag).FirstOrDefault();
var FundReportModel = new FundReportModel()
{
LastDayRemainFund = clientBalance?.LastDayRemainFund ?? 0,
LastDayRemainFundWithProduct = clientBalance?.LastDayRemainFundWithProduct ?? 0,
CashInCashOutChange = clientBalance?.NetFundAll ?? 0,
CashInChange = clientBalance?.InFund ?? 0,
CashOutChange = clientBalance?.OutFund ?? 0,
CashInCashOutOther = clientBalance?.OtherFund ?? 0,
CashInCashOutProductChange = clientBalance?.CashInCashOutProductChange ?? 0,
OptionPremium = clientBalance?.OptionPremium ?? 0,
OptionPremiumSwap = clientBalance?.OptionPremiumSwap ?? 0,
SettlementBalance = clientBalance?.SettlementBalance ?? 0,
UnwindBalance = clientBalance?.UnwindBalance ?? 0,
ExerciseBalance = clientBalance?.ExerciseBalance ?? 0,
SwapBalance = clientBalance?.SwapBalance ?? 0,
Coupon = clientBalance?.Coupon ?? 0,
TodayRemianFund = clientBalance?.AmountFund ?? 0,
TodayRemianFundProduct = clientBalance?.AmountFundWithProduct ?? 0,
GuaranteesTotalAmount = clientBalance?.GuaranteesTotalAmount ?? 0,
WorstCastClientPayable = clientBalance?.MinusPayableMarginTotal ?? 0,
AvailableFund = clientBalance?.AvailableAmount ?? 0,
TotalMargin = clientBalance?.TotalMarginTotal,
Credit = clientBalance?.TotalCredit ?? 0,
CreditRatio = clientBalance?.CreditUsed ?? 0,
Margin = clientBalance?.MarginByPayableMarginTotal ?? 0,
Amount = (PS.Config.IsPVRounded ? clientBalance?.RoundedTotalAmountTotal : clientBalance?.TotalAmountTotal) ?? 0,
TotalPnl = (PS.Config.IsPVRounded ? (decimal)(clientBalance?.RoundedPositionPnl ?? 0) : (decimal)(clientBalance?.PositionPnl ?? 0)),
PositionPremiumNetCash = clientBalance?.PositionPremiumNetCash ?? 0,
SellTradePrice = clientBalance?.SellTradePrice,
LastDayPositionPremiumNetCash = clientBalance?.LastDayPositionPremiumNetCash ?? 0,
WinLoss =Math.Round( clientBalance?.WinLoss ?? 0,ConsGlobal.MoneyRound,MidpointRounding.AwayFromZero),
ClosedTradeFundGap = clientBalance?.ClosedTradeFundGap ?? 0,
ClosedTradePayableFund = clientBalance?.ClosedTradePayableFundTotal ?? 0,
PositionTradePayableFund = clientBalance?.MarginByPayableMarginTotal ?? 0,
DesirableFund = clientBalance?.DesirableFundTotal ?? 0,
PayableFund = emailData.PayableFund >= 0 ? emailData.PayableFund : (clientBalance?.PayableFundTotal ?? 0),
PositionPv = PS.Config.IsPVRounded ? (clientBalance?.RoundedPositionPv ?? 0) : (clientBalance?.PositionPv ?? 0),
PrepaymentAmount = clientBalance?.PrepaymentAmount,
PositionPnl = PS.Config.IsPVRounded ? (clientBalance?.RoundedPositionPnl ?? 0) : (clientBalance?.PositionPnl ?? 0),
TotalNetSettlement = clientBalance?.TotalNetSettlementTotal ?? 0,
ClientSellPositionPnl = clientBalance?.ClientSellPositionPnl,
FreezePremium = clientBalance?.FreezePremium,
EndDesirableFund = clientBalance?.EndDesirableFund ?? 0,
MySideMargin= clientBalance?.MySideMargin,
MarginBalance= clientBalance?.MarginBalance,
NetFundAll = clientBalance?.NetFundAll,
SwapMarketAmount= clientBalance?.SwapMarketAmount,
VmFundSum= clientBalance?.VmFundSum,
MaintenanceMargin=clientBalance?.MaintenanceMargin,
};
return FundReportModel;
}
/// <summary>
/// 资金明细
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
private List<ClientCashInCashOutExtend> SearchListExtendOnly(EntryExitReq req)
{
req.State = "已确认,已结算";
req.Direction = $"入金,出金,其他收入,其他支出,应收";
req.TradeAction =
$"{ClientCashInCashOut.系统操作_行权费},{ClientCashInCashOut.系统操作_平仓费},{ClientCashInCashOut.系统操作_期权费},{ClientCashInCashOut.系统操作_票息},{ClientCashInCashOut.系统操作_互换},{ClientCashInCashOut.系统操作_应付预付金},{ClientCashInCashOut.系统操作_预付金返息}";
req.IsMoneyNotEqualsZero = true;
var sList = new EntryExitBLL().SearchListExtendOnly(req);
return sList;
}
/// <summary>
/// 质押记录
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
private List<clientcashincashout_productLinq> SearchListOnlyForMarketReport(clientcashincashout_productReq req)
{
var bll = new clientcashincashout_productBLL();
var sList = bll.SearchListOnlyForMarketReport(req);
return sList;
}
private string ReplaceWildcard(string input, ClientDingShiReport_ShanXi report)
{
if (!string.IsNullOrEmpty(input))
{
input = Regex.Replace(input, @"\{\{(.*?)\}\}", m =>
{
switch (m.Groups[1].Value)
{
case "客户名称": return report.client.Name;
case "客户编号": return report.client.Number;
case "支付截止时间":
if (PS.Config.Company == CompanyEnum.宏源)
{
return DateTime.Now.Hour >= 15 ? QdpCalendarHelper.GetNonHoliday(DateTime.Now.AddDays(1)).ToString("yyyy年MM月dd日") + "上午11时" : QdpCalendarHelper.GetNonHoliday(DateTime.Now).ToString("yyyy年MM月dd日") + "下午16:30";
}
else
if (PS.Config.Company == CompanyEnum.浙期)
{
return QdpCalendarHelper.GetNonHoliday(DateTime.Now < DateTime.Now.Date.AddHours(11).AddMinutes(30) ? DateTime.Now : DateTime.Now.AddDays(1)).ToString("yyyy年MM月dd日") + "上午11:30";
}
else
{
return QdpCalendarHelper.GetNonHoliday(DateTime.Now < DateTime.Now.Date.AddHours(9).AddMinutes(30) ? DateTime.Now : DateTime.Now.AddDays(1)).ToString("yyyy年MM月dd日") + "上午9:30";
}
case "追保金额": return report.FundReportModel.PositionTradePayableFundString;
case "大写追保金额": return NumberHelper.CmycurD(report.FundReportModel.PositionTradePayableFund ?? 0);
case "预付金余额": return report.FundReportModel.MarginBalanceString;
case "初始保证金金额": return report.FundReportModel.MySideMarginString;
case "发送日期": return DateTime.Now.ToString("yyyy-MM-dd");
case "可用资金": return report.FundReportModel.AvailableFundString;
case "可取资金": return report.FundReportModel.DesirableFundString;
case "起始日期": return report.ReportFrom.ToString("yyyy-MM-dd");
case "结束日期": return report.ReportEnd.ToString("yyyy-MM-dd");
case "开户行":
if (report.ClientBank.Any())
{
var Bank = new StringBuilder();
report.ClientBank.ForEach(x =>
{
Bank.Append(x.Bank).Append(",");
});
return Bank.ToString().Substring(0, Bank.ToString().Length - 1);
}
return string.Empty;
case "户名":
if (report.ClientBank.Any())
{
var ClientName = new StringBuilder();
report.ClientBank.ForEach(x =>
{
ClientName.Append(x.ClientName).Append(",");
});
return ClientName.ToString().Substring(0, ClientName.ToString().Length - 1);
}
return string.Empty;
case "账号":
if (report.ClientBank.Any())
{
var Card = new StringBuilder();
report.ClientBank.ForEach(x =>
{
Card.Append(x.Card).Append(",");
});
return Card.ToString().Substring(0, Card.ToString().Length - 1);
}
return string.Empty;
case "期末结存":
return report.FundReportModel.TodayRemianFundString;
default: return string.Empty;
}
});
}
return input;
}
}
}