/*新个税计算公式<=1500 3% 0>1500 <=4500 10% 105>4500 <=9000 20% 555>9000 <=35000 25% 1005>35000 <=55000 30% 2755>55000 <=80000 35% 5505>80000 <=45% 13505*/if OBJECT_ID('dbo.cal') is not null drop function dbo.calgocreate function dbo.cal( @salary money, @k money) returns varchar(100)as begin declare @startNum as money = 3500 declare @cha as money declare @result as money set @cha = @salary - @k - @startNum; if @cha <= 0 set @result = 0 else if @cha>0 and @cha<=1500 set @result = @cha *3/100 else if @cha>1500 and @cha<=4500 set @result = @cha *10/100-105 else if @cha>4500 and @cha<=9000 set @result = @cha *20/100-555 else if @cha>9000 and @cha<=35000 set @result = @cha *25/100-1005 else if @cha>35000 and @cha<=55000 set @result = @cha *30/100-2755 else if @cha>55000 and @cha<=80000 set @result = @cha *35/100-5505 else if @cha>80000 set @result = @cha *45/100-13505 return cast(@result as varchar(10))endgo