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;
using SqlSugar;
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? 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? UnsettledAmountText => Details == null ? string.Empty :
string.Join(" ", Details.GroupBy(x => x.OriginalCurrency).Select(x => new
{
Currency = x.Key,
UnsettledAmount = x.Sum(x => x.OriginalAmount - x.OriginalProcessedAmount),
}).Select(x => x.Currency + x.UnsettledAmount));
///
/// 原币金额
///
public string OriginalAmountText => 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
///
public long CreateBy { get; set; }
///
/// 创建人
///
public string? CreateByName { get; set; }
public string? Payee { get; set; }
public string? Checker { get; set; }
public bool IsSetRed { get; set; }
public string? RedCode { get; set; }
public string? RedNO { get; set; }
public string? RedReason { get; set; }
public long? RedBillId { get; set; }
///
/// 推送方式
///
[IgnoreDataMember]
public string? PushMode { get; set; }
///
/// 推送方式值
///
public PushMode[] PushModeValues { get; set; } = [];
public string? CellPhoneNO { get; set; }
public string? Email { get; set; }
public string? Note { 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? Applications { get; set; }
///
/// 费用明细汇总
///
public List? Summary { get; set; }
///
/// 本次结算人民币
///
public decimal SettlementRMB { get; set; }
///
/// 本次结算美元
///
public decimal SettlementUSD { get; set; }
///
/// 本次结算其他币别
///
public decimal SettlementOther { get; set; }
///
/// 未结人民币
///
public decimal UnSettledRMB { get; set; }
///
/// 未结美元
///
public decimal UnSettledUSD { get; set; }
///
/// 未结其他
///
public decimal UnSettledOther { get; set; }
}
}