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