0% found this document useful (0 votes)
7 views3 pages

RATE

Uploaded by

dekumeedoriya1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

RATE

Uploaded by

dekumeedoriya1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

CREATE PROCEDURE SP_semFunction

@pintMode INT,
@pstrSiteCode NCHAR(5),
@pmonWorkDays MONEY,
@pstrCreatedBy VARCHAR(30),
@pstrErrorMessage VARCHAR(100) OUTPUT,
@pintErrorNumber INT OUTPUT

AS
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
SET @pstrErrorMessage = 'SQL Internal Error Occured.'
SET @pintErrorNumber = 4444

IF @pintMode = 1
BEGIN

DECLARE @mmonWorkDays MONEY

CREATE TABLE #tmpData(


datEmployeeNumber NCHAR(5),
datSalaryType VARCHAR(20),
datCategory VARCHAR(30),
datDailyRate MONEY DEFAULT 0,
datRecordNumber INT IDENTITY(1,1) NOT NULL)

SELECT @mmonWorkDays = steTotalWorkingDays


FROM pmmSiteMasterlist
WHERE steCode = @pstrSiteCode

INSERT INTO #tmpData(


datEmployeeNumber,
datSalaryType,
datCategory,
datDailyRate)
SELECT
salEmployeeNumber,
salSalaryType,
salCategory,
salDailyRate
FROM pmmEmployeeSalaryMasterlist
WHERE salIsActive = 1
AND salSiteCode = @pstrSiteCode

DECLARE @mintMinRecordNumber INT


DECLARE @mintMaxRecordNumber INT
DECLARE @mstrEmployeeNumber NCHAR(8)
DECLARE @mmonDailyRate MONEY

DECLARE @mmonDerivedMonthlyRate MONEY


DECLARE @mmonDerivedOTRate MONEY
DECLARE @mmonDerivedNDRate MONEY
DECLARE @mmonDerivedNDOTRate MONEY
DECLARE @mmonDerivedSHRate MONEY
DECLARE @mmonDerivedSHOTRate MONEY
DECLARE @mmonDerivedSHNDRate MONEY
DECLARE @mmonDerivedSHNDOTRate MONEY
DECLARE @mmonDerivedSHRRate MONEY
DECLARE @mmonDerivedSHOTRRate MONEY
DECLARE @mmonDerivedSHNDRRate MONEY
DECLARE @mmonDerivedSHNDOTRRate MONEY
DECLARE @mmonDerivedLHRate MONEY
DECLARE @mmonDerivedLHOTRate MONEY
DECLARE @mmonDerivedLHNDRate MONEY
DECLARE @mmonDerivedLHNDOTRate MONEY
DECLARE @mmonDerivedLHRRate MONEY
DECLARE @mmonDerivedLHOTRRate MONEY
DECLARE @mmonDerivedLHNDRRate MONEY
DECLARE @mmonDerivedLHNDOTRRate MONEY
DECLARE @mmonDerivedSPRRate MONEY
DECLARE @mmonDerivedSPOTRRate MONEY
DECLARE @mmonDerivedSPNDRRate MONEY
DECLARE @mmonDerivedSPNDOTRRate MONEY

SELECT
@mintMinRecordNumber = MIN(datRecordNumber),
@mintMaxRecordNumber = MAX(datRecordNumber)
FROM #tmpData

WHILE @mintMinRecordNumber <= @mintMaxRecordNumber


BEGIN
SELECT
@mstrEmployeeNumber = datEmployeeNumber,
@mmonDailyRate = datDailyRate
FROM #tmpData
WHERE datRecordNumber = @mintMinRecordNumber

SET @mmonDerivedMonthlyRate = 0
SET @mmonDerivedOTRate = 0
SET @mmonDerivedNDRate = 0
SET @mmonDerivedNDOTRate = 0
SET @mmonDerivedSHRate = 0
SET @mmonDerivedSHOTRate = 0
SET @mmonDerivedSHNDRate = 0
SET @mmonDerivedSHNDOTRate = 0
SET @mmonDerivedSHRRate = 0
SET @mmonDerivedSHOTRRate = 0
SET @mmonDerivedSHNDRRate = 0
SET @mmonDerivedSHNDOTRRate = 0
SET @mmonDerivedLHRate = 0
SET @mmonDerivedLHOTRate = 0
SET @mmonDerivedLHNDRate = 0
SET @mmonDerivedLHNDOTRate = 0
SET @mmonDerivedLHRRate = 0
SET @mmonDerivedLHOTRRate = 0
SET @mmonDerivedLHNDRRate = 0
SET @mmonDerivedLHNDOTRRate = 0
SET @mmonDerivedSPRRate = 0
SET @mmonDerivedSPOTRRate = 0
SET @mmonDerivedSPNDRRate = 0
SET @mmonDerivedSPNDOTRRate = 0

SET @mmonDerivedMonthlyRate = @mmonDailyRate / @pmonWorkDays

SET @mmonDerivedOTRate = 0
SET @mmonDerivedNDRate = 0
SET @mmonDerivedNDOTRate = 0
SET @mintMinRecordNumber = @mintMinRecordNumber + 1
END

DROP TABLE #tmpData


END

You might also like