You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

174 lines
4.8 KiB
C#

using System.Runtime.Serialization;
using DS.Module.Core;
using DS.WMS.Core.Op.Entity;
namespace DS.WMS.Core.Fee.Dtos
{
/// <summary>
/// 按业务展示的费用信息
/// </summary>
public class FeeDto
{
readonly IEnumerable<FeeRecordDto> _items;
/// <summary>
/// 费用记录项
/// </summary>
public IEnumerable<FeeRecordDto> Items => _items;
/// <summary>
/// 使用指定的数据源初始化统计。
/// </summary>
/// <param name="source">数据源</param>
public FeeDto(IEnumerable<FeeRecordDto> source)
{
_items = source;
//人民币
ReceivableCNY = _items.Where(x => x.FeeType == FeeType.Receivable && x.Currency == "CNY").Sum(x => x.Amount).GetValueOrDefault();
PayableCNY = _items.Where(x => x.FeeType == FeeType.Payable && x.Currency == "CNY").Sum(x => x.Amount).GetValueOrDefault();
//美元
ReceivableUSD = _items.Where(x => x.FeeType == FeeType.Receivable && x.Currency == "USD").Sum(x => x.Amount).GetValueOrDefault();
PayableUSD = _items.Where(x => x.FeeType == FeeType.Payable && x.Currency == "USD").Sum(x => x.Amount).GetValueOrDefault();
//其他
ReceivableOther = _items.Where(x => x.FeeType == FeeType.Receivable && x.Currency != "USD" && x.Currency != "CNY").Sum(x => x.Amount).GetValueOrDefault();
PayableOther = _items.Where(x => x.FeeType == FeeType.Payable && x.Currency == "USD" && x.Currency != "CNY").Sum(x => x.Amount).GetValueOrDefault();
}
/// <summary>
/// 人民币应收款
/// </summary>
public decimal ReceivableCNY { get; private set; }
/// <summary>
/// 人民币应付款
/// </summary>
public decimal PayableCNY { get; private set; }
/// <summary>
/// 美元应收款
/// </summary>
public decimal ReceivableUSD { get; private set; }
/// <summary>
/// 美元应付款
/// </summary>
public decimal PayableUSD { get; private set; }
/// <summary>
/// 其他币种应收款
/// </summary>
public decimal ReceivableOther { get; private set; }
/// <summary>
/// 其他币种应付款
/// </summary>
public decimal PayableOther { get; private set; }
}
/// <summary>
/// 费用记录
/// </summary>
public class FeeRecordDto
{
/// <summary>
/// 申请单ID
/// </summary>
public long ApplicationId { get; set; }
/// <summary>
/// 费用记录ID
/// </summary>
public long RecordId { get; set; }
/// <summary>
/// 业务ID
/// </summary>
public long BusinessId { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public BusinessType BusinessType { get; set; }
/// <summary>
/// 客户名称
/// </summary>
public string? CustomerName { get; set; }
/// <summary>
/// 费用ID
/// </summary>
public long FeeId { get; set; }
/// <summary>
/// 费用名称
/// </summary>
public string? FeeName { get; set; }
/// <summary>
/// 费用类型
/// </summary>
public FeeType FeeType { get; set; }
/// <summary>
/// 费用总金额
/// </summary>
public decimal? Amount { get; set; }
/// <summary>
/// 币别
/// </summary>
public string Currency { get; set; }
/// <summary>
/// 原始币别
/// </summary>
public string OriginalCurrency { get; set; }
/// <summary>
/// 原始汇率
/// </summary>
public decimal? OriginalRate { get; set; }
/// <summary>
/// 折算汇率
/// </summary>
public decimal? ExchangeRate { get; set; }
/// <summary>
/// 未结金额
/// </summary>
public decimal? RestAmount { get; set; }
/// <summary>
/// 本次申请金额
/// </summary>
public decimal? ApplyAmount { get; set; }
/// <summary>
/// 本次申请原始金额
/// </summary>
public decimal? OriginalApplyAmount { get; set; }
/// <summary>
/// 开票金额
/// </summary>
public decimal? InvoiceAmount { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Remark { get; set; }
[IgnoreDataMember]
public long CreateBy { get; set; }
/// <summary>
/// 录入人
/// </summary>
public string? CreateByName { get; set; }
}
}