Project

General

Profile

Bug #1990 » CBKTTMTOPYTOTALUANGMAKAN.sql

Tri Rizqiaty, 02/15/2023 11:15 AM

 
1
CREATE PROCEDURE CBKTTMTOPYTOTALUANGMAKAN
2
(
3
	@EmployeeID VARCHAR(20)
4
	,@StartDate VARCHAR(20)
5
	,@EndDate VARCHAR(20)
6
	,@TotAttendance VARCHAR(20)
7
	,@WageType VARCHAR(20)
8
)
9
AS
10

    
11
--DECLARE @EmployeeID VARCHAR(20) = '00001000'
12
--DECLARE @StartDate VARCHAR(20) = '20230130'
13
--DECLARE @EndDate VARCHAR(20) = '20230205'
14
--DECLARE @TotAttendance VARCHAR(20) = '5'
15
--DECLARE @WageType VARCHAR(20) = '4505'
16

    
17
IF(@WageType <> '') BEGIN SET @WageType = @WageType END ELSE BEGIN SET @WageType = '4505' END
18

    
19
DECLARE @Base DECIMAL(22,0) 
20
SELECT DISTINCT @Base = Amount FROM dbo.PHRPYCU0303 
21
WHERE WageType = @WageType
22
	AND StartDate <= @EndDate AND EndDate >= @EndDate
23

    
24
DECLARE @TotUangMakan DECIMAL(22,0)
25
SET @TotUangMakan = @TotAttendance * @Base
26

    
27
SELECT @TotUangMakan AS TotUangMakan
(2-2/4)