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.

734 lines
17 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System.Runtime.Serialization;
using DS.Module.Core;
using DS.Module.Core.Enums;
using DS.WMS.Core.Op.Entity;
namespace DS.WMS.Core.Fee.Dtos
{
/// <summary>
/// 费用申请单
/// </summary>
public class ApplicationDto
{
/// <summary>
/// 申请单编号
/// </summary>
public string ApplicationNO { get; set; }
/// <summary>
/// 申请单状态
/// </summary>
public PaymentApplicationStatus Status { get; set; }
/// <summary>
/// 人民币申请金额
/// </summary>
public decimal? AmountRMB { get; set; }
/// <summary>
/// 美元申请金额
/// </summary>
public decimal? AmountUSD { get; set; }
/// <summary>
/// 其他币别申请金额
/// </summary>
public decimal? AmountOther { get; set; }
/// <summary>
/// 申请币别
/// </summary>
public string? Currency { get; set; }
/// <summary>
/// 折算汇率
/// </summary>
public decimal? ExchangeRate { get; set; }
/// <summary>
/// 审核人
/// </summary>
public long? AuditerId { get; set; }
/// <summary>
/// 审核人名称
/// </summary>
public string? AuditerName { get; set; }
/// <summary>
/// 审核时间
/// </summary>
public DateTime? AuditTime { get; set; }
/// <summary>
/// 审核备注
/// </summary>
public string? AuditRemark { get; set; }
/// <summary>
/// 是否已打印
/// </summary>
public bool IsPrinted { get; set; }
/// <summary>
/// 打印次数
/// </summary>
public int PrintTimes { get; set; }
/// <summary>
/// 打印人
/// </summary>
public long? PrinterId { get; set; }
/// <summary>
/// 打印人名称
/// </summary>
public string? PrinterName { get; set; }
/// <summary>
/// 打印时间
/// </summary>
public DateTime? PrintTime { get; set; }
/// <summary>
/// 驳回原因
/// </summary>
public string? Reason { get; set; }
/// <summary>
/// 客户名称/结算单位
/// </summary>
public string? CustomerName { get; set; }
/// <summary>
/// 结算方式
/// </summary>
public int Type { get; set; }
/// <summary>
/// 结算人
/// </summary>
public long? SettlerId { get; set; }
/// <summary>
/// 结算人名称
/// </summary>
public string? SettlerName { get; set; }
/// <summary>
/// 结算时间
/// </summary>
public DateTime? SettlementTime { get; set; }
/// <summary>
/// 支票备注
/// </summary>
public string? ChequeRemarks { get; set; }
/// <summary>
/// 发票号
/// </summary>
public string? InvoiceNO { get; set; }
/// <summary>
/// 发票日期
/// </summary>
public DateTime? InvoiceDate { get; set; }
/// <summary>
/// 开票金额
/// </summary>
public decimal? InvoiceAmount { get; set; }
/// <summary>
/// 客户银行账号
/// </summary>
public string? CustomerBAN { get; set; }
/// <summary>
/// 所属分部
/// </summary>
[IgnoreDataMember]
public long? SaleDeptId { get; set; }
public string? SaleDeptName { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Note { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 创建人
/// </summary>
public long CreateBy { get; set; }
public string CreateByName { get; set; }
public List<FeeApplicationDetailDto>? Details { get; set; }
/// <summary>
/// 委托单位
/// </summary>
public string? Client { get; set; }
/// <summary>
/// 结算对象银行
/// </summary>
public string? CustomerBank { get; set; }
/// <summary>
/// 审核状态(仅查询用)
/// </summary>
public AuditStatusForQuery? AuditStatus { get; set; }
}
public enum AuditStatusForQuery
{
/// <summary>
/// 未审核
/// </summary>
Pending = 1,
/// <summary>
/// 已审核
/// </summary>
Audited = 2,
/// <summary>
/// 仅需自己审核
/// </summary>
MarkerOnly = 3
}
/// <summary>
/// 费用申请单明细
/// </summary>
public class FeeApplicationDetailDto
{
/// <summary>
/// 业务类型
/// </summary>
public long BusinessId { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public BusinessType BusinessType { get; set; }
/// <summary>
/// 主提单号
/// </summary>
public string? MBLNO { get; set; }
/// <summary>
/// 分提单号
/// </summary>
public string? HBLNO { get; set; }
/// <summary>
/// 委托编号
/// </summary>
public string? CustomerNo { get; set; }
/// <summary>
/// 费用对象ID
/// </summary>
public long? CustomerId { get; set; }
/// <summary>
/// 委托单位名称
/// </summary>
public string? CustomerName { get; set; }
/// <summary>
/// 业务锁定
/// </summary>
public bool? IsBusinessLocking { get; set; }
/// <summary>
/// 费用锁定
/// </summary>
public bool? IsFeeLocking { get; set; }
/// <summary>
/// 开船日期
/// </summary>
public DateTime? ETD { get; set; }
/// <summary>
/// 业务来源
/// </summary>
public string? SourceName { get; set; }
/// <summary>
/// 揽货人
/// </summary>
public string? SaleName { get; set; }
/// <summary>
/// 集装箱
/// </summary>
public string? CntrTotal { get; set; }
/// <summary>
/// 会计期间
/// </summary>
public string? AccountDate { get; set; }
/// <summary>
/// 所属分部
/// </summary>
public string? SaleDeptName { get; set; }
/// <summary>
/// 费用名称
/// </summary>
public string? FeeName { get; set; }
/// <summary>
/// 费用类型
/// </summary>
public FeeType FeeType { get; set; }
/// <summary>
/// 费用对象
/// </summary>
public string? FeeObject { get; set; }
/// <summary>
/// 申请金额
/// </summary>
public decimal Amount { get; set; }
/// <summary>
/// 原始金额
/// </summary>
public decimal OriginalAmount { 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 AccTaxRate { get; set; }
/// <summary>
/// 更改单
/// </summary>
public string? ChangeOrder { get; set; }
/// <summary>
/// 操作
/// </summary>
public string? Operator { get; set; }
/// <summary>
/// 船名
/// </summary>
public string? Vessel { get; set; }
/// <summary>
/// 航次
/// </summary>
public string? Voyage { get; set; }
/// <summary>
/// 船公司
/// </summary>
public string? Carrier { get; set; }
/// <summary>
/// 订舱代理
/// </summary>
public string? Forwarder { get; set; }
/// <summary>
/// 未收合计
/// </summary>
public decimal? OutstandingAmount { get; set; }
/// <summary>
/// 发票备注
/// </summary>
public string? InvoiceRemark { get; set; }
/// <summary>
/// 订舱编号
/// </summary>
public string? BookingNo { get; set; }
}
/// <summary>
/// 费用申请单审核明细展示
/// </summary>
public class FeeApplicationSummary
{
/// <summary>
/// 费用汇总
/// </summary>
public List<SummaryItem> SummaryItems { get; set; }
/// <summary>
/// 申请单明细
/// </summary>
public List<FeeApplicationDetailDto>? Details { get; set; }
/// <summary>
/// 初始化
/// </summary>
/// <param name="details">申请单明细</param>
public FeeApplicationSummary(List<FeeApplicationDetailDto> details)
{
ArgumentNullException.ThrowIfNull(details);
Details = details;
SummaryItems = details.GroupBy(x => new { x.FeeType, x.OriginalCurrency }).Select(x => new SummaryItem
{
FeeType = x.Key.FeeType,
Currency = x.Key.OriginalCurrency,
Amount = x.Sum(y => y.Amount),
OriginalAmount = x.Sum(y => y.OriginalAmount)
}).ToList();
}
}
/// <summary>
/// 按业务统计费用
/// </summary>
public class FeeBiz
{
/// <summary>
/// 当前结算对象的全局应收总额
/// </summary>
public decimal ReceivableTotal { get; set; }
/// <summary>
/// 费用合计
/// </summary>
public List<TotalItem> TotalItems { get; set; }
}
/// <summary>
/// 申请单费用汇总
/// </summary>
public class SummaryItem
{
/// <summary>
/// 费用类型
/// </summary>
public FeeType FeeType { get; set; }
/// <summary>
/// 币别
/// </summary>
public string Currency { get; set; }
/// <summary>
/// 申请金额
/// </summary>
public decimal Amount { get; set; }
/// <summary>
/// 原始金额
/// </summary>
public decimal OriginalAmount { get; set; }
}
/// <summary>
/// 申请单费用合计项
/// </summary>
public class TotalItem
{
/// <summary>
/// 币别
/// </summary>
public string Currency { get; set; }
/// <summary>
/// 应收款
/// </summary>
public decimal ReceivableAmount { get; set; }
/// <summary>
/// 未收
/// </summary>
public decimal RestAmount { get; set; }
/// <summary>
/// 应付款
/// </summary>
public decimal PayableAmount { get; set; }
/// <summary>
/// 利润
/// </summary>
public decimal Profit { get { return ReceivableAmount - PayableAmount; } }
/// <summary>
/// 利润率
/// </summary>
public string ProfitMargin
{
get
{
if (PayableAmount == 0)
return string.Empty;
//利润率=利润÷成本×100%
return string.Concat((ReceivableAmount / PayableAmount) * 100, "%");
}
}
}
/// <summary>
/// 按票统计
/// </summary>
public class BizFeeStat
{
/// <summary>
/// 应收款总计
/// </summary>
public decimal ReceivableTotal { get; set; }
/// <summary>
/// 应付款总计
/// </summary>
public decimal PayableTotal { get; set; }
/// <summary>
/// 利润总计
/// </summary>
public decimal ProfitTotal { get { return ReceivableTotal - PayableTotal; } }
/// <summary>
/// 利润率
/// </summary>
public string ProfitMargin
{
get
{
if (PayableTotal == 0)
return string.Empty;
//利润率=利润÷成本×100%
return string.Concat(Math.Round(ReceivableTotal / PayableTotal * 100, 2, MidpointRounding.AwayFromZero), "%");
}
}
/// <summary>
/// 人民币应收款
/// </summary>
public decimal ReceivableCNY { get; set; }
/// <summary>
/// 人民币应付款
/// </summary>
public decimal PayableCNY { get; set; }
/// <summary>
/// 人民币利润
/// </summary>
public decimal ProfitCNY { get { return ReceivableCNY - PayableCNY; } }
/// <summary>
/// 美元应收款
/// </summary>
public decimal ReceivableUSD { get; set; }
/// <summary>
/// 美元应付款
/// </summary>
public decimal PayableUSD { get; set; }
/// <summary>
/// 美元利润
/// </summary>
public decimal ProfitUSD { get { return ReceivableUSD - PayableUSD; } }
/// <summary>
/// 其他币种应收款
/// </summary>
public decimal ReceivableOther { get; set; }
/// <summary>
/// 其他币种应付款
/// </summary>
public decimal PayableOther { get; set; }
/// <summary>
/// 其他币种利润
/// </summary>
public decimal ProfitOther { get { return ReceivableOther - PayableOther; } }
/// <summary>
/// 退舱
/// </summary>
public string? CancelCabin { get; set; }
/// <summary>
/// 签单方式
/// </summary>
public string? IssueType { get; set; }
/// <summary>
/// 报关日期
/// </summary>
public DateTime? CustomsDate { get; set; }
/// <summary>
/// 预抵日期
/// </summary>
public DateTime? ETA { get; set; }
/// <summary>
/// 装货港
/// </summary>
public string? LoadPort { get; set; }
// <summary>
/// 卸货港
/// </summary>
public string? DischargePort { get; set; }
/// <summary>
/// 目的地
/// </summary>
public string? Destination { get; set; }
/// <summary>
/// 场站
/// </summary>
public string? Yard { get; set; }
/// <summary>
/// 业务来源明细
/// </summary>
public string? SourceDetailName { get; set; }
/// <summary>
/// 箱TEU
/// </summary>
public int TEU { get; set; }
/// <summary>
/// 品名
/// </summary>
public string? GoodsName { get; set; }
/// <summary>
/// 国外代理
/// </summary>
public string? Agent { get; set; }
/// <summary>
/// 操作员代码
/// </summary>
public long? OperatorId { get; set; }
/// <summary>
/// 主提单号
/// </summary>
public string? MBLNO { get; set; }
/// <summary>
/// 分提单号
/// </summary>
public string? HBLNO { get; set; }
/// <summary>
/// 委托编号
/// </summary>
public string? CustomerNo { get; set; }
/// <summary>
/// 费用对象ID
/// </summary>
public long? CustomerId { get; set; }
/// <summary>
/// 委托单位名称
/// </summary>
public string? CustomerName { get; set; }
/// <summary>
/// 业务锁定
/// </summary>
public bool? IsBusinessLocking { get; set; }
/// <summary>
/// 费用锁定
/// </summary>
public bool? IsFeeLocking { get; set; }
/// <summary>
/// 开船日期
/// </summary>
public DateTime? ETD { get; set; }
/// <summary>
/// 业务来源
/// </summary>
public string? SourceName { get; set; }
/// <summary>
/// 集装箱
/// </summary>
public string? CntrTotal { get; set; }
/// <summary>
/// 会计期间
/// </summary>
public string? AccountDate { get; set; }
/// <summary>
/// 操作
/// </summary>
public string? Operator { get; set; }
/// <summary>
/// 船名
/// </summary>
public string? Vessel { get; set; }
/// <summary>
/// 航次
/// </summary>
public string? Voyage { get; set; }
/// <summary>
/// 船公司
/// </summary>
public string? Carrier { get; set; }
/// <summary>
/// 订舱代理
/// </summary>
public string? Forwarder { get; set; }
/// <summary>
/// 订舱编号
/// </summary>
public string? BookingNo { get; set; }
}
}