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.

268 lines
7.2 KiB
C#

using System.Runtime.Serialization;
using DS.Module.Core;
using DS.WMS.Core.Op.Entity;
namespace DS.WMS.Core.Application.Dtos
{
/// <summary>
/// 费用记录
/// </summary>
public class FeeRecordDto
{
/// <summary>
/// 费用记录ID
/// </summary>
public long RecordId { get; set; }
/// <summary>
/// 业务ID
/// </summary>
public long BusinessId { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public BusinessType BusinessType { get; set; }
/// <summary>
/// 客户ID
/// </summary>
public long CustomerId { 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 decimal RestAmount { get; set; }
/// <summary>
/// 本次申请/开票金额
/// </summary>
public decimal ApplyAmount { get; set; }
/// <summary>
/// 原始汇率
/// </summary>
public decimal? ExchangeRate { get; set; }
[IgnoreDataMember]
public long CreateBy { get; set; }
/// <summary>
/// 录入人
/// </summary>
public string? CreateByName { get; set; }
/// <summary>
/// 录入方式
/// </summary>
public string? InputMethod { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Remark { get; set; }
}
/// <summary>
/// 按业务展示的费用信息
/// </summary>
public class PaymentApplicaitonBiz
{
readonly IEnumerable<FeePaymentDto> _items;
/// <summary>
/// 费用记录项
/// </summary>
public IEnumerable<FeePaymentDto> Items => _items;
/// <summary>
/// 使用指定的数据源初始化统计。
/// </summary>
/// <param name="source">数据源</param>
public PaymentApplicaitonBiz(List<FeePaymentDto> source)
{
_items = source;
//人民币
ReceivableCNY = _items.Where(x => x.FeeType == FeeType.Receivable && x.Currency == "CNY").Sum(x => x.Amount);
PayableCNY = _items.Where(x => x.FeeType == FeeType.Payable && x.Currency == "CNY").Sum(x => x.Amount);
//美元
ReceivableUSD = _items.Where(x => x.FeeType == FeeType.Receivable && x.Currency == "USD").Sum(x => x.Amount);
PayableUSD = _items.Where(x => x.FeeType == FeeType.Payable && x.Currency == "USD").Sum(x => x.Amount);
//其他
ReceivableOther = _items.Where(x => x.FeeType == FeeType.Receivable && x.Currency != "USD" && x.Currency != "CNY").Sum(x => x.Amount);
PayableOther = _items.Where(x => x.FeeType == FeeType.Payable && x.Currency == "USD" && x.Currency != "CNY").Sum(x => x.Amount);
}
/// <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 FeePaymentDto : FeeRecordDto
{
/// <summary>
/// 原始汇率
/// </summary>
public decimal? OriginalRate { get; set; }
/// <summary>
/// 原始币别
/// </summary>
public string OriginalCurrency { get; set; }
/// <summary>
/// 本次申请原始金额
/// </summary>
public decimal? OriginalApplyAmount { get; set; }
/// <summary>
/// 开票金额
/// </summary>
public decimal? InvoiceAmount { get; set; }
public long? SaleDeptId { get; set; }
/// <summary>
/// 所属分部
/// </summary>
public string? SaleDeptName { get; set; }
/// <summary>
/// 税率
/// </summary>
public decimal TaxRate { get; set; }
/// <summary>
/// 录入方式
/// </summary>
public string? InputMethod { get; set; }
}
/// <summary>
/// 按业务展示的费用信息
/// </summary>
public class InvoiceApplicaitonBiz
{
readonly IEnumerable<FeeInvoiceDto> _items;
/// <summary>
/// 费用记录项
/// </summary>
public IEnumerable<FeeInvoiceDto> Items => _items;
/// <summary>
/// 使用指定的数据源初始化统计。
/// </summary>
/// <param name="source">数据源</param>
public InvoiceApplicaitonBiz(List<FeeInvoiceDto> source)
{
_items = source;
RestAmountCNY = _items.Where(x => x.Currency == "CNY").Sum(x => x.RestAmount);
RestAmountUSD = _items.Where(x => x.Currency == "USD").Sum(x => x.RestAmount);
RestAmountOther = _items.Where(x => x.Currency != "CNY" && x.Currency != "USD").Sum(x => x.RestAmount);
}
/// <summary>
/// 人民币未开
/// </summary>
public decimal RestAmountCNY { get; private set; }
/// <summary>
/// 美元未开
/// </summary>
public decimal RestAmountUSD { get; private set; }
/// <summary>
/// 其他未开
/// </summary>
public decimal RestAmountOther { get; private set; }
}
/// <summary>
/// 发票申请费用记录
/// </summary>
public class FeeInvoiceDto : FeeRecordDto
{
/// <summary>
/// 税率
/// </summary>
public decimal TaxRate { get; set; }
/// <summary>
/// 原始申请金额
/// </summary>
public decimal OriginalAmount { get; set; }
/// <summary>
/// 原始汇率
/// </summary>
public decimal? OriginalRate { get; set; }
/// <summary>
/// 原始币别
/// </summary>
public string? OriginalCurrency { get; set; }
}
}