zoukankan      html  css  js  c++  java
  • 计算个人所得税函数

    -- =============================================

    -- Author:    Maco_wang

    -- Create date: 2011-03-<Create Date,,>

    -- Description:   参考htl258(Tony)的思路,改写的计算个税的函数

    -- =============================================

    create function TaxRateOfPersonal

    (

        @fvalue numeric(18,4)

    )

    returns numeric(18,4)

    as

    begin

        declare @i numeric(18,4)

        declare @basetable table(id int,

        basemoney numeric(18,4),minvalue numeric(18,4),

        maxvalue numeric(18,4),taxs numeric(18,4))

       

        insert into @basetable

        select 1,2000,0,1000,0.05 union all

        select 2,2000,1000,3000,0.1 union all

        select 3,2000,3000,6000,0.15 union all

        select 4,2000,6000,10000,0.2 union all

        select 5,2000,10000,15000,0.25

        select @i=sum(case when @fvalue>basemoney+maxvalue

        then maxvalue-minvalue else @fvalue-basemoney-minvalue end *taxs)

        from @basetable where basemoney+minvalue<=@fvalue

        return @i

    end

     

    --测试示例

    select dbo.TaxRateOfPersonal(2500)

    select dbo.TaxRateOfPersonal(3500)

    select dbo.TaxRateOfPersonal(5000)

    select dbo.TaxRateOfPersonal(9500)

     

    --运行结果

    /*

    25.0000

    100.0000

    250.0000

    1000.0000

    */

  • 相关阅读:
    java8之OptionalDemo
    Java8之日期和时间demo
    bitUtils
    在线工具类网站
    linux配置nginx命令
    批处理命令:修改IP与DNS地址脚本
    Springboot解决使用@Scheduled创建任务时无法在同一时间执行多个任务的BUG
    Selenium常用命令
    火狐浏览器各版本下载地址
    Mysql安装多版本数据库
  • 原文地址:https://www.cnblogs.com/accumulater/p/6244760.html
Copyright © 2011-2022 走看看