通用工资计税方案

来源:百度文库 编辑:神马文学网 时间:2024/04/27 21:34:12
[日期:2005-07-08]来源:CSDN  作者:[字体:大中小]
--1:计税方案表
create table  skm_mstr(序号 int,工资比例 int,始 int, 止 int,税率 int,速算值 int )
/*
以下数据为深圳龙岗台资企业计税方式:
(比如工资为4000的计税方式为:4000*87/100 = 3840, 在2100-3599之间,适用于第3条
则计算公式为 (4000*87/100-2100)*10/100 + 25 = 163  )
*/
insert skm_mstr select  1,    87    ,0   ,  1599 , 0 ,0
union all select     2 ,   87   , 1600,  2099 , 5 ,0
union all select     3  ,  87  ,  2100,  3599 , 10 ,25
union all select     4   , 87 ,  3600,  6599 , 15 ,175
union all select     5    ,87,    6600,  99999, 20 ,625
go
--2:自定义函数计税
create function test(@a numeric(10,2))
returns numeric(10,2)
As
begin
declare @b numeric(10,2)
select @b = ( @a * 工资比例/100 - 始) * 税率 / 100 + 速算值
from skm_mstr
where floor(@a * 工资比例/100) between 始 and 止
return @b
end
go
--3:调用
Select dbo.test(4000)  -- 计算工资额为4000时的税款。
/*显示结果为
------------
163.00
(所影响的行数为 1 行)
*/