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.

692 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 DS.Module.Core;
using DS.Module.Core.Enums;
using DS.WMS.Core.Application.Dtos;
using DS.WMS.Core.Op.Entity;
using Masuit.Tools.Systems;
using SqlSugar;
namespace DS.WMS.Core.Fee.Dtos
{
/// <summary>
/// 付费申请单
/// </summary>
public class PaymentApplicationDto : ApplicationDto
{
/// <summary>
/// 申请单状态
/// </summary>
public PaymentApplicationStatus Status { get; set; }
public string StatusText => Status.GetDescription();
/// <summary>
/// 人民币申请金额
/// </summary>
public decimal? AmountRMB { get; set; }
/// <summary>
/// 美元申请金额
/// </summary>
public decimal? AmountUSD { get; set; }
/// <summary>
/// 其他币别申请金额
/// </summary>
public decimal? AmountOther { get; set; }
/// <summary>
/// 预计结算人民币
/// </summary>
public decimal? EstimatedSettlementRMB { get; set; }
/// <summary>
/// 预计结算美元
/// </summary>
public decimal? EstimatedSettlementRMBUSD { get; set; }
/// <summary>
/// 预计结算其他币别
/// </summary>
public decimal? EstimatedSettlementOther { get; set; }
/// <summary>
/// 结算人民币
/// </summary>
public decimal? SettlementRMB { get; set; }
/// <summary>
/// 结算美元
/// </summary>
public decimal? SettlementRMBUSD { get; set; }
/// <summary>
/// 结算其他币别
/// </summary>
public decimal? SettlementOther { get; set; }
/// <summary>
/// 人民币未申请
/// </summary>
public decimal? RestAmountRMB { get; set; }
/// <summary>
/// 美元未申请
/// </summary>
public decimal? RestAmountUSD { get; set; }
/// <summary>
/// 其他币别未申请
/// </summary>
public decimal? RestAmountOther { get; set; }
/// <summary>
/// 结算方式
/// </summary>
public long? SettlementType { get; set; }
/// <summary>
/// 结算方式名称
/// </summary>
public string? SettlementTypeName { 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? Note { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 创建人
/// </summary>
public long CreateBy { get; set; }
/// <summary>
/// 创建人名称
/// </summary>
public string CreateByName { get; set; }
public List<PaymentApplicationDetailDto>? Details { get; set; }
/// <summary>
/// 委托单位
/// </summary>
public string? Client { get; set; }
/// <summary>
/// 是否收到发票
/// </summary>
public bool IsInvoiceReceived { get; set; }
/// <summary>
/// 申请支付日期
/// </summary>
public DateTime? PaymentDate { get; set; }
/// <summary>
/// 支票抬头
/// </summary>
public string? ChequeHeader { get; set; }
/// <summary>
/// 支票备注
/// </summary>
public string? ChequeRemarks { get; set; }
/// <summary>
/// 业务编号
/// </summary>
public string? BillNO { get; set; }
public AuditStatusForQuery? AuditStatus { get; set; }
}
/// <summary>
/// 费用申请单明细
/// </summary>
public class PaymentApplicationDetailDto
{
/// <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 decimal? RestAmount { 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<PaymentApplicationDetailDto>? Details { get; set; }
/// <summary>
/// 初始化
/// </summary>
/// <param name="details">申请单明细</param>
public FeeApplicationSummary(List<PaymentApplicationDetailDto> 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; }
}
}