I have never been aware of how to calculate my salary tax deduction. I checked the information and found that it was quite troublesome (I had to look at the table every time), so I made a small program to work on behalf of me.
The main code is as follows:
// Calculate personal income tax Click Event
Private void button2_click (Object sender, eventargs E)
{
If (t_wage.text.trim (). Length = 0)
Return;
// Start, end, tax rate, and deduction after the individual income tax table (wage-1600) is paid
Arraylist taxtables = new arraylist ();
Taxtables. Add (New taxtable (0,500, 5, 0 ));
Taxtables. Add (New taxtable (500,200 0, 10, 25 ));
Taxtables. Add (New taxtable (2000,500 0, 15,125 ));
Taxtables. Add (New taxtable (5000,200 00, 20,375 ));
Taxtables. Add (New taxtable (20000,400 00, 25,137 5 ));
Taxtables. Add (New taxtable (30,337 ));
Taxtables. Add (New taxtable (60000,800 00, 35,637 5 ));
Taxtables. Add (New taxtable (80000,100 000, 40,103 75 ));
Taxtables. Add (New taxtable (100000, double. maxvalue, 45,153 75 ));
MSG. forecolor = color. Tomato;
Try
{
Double wage = double. parse (t_wage.text );
Double wage_tax = wage-1600;
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 = "pre-tax salary:" + t_wage.text + "Yuan \ r \ n" +
"After-tax salary:" + remain. tostring () + "RMB \ r \ n" +
"Personal income tax payable:" + tax. tostring () + "RMB ";
}
Catch (exception ex)
{
MSG. Text = ex. message;
}
}
/// <Summary>
/// Category of the Personal Income Tax Rate Table
/// </Summary>
Class taxtable
{
Public double tax_low; // After-1600
Public double tax_up; // After-1600
Public int taxrate; // value range: 0--100
Public int deduct; // deduct the amount
Public taxtable (double ptax_low, double ptax_up, int ptaxrate, int pdeduct)
{
Tax_low = ptax_low;
Tax_up = ptax_up;
Taxrate = ptaxrate;
Deduct = pdeduct;
}
}
If you need it, you are too lazy to implement it yourself. Here are the downloads:
Source code download: Code demo version (available as a small tool): Demo