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.

312 lines
7.9 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.Enums;
using DS.WMS.Core.Application.Dtos;
using DS.WMS.Core.Application.Entity;
using Masuit.Tools.Systems;
namespace DS.WMS.Core.Invoice.Dtos
{
/// <summary>
/// 发票
/// </summary>
public class InvoiceDto
{
/// <summary>
/// ID
/// </summary>
public long Id { get; set; }
/// <summary>
/// 发票号
/// </summary>
public string? InvoiceNO { get; set; }
/// <summary>
/// 发票业务编号
/// </summary>
public string BillNO { get; set; }
/// <summary>
/// 流水号
/// </summary>
public string? SN { get; set; }
/// <summary>
/// 开票时间
/// </summary>
public DateTime InvoiceDate { get; set; }
/// <summary>
/// 开票单位ID
/// </summary>
public long CustomerId { get; set; }
/// <summary>
/// 开票单位名称
/// </summary>
public string? CustomerName { get; set; }
/// <summary>
/// 发票抬头
/// </summary>
public string? InvoiceHeader { get; set; }
/// <summary>
/// 收款单位账号
/// </summary>
public string? Account { get; set; }
/// <summary>
/// 收款单位银行
/// </summary>
public string? BankName { get; set; }
/// <summary>
/// 申请金额(费用明细的合计)
/// </summary>
public decimal ApplyAmount { get; set; }
/// <summary>
/// 币别
/// </summary>
public string Currency { get; set; }
/// <summary>
/// 实收币别
/// </summary>
public string? ReceiptCurrency { get; set; }
/// <summary>
/// 锁定状态
/// </summary>
public bool IsLocked { get; set; }
/// <summary>
/// 锁定人ID
/// </summary>
[IgnoreDataMember]
public long? LockUserId { get; set; }
/// <summary>
/// 锁定人
/// </summary>
public string? LockUserName { get; set; }
/// <summary>
/// 锁定时间
/// </summary>
public DateTime? LockTime { get; set; }
/// <summary>
/// 开票人ID
/// </summary>
public long? OperatorId { get; set; }
/// <summary>
/// 开票人
/// </summary>
public string? OperatorName { get; set; }
/// <summary>
/// 发票类型
/// </summary>
public InvoiceType? Type { get; set; }
/// <summary>
/// 发票类型文本
/// </summary>
public string? TypeText => Type?.GetDescription();
/// <summary>
/// 开票方式
/// </summary>
public InvoiceMode Mode { get; set; }
/// <summary>
/// 开票方式文本
/// </summary>
public string ModeText => Mode.GetDescription();
/// <summary>
/// 是否已打印
/// </summary>
public bool IsPrinted { get; set; }
/// <summary>
/// 是否已结算
/// </summary>
public bool IsSettled { get; set; }
/// <summary>
/// 开票税率
/// </summary>
public decimal TaxRate { get; set; }
/// <summary>
/// 税额
/// </summary>
public decimal Tax => ApplyAmount - ApplyAmount * TaxRate;
/// <summary>
/// 不含税金额
/// </summary>
public decimal NoTaxAmount => ApplyAmount - Tax;
/// <summary>
/// 所属机构(公司)
/// </summary>
public long? OrgId { get; set; }
/// <summary>
/// 所属部门
/// </summary>
public string? OrgName { get; set; }
///// <summary>
///// 销方名称
///// </summary>
//public string? SellerName { get; set; }
/// <summary>
/// 纳税人识别号
/// </summary>
public string? TaxID { get; set; }
/// <summary>
/// 客户纳税人识别号
/// </summary>
public string? CustomerTaxID { get; set; }
/// <summary>
/// 客户地址电话
/// </summary>
public string? CustomerAddressTel { get; set; }
/// <summary>
/// 客户银行
/// </summary>
public string? CustomerBankName { get; set; }
/// <summary>
/// 客户银行账号
/// </summary>
public string? CustomerAccount { get; set; }
/// <summary>
/// 代开客户
/// </summary>
public string? AutualCustomerName { get; set; }
/// <summary>
/// 发票类别
/// </summary>
public string? Category { get; set; }
/// <summary>
/// 发票类别代码
/// </summary>
public string? CategoryCode { get; set; }
/// <summary>
/// 开票金额(开票明细的合计)
/// </summary>
public decimal InvoiceAmount { get; set; }
/// <summary>
/// 未结算金额
/// </summary>
public string? UnsettledAmount => Details == null ? string.Empty :
string.Join(" ", Details.GroupBy(x => x.OriginalCurrency).Select(x => new
{
Currency = x.Key,
UnsettledAmount = x.Sum(x => x.OriginalAmount - x.OriginalSettlementAmount),
}).Select(x => x.Currency + x.UnsettledAmount));
/// <summary>
/// 原币金额
/// </summary>
public string OriginalAmount => Details == null ? string.Empty :
string.Join(" ", Details.GroupBy(x => x.OriginalCurrency).Select(x => new
{
Currency = x.Key,
OriginalAmount = x.Sum(x => x.OriginalAmount),
}).Select(x => x.Currency + x.OriginalAmount));
/// <summary>
/// 开票分公司ID所属机构
/// </summary>
public long? SaleDeptId { get; set; }
/// <summary>
/// 所属分部
/// </summary>
public string? SaleDeptName { get; set; }
/// <summary>
/// 电子发票PDF地址
/// </summary>
public string? PDFUrl { get; set; }
/// <summary>
/// 是否已作废
/// </summary>
public bool IsCancelled { get; set; }
/// <summary>
/// 作废人ID
/// </summary>
[IgnoreDataMember]
public long? CancelUserId { get; set; }
/// <summary>
/// 作废人
/// </summary>
public string? CancelUserName { get; set; }
/// <summary>
/// 作废时间
/// </summary>
public DateTime? CancelTime { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 创建人ID
/// </summary>
[IgnoreDataMember]
public long CreateBy { get; set; }
/// <summary>
/// 创建人
/// </summary>
public string? CreateByName { get; set; }
[IgnoreDataMember]
public List<string>? InvoiceApplicationList { get; set; }
/// <summary>
/// 发票申请单号
/// </summary>
public string InvoiceApplicationNO => InvoiceApplicationList == null ? string.Empty : string.Join(',', InvoiceApplicationList);
/// <summary>
/// 费用明细
/// </summary>
public List<ApplicationDetailDto>? Details { get; set; }
/// <summary>
/// 发票明细
/// </summary>
public List<InvoiceDetail>? InvoiceDetails { get; set; }
/// <summary>
/// 费用明细汇总
/// </summary>
public List<SummaryItem>? Summary { get; set; }
}
}