Project

General

Profile

Bug #960 » PDSLOANLASTBALANCEPELUNASAN_20220419.sql

Tri Rizqiaty, 04/19/2022 09:45 AM

 
1
??USE [MinovaES_BBG_Prod]
2

3
GO
4

5
/****** Object:  StoredProcedure [dbo].[PDSLOANLASTBALANCEPELUNASAN]    Script Date: 19/04/2022 09.31.40 ******/
6

7
SET ANSI_NULLS ON
8

9
GO
10

11
SET QUOTED_IDENTIFIER ON
12

13
GO
14

15
ALTER PROCEDURE [dbo].[PDSLOANLASTBALANCEPELUNASAN]
16

17
(
18

19
	@EmployeeID VARCHAR(50),
20

21
	@StartDate VARCHAR(50),
22

23
	@HeaderSequence VARCHAR(50),
24

25
	 @LoanType VARCHAR(50)
26

27
)
28

29
AS
30

31

32

33
--DECLARE @EmployeeID VARCHAR(50) = '00000066'
34

35
--DECLARE @StartDate VARCHAR(50) = '20220201'
36

37
--DECLARE @HeaderSequence VARCHAR(50) = '3'
38

39
--DECLARE @LoanType VARCHAR(50) = '2000'
40

41

42

43
DECLARE @DateBefore VARCHAR(50)
44

45
SET @DateBefore = dbo.fn_formatdatetime(( DATEADD(dd, -1,CONVERT(DATETIME, @StartDate))),'yyyymmdd')
46

47

48

49
DECLARE @LastBalance DECIMAL(22,0)
50

51

52

53
SELECT @LastBalance = pa35.Balance
54

55
FROM dbo.PHRPA0035 AS pa35
56

57
WHERE pa35.EmployeeID = @EmployeeID
58

59
	AND pa35.HeaderSequence = @HeaderSequence
60

61
	AND pa35.EndDate = @DateBefore
62

63

64

65
SELECT @LastBalance AS LastBalance
(4-4/8)