Rev 66 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<%@LANGUAGE="VBSCRIPT"%><%'====================================================='| |'| RequestProductNotes |'| |'=====================================================%><%Option explicitResponse.Expires = 0%><!--#include file="common/globals.asp"--><!--#include file="common/config.asp"--><!--#include file="common/common_subs.asp"--><%'------------ VARIABLE DEFINITION -------------Dim bgColorDim newProdId, ProdIdDim notesCount'------------ CONSTANTS DECLARATION -----------'------------ VARIABLE INIT -------------------newProdId = Request("new_prod_id") ' The PV_ID of the product in the target BOMProdId = Request("prod_id") ' The PV_ID of the product in the production BOMbgColor = NULLnotesCount = 0'------------ RUN BEFORE PAGE RENDER ----------'----------------------------------------------Sub DisplayNoteHistory(ByVal thisBomProduct_PV_ID, ByVal prodBomProduct_PV_ID)Dim this_PV_ID' if the product in this BOM looks like it was created after the equivalent product in the production BOM...If CLng(thisBomProduct_PV_ID) >= CLng(prodBomProduct_PV_ID) ThenCall Notes(thisBomProduct_PV_ID)this_PV_ID = thisBomProduct_PV_IDDothis_PV_ID = LastPvId(this_PV_ID)If (NOT IsNull(this_PV_ID)) AND CLng(this_PV_ID) >= CLng(prodBomProduct_PV_ID) ThenCall Notes(this_PV_ID)End IfLoop While (NOT IsNull(this_PV_ID)) AND (CLng(this_PV_ID) > CLng(prodBomProduct_PV_ID))' if the product in this BOM looks like it was created before the equivalent product in the production BOM...ElseIf CLng(thisBomProduct_PV_ID) < CLng(prodBomProduct_PV_ID) ThenCall Notes(prodBomProduct_PV_ID)this_PV_ID = prodBomProduct_PV_IDDothis_PV_ID = LastPvId(this_PV_ID)If (NOT IsNull(this_PV_ID)) AND CLng(this_PV_ID) >= CLng(thisBomProduct_PV_ID) ThenCall Notes(this_PV_ID)End IfLoop While (NOT IsNull(this_PV_ID)) AND (CLng(this_PV_ID) > CLng(thisBomProduct_PV_ID))End IfEnd Sub'--------------------------------------------------------------------------------------------------------------------------Function LastPvId(ByVal pvId)Dim rsQrySet rsQry = OraDatabase.DbCreateDynaset("SELECT LAST_PV_ID FROM PACKAGE_VERSIONS WHERE PV_ID="&pvId , cint(0))If IsNull(rsQry("last_pv_id")) OR (rsQry("last_pv_id") = 0) OR (rsQry.RecordCount = 0) ThenLastPvId = NULLElseIf pvId <> rsQry("last_pv_id") ThenLastPvId = rsQry("last_pv_id")ElseLastPvId = NULLEnd IfEnd IfrsQry.Close()Set rsQry = NothingEnd Function'--------------------------------------------------------------------------------------------------------------------------Sub Notes(Pv_Id)Dim notesSet 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))If notes.RecordCount > 0 ThennotesCount = notesCount + 1%><tr><td <%=bgColor%> wrap valign="top" class="body_row" colspan="4"><%=notes("pkg_version")%> - <%=notes("notes")%></td></tr><%End Ifnotes.Close()Set notes = NothingEnd Sub'--------------------------------------------------------------------------------------------------------------------------%><table width="100%" border="0" cellspacing="3" cellpadding="0"><%If IsNull(newProdId) OR newProdId = "" Then' do nothingElse' For some reason, this page can be called with a null ProdId value. To keep things safe for later on, set it' to the same value as the newProdIdIf IsNull(ProdId) OR ProdId = "" ThenProdId = newProdIdEnd IfCall DisplayNoteHistory( newProdId, ProdId )End IfIf notesCount = 0 Then%><tr><td <%=bgColor%> wrap valign="top" class="body_row" colspan="4">Product contains no notes.</td></tr><%End If%></table><%'------------ RUN AFTER PAGE RENDER -----------'----------------------------------------------%><!--#include file="common/globals_destructor.asp"-->