一直以来工资被扣税都不知道怎么算的,查了一下资料发现笔算起来挺麻烦的(每次都要对着表弄),于是做一个小程序代劳。
(使用2008年3月生效的2000起征点)
主代码如下:
//计算个人所得税按钮单击事件
private void button2_Click(object sender, EventArgs e)
{
if (t_wage.Text.Trim().Length == 0)
return;
//工资上缴个人所得税表 (工资-2000) 之后的起始、终止、税率、减除额
ArrayList taxTables = new ArrayList();
taxTables.Add(new TaxTable(0, 500, 5, 0));
taxTables.Add(new TaxTable(500, 2000, 10, 25));
taxTables.Add(new TaxTable(2000, 5000, 15, 125));
taxTables.Add(new TaxTable(5000, 20000, 20,375));
taxTables.Add(new TaxTable(20000, 40000, 25, 1375));
taxTables.Add(new TaxTable(40000,60000, 30, 3375));
taxTables.Add(new TaxTable(60000, 80000, 35, 6375));
taxTables.Add(new TaxTable(80000, 100000, 40, 10375));
taxTables.Add(new TaxTable(100000, double.MaxValue, 45, 15375));
msg.ForeColor = Color.Tomato;
try
{
double wage = double.Parse(t_wage.Text);
double wage_Tax=wage-2000;
double tax=0;
foreach (TaxTable tb in taxTables)
{
if(wage_Tax>tb.tax_low&&wage_Tax<=tb.tax_up)
{
tax = wage_Tax * tb.taxRate / 100 - tb.deduct;
break;
}
}
double remain = wage - tax;
msg.Text = "税前工资:" + t_wage.Text + "元\r\n" +
"税后工资:" + remain.ToString() + "元\r\n" +
"应交个人所得税:" + tax.ToString() + "元";
}
catch (Exception ex)
{
msg.Text = ex.Message;
}
}
/// <summary>
/// 存放个人所得税税率表的类
/// </summary>
class TaxTable
{
public double tax_low; //工资-2000后
public double tax_up; //工资-2000后
public int taxRate; //取值范围0--100
public int deduct; //减除额
public TaxTable(double Ptax_low, double Ptax_up, int PtaxRate, int Pdeduct)
{
tax_low = Ptax_low;
tax_up = Ptax_up;
taxRate = PtaxRate;
deduct = Pdeduct;
}
}
private void button2_Click(object sender, EventArgs e)
{
if (t_wage.Text.Trim().Length == 0)
return;
//工资上缴个人所得税表 (工资-2000) 之后的起始、终止、税率、减除额
ArrayList taxTables = new ArrayList();
taxTables.Add(new TaxTable(0, 500, 5, 0));
taxTables.Add(new TaxTable(500, 2000, 10, 25));
taxTables.Add(new TaxTable(2000, 5000, 15, 125));
taxTables.Add(new TaxTable(5000, 20000, 20,375));
taxTables.Add(new TaxTable(20000, 40000, 25, 1375));
taxTables.Add(new TaxTable(40000,60000, 30, 3375));
taxTables.Add(new TaxTable(60000, 80000, 35, 6375));
taxTables.Add(new TaxTable(80000, 100000, 40, 10375));
taxTables.Add(new TaxTable(100000, double.MaxValue, 45, 15375));
msg.ForeColor = Color.Tomato;
try
{
double wage = double.Parse(t_wage.Text);
double wage_Tax=wage-2000;
double tax=0;
foreach (TaxTable tb in taxTables)
{
if(wage_Tax>tb.tax_low&&wage_Tax<=tb.tax_up)
{
tax = wage_Tax * tb.taxRate / 100 - tb.deduct;
break;
}
}
double remain = wage - tax;
msg.Text = "税前工资:" + t_wage.Text + "元\r\n" +
"税后工资:" + remain.ToString() + "元\r\n" +
"应交个人所得税:" + tax.ToString() + "元";
}
catch (Exception ex)
{
msg.Text = ex.Message;
}
}
/// <summary>
/// 存放个人所得税税率表的类
/// </summary>
class TaxTable
{
public double tax_low; //工资-2000后
public double tax_up; //工资-2000后
public int taxRate; //取值范围0--100
public int deduct; //减除额
public TaxTable(double Ptax_low, double Ptax_up, int PtaxRate, int Pdeduct)
{
tax_low = Ptax_low;
tax_up = Ptax_up;
taxRate = PtaxRate;
deduct = Pdeduct;
}
}
要是有需要又懒得自己实现,这里有下载:
源码下载:Code 演示版(可当小工具使用):Demo