|
|
|
@ -0,0 +1,225 @@
|
|
|
|
|
using DS.WMS.Core.Fee.Entity;
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.Core.Fee.Dtos
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 费用汇总统计模型
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class FeeStatistics
|
|
|
|
|
{
|
|
|
|
|
readonly IEnumerable<FeeRecord> _source;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 使用指定的数据源初始化统计。
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="source">数据源</param>
|
|
|
|
|
public FeeStatistics(IEnumerable<FeeRecord> source)
|
|
|
|
|
{
|
|
|
|
|
_source = source;
|
|
|
|
|
|
|
|
|
|
//合计
|
|
|
|
|
ReceivableTotal = _source.Where(x => x.FeeType == 1).Sum(x => x.Amount).GetValueOrDefault();
|
|
|
|
|
PayableTotal = _source.Where(x => x.FeeType == 2).Sum(x => x.Amount).GetValueOrDefault();
|
|
|
|
|
NoTaxReceivableTotal = _source.Where(x => x.FeeType == 1).Sum(x => x.NoTaxAmount);
|
|
|
|
|
NoTaxPayableTotal = _source.Where(x => x.FeeType == 2).Sum(x => x.NoTaxAmount);
|
|
|
|
|
|
|
|
|
|
//人民币
|
|
|
|
|
ReceivableCNY = _source.Where(x => x.FeeType == 1 && x.Currency == "CNY").Sum(x => x.Amount).GetValueOrDefault();
|
|
|
|
|
PayableCNY = _source.Where(x => x.FeeType == 2 && x.Currency == "CNY").Sum(x => x.Amount).GetValueOrDefault();
|
|
|
|
|
NoTaxReceivableCNY = _source.Where(x => x.FeeType == 1 && x.Currency == "CNY").Sum(x => x.NoTaxAmount);
|
|
|
|
|
NoTaxPayableCNY = _source.Where(x => x.FeeType == 2 && x.Currency == "CNY").Sum(x => x.NoTaxAmount);
|
|
|
|
|
|
|
|
|
|
//美元
|
|
|
|
|
ReceivableUSD = _source.Where(x => x.FeeType == 1 && x.Currency == "USD").Sum(x => x.Amount).GetValueOrDefault();
|
|
|
|
|
PayableUSD = _source.Where(x => x.FeeType == 2 && x.Currency == "USD").Sum(x => x.Amount).GetValueOrDefault();
|
|
|
|
|
NoTaxReceivableUSD = _source.Where(x => x.FeeType == 1 && x.Currency == "USD").Sum(x => x.NoTaxAmount);
|
|
|
|
|
NoTaxPayableUSD = _source.Where(x => x.FeeType == 2 && x.Currency == "USD").Sum(x => x.NoTaxAmount);
|
|
|
|
|
|
|
|
|
|
//其他
|
|
|
|
|
ReceivableOther = _source.Where(x => x.FeeType == 1 && x.Currency != "USD" && x.Currency != "CNY").Sum(x => x.Amount).GetValueOrDefault();
|
|
|
|
|
PayableOther = _source.Where(x => x.FeeType == 2 && x.Currency == "USD" && x.Currency != "CNY").Sum(x => x.Amount).GetValueOrDefault();
|
|
|
|
|
NoTaxReceivableOther = _source.Where(x => x.FeeType == 1 && x.Currency == "USD" && x.Currency != "CNY").Sum(x => x.NoTaxAmount);
|
|
|
|
|
NoTaxPayableOther = _source.Where(x => x.FeeType == 2 && x.Currency == "USD" && x.Currency != "CNY").Sum(x => x.NoTaxAmount);
|
|
|
|
|
|
|
|
|
|
//按客户统计
|
|
|
|
|
ByCustomers = (from s in _source
|
|
|
|
|
group s by s.CustomerName into g
|
|
|
|
|
select new CustomerFeeStatistics
|
|
|
|
|
{
|
|
|
|
|
CustomerName = g.Key,
|
|
|
|
|
ReceivableTotal = g.Where(x => x.FeeType == 1).Sum(x => x.Amount).GetValueOrDefault(),
|
|
|
|
|
PayableTotal = g.Where(x => x.FeeType == 2).Sum(x => x.Amount).GetValueOrDefault(),
|
|
|
|
|
ReceivableCNY = g.Where(x => x.FeeType == 1 && x.Currency == "CNY").Sum(x => x.Amount).GetValueOrDefault(),
|
|
|
|
|
PayableCNY = g.Where(x => x.FeeType == 2 && x.Currency == "CNY").Sum(x => x.Amount).GetValueOrDefault(),
|
|
|
|
|
ReceivableUSD = g.Where(x => x.FeeType == 1 && x.Currency == "USD").Sum(x => x.Amount).GetValueOrDefault(),
|
|
|
|
|
PayableUSD = g.Where(x => x.FeeType == 2 && x.Currency == "USD").Sum(x => x.Amount).GetValueOrDefault()
|
|
|
|
|
}).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 应收款总计
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual decimal ReceivableTotal { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 不含税应收款总计
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual decimal NoTaxReceivableTotal { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 应付款总计
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual decimal PayableTotal { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 不含税应付款总计
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual decimal NoTaxPayableTotal { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 利润总计
|
|
|
|
|
/// </summary>
|
|
|
|
|
public decimal ProfitTotal { get { return ReceivableTotal - PayableTotal; } }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 不含税利润总计
|
|
|
|
|
/// </summary>
|
|
|
|
|
public decimal NoTaxProfitTotal { get { return NoTaxReceivableTotal - NoTaxPayableTotal; } }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 人民币应收款
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual decimal ReceivableCNY { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 不含税人民币应收款
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual decimal NoTaxReceivableCNY { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 人民币应付款
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual decimal PayableCNY { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 不含税人民币应付款
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual decimal NoTaxPayableCNY { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 人民币利润
|
|
|
|
|
/// </summary>
|
|
|
|
|
public decimal ProfitCNY { get { return ReceivableCNY - PayableCNY; } }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 不含税人民币利润
|
|
|
|
|
/// </summary>
|
|
|
|
|
public decimal NoTaxProfitCNY { get { return NoTaxReceivableCNY - NoTaxPayableCNY; } }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 美元应收款
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual decimal ReceivableUSD { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 不含税美元应收款
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual decimal NoTaxReceivableUSD { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 美元应付款
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual decimal PayableUSD { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 不含税美元应付款
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual decimal NoTaxPayableUSD { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 美元利润
|
|
|
|
|
/// </summary>
|
|
|
|
|
public decimal ProfitUSD { get { return ReceivableUSD - PayableUSD; } }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 不含税美元利润
|
|
|
|
|
/// </summary>
|
|
|
|
|
public decimal NoTaxProfitUSD { get { return NoTaxReceivableUSD - NoTaxPayableUSD; } }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 其他币种应收款
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual decimal ReceivableOther { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 不含税其他币种应收款
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual decimal NoTaxReceivableOther { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 其他币种应付款
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual decimal PayableOther { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 不含税其他币种应付款
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual decimal NoTaxPayableOther { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 其他币种利润
|
|
|
|
|
/// </summary>
|
|
|
|
|
public decimal ProfitOther { get { return ReceivableOther - PayableOther; } }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 不含税其他币种利润
|
|
|
|
|
/// </summary>
|
|
|
|
|
public decimal NoTaxProfitOther { get { return NoTaxReceivableOther - NoTaxPayableOther; } }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 按客户统计
|
|
|
|
|
/// </summary>
|
|
|
|
|
public List<CustomerFeeStatistics> ByCustomers { get; private set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 费用记录按客户统计
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class CustomerFeeStatistics
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 客户名称
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string CustomerName { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 应收款总计
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual decimal ReceivableTotal { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 应付款总计
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual decimal PayableTotal { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 人民币应收款
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual decimal ReceivableCNY { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 人民币应付款
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual decimal PayableCNY { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 美元应收款
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual decimal ReceivableUSD { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 美元应付款
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual decimal PayableUSD { get; set; }
|
|
|
|
|
}
|
|
|
|
|
}
|