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