Project

General

Profile

Feature #2908 » PDSCMBSPURCHASEDOCSTATUS.sql

Tri Rizqiaty, 10/23/2024 09:46 AM

 
1
??ALTER PROCEDURE [dbo].[PDSCMBSPURCHASEDOCSTATUS]
2

3
(
4

5
	@DocType VARCHAR(20)
6

7
	,@MenuID VARCHAR(250)
8

9
)
10

11
AS
12

13

14

15
--DECLARE @DocType VARCHAR(20) = ''
16

17
--DECLARE @MenuID VARCHAR(250) = ''
18

19

20

21
IF(@MenuID = 'PURCHREQUISITIONDRAFT')
22

23
BEGIN
24

25
	SELECT * 
26

27
	FROM dbo.PCMBSPURCHASEDOCSTATUS
28

29
	WHERE DocStatus IN ('1','3','5') AND DocType = @DocType
30

31
END
32

33
ELSE IF(@MenuID = 'PURCHDEMANDFORGOODS')
34

35
BEGIN
36

37
	SELECT * 
38

39
	FROM dbo.PCMBSPURCHASEDOCSTATUS
40

41
	WHERE DocStatus IN ('2') AND DocType = @DocType
42

43
END
44

45
ELSE IF(@MenuID = 'PURCHREQUISITION')
46

47
BEGIN
48

49
	SELECT * 
50

51
	FROM dbo.PCMBSPURCHASEDOCSTATUS
52

53
	WHERE DocType = @DocType
54

55
END
56

57
ELSE IF(@MenuID = 'PURCHORDER')
58

59
BEGIN
60

61
	SELECT * 
62

63
	FROM dbo.PCMBSPURCHASEDOCSTATUS
64

65
	WHERE DocType = 'PO'
66

67
END
68

69
ELSE
70

71
BEGIN
72

73
	SELECT DISTINCT StartDate, EndDate, '', DocStatus, Description 
74

75
	FROM dbo.PCMBSPURCHASEDOCSTATUS
76

77
END
(2-2/3)