Subversion Repositories DevTools

Rev

Rev 64 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 64 Rev 66
Line 1... Line 1...
1
<%@LANGUAGE="VBSCRIPT"%>
1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
2
<%
3
'=====================================================
3
'=====================================================
4
'|                                                   |
4
'|                                                   |
5
'|		          RequestProductNotes			 	 |
5
'|                RequestProductNotes                |
6
'|                                                   |
6
'|                                                   |
7
'=====================================================
7
'=====================================================
8
%>
8
%>
9
<%
9
<%
10
Option explicit
10
Option explicit
Line 13... Line 13...
13
<!--#include file="common/globals.asp"-->
13
<!--#include file="common/globals.asp"-->
14
<!--#include file="common/config.asp"-->
14
<!--#include file="common/config.asp"-->
15
<!--#include file="common/common_subs.asp"-->
15
<!--#include file="common/common_subs.asp"-->
16
<%
16
<%
17
'------------ VARIABLE DEFINITION -------------
17
'------------ VARIABLE DEFINITION -------------
18
Dim rsQry
-
 
19
Dim IsProductInNewBom
-
 
20
Dim bgColor
18
Dim bgColor
21
Dim QueryName
-
 
22
Dim parBomId
-
 
23
Dim objWSH
-
 
24
Dim rsPkg, pkgName, pkgVersion, pkgId
-
 
25
Dim rsProj, projName, branchName
-
 
26
Dim rsOS, OSName
-
 
27
Dim	newProdId, ProdId
19
Dim newProdId, ProdId
28
Dim	errormsg
20
Dim notesCount
29
'------------ CONSTANTS DECLARATION -----------
21
'------------ CONSTANTS DECLARATION -----------
30
'------------ VARIABLE INIT -------------------
22
'------------ VARIABLE INIT -------------------
31
parBomId = Request("bom_id")
-
 
32
newProdId	=	Request("new_prod_id")
23
newProdId  = Request("new_prod_id")  ' The PV_ID of the product in the target BOM
33
ProdId	=	Request("prod_id")
24
ProdId     = Request("prod_id")      ' The PV_ID of the product in the production BOM
-
 
25
 
34
 bgColor = NULL
26
bgColor    = NULL
35
'------------ CONDITIONS ----------------------
27
notesCount = 0
36
'----------------------------------------------
-
 
37
%>
-
 
38
<%
-
 
39
'--------------------------------------------------------------------------------------------------------------
-
 
40
'--------------------------------------------------------------------------------------------------------------
-
 
41
%>
-
 
42
<%
-
 
43
'------------ RUN BEFORE PAGE RENDER ----------
28
'------------ RUN BEFORE PAGE RENDER ----------
44
'----------------------------------------------
29
'----------------------------------------------
45
Sub PreviousVersions(newProdId, ProdId)
30
Sub DisplayNoteHistory(ByVal thisBomProduct_PV_ID, ByVal prodBomProduct_PV_ID)
46
	
31
 
-
 
32
   Dim this_PV_ID
-
 
33
 
-
 
34
   ' if the product in this BOM looks like it was created after the equivalent product in the production BOM...
47
	If CLng(newProdId) >= CLng(ProdId) Then
35
   If CLng(thisBomProduct_PV_ID) >= CLng(prodBomProduct_PV_ID) Then
-
 
36
 
48
		While CLng(newProdId) >= CLng(ProdId)
37
      Call Notes(thisBomProduct_PV_ID)
-
 
38
 
-
 
39
      this_PV_ID = thisBomProduct_PV_ID
-
 
40
      Do
49
			ProdId = LastPvId(ProdId)
41
         this_PV_ID = LastPvId(this_PV_ID)
-
 
42
 
50
			If CLng(newProdId) >= CLng(ProdId) Then
43
         If (NOT IsNull(this_PV_ID)) AND CLng(this_PV_ID) >= CLng(prodBomProduct_PV_ID) Then
51
				Call Notes(ProdId)
44
            Call Notes(this_PV_ID)
52
			End If
45
         End If
53
		Wend
46
 
-
 
47
      Loop While (NOT IsNull(this_PV_ID)) AND (CLng(this_PV_ID) > CLng(prodBomProduct_PV_ID))
54
	End If	
48
 
-
 
49
   ' if the product in this BOM looks like it was created before the equivalent product in the production BOM...
-
 
50
   ElseIf CLng(thisBomProduct_PV_ID) < CLng(prodBomProduct_PV_ID) Then
55
 
51
 
56
	If CLng(ProdId) >= CLng(newProdId) Then
52
      Call Notes(prodBomProduct_PV_ID)
-
 
53
 
57
		While CLng(ProdId) >= CLng(newProdId)
54
      this_PV_ID = prodBomProduct_PV_ID
-
 
55
      Do
58
			newProdId = LastPvId(newProdId)
56
         this_PV_ID = LastPvId(this_PV_ID)
-
 
57
 
59
			If CLng(ProdId) >= CLng(newProdId) Then
58
         If (NOT IsNull(this_PV_ID)) AND CLng(this_PV_ID) >= CLng(thisBomProduct_PV_ID) Then
60
				Call Notes(newProdId)
59
            Call Notes(this_PV_ID)
61
			End If
60
         End If
-
 
61
 
-
 
62
      Loop While (NOT IsNull(this_PV_ID)) AND (CLng(this_PV_ID) > CLng(thisBomProduct_PV_ID))
62
		Wend	
63
 
63
	End If
64
   End If
64
		 
65
 
65
End Sub
66
End Sub
66
'--------------------------------------------------------------------------------------------------------------------------
67
'--------------------------------------------------------------------------------------------------------------------------
67
Function LastPvId(pvId)
68
Function LastPvId(ByVal pvId)
68
	Dim qryA
69
   Dim rsQry
69
	Set qryA = OraDatabase.DbCreateDynaset("SELECT LAST_PV_ID FROM PACKAGE_VERSIONS WHERE PV_ID="&pvId , cint(0))
70
   Set rsQry = OraDatabase.DbCreateDynaset("SELECT LAST_PV_ID FROM PACKAGE_VERSIONS WHERE PV_ID="&pvId , cint(0))
70
	
71
 
-
 
72
   If IsNull(rsQry("last_pv_id")) OR (rsQry("last_pv_id") = 0) OR (rsQry.RecordCount = 0) Then
71
	LastPvId = pvId
73
      LastPvId = NULL
72
	
74
   Else
73
	If pvId <> qryA("last_pv_id") Then	
75
      If pvId <> rsQry("last_pv_id") Then
74
		LastPvId = qryA("last_pv_id")
76
         LastPvId = rsQry("last_pv_id")
75
	'Else 
77
      Else
76
	'	errormsg = true
78
         LastPvId = NULL
-
 
79
      End If
77
	End If
80
   End If
78
	
81
 
79
	qryA.Close()
82
   rsQry.Close()
80
	Set qryA = Nothing
83
   Set rsQry = Nothing
81
 
84
 
82
End Function
85
End Function
83
'--------------------------------------------------------------------------------------------------------------------------
86
'--------------------------------------------------------------------------------------------------------------------------
84
Sub Notes(Pv_Id)
87
Sub Notes(Pv_Id)
85
	Dim notes
88
   Dim notes
86
	Set notes = OraDatabase.DbCreateDynaset("SELECT PN.NOTES, PV.PKG_VERSION FROM PACKAGE_VERSIONS PV, PRODUCT_NOTES PN WHERE PN.PROD_ID = PV.PV_ID AND PN.PROD_ID="&Pv_id , cint(0))
89
   Set notes = OraDatabase.DbCreateDynaset("SELECT PN.NOTES, PV.PKG_VERSION FROM PACKAGE_VERSIONS PV, PRODUCT_NOTES PN WHERE PN.PROD_ID = PV.PV_ID AND PN.PROD_ID="&Pv_id , cint(0))
87
	If notes.RecordCount > 0 Then
90
   If notes.RecordCount > 0 Then
-
 
91
      notesCount = notesCount + 1
88
%>
92
      %>
89
<tr>
93
      <tr>
90
	<td <%=bgColor%> nowrap valign="top" class="body_row" colspan="2"><%=notes("pkg_version")%> - <%=notes("notes")%></td>
94
         <td <%=bgColor%> wrap valign="top" class="body_row" colspan="4"><%=notes("pkg_version")%> - <%=notes("notes")%></td>
91
</tr>	
95
      </tr>
92
<%
96
      <%
93
	End If
97
   End If
94
	notes.Close()
98
   notes.Close()
95
	Set notes = Nothing
99
   Set notes = Nothing
96
End Sub
100
End Sub
97
'--------------------------------------------------------------------------------------------------------------------------
101
'--------------------------------------------------------------------------------------------------------------------------
98
 
102
 
99
%>
103
%>
-
 
104
<table width="100%"  border="0" cellspacing="3" cellpadding="0">
-
 
105
   <%
-
 
106
 
-
 
107
   If IsNull(newProdId) OR newProdId = "" Then
-
 
108
      ' do nothing
-
 
109
   Else
-
 
110
      ' For some reason, this page can be called with a null ProdId value. To keep things safe for later on, set it
-
 
111
      ' to the same value as the newProdId
-
 
112
      If IsNull(ProdId) OR ProdId = "" Then
-
 
113
         ProdId = newProdId
-
 
114
      End If
-
 
115
 
-
 
116
      Call DisplayNoteHistory( newProdId, ProdId )
-
 
117
   End If
-
 
118
 
-
 
119
   If notesCount = 0 Then
-
 
120
      %>
-
 
121
      <tr>
-
 
122
         <td <%=bgColor%> wrap valign="top" class="body_row" colspan="4">Product contains no notes.</td>
-
 
123
     </tr>
-
 
124
      <%
-
 
125
   End If
-
 
126
 
-
 
127
 
-
 
128
   %>
-
 
129
</table>
-
 
130
 
-
 
131
 
100
 
132
 
101
		
-
 
102
		<table width="100%"  border="0" cellspacing="3" cellpadding="0">
-
 
103
          <%
-
 
104
		  'If newProdId > ProdId Then
-
 
105
		'	  Call PreviousVersions(newProdId, ProdId)
-
 
106
		'  End If
-
 
107
		  
-
 
108
		 ' OraDatabase.Parameters.Add "BOM_ID", 			Request("bom_id"),			ORAPARM_INPUT, ORATYPE_NUMBER 
-
 
109
		 ' OraDatabase.Parameters.Add "COMPARE_BOM_ID", 	Request("compare_bom_id"),	ORAPARM_INPUT, ORATYPE_NUMBER 
-
 
110
		 ' OraDatabase.Parameters.Add "PROD_ID",  		Request("prod_id"),		ORAPARM_INPUT, ORATYPE_NUMBER 
-
 
111
		 ' OraDatabase.Parameters.Add "PKG_ID",  		Request("pkg_id"),		ORAPARM_INPUT, ORATYPE_NUMBER 
-
 
112
		  
-
 
113
		 ' Set rsQry = OraDatabase.DbCreateDynaset( GetQuery ( QueryName ), ORADYN_DEFAULT )
-
 
114
		  
-
 
115
		 ' bgColor = NULL
-
 
116
		 ' End If
-
 
117
		 %> 
-
 
118
		</table>	
-
 
119
		 
-
 
120
	
-
 
121
	
-
 
122
<%
133
<%
123
'------------ RUN AFTER PAGE RENDER -----------
134
'------------ RUN AFTER PAGE RENDER -----------
124
'----------------------------------------------
135
'----------------------------------------------
125
%><!--#include file="common/globals_destructor.asp"-->
-
 
126
136
%><!--#include file="common/globals_destructor.asp"-->
-
 
137