General pay tax

zhaozj2021-02-16  52

--1: Speaking schedule Create Table SKM_MSTR (Sequence INT, Salary INT, Start INT, Taxation INT, Tax Rate INT, Speed ​​Rate Int) / * The following data is Shenzhen Longgang Taiwan-funded enterprise tax mode: (such as salary The 4000 taxation mode is: 4000 * 87/100 = 3840, between 2100-3599, suitable for article 3, calculation formula is (4000 * 87 / 100-2100) * 10/100 25 = 163) * / INSERT SKM_MSTR SELECT 1, 87, 0, 1599, 0, 0UNION All Select 2, 87, 1600, 2099, 5, 0Union All Select 3, 87, 2100, 3599, 10, 25Union All Slect 4, 87, 3600, 6599 , 15, 175Union All Slect 5, 87, 6600, 99999, 20, 625GO

--2: Custom Function Tax Create Function Test (@A Numeric (10, 2)) Returns Numeric (10, 2) asbegindeclare @B Numeric (10, 2) SELECT @B = (@A * Wedding ratio / 100 - Start) * Tax rate / 100 speed calculation from SKM_MST WHERE FLOOR (@A * salary / 100) BetWeen starts Return @Bend Go

--3: Call Select DBO.TEST (4000) - The tax payment of 4000 is calculated. / * Display result is ------------ 163.00

(The number of rows affects is 1 line) * /

转载请注明原文地址:https://www.9cbs.com/read-22848.html

New Post(0)