Project

General

Profile

Feature #2998 » PDSCMBSSALESDOCSTATUS.sql

Tri Rizqiaty, 10/21/2024 09:45 AM

 
1
??ALTER PROCEDURE [dbo].[PDSCMBSSALESDOCSTATUS]
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) = 'SALESINQDRAFT'
18

19

20

21
IF(@MenuID = 'SALESINQDRAFT')
22

23
BEGIN
24

25
	SELECT * 
26

27
	FROM dbo.PCMBSSALESDOCSTATUS
28

29
	WHERE DocStatus IN ( '1','2') AND DocType = 'SINQ'
30

31
END
32

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

35
BEGIN
36

37
	SELECT * 
38

39
	FROM dbo.PCMBSSALESDOCSTATUS
40

41
	WHERE DocType = 'SINQ'
42

43
END
44

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

47
BEGIN
48

49
	SELECT * 
50

51
	FROM dbo.PCMBSSALESDOCSTATUS
52

53
	WHERE DocStatus IN ('7','9','10') AND DocType = 'SORD'--WHERE DocStatus IN ('7','9') AND DocType = 'SORD'
54

55
END
56

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

59
BEGIN
60

61
	SELECT * 
62

63
	FROM dbo.PCMBSSALESDOCSTATUS
64

65
	WHERE DocType = 'SORD'
66

67
END
68

69
ELSE IF(@MenuID = 'SALESQUOTADRAFT')
70

71
BEGIN
72

73
	SELECT * 
74

75
	FROM dbo.PCMBSSALESDOCSTATUS
76

77
	WHERE DocStatus IN ('4','6') AND DocType = 'SQUO'
78

79
END
80

81
ELSE IF(@MenuID = 'SALESQUOTA')
82

83
BEGIN
84

85
	SELECT * 
86

87
	FROM dbo.PCMBSSALESDOCSTATUS
88

89
	WHERE DocType = 'SQUO'
90

91
END
92

93
ELSE
94

95
BEGIN
96

97
	SELECT DISTINCT *
98

99
	FROM dbo.PCMBSSALESDOCSTATUS
100

101
END
(2-2/4)