|
@@ -0,0 +1,186 @@
|
|
|
+using AIPlatform.Protocol.Utilities;
|
|
|
+using Newtonsoft.Json;
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.IO;
|
|
|
+
|
|
|
+namespace AIPlatform.Protocol
|
|
|
+{
|
|
|
+ /// <summary>
|
|
|
+ /// 个人所得税参数
|
|
|
+ /// </summary>
|
|
|
+ public class PersonalIncomeTaxParameter
|
|
|
+ {
|
|
|
+ /// <summary>
|
|
|
+ /// 预扣率,单位%
|
|
|
+ /// </summary>
|
|
|
+ public decimal WithHoldingRate { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 最少减除费用(税前少于4000时,最少减除费用为800)
|
|
|
+ /// </summary>
|
|
|
+ public decimal MinDeductibleExpenses { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 减除费用率,单位%
|
|
|
+ /// </summary>
|
|
|
+ public decimal DeductibleExpensesRate { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 速算扣除数
|
|
|
+ /// </summary>
|
|
|
+ public decimal QuickDeductionAmount { get; set; }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 增值税参数
|
|
|
+ /// </summary>
|
|
|
+ public class ValueAddedTaxParameter
|
|
|
+ {
|
|
|
+ /// <summary>
|
|
|
+ /// 税率,单位%
|
|
|
+ /// </summary>
|
|
|
+ public decimal TaxRate { get; set; }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 城建税参数
|
|
|
+ /// </summary>
|
|
|
+ public class UrbanConstructionTaxParameter
|
|
|
+ {
|
|
|
+ /// <summary>
|
|
|
+ /// 税率,单位%
|
|
|
+ /// </summary>
|
|
|
+ public decimal TaxRate { get; set; }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 税率配置信息
|
|
|
+ /// </summary>
|
|
|
+ public class TaxConfigInfo
|
|
|
+ {
|
|
|
+ /// <summary>
|
|
|
+ /// 个人所得税税率表
|
|
|
+ /// </summary>
|
|
|
+ public Dictionary<decimal, PersonalIncomeTaxParameter> PersonalIncomeTaxRateDictionary { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 增值税税率表
|
|
|
+ /// </summary>
|
|
|
+ public Dictionary<decimal, ValueAddedTaxParameter> ValueAddedTaxRateDictionary { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 城建税税率表
|
|
|
+ /// </summary>
|
|
|
+ public Dictionary<decimal, UrbanConstructionTaxParameter> UrbanConstructionTaxRateDictionary { get; set; }
|
|
|
+ }
|
|
|
+
|
|
|
+ public class TaxConfig : TaxConfigInfo
|
|
|
+ {
|
|
|
+ private static readonly string _configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TaxConfig.json");
|
|
|
+
|
|
|
+ public static TaxConfig Instance { get; private set; }
|
|
|
+
|
|
|
+ static TaxConfig()
|
|
|
+ {
|
|
|
+ if (!LoadConfig())
|
|
|
+ {
|
|
|
+ var personalIncomeTaxRateDictionary = new Dictionary<decimal, PersonalIncomeTaxParameter>
|
|
|
+ {
|
|
|
+ {
|
|
|
+ 20000,
|
|
|
+ new PersonalIncomeTaxParameter()
|
|
|
+ {
|
|
|
+ MinDeductibleExpenses = 800,
|
|
|
+ DeductibleExpensesRate=20,
|
|
|
+ WithHoldingRate = 20,
|
|
|
+ QuickDeductionAmount = 0,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ 50000,
|
|
|
+ new PersonalIncomeTaxParameter()
|
|
|
+ {
|
|
|
+ MinDeductibleExpenses = 0,
|
|
|
+ DeductibleExpensesRate=20,
|
|
|
+ WithHoldingRate = 30,
|
|
|
+ QuickDeductionAmount = 2000,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ decimal.MaxValue,
|
|
|
+ new PersonalIncomeTaxParameter()
|
|
|
+ {
|
|
|
+ MinDeductibleExpenses = 0,
|
|
|
+ DeductibleExpensesRate=20,
|
|
|
+ WithHoldingRate = 40,
|
|
|
+ QuickDeductionAmount = 7000,
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ var valueAddedTaxRateDictionary = new Dictionary<decimal, ValueAddedTaxParameter>
|
|
|
+ {
|
|
|
+ {
|
|
|
+ 500,
|
|
|
+ new ValueAddedTaxParameter
|
|
|
+ {
|
|
|
+ TaxRate = 0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ decimal.MaxValue,
|
|
|
+ new ValueAddedTaxParameter
|
|
|
+ {
|
|
|
+ TaxRate = 1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ var urbanConstructionTaxRateDictionary = new Dictionary<decimal, UrbanConstructionTaxParameter>
|
|
|
+ {
|
|
|
+ {
|
|
|
+ decimal.MaxValue,
|
|
|
+ new UrbanConstructionTaxParameter
|
|
|
+ {
|
|
|
+ TaxRate = 3.5m
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ Instance = new TaxConfig
|
|
|
+ {
|
|
|
+ PersonalIncomeTaxRateDictionary = personalIncomeTaxRateDictionary,
|
|
|
+ ValueAddedTaxRateDictionary = valueAddedTaxRateDictionary,
|
|
|
+ UrbanConstructionTaxRateDictionary = urbanConstructionTaxRateDictionary
|
|
|
+ };
|
|
|
+ Save();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private static bool LoadConfig()
|
|
|
+ {
|
|
|
+ if (!File.Exists(_configPath))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var jsonString = File.ReadAllText(_configPath);
|
|
|
+ Instance = JsonConvert.DeserializeObject<TaxConfig>(jsonString);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ Logger.WriteLineError($"TaxConfigInfo LoadConfig error: {ex}");
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static void Save()
|
|
|
+ {
|
|
|
+ var jsonString = JsonConvert.SerializeObject(Instance, new JsonSerializerSettings
|
|
|
+ {
|
|
|
+ Formatting = Formatting.Indented
|
|
|
+ });
|
|
|
+ File.WriteAllText(_configPath, jsonString);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|