| 64 |
jtweddle |
1 |
<%@LANGUAGE="VBSCRIPT"%>
|
|
|
2 |
<%
|
|
|
3 |
'=====================================================
|
|
|
4 |
'| |
|
| 66 |
ghuddy |
5 |
'| RequestProductNotes |
|
| 64 |
jtweddle |
6 |
'| |
|
|
|
7 |
'=====================================================
|
|
|
8 |
%>
|
|
|
9 |
<%
|
|
|
10 |
Option explicit
|
|
|
11 |
Response.Expires = 0
|
|
|
12 |
%>
|
|
|
13 |
<!--#include file="common/globals.asp"-->
|
|
|
14 |
<!--#include file="common/config.asp"-->
|
|
|
15 |
<!--#include file="common/common_subs.asp"-->
|
|
|
16 |
<%
|
|
|
17 |
'------------ VARIABLE DEFINITION -------------
|
|
|
18 |
Dim bgColor
|
| 66 |
ghuddy |
19 |
Dim newProdId, ProdId
|
|
|
20 |
Dim notesCount
|
| 64 |
jtweddle |
21 |
'------------ CONSTANTS DECLARATION -----------
|
|
|
22 |
'------------ VARIABLE INIT -------------------
|
| 66 |
ghuddy |
23 |
newProdId = Request("new_prod_id") ' The PV_ID of the product in the target BOM
|
|
|
24 |
ProdId = Request("prod_id") ' The PV_ID of the product in the production BOM
|
|
|
25 |
|
|
|
26 |
bgColor = NULL
|
|
|
27 |
notesCount = 0
|
| 64 |
jtweddle |
28 |
'------------ RUN BEFORE PAGE RENDER ----------
|
|
|
29 |
'----------------------------------------------
|
| 66 |
ghuddy |
30 |
Sub DisplayNoteHistory(ByVal thisBomProduct_PV_ID, ByVal prodBomProduct_PV_ID)
|
| 64 |
jtweddle |
31 |
|
| 66 |
ghuddy |
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...
|
|
|
35 |
If CLng(thisBomProduct_PV_ID) >= CLng(prodBomProduct_PV_ID) Then
|
|
|
36 |
|
|
|
37 |
Call Notes(thisBomProduct_PV_ID)
|
|
|
38 |
|
|
|
39 |
this_PV_ID = thisBomProduct_PV_ID
|
|
|
40 |
Do
|
|
|
41 |
this_PV_ID = LastPvId(this_PV_ID)
|
|
|
42 |
|
|
|
43 |
If (NOT IsNull(this_PV_ID)) AND CLng(this_PV_ID) >= CLng(prodBomProduct_PV_ID) Then
|
|
|
44 |
Call Notes(this_PV_ID)
|
|
|
45 |
End If
|
|
|
46 |
|
|
|
47 |
Loop While (NOT IsNull(this_PV_ID)) AND (CLng(this_PV_ID) > CLng(prodBomProduct_PV_ID))
|
|
|
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
|
|
|
51 |
|
|
|
52 |
Call Notes(prodBomProduct_PV_ID)
|
|
|
53 |
|
|
|
54 |
this_PV_ID = prodBomProduct_PV_ID
|
|
|
55 |
Do
|
|
|
56 |
this_PV_ID = LastPvId(this_PV_ID)
|
|
|
57 |
|
|
|
58 |
If (NOT IsNull(this_PV_ID)) AND CLng(this_PV_ID) >= CLng(thisBomProduct_PV_ID) Then
|
|
|
59 |
Call Notes(this_PV_ID)
|
|
|
60 |
End If
|
|
|
61 |
|
|
|
62 |
Loop While (NOT IsNull(this_PV_ID)) AND (CLng(this_PV_ID) > CLng(thisBomProduct_PV_ID))
|
|
|
63 |
|
|
|
64 |
End If
|
|
|
65 |
|
| 64 |
jtweddle |
66 |
End Sub
|
|
|
67 |
'--------------------------------------------------------------------------------------------------------------------------
|
| 66 |
ghuddy |
68 |
Function LastPvId(ByVal pvId)
|
|
|
69 |
Dim rsQry
|
|
|
70 |
Set rsQry = OraDatabase.DbCreateDynaset("SELECT LAST_PV_ID FROM PACKAGE_VERSIONS WHERE PV_ID="&pvId , cint(0))
|
| 64 |
jtweddle |
71 |
|
| 66 |
ghuddy |
72 |
If IsNull(rsQry("last_pv_id")) OR (rsQry("last_pv_id") = 0) OR (rsQry.RecordCount = 0) Then
|
|
|
73 |
LastPvId = NULL
|
|
|
74 |
Else
|
|
|
75 |
If pvId <> rsQry("last_pv_id") Then
|
|
|
76 |
LastPvId = rsQry("last_pv_id")
|
|
|
77 |
Else
|
|
|
78 |
LastPvId = NULL
|
|
|
79 |
End If
|
|
|
80 |
End If
|
|
|
81 |
|
|
|
82 |
rsQry.Close()
|
|
|
83 |
Set rsQry = Nothing
|
|
|
84 |
|
| 64 |
jtweddle |
85 |
End Function
|
|
|
86 |
'--------------------------------------------------------------------------------------------------------------------------
|
|
|
87 |
Sub Notes(Pv_Id)
|
| 66 |
ghuddy |
88 |
Dim notes
|
|
|
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))
|
|
|
90 |
If notes.RecordCount > 0 Then
|
|
|
91 |
notesCount = notesCount + 1
|
|
|
92 |
%>
|
|
|
93 |
<tr>
|
|
|
94 |
<td <%=bgColor%> wrap valign="top" class="body_row" colspan="4"><%=notes("pkg_version")%> - <%=notes("notes")%></td>
|
|
|
95 |
</tr>
|
|
|
96 |
<%
|
|
|
97 |
End If
|
|
|
98 |
notes.Close()
|
|
|
99 |
Set notes = Nothing
|
| 64 |
jtweddle |
100 |
End Sub
|
|
|
101 |
'--------------------------------------------------------------------------------------------------------------------------
|
|
|
102 |
|
|
|
103 |
%>
|
| 66 |
ghuddy |
104 |
<table width="100%" border="0" cellspacing="3" cellpadding="0">
|
|
|
105 |
<%
|
| 64 |
jtweddle |
106 |
|
| 66 |
ghuddy |
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 |
|
|
|
132 |
|
| 64 |
jtweddle |
133 |
<%
|
|
|
134 |
'------------ RUN AFTER PAGE RENDER -----------
|
|
|
135 |
'----------------------------------------------
|
| 66 |
ghuddy |
136 |
%><!--#include file="common/globals_destructor.asp"-->
|