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.

474 lines
16 KiB
C#

using System.ComponentModel;
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Info.Entity;
using DS.WMS.Core.Op.Entity;
using SqlSugar;
namespace DS.WMS.Core.Fee.Entity
{
/// <summary>
/// 费用记录
/// </summary>
[SugarTable("fee_record", TableDescription = "费用记录")]
public class FeeRecord : BaseModelV2<long>
{
/// <summary>
/// 业务Id
/// </summary>
[SugarColumn(ColumnDescription = "业务Id")]
public long BusinessId { get; set; }
/// <summary>
/// 业务类型
/// </summary>
[SugarColumn(ColumnDescription = "业务类型")]
public BusinessType BusinessType { get; set; }
/// <summary>
/// 费用状态
/// </summary>
[SugarColumn(ColumnDescription = "费用状态", DefaultValue = "1")]
public FeeStatus FeeStatus { get; set; } = FeeStatus.Entering;
/// <summary>
/// 收付类型(收、付) 1应收 2 应付
/// </summary>
[SugarColumn(ColumnDescription = "收付类型(收、付)", IsNullable = false, DefaultValue = "1")]
public FeeType FeeType { get; set; }
/// <summary>
/// 费用Id
/// </summary>
[SugarColumn(ColumnDescription = "费用Id")]
public long FeeId { get; set; }
[Navigate(NavigateType.OneToOne, nameof(FeeId))]
public FeeCode Fee { get; set; }
/// <summary>
/// 费用代码 录入费用是作为检索
/// </summary>
[SugarColumn(ColumnDescription = "费用代码", Length = 50, IsNullable = true)]
public string? FeeCode { get; set; }
/// <summary>
/// 费用名称
/// </summary>
[SugarColumn(ColumnDescription = "费用名称", Length = 100, IsNullable = true)]
public string FeeName { get; set; }
/// <summary>
/// 费用英文名称
/// </summary>
[SugarColumn(ColumnDescription = "费用英文名称", Length = 100, IsNullable = true)]
public string? FeeEnName { get; set; }
/// <summary>
/// 费用对象名称
/// </summary>
[SugarColumn(ColumnDescription = "费用对象名称", Length = 100, IsNullable = true)]
public string CustomerName { get; set; }
/// <summary>
/// 费用对象编码
/// </summary>
[SugarColumn(ColumnDescription = "费用对象编码", Length = 100, IsNullable = true)]
public string CustomerCode { get; set; }
/// <summary>
/// 费用对象Id
/// </summary>
[SugarColumn(ColumnDescription = "费用对象Id")]
public long CustomerId { get; set; }
[Navigate(NavigateType.OneToOne, nameof(CustomerId))]
public InfoClient Customer { get; set; }
/// <summary>
/// 客户类别
/// </summary>
[SugarColumn(ColumnDescription = "客户类别", Length = 50, IsNullable = true)]
public string? CustomerType { get; set; }
/// <summary>
/// 客户类别文本
/// </summary>
[SugarColumn(ColumnDescription = "客户类别文本", Length = 50, IsNullable = true)]
public string CustomerTypeText { get; set; }
/// <summary>
/// 费用标准
/// </summary>
[SugarColumn(ColumnDescription = "费用标准", Length = 20, IsNullable = true)]
public string? Unit { get; set; }
/// <summary>
/// 费用标准文本
/// </summary>
[SugarColumn(ColumnDescription = "费用标准文本", Length = 50, IsNullable = true)]
public string UnitText { get; set; }
/// <summary>
/// 不含税单价
/// </summary>
[SugarColumn(ColumnDescription = "不含税单价", IsNullable = true, Length = 18, DecimalDigits = 4, DefaultValue = "0")]
public decimal UnitPrice { get; set; }
/// <summary>
/// 数量
/// </summary>
[SugarColumn(ColumnDescription = "数量", IsNullable = true, Length = 10, DecimalDigits = 2, DefaultValue = "0")]
public decimal Quantity { get; set; } = 1m;
/// <summary>
/// 金额
/// </summary>
[SugarColumn(ColumnDescription = "金额", IsNullable = true, Length = 18, DecimalDigits = 2, DefaultValue = "0")]
public decimal Amount { get; set; }
/// <summary>
/// 币别
/// </summary>
[SugarColumn(ColumnDescription = "币别", Length = 20)]
public string Currency { get; set; }
/// <summary>
/// 币别文本
/// </summary>
[SugarColumn(ColumnDescription = "币别文本", Length = 50, IsNullable = true)]
public string CurrencyText { get; set; }
/// <summary>
/// 汇率
/// </summary>
[SugarColumn(ColumnDescription = "汇率", IsNullable = true, Length = 18, DecimalDigits = 5, DefaultValue = "1")]
public decimal? ExchangeRate { get; set; }
/// <summary>
/// 驳回原因
/// </summary>
[SugarColumn(ColumnDescription = "驳回原因", Length = 100, IsNullable = true)]
public string? Reason { get; set; }
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnDescription = "备注", Length = 1000, IsNullable = true)]
public string? Remark { get; set; }
/// <summary>
/// Desc:佣金比率
/// </summary>
[SugarColumn(ColumnDescription = "佣金比率", Length = 18, DecimalDigits = 3, DefaultValue = "0")]
public decimal CommissionRate { get; set; }
/// <summary>
/// 已结算金额
/// </summary>
[SugarColumn(ColumnDescription = "已结算金额", Length = 18, DecimalDigits = 2, DefaultValue = "0")]
public decimal SettlementAmount { get; set; }
/// <summary>
/// 已开票金额
/// </summary>
[SugarColumn(ColumnDescription = "已开票金额", Length = 18, DecimalDigits = 2, DefaultValue = "0")]
public decimal InvoiceAmount { get; set; }
/// <summary>
///已申请金额
/// </summary>
[SugarColumn(ColumnDescription = "已申请金额", Length = 18, DecimalDigits = 2, DefaultValue = "0")]
public decimal OrderAmount { get; set; }
/// <summary>
/// Desc:申请开票金额
/// </summary>
[SugarColumn(ColumnDescription = "申请开票金额", Length = 18, DecimalDigits = 2, DefaultValue = "0")]
public decimal OrderInvoiceAmount { get; set; }
/// <summary>
/// 审核人Id
/// </summary>
[SugarColumn(ColumnDescription = "审核人Id", IsNullable = true)]
public long? AuditBy { get; set; }
/// <summary>
/// 审核人
/// </summary>
[SugarColumn(ColumnDescription = "审核人", IsNullable = true, Length = 50)]
public string? AuditOperator { get; set; }
/// <summary>
/// 审核日期
/// </summary>
[SugarColumn(ColumnDescription = "审核日期", IsNullable = true)]
public DateTime? AuditDate { get; set; }
/// <summary>
/// 是否公开费用
/// </summary>
[SugarColumn(ColumnDescription = "是否公开费用", DefaultValue = "1")]
public bool IsOpen { get; set; } = true;
/// <summary>
/// 对帐编号
/// </summary>
[SugarColumn(ColumnDescription = "对帐编号", IsNullable = true, Length = 50)]
public string DebitNo { get; set; }
/// <summary>
/// 是否对帐
/// </summary>
[SugarColumn(ColumnDescription = "是否对帐", DefaultValue = "0")]
public bool IsDebit { get; set; } = false;
/// <summary>
/// 是否垫付费用
/// </summary>
[SugarColumn(ColumnDescription = "是否垫付费用", DefaultValue = "0")]
public bool IsAdvancedPay { get; set; } = false;
/// <summary>
/// 是否禁开发票
/// </summary>
[SugarColumn(ColumnDescription = "是否禁开发票", DefaultValue = "0")]
public bool IsInvoice { get; set; } = false;
/// <summary>
/// 是否销售订舱
/// </summary>
[SugarColumn(ColumnDescription = "是否销售订舱", DefaultValue = "0")]
public bool IsCrmOrderFee { get; set; } = false;
/// <summary>
/// 发票号
/// </summary>
[SugarColumn(ColumnDescription = "发票号", IsNullable = true, Length = 200)]
public string InvoiceNO { get; set; }
/// <summary>
/// 支票号
/// </summary>
[SugarColumn(ColumnDescription = "支票号", IsNullable = true, Length = 200)]
[Description("支票号")]
public string ChequeNO { get; set; }
/// <summary>
/// 仓储编号
/// </summary>
[SugarColumn(ColumnDescription = "仓储编号", IsNullable = true, Length = 100)]
public string WmsOutBSNO { get; set; }
/// <summary>
/// 税率
/// </summary>
[SugarColumn(ColumnDescription = "税率", Length = 18, DecimalDigits = 4, DefaultValue = "0")]
public decimal TaxRate { get; set; }
/// <summary>
/// 不含税金额
/// </summary>
[SugarColumn(ColumnDescription = "不含税金额", Length = 18, DecimalDigits = 2, DefaultValue = "0")]
public decimal NoTaxAmount { get; set; }
/// <summary>
/// 财务税率 (销项税率)
/// </summary>
[SugarColumn(ColumnDescription = "财务税率 (销项税率)", Length = 18, DecimalDigits = 4, DefaultValue = "0")]
public decimal AccTaxRate { get; set; }
/// <summary>
/// 是否生成凭证
/// </summary>
[SugarColumn(ColumnDescription = "是否生成凭证", IsNullable = true, DefaultValue = "0")]
public bool IsVou { get; set; }
/// <summary>
/// 报销编号
/// </summary>
[SugarColumn(ColumnDescription = "报销编号", IsNullable = true, Length = 50)]
public string BxId { get; set; }
/// <summary>
/// 税额
/// </summary>
[SugarColumn(ColumnDescription = "税额", Length = 18, DecimalDigits = 2, DefaultValue = "0")]
public decimal Tax { get; set; }
/// <summary>
/// 申请金额已结算
/// </summary>
[SugarColumn(ColumnDescription = "申请金额已结算", Length = 18, DecimalDigits = 2, DefaultValue = "0")]
public decimal OrderSettlementAmount { get; set; }
/// <summary>
/// 含税单价
/// </summary>
[SugarColumn(ColumnDescription = "含税单价", Length = 18, DecimalDigits = 4, DefaultValue = "0")]
public decimal TaxUnitPrice { get; set; }
/// <summary>
/// 申请发票金额已开票
/// </summary>
[SugarColumn(ColumnDescription = "申请发票金额已开票", Length = 18, DecimalDigits = 3, DefaultValue = "0")]
public decimal OrderInvSettlementAmount { get; set; }
/// <summary>
/// 凭证号
/// </summary>
[SugarColumn(ColumnDescription = "凭证号", IsNullable = true, Length = 50)]
public string VoucherNo { get; set; }
/// <summary>
///
/// </summary>
[SugarColumn(ColumnDescription = "SalesNo", IsNullable = true, Length = 50)]
public string? SalesNo { get; set; }
/// <summary>
/// 借款编号
/// </summary>
[SugarColumn(ColumnDescription = "借款编号", IsNullable = true, Length = 50)]
public string? JkId { get; set; }
/// <summary>
///
/// </summary>
[SugarColumn(ColumnDescription = "DeliveryNo", IsNullable = true, Length = 50)]
public string? DeliveryNo { get; set; }
/// <summary>
/// 本位币
/// </summary>
[SugarColumn(ColumnDescription = "本位币", IsNullable = true, Length = 30, IsOnlyIgnoreUpdate = true)]
public string? LocalCurrency { get; set; }
/// <summary>
/// 责任人
/// </summary>
[SugarColumn(ColumnDescription = "责任人", IsNullable = true, Length = 50)]
public string? Manager { get; set; }
/// <summary>
/// 是否财务费用
/// </summary>
[SugarColumn(ColumnDescription = "是否财务费用", IsNullable = true, DefaultValue = "0")]
public bool IsAcc { get; set; }
/// <summary>
///
/// </summary>
[SugarColumn(ColumnDescription = "PaymentId", IsNullable = true, Length = 50)]
public string? PaymentId { get; set; }
/// <summary>
///
/// </summary>
[SugarColumn(ColumnDescription = "StatementNo", IsNullable = true, Length = 50)]
public string? StatementNo { get; set; }
/// <summary>
/// 核算单位
/// </summary>
[SugarColumn(ColumnDescription = "核算单位", IsNullable = true, Length = 50)]
public string? SaleOrg { get; set; }
/// <summary>
/// 核算单位Id
/// </summary>
[SugarColumn(ColumnDescription = "核算单位Id", IsNullable = true)]
public long? SaleOrgId { get; set; }
/// <summary>
/// 发票自助连接
/// </summary>
[SugarColumn(ColumnDescription = "发票自助连接", IsNullable = true, Length = 50)]
public string? InvLinkId { get; set; }
/// <summary>
/// 提交日期
/// </summary>
[SugarColumn(ColumnDescription = "提交日期", IsNullable = true)]
public DateTime? SubmitDate { get; set; }
/// <summary>
/// 提交人
/// </summary>
[SugarColumn(ColumnDescription = "提交人", IsNullable = true, Length = 50)]
public long? SubmitBy { get; set; }
//[SugarColumn(ColumnDescription = "当前审批ID", IsNullable = true)]
//public long? FlowId { get; set; }
/// <summary>
/// 排序
/// </summary>
[SugarColumn(ColumnDescription = "排序", IsNullable = true)]
public int? OrderNo { get; set; }
/// <summary>
/// 录入方式
/// </summary>
[SugarColumn(ColumnDescription = "录入方式", IsNullable = true)]
public InputMethod? InputMethod { get; set; }
/// <summary>
/// 费用模板Id
/// </summary>
[SugarColumn(ColumnDescription = "费用模板Id")]
public long? TemplateId { get; set; }
/// <summary>
/// 通过含税单价数量 和税率
/// 计算不含税单价 不含税金额
/// </summary>
public void SetTax()
{
if (TaxRate == 0)
{
if (TaxUnitPrice == 0)
{
TaxUnitPrice = UnitPrice;
}
else if (UnitPrice == 0)
{
UnitPrice = TaxUnitPrice;
}
if (Amount == 0)
{
Amount = NoTaxAmount;
}
else if (NoTaxAmount == 0)
{
NoTaxAmount = Amount;
}
}
else
{
var taxrateb = 1 + TaxRate / 100;
NoTaxAmount = Amount / taxrateb;
Tax = Amount - NoTaxAmount;
if (Quantity > 0)
{
UnitPrice = NoTaxAmount / Quantity;
TaxUnitPrice = Amount / Quantity;
}
else
{
UnitPrice = NoTaxAmount;
TaxUnitPrice = Amount;
}
}
NoTaxAmount = Math.Round(UnitPrice * Quantity, 2, MidpointRounding.AwayFromZero);
Amount = Math.Round(TaxUnitPrice * Quantity, 2, MidpointRounding.AwayFromZero);
}
}
/// <summary>
/// 费用录入方式
/// </summary>
public enum InputMethod
{
/// <summary>
/// 手工录入
/// </summary>
[Description("手工录入")]
Manual,
/// <summary>
/// 模板自动生成
/// </summary>
[Description("模板自动生成")]
Automatic
}
}