Subversion Repositories DevTools

Rev

Rev 66 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'|                                                   |
'|                   Bom_Home                        |
'|                                                   |
'=====================================================
%>
<%
Option explicit
Response.Expires = 0
Response.buffer = True
%>
<%
'To enable the script timeout to 10 mins
Server.ScriptTimeout=600
%>
<!--#include file="common/globals.asp"-->
<!--#include file="common/config.asp"-->
<!--#include file="common/common_subs.asp"-->
<!--#include file="common/_bom_common.asp"-->
<!--#include file="controls/ERGFormComponent/classFormComponent.asp"-->
<%
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_general.asp"-->
<%
'------------ VARIABLE DEFINITION -------------
Dim rsQry
Dim parProd_id_select
Dim parShowall

Dim objFormCollector
Dim objFormComponent
Dim rsTemp
'------------ CONSTANTS DECLARATION -----------
Const LIMG_UPDATED = "<img src='icons/i_updated.gif' width='11' height='11' hspace='2' vspace='2' border='0' align='absmiddle' title='Updated'>"
Const LIMG_ADDED = "<img src='icons/i_added.gif' width='11' height='11' border='0' hspace='2' vspace='2' align='absmiddle' title='Added'>"
Const LIMG_REMOVED = "<img src='icons/i_removed.gif' width='11' height='11' border='0' hspace='2' vspace='2' align='absmiddle' title='Removed'>"
Const LIMG_NOTE_NEW = "<img src='icons/i_note_new.gif' width='18' height='18' border='0' align='absmiddle'>"
Const LIMG_NOTE_EDIT = "<img src='icons/i_note_edit.gif' width='18' height='18' border='0' align='absmiddle'>"
'------------ VARIABLE INIT -------------------
Set objFormCollector = CreateObject("Scripting.Dictionary")
Set objFormComponent = New FormComponent
'------------ CONDITIONS ----------------------
'----------------------------------------------
%>
<%
'--------------------------------------------------------------------------------------------------------------------------
'Extract the parts of the version string into seperate variables
Sub GetMajorMinorPatch( ByVal versionString, ByRef Major, ByRef Minor, ByRef Patch)

   Dim pos

   ' Find the first occurence of the dot in package version A
   pos = InStr(versionString, ".")
   If pos <> 0 Then
      ' Extract the Major Version for A
      Major = Mid(versionString, 1, pos - 1)
      ' Delete the Major Version Value from the string to get the minor and patch version
      versionString = Mid(versionString, pos + 1, Len(versionString))
      ' Find the second occurence of the dot in package version A
      pos = InStr(versionString, ".")
      ' Extract the Minor Version for A
      If pos <> 0 Then
         Minor = Mid(versionString, 1, pos - 1)
         ' Delete the Minor Version value from the string to get the patch version
         versionString = Mid(versionString, pos + 1, Len(versionString))
         ' Find the last occurence of the dot in package version A
         pos = InStr(versionString, ".")
         If pos <> 0 Then
            ' Extract the Patch Version for A
            Patch = Mid(versionString, 1, pos - 1)
         End If
      End If
   End If

End Sub
'--------------------------------------------------------------------------------------------------------------------------
Sub AdjustPatch(ByRef PatchA, ByRef PatchB)
   If NOT isNull(PatchA) AND NOT isNull(PatchB) Then
      If isNumeric(PatchA) AND isNumeric(PatchB) Then
         If CLng(PatchA) < 1000 Then
            PatchA = CLng(PatchA) * 1000
         End If
         If CLng(PatchB) < 1000 Then
            PatchB = CLng(PatchB) * 1000
         End If
      End If
   End If
End Sub
'--------------------------------------------------------------------------------------------------------------------------
' Return True if verA is same or newer than verB, else return false
' If for some reason verA cannot be compared to verB, return the defaultReturn value as specified.
' This might happen if for example one of the version inputs was null due to one BOM not containing the package
' that another BOM did contain.
Function Is_VerA_SameOrNewerThan_VerB(ByVal verA, ByVal verB, defaultReturn)

   ' Process the version numbers to see what the difference is
   Dim MajorA, MajorB, MinorA, MinorB, PatchA, PatchB

   MajorA = NULL
   MajorB = NULL
   MinorA = NULL
   MinorB = NULL
   PatchA = NULL
   PatchB = NULL

   Is_VerA_SameOrNewerThan_VerB = defaultReturn

   Call GetMajorMinorPatch(verA, MajorA, MinorA, PatchA)

   Call GetMajorMinorPatch(verB, MajorB, MinorB, PatchB)

   Call AdjustPatch(PatchA, PatchB)

   If MajorA = MajorB Then
      If MinorA = MinorB Then
         If IsNumeric(PatchA) AND IsNumeric(PatchB) Then

            If CDbl(PatchB) > CDbl(PatchA) Then
               Is_VerA_SameOrNewerThan_VerB = False
            Else
               Is_VerA_SameOrNewerThan_VerB = True
            End If
         End If
      Else
         If IsNumeric(MinorA) AND IsNumeric(MinorB) Then
            If CInt(MinorB) > CInt(MinorA) Then
               Is_VerA_SameOrNewerThan_VerB = False
            Else
               Is_VerA_SameOrNewerThan_VerB = True
            End If
         End If
      End If
   Else
      If IsNumeric(MajorA) AND IsNumeric(MajorB) Then
         If CInt(MajorB) > CInt(MajorA) Then
            Is_VerA_SameOrNewerThan_VerB = False
         Else
            Is_VerA_SameOrNewerThan_VerB = True
         End If
      End If
   End If

End Function
'--------------------------------------------------------------------------------------------------------------------------
' Get the product ID, package version, and comments for a specifed package ID in a specified BOM
' The specified BOM is always going to be the production BOM, although the actual query used is general. Only
' the name of the oracle query parameter (PRODUCTION_BOM) implies that the BOM is expected to be the production BOM.
Function GetProductIDandVersionInBOM(bom_id, pkg_id, ByRef prod_id, ByRef pkg_version, ByRef comments)
   Dim rsQry

   OraDatabase.Parameters.Remove "PRODUCTION_BOM"
   OraDatabase.Parameters.Remove "PKG_ID"
   OraDatabase.Parameters.Add    "PRODUCTION_BOM", bom_id, ORAPARM_INPUT, ORATYPE_NUMBER
   OraDatabase.Parameters.Add    "PKG_ID",         pkg_id, ORAPARM_INPUT, ORATYPE_NUMBER

   Set rsQry = OraDatabase.DbCreateDynaset(GetQuery("ProdVersion.sql"), ORADYN_DEFAULT)

   If rsQry.RecordCount > 0 Then
      prod_id     = rsQry("prod_id")
      pkg_version = rsQry("pkg_version")
      comments    = rsQry("comments")

      GetProductIDandVersionInBOM = True
   Else
      ' must set these to NULL so that Is_VerA_SameOrNewerThan_VerB() doesn't do anything
      prod_id     = NULL
      pkg_version = NULL
      comments    = NULL

      GetProductIDandVersionInBOM = False
   End If

   rsQry.Close()
   Set rsQry = Nothing

   OraDatabase.Parameters.Remove "PRODUCTION_BOM"
   OraDatabase.Parameters.Remove "PKG_ID"
End Function
'--------------------------------------------------------------------------------------------------------------------------
' This function returns True if for any package that is in both the comparison and production BOMs, the version in the
' comparison BOM is the same or newer than that in the production BOM
Function CheckProduction (ProductionBOM, ComparisonBOM)

   Dim PkgIdInComparisonBOM
   Dim PkgVersionInComparisonBOM

   Dim ProdIdInProductionBOM
   Dim PkgVersionInProductionBOM
   Dim Comments

   CheckProduction = False 'Setting it initially to be false

   OraDatabase.Parameters.Remove "PRODUCTION_BOM"
   OraDatabase.Parameters.Add    "PRODUCTION_BOM", ProductionBOM, ORAPARM_INPUT, ORATYPE_NUMBER
   OraDatabase.Parameters.Add    "CURRENT_BOM",    ComparisonBOM, ORAPARM_INPUT, ORATYPE_NUMBER

   Set rsTemp = OraDatabase.DbCreateDynaset( GetQuery ("BomCheck.sql"), ORADYN_DEFAULT )

   OraDatabase.Parameters.Remove "CURRENT_BOM"

   ' iterate through packages
   While (NOT rsTemp.BOF) AND (NOT rsTemp.EOF) AND (CheckProduction = False)

      PkgIdInComparisonBOM      = rsTemp("pkg_id")
      PkgVersionInComparisonBOM = rsTemp("pkg_version")

      ' Get the version of this product that is currently in the production BOM
      If (GetProductIDandVersionInBOM( ProductionBOM, PkgIdInComparisonBOM, ProdIdInProductionBOM, PkgVersionInProductionBOM, Comments ) = True) Then
         'check to see if the comparison BOM has the same or newer version
         CheckProduction = Is_VerA_SameOrNewerThan_VerB( PkgVersionInComparisonBOM, PkgVersionInProductionBOM, False )
      End If

      rsTemp.MoveNext()
   WEnd

   OraDatabase.Parameters.Remove "PRODUCTION_BOM"

   rsTemp.Close()
   Set rsTemp = Nothing
End Function
'--------------------------------------------------------------------------------------------------------------------------
Function AddTrailingZeros(byval n, byval count)
   if len(n) >= count then
      AddTrailingZeros = n
      exit function
   end if

   dim c, s, i
   c = count - len(n)

   for i = 1 to c
      s = s & "0"
   next
   s = cstr(n) & s

   AddTrailingZeros = s
End function
'--------------------------------------------------------------------------------------------------------------
Sub GetProductList ( nBom_id, nComparedBomId, outProductList, Flag )
   Dim rsQry, showAll

   '' Use SHOWALL parameter is BOM has old bom
   'showAll = "Y"
   'If nBom_id <> nComparedBomId Then
   '   showAll = parShowall
   'End If
   OraDatabase.Parameters.Add "BOM_ID",         nBom_id,        ORAPARM_INPUT, ORATYPE_NUMBER
   OraDatabase.Parameters.Add "COMPARE_BOM_ID", nComparedBomId, ORAPARM_INPUT, ORATYPE_NUMBER
   OraDatabase.Parameters.Add "CURRENT_BOM",    dbPARbom_id,    ORAPARM_INPUT, ORATYPE_NUMBER

   If Flag = TRUE Then
      Set rsQry = OraDatabase.DbCreateDynaset( GetQuery ("BomCompare.sql"), ORADYN_DEFAULT )
   Else
      Set rsQry = OraDatabase.DbCreateDynaset( GetQuery ("BomCompare_BaseConfig.sql"), ORADYN_DEFAULT )
   End If

   If rsQry.RecordCount > 0 Then
      outProductList = rsQry.GetRows()
   Else
      outProductList = NULL
   End If

   OraDatabase.Parameters.Remove "COMPARE_BOM_ID"
   OraDatabase.Parameters.Remove "BOM_ID"
   OraDatabase.Parameters.Remove "CURRENT_BOM"
End Sub
'--------------------------------------------------------------------------------------------------------------------------
Sub GetFormDetails ( nBom_id, ByRef outobjDetails )

   Call GetBomDetails ( nBom_id, outobjDetails )

   outobjDetails.Item("root_version") = GetRootVersion ( outobjDetails.Item("bom_version") )

   '-- Set compare_bom_id
   If Request("compare_bom_id") <> "" Then
      outobjDetails.Item("compare_bom_id") =  Request("compare_bom_id")
   Else
      outobjDetails.Item("compare_bom_id") = outobjDetails.Item("parent_bom_id")
   End If

End Sub
'--------------------------------------------------------------------------------------------------------------
Function GetBomTreeList ()
   Dim rsQry

   OraDatabase.Parameters.Add "BRANCH_ID", objFormCollector.Item("rtag_id_fk"), ORAPARM_INPUT, ORATYPE_NUMBER
   OraDatabase.Parameters.Add "BOM_ID",    objFormCollector.Item("bom_id"),     ORAPARM_INPUT, ORATYPE_NUMBER
   OraDatabase.Parameters.Add "BOM_NAME",  objFormCollector.Item("bom_name"),   ORAPARM_INPUT, ORATYPE_NUMBER

   If objFormCollector.Item("rtag_id_fk") = 542 Then'This is because SFO uses Front Office and Back Office
      Set rsQry = OraDatabase.DbCreateDynaset( GetQuery ("ProductionTreeComboSFO.sql"), ORADYN_DEFAULT )
   Else
      Set rsQry = OraDatabase.DbCreateDynaset( GetQuery ("ProductionTreeCombo.sql"), ORADYN_DEFAULT )
   End If

   If rsQry.RecordCount > 0 Then
      GetBomTreeList = rsQry.GetRows()

   Else
      GetBomTreeList = NULL

   End If

   OraDatabase.Parameters.Remove "BRANCH_ID"
   OraDatabase.Parameters.Remove "BOM_NAME"
   OraDatabase.Parameters.Remove "BOM_ID"

   rsQry.Close
   Set rsQry = Nothing
End Function

'--------------------------------------------------------------------------------------------------------------
Function GetCompareBomDetails ( nBomId )
   Dim rsQry
   OraDatabase.Parameters.Add "BOM_ID",    nBomId,   ORAPARM_INPUT, ORATYPE_NUMBER

   Set rsQry = OraDatabase.DbCreateDynaset( GetQuery ("BomLocationDetails.sql"), ORADYN_DEFAULT )

   If rsQry.RecordCount > 0 Then
      GetCompareBomDetails = rsQry("proj_name") &"&nbsp;/&nbsp;"& rsQry("branch_name") &"&nbsp;/&nbsp;"& rsQry("bom_name") &"&nbsp;"& rsQry("bom_version") &"."& rsQry("bom_lifecycle")

   Else
      GetCompareBomDetails = NULL

   End If

   OraDatabase.Parameters.Remove "BOM_ID"

   rsQry.Close
   Set rsQry = Nothing
End Function
'--------------------------------------------------------------------------------------------------------------
%>
<%
'------------ RUN BEFORE PAGE RENDER ----------
objPMod.PersistInQryString ( Array("compare_bom_id") )

Call GetFormDetails ( dbPARbom_id, objFormCollector )
'----------------------------------------------
%>
<html>
<head>
<title>Production Manager</title>
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="scripts/deployment_manager.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="scripts/common.js"></script>
<script language="JavaScript" src="scripts/remote_scripting.js"></script>
<script language="JavaScript" type="text/javascript">
<!--

function RequestProductLocation( paramString, rowId ){
   var requestURL;

   // Product is changes, hence can be found in current bom
   requestURL = 'RequestBomDiffProductLocation.asp';


   // Show div
   ToggleDisplay( 'PRODUCT_'+ rowId, 'IMG_EXPAND_PRODUCT_' + rowId, 'IMG_COLLAPSE_PRODUCT_' + rowId );

   // Set ajax divname
   ajaxdivname = 'PRODUCT_'+ rowId;

   if ( MM_findObj( ajaxdivname ).innerHTML == '<%=enumLOADING%>')
   {

      //Append the name to search for to the requestURL
      var url = requestURL + paramString;

      //Create the xmlHttp object to use in the request
      //stateChangeHandler will fire when the state has changed, i.e. data is received back
      // This is non-blocking (asynchronous)
      xmlHttp = GetXmlHttpObject(stateChangeHandler);

      //Send the xmlHttp get to the specified url
      xmlHttp_Get(xmlHttp, url);

   }


}

function RequestProductNotes( paramString, rowId ){
   var requestURL;

   // Product is changes, hence can be found in current bom
   requestURL = 'RequestProductNotes.asp';


   // Show div
   ToggleDisplay( 'PRODNOTES_'+ rowId, 'IMG_EXPAND_PRODNOTES_' + rowId, 'IMG_COLLAPSE_PRODNOTES_' + rowId );

   // Set ajax divname
   ajaxdivname = 'PRODNOTES_'+ rowId;

   if ( MM_findObj( ajaxdivname ).innerHTML == '<%=enumLOADING%>')
   {

      //Append the name to search for to the requestURL
      var url = requestURL + paramString;

      //Create the xmlHttp object to use in the request
      //stateChangeHandler will fire when the state has changed, i.e. data is received back
      // This is non-blocking (asynchronous)
      xmlHttp = GetXmlHttpObject(stateChangeHandler);

      //Send the xmlHttp get to the specified url
      xmlHttp_Get(xmlHttp, url);

   }
}

function RequestPatches( paramString, rowId ){
   var requestURL;

   // Product is changes, hence can be found in current bom
   requestURL = 'RequestBomDiffPatches.asp';


   // Show div
   ToggleDisplay( 'PRODUCT_'+ rowId, 'IMG_EXPAND_PRODUCT_' + rowId, 'IMG_COLLAPSE_PRODUCT_' + rowId );

   // Set ajax divname
   ajaxdivname = 'PRODUCT_'+ rowId;

   if ( MM_findObj( ajaxdivname ).innerHTML == '<%=enumLOADING%>')
   {

      //Append the name to search for to the requestURL
      var url = requestURL + paramString;

      //Create the xmlHttp object to use in the request
      //stateChangeHandler will fire when the state has changed, i.e. data is received back
      // This is non-blocking (asynchronous)
      xmlHttp = GetXmlHttpObject(stateChangeHandler);

      //Send the xmlHttp get to the specified url
      xmlHttp_Get(xmlHttp, url);

   }

}




//-->
</script>
</head>
<body leftmargin="0" topmargin="0">
<!-- HEADER ++++++++++++++++ -->
<!--#include file="_header.asp"-->
<!-- +++++++++++++++++++++++ -->
<!-- MAIN MENU  +  CRUMBS ++++++++++++++++ -->
<!--#include file="_main_menu.asp"-->
<!-- +++++++++++++++++++++++++++++++++++++ -->
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
   <tr>
      <td width="1%" valign="top" background="images/bg_bage_0.gif">
         <!-- NODE BROWSER ++++++++++++++++++++++ -->
         <!--#include file="_bom_browser.asp"-->
         <!-- END OF NODE BROWSER +++++++++++++++ -->
      </td>
      <td width="1" background="images/bg_bage_1.gif"><img src="images/spacer.gif" width="1" height="600"></td>
      <td width="100%" valign="top" bgcolor="#FFFFFF">
         <table width="100%"  border="0" cellspacing="0" cellpadding="0">
            <tr>
               <td valign="top" background="images/bg_green.gif"></td>
               <td align="right" valign="bottom" background="images/bg_green.gif" class="body_txtw"><%Call RenderTitleWithoutVersion( objBomCollector )%></td>
               <td background="images/bg_green.gif"><img src="images/spacer.gif" width="10" height="20"></td>
            </tr>
            <tr>
               <td width="1%" valign="top" background="images/bg_green.gif"></td>
               <td width="100%" valign="bottom" background="images/bg_green.gif">
                  <!-- TAB CONTROLS ++++++++++++++++++++++ -->
                  <!--#include file="_tabs_definition.asp"-->
                  <%
                  Set objTabControl = New TabControl
                  objTabControl.TemplateDoc = ReadFile( Server.MapPath("controls/ERGTabStyleWinXP/tab_style.html") ) ' Supply tab style definition
                  objTabControl.TabStyle = "StyleWinXP"
                  objTabControl.AddTabDefnition ( arrBomTabDef )
                  objTabControl.Render ()
                  %>
                  <!-- END OF TAB CONTROLS +++++++++++++++ -->
               </td>
               <td width="1%" background="images/bg_green.gif"><img src="images/spacer.gif" width="10" height="35"></td>
            </tr>
            <tr>
               <td background="images/bg_bage_0.gif"><img src="images/spacer.gif" width="30" height="10"></td>
               <td background="images/bg_bage_0.gif">
                  <!-- BUTTONS CONTROL +++++++++++++++++++ -->
                  <%
                  '-- Define Action buttons on this tab
                  aTabBtnsDef = Array("abtnAddPatches")

                  Call LoadTabActionButtons ( aTabBtnsDef, objBtnControl )

                  ' -- Tell control if buttons need to be readonly actions
                  objBtnControl.IsReadonlyAction = objBomCollector.Item("is_readonly")

                  ' -- Render Buttons
                  Call objBtnControl.Render  ( aTabBtnsDef )
                  %>
                  <!-- +++++++++++++++++++++++++++++++++++ -->
               </td>
               <td background="images/bg_green.gif"><img src="images/p_bar_corrner.gif" width="17" height="42"></td>
            </tr>
            <tr>
               <td>&nbsp;</td>
               <td>&nbsp;</td>
               <td valign="top"><%If Request.Cookies( enumCOOKIE_NAME )( "user_bar" ) = "hide" Then%><a href="<%=SCRIPT_NAME%>?user_bar=<%=enumDEFAULT%>&<%=objPMod.ComposeURL()%>"><img src="icons/b_left.gif" title="Maximize favourits" width="13" height="13" vspace="5" border="0"></a><%End If%></td>
            </tr>
         </table>

         <!-- PRODUCT REJECTED ------------------------------------------------------------------------------------------ -->
         <%If objBomCollector.Item ("is_rejected") = enumDB_YES Then%>
            <table width="100%"  border="0" cellspacing="10" cellpadding="0">
               <tr>
                  <td>
                     <%
                     OraDatabase.Parameters.Add "ENTITY_ID",        dbPARbom_id,           ORAPARM_INPUT, ORATYPE_NUMBER
                     OraDatabase.Parameters.Add "ENUM_ENTITY_TYPE", "enumENTITY_TYPE_BOM", ORAPARM_INPUT, ORATYPE_VARCHAR2

                     Set rsQry = OraDatabase.DbCreateDynaset( GetQuery ("RejectionTrail.sql"), ORADYN_DEFAULT )

                     Dim sMessage
                     sMessage = "<table width='100%'  border='0' cellspacing='3' cellpadding='0'>"
                     sMessage = sMessage &"<tr>"
                     sMessage = sMessage &"<td width='100%' class='body_txt'><b>BOM is REJECTED!</b><br><br><br></td>"
                     sMessage = sMessage &"<td width='1%' nowrap valign='bottom' align='right'><a href='javascript:;' onClick=""MM_openBrWindow('wBomRejectNote.asp?rfile="& SCRIPT_NAME &"&"& objPMod.ComposeURL() &"','BomRejectNote','scrollbars=yes,resizable=yes,width=600,height=350');""  class='body_smllink' title='Create new note'>Create Note"& LIMG_NOTE_NEW &"</a></td>"
                     sMessage = sMessage &"</tr>"

                     While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
                        sMessage = sMessage & "<tr><td colspan='2' background='images/bg_table_border.gif'><img src='images/spacer.gif' width='1' height='1'></td></tr>"
                        sMessage = sMessage &"<tr>"
                        sMessage = sMessage &"<td class='body_txt'>"
                        If rsQry("is_rejected") = enumDB_YES Then
                           sMessage = sMessage &"BOM is REJECTED!<br>"
                        Else
                           sMessage = sMessage &"BOM is Accepted!<br>"
                        End If
                        sMessage = sMessage & objFormater.TextToHTML( rsQry("comments") ) &"<br><SPAN class='body_smltxtg'>"& rsQry("creator") &"</SPAN></td>"
                        sMessage = sMessage &"<td nowrap valign='bottom' align='right'><a href='javascript:;' onClick=""MM_openBrWindow('wBomRejectNote.asp?reject_seq="& rsQry("reject_seq") &"&rfile="& SCRIPT_NAME &"&"& objPMod.ComposeURL() &"','BomRejectNote','scrollbars=yes,resizable=yes,width=600,height=350');"" class='body_smllink' title='Edit note'>Edit Note"& LIMG_NOTE_EDIT &"</a></td>"
                        sMessage = sMessage &"</tr>"

                        rsQry.MoveNext
                     WEnd
                     rsQry.Close

                     sMessage = sMessage &"</table>"

                     Call Messenger ( sMessage, "bi_rejected.gif", "100%" )

                     Response.write "<br>"


                     OraDatabase.Parameters.Remove "ENTITY_ID"
                     OraDatabase.Parameters.Remove "ENUM_ENTITY_TYPE"
                     %>
                  </td>
               </tr>
            </table>
         <%End If%>
         <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->

         <table width="100%"  border="0" cellspacing="10" cellpadding="0">

            <tr>
               <td width="1"><img src="images/spacer.gif" width="1" height="1"></td>
               <td width="100%"><img src="images/spacer.gif" width="1" height="1"></td>
            </tr>

            <!-- BOM Comments +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
            <%If (objBomCollector.Item("bom_comments") <> "") Then%>
               <tr>
                  <td align="right" valign="top"><img src="icons/i_bom_properties.gif" width="30" height="30" hspace="3"></td>
                  <td valign="top" class="body_txt">
                     <SPAN class="body_colb">BOM Comments</SPAN>
                     <hr width="100%" size="1px" noshade color="#808080">
                     <SPAN class="body_txt"><%= objFormater.TextToHTML( objBomCollector.Item("bom_comments") )%></SPAN><br><br><br><br>
                  </td>
               </tr>
            <%End If%>

            <!-- COMPARE BOM +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
            <tr>
               <td align="right" valign="top"><img src="icons/i_bom_diff.gif" width="37" height="33" hspace="3"></td>
               <td valign="top" class="body_txt">
                  <%
                  '-- FROM START --------------------------------------------------------------------------------------------------------------
                  objFormComponent.FormName = "OldVersion"
                  objFormComponent.Action = SCRIPT_NAME
                  objFormComponent.Method = "get"
                  Call objFormComponent.FormStart()

                  Dim numOfBomRows
                  Dim rowNumBom

                  If (NOT IsNull(GetBomTreeList())) Then
                     numOfBomRows = UBound( GetBomTreeList(), 2 )
                  Else
                     numOfBomRows = -1
                  End If

                  For rowNumBom = 0 To numOfBomRows
                     Dim thisBomId
                     Dim nextBomId
                     thisBomId = GetBomTreeList()( 0, rowNumBom )
                     If rowNumBom = numOfBomRows Then
                        nextBomId = 0
                     Else
                        nextBomId = GetBomTreeList()( 0, rowNumBom + 1 )
                     End If

                     Call GetFormDetails ( thisBomId, objBomCollector )
                     %>
                     <SPAN class="body_colb"><br><%= objFormater.TextToHTML( objBomCollector.Item("bom_comments") )%><br><br></SPAN>
                     <SPAN class="body_colb">Products/Patches Introduced in <%Call RenderTitle( objBomCollector )%> but not yet deployed in Production BOM<br></SPAN>
                     <%If InStr(APP_ROOT, "DEPLOYMAN_WWW") > 0 Then%>
                        <a href="downloads\<%Call RenderTitleWithoutBold( objBomCollector )%>.pdf" class="body_link" target="_blank"><b>Click here to Download PDF</b></a>
                     <%Else%>
                        <a href="../deployment_manager/pdf\<%Call RenderTitleWithoutBold( objBomCollector )%>.pdf" class="body_link" target="_blank"><b>Click here to Download PDF</b></a>
                     <%End If%>
                     <hr width="100%" size="1px" noshade color="#808080">
                     <table width="100%"  border="0" cellspacing="2" cellpadding="0">
                        <tr>
                           <td width="20%" background="images/bg_table_border.gif">
                              <table width="100%"  border="0" cellspacing="1" cellpadding="2">
                                 <tr>
                                    <td align="left" nowrap background="images/bg_table_col.gif" class="body_col">Product</td>
                                 </tr>
                              </table>
                           </td>
                           <td width="20%" nowrap align="left" background="images/bg_table_col.gif" class="body_col">Version</td>
                           <td width="60%" nowrap align="left" background="images/bg_table_col.gif" class="body_col">Reason For This Version</td>
                           <td width="60%" nowrap align="left" background="images/bg_table_col.gif" class="body_col">Approval</td>
                        </tr>
                        <%
                        If NOT CheckProduction( Request("bom_id"), thisBomId) Then
                           %>
                           <tr>
                              <td colspan="4" class="body_txtr"><b>Found Matching BOM or Older Versions...Exiting Comparison</b></td>
                           </tr>
                           <%
                           Exit For
                        End If

                        Dim aProductList

                        Call GetProductList ( thisBomId, nextBomId, aProductList, TRUE )

                        If NOT IsNull( aProductList ) Then

                           ' Variable used to prevent multiple entries being rendered for the same package
                           Dim LastPkgId
                           LastPkgId = -1

                           Dim numOfProdRows
                           Dim rowNumProd

                           numOfProdRows = UBound( aProductList, 2 )

                           ' Iterate through the list of products
                           For rowNumProd = 0 To numOfProdRows

                              Response.Flush

                              Dim thisProdId
                              Dim thisPkgName
                              Dim thisPkgVersion
                              Dim thisIsPatch
                              Dim thisIsRejected
                              Dim thisPkgId

                              'Extract values into named variables to make code more readable where the values are used later on
                              thisProdId      = aProductList( 0, rowNumProd )
                              thisPkgName     = aProductList( 1, rowNumProd )
                              thisPkgVersion  = aProductList( 2, rowNumProd )
                              thisIsPatch     = aProductList( 3, rowNumProd )
                              thisIsRejected  = aProductList( 4, rowNumProd )
                              thisPkgId       = aProductList( 5, rowNumProd )

                              ' Get the version of this product that is currently in the production BOM
                              Dim ProdIdInProductionBOM
                              Dim PkgVersionInProductionBOM
                              Dim Comments
                              Call GetProductIDandVersionInBOM( dbPARbom_id, thisPkgId, ProdIdInProductionBOM, PkgVersionInProductionBOM, Comments )

                              ' We want to figure out if we have to display this product. We only want to do so if the version of it is the
                              ' same or newer than that currently in the production BOM
                              Dim IsDisplay
                              IsDisplay = True

                              If IsNull(thisIsPatch) Then
                                 IsDisplay = Is_VerA_SameOrNewerThan_VerB( thisPkgVersion, PkgVersionInProductionBOM, IsDisplay )
                              End If

                              If IsDisplay Then
                                 Set rsTemp = OraDatabase.DbCreateDynaset("SELECT * FROM PACKAGE_VERSIONS PV, PRODUCT_DETAILS PD WHERE PD.PROD_ID(+) = PV.PV_ID AND PV.PV_ID ="&thisProdId, ORADYN_DEFAULT )
                                 %>
                                 <%If IsNull(thisIsPatch) Then
                                    If CDbl(LastPkgId) <> CDbl(thisPkgId) Then%>
                                       <tr>
                                          <td nowrap valign="top">
                                             <SPAN id="IMG_EXPAND_PRODUCT_<%=thisBomId%>_<%=thisProdId%>" name="IMG_EXPAND_PRODUCT_<%=thisBomId%>_<%=thisProdId%>" style="display:block;">
                                                <a href="javascript:;" class="menu_link" onClick="RequestProductLocation('?new_version=<%=thisPkgVersion%>&new_prod_id=<%=thisProdId%>&prod_id=<%=ProdIdInProductionBOM%>&bom_id=<%=dbPARbom_id%>&compare_bom_id=<%=thisBomId%>&pkg_id=<%=thisPkgId%>&change_type=', '<%=thisBomId%>_<%=thisProdId%>');">
                                                   <%=LIMG_EXPAND & GetProductIcon( rsTemp ) & thisPkgName%>
                                                </a>
                                             </SPAN>
                                             <SPAN id="IMG_COLLAPSE_PRODUCT_<%=thisBomId%>_<%=thisProdId%>" name="IMG_COLLAPSE_PRODUCT_<%=thisBomId%>_<%=thisProdId%>" style="display:none;">
                                                <a href="javascript:;" class="menu_link" onClick="ToggleDisplay( 'PRODUCT_<%=thisBomId%>_<%=thisProdId%>', 'IMG_EXPAND_PRODUCT_<%=thisBomId%>_<%=thisProdId%>', 'IMG_COLLAPSE_PRODUCT_<%=thisBomId%>_<%=thisProdId%>');">
                                                   <%=LIMG_COLLAPSE & GetProductIcon( thisIsRejected ) &  thisPkgName%>
                                                </a>
                                             </SPAN>
                                          </td>
                                          <td nowrap class="body_row" valign="top"><%=thisPkgVersion%>         </td>
                                          <td class="body_rowlite"><%=rsTemp("comments")%> <!-- <a href="download_version.asp?prod_id=<%=thisProdId%>&bom_id=<%=Request("bom_id")%>&os_id=" class="body_link">Download</a> --></td>
                                          <%
                                          Dim rsForm, Tester, Manager
                                          Tester = False
                                          Manager = False
                                          If objAccessControl.IsActive("ApprovedByManager") Then
                                             Manager = True
                                          ElseIf objAccessControl.IsActive("ApprovedByTester") Then
                                             Tester = True
                                          End If

                                          Set rsForm = OraDatabase.DbCreateDynaset("SELECT * FROM RELEASE_AUTHORISATION WHERE PV_ID="&thisProdId&" AND BOM_ID="&Request("bom_id"), ORADYN_DEFAULT)

                                          %>
                                          <%If rsForm.RecordCount = 0 Then%>
                                             <%If Tester Then%>
                                                <td class="body_rowlite"><a href="_wform_approval.asp?pv_id=<%=thisProdId%>&bom_id=<%=Request("bom_id")%>" onClick="popup = window.open('_wform_approval.asp?pv_id=<%=thisProdId%>&bom_id=<%=Request("bom_id")%>', 'Approval Form', 'height=220,width=600,scrollbars=yes,resizable=yes'); return false" target="_blank" style="text-decoration:none" class="body_txtr">Accept/Reject</a></td>
                                             <%ElseIf Manager Then%>
                                                <td class="body_txto">Awaiting Tester</td>
                                             <%Else%>
                                                <td class="body_txto"></td>
                                             <%End If%>
                                          <%ElseIf IsNull(rsForm("is_official")) Then%>
                                             <%If NOT IsNull(rsForm("tester_id")) And Tester   Then %>
                                                <td class="body_txto">Awaiting Manager</td>
                                             <%ElseIf NOT IsNull(rsForm("tester_id")) And Manager Then%>
                                                <td class="body_rowlite"><a href="_wform_approval.asp?pv_id=<%=thisProdId%>&bom_id=<%=Request("bom_id")%>" onClick="popup = window.open('_wform_approval.asp?pv_id=<%=thisProdId%>&bom_id=<%=Request("bom_id")%>', 'Approval Form', 'height=440,width=600,scrollbars=yes,resizable=yes'); return false" target="_blank" style="text-decoration:none" class="body_txtr">Accept</a></td>
                                             <%Else%>
                                                <td class="body_rowlite"></td>
                                             <%End If%>
                                          <%Else%>
                                             <td class="body_txtg">Accepted</td>
                                          <%End If

                                          rsForm.Close()
                                          Set rsForm = nothing
                                          %>
                                       </tr>
                                       <tr>
                                          <td nowrap valign="top" class="body_row" colspan="3">
                                             <DIV id="PRODUCT_<%=thisBomId%>_<%=thisProdId%>" name="PRODUCT_<%=thisBomId%>_<%=thisProdId%>" style="display:none;"><%=enumLOADING%></DIV>
                                          </td>
                                       </tr>

                                       <%If rowNumProd <> numOfProdRows Then%>
                                          <tr>
                                             <td colspan="4" background="images/bg_table_border.gif"><img src="images/spacer.gif" width="1" height="1"></td>
                                          </tr>
                                       <%End If%>
                                    <%End If%>
                                 <%Else
                                    If CDbl(LastPkgId) <> CDbl(thisPkgId) Then
                                       %>
                                       <tr>
                                          <%If rowNumBom <> numOfBomRows Then%>
                                             <td nowrap valign="top">
                                                <SPAN id="IMG_EXPAND_PRODUCT_<%=thisBomId%>_<%=thisProdId & thisIsPatch%>" name="IMG_EXPAND_PRODUCT_<%=thisBomId%>_<%=thisProdId & thisIsPatch%>" style="display:block;">
                                                   <a href="javascript:;" class="menu_link" onClick="RequestPatches('?pkg_id=<%=thisPkgId%>&bom_id=<%=thisBomId%>&compare_bom_id=<%=nextBomId%>&current_bom_id=<%=dbPARbom_id%>', '<%=thisBomId%>_<%=thisProdId & thisIsPatch%>');">
                                                      <%=LIMG_EXPAND & GetProductIcon( rsTemp ) & thisPkgName%>
                                                   </a>
                                                </SPAN>
                                                <SPAN id="IMG_COLLAPSE_PRODUCT_<%=thisBomId%>_<%=thisProdId & thisIsPatch%>" name="IMG_COLLAPSE_PRODUCT_<%=thisBomId%>_<%=thisProdId & thisIsPatch%>" style="display:none;">
                                                   <a href="javascript:;" class="menu_link" onClick="ToggleDisplay( 'PRODUCT_<%=thisBomId%>_<%=thisProdId & thisIsPatch%>', 'IMG_EXPAND_PRODUCT_<%=thisBomId%>_<%=thisProdId & thisIsPatch%>', 'IMG_COLLAPSE_PRODUCT_<%=thisBomId%>_<%=thisProdId & thisIsPatch%>');">
                                                      <%=LIMG_COLLAPSE & GetProductIcon( rsTemp ) & thisPkgName%>
                                                   </a>
                                                </SPAN>
                                             </td>
                                          <%Else%>
                                             <td nowrap valign="top">
                                                <SPAN id="IMG_EXPAND_PRODUCT_<%=thisBomId%>_<%=thisProdId & thisIsPatch%>" name="IMG_EXPAND_PRODUCT_<%=thisBomId%>_<%=thisProdId & thisIsPatch%>" style="display:block;">
                                                   <a href="javascript:;" class="menu_link" onClick="RequestPatches('?pkg_id=<%=thisPkgId%>&bom_id=<%=thisBomId%>&compare_bom_id=<%=thisBomId%>&current_bom_id=<%=dbPARbom_id%>', '<%=thisBomId%>_<%=thisProdId & thisIsPatch%>');">
                                                      <%=LIMG_EXPAND & GetProductIcon( rsTemp ) & thisPkgName%>
                                                   </a>
                                                </SPAN>
                                                <SPAN id="IMG_COLLAPSE_PRODUCT_<%=thisBomId%>_<%=thisProdId & thisIsPatch%>" name="IMG_COLLAPSE_PRODUCT_<%=thisBomId%>_<%=thisProdId & thisIsPatch%>" style="display:none;">
                                                   <a href="javascript:;" class="menu_link" onClick="ToggleDisplay( 'PRODUCT_<%=thisBomId%>_<%=thisProdId & thisIsPatch%>', 'IMG_EXPAND_PRODUCT_<%=thisBomId%>_<%=thisProdId & thisIsPatch%>', 'IMG_COLLAPSE_PRODUCT_<%=thisBomId%>_<%=thisProdId & thisIsPatch%>');">
                                                      <%=LIMG_COLLAPSE & GetProductIcon( rsTemp ) & thisPkgName%>
                                                   </a>
                                                </SPAN>
                                             </td>
                                          <%End If%>
                                          <td nowrap class="body_row" valign="top"></td>
                                          <td class="body_rowlite"></td>
                                       </tr>

                                       <tr>
                                          <td nowrap valign="top" class="body_row" colspan="3">
                                             <DIV id="PRODUCT_<%=thisBomId%>_<%=thisProdId & thisIsPatch%>" name="PRODUCT_<%=thisBomId%>_<%=thisProdId & thisIsPatch%>" style="display:none;"><%=enumLOADING%></DIV>
                                          </td>
                                       </tr>
                                       <%If rowNumProd <> numOfProdRows Then%>
                                          <tr>
                                             <td colspan="4" background="images/bg_table_border.gif"><img src="images/spacer.gif" width="1" height="1"></td>
                                          </tr>
                                       <%End If%>

                                       <%
                                       LastPkgId = CDbl(thisPkgId)
                                    End If
                                 ' -------- END GROUP ------------------------
                                 End If%>

                                 <%
                                 rsTemp.Close()
                                 Set rsTemp = nothing
                              End If
                           Next  'For Next Loop End

                        Else%>

                           <tr>
                              <td colspan="4" class="body_txtr"><b>No Changes Detected In Comparison</b></td>
                           </tr>
                        <%End If%>

                        <tr>
                           <td colspan="4" background="images/bg_table_border.gif">
                              <table width="100%"  border="0" cellspacing="1" cellpadding="2">
                                 <tr>
                                    <td nowrap background="images/bg_table_col.gif"><img src="images/spacer.gif" width="1" height="1"></td>
                                 </tr>
                              </table>
                           </td>
                        </tr>
                     </table>
                     <br>
                     <%
                     Response.Flush
                  Next
                  Call objFormComponent.FormEnd()
                  '-- FROM END ----------------------------------------------------------------------------------------------------------------
                  %>
               </td>
            </tr>
         </table>
      </td>
      <td width="1%" valign="top" background="images/bg_favourits.gif">
         <%If Request.Cookies( enumCOOKIE_NAME )( "user_bar" ) <> "hide" Then%>

         <%End If%>
      </td>
   </tr>
   <tr>
      <td background="images/bg_bage_0a.gif"><img src="images/spacer.gif" width="1" height="15"></td>
      <td background="images/bg_bage_1.gif"><img src="images/spacer.gif" width="1" height="1"></td>
      <td bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td>
      <td bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td>
   </tr>
   <tr>
      <td bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="20"></td>
      <td bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td>
      <td bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td>
      <td bgcolor="#FFFFFF">&nbsp;</td>
   </tr>
</table>
<!-- FOOTER ++++++++++++++++ -->
<!--#include file="_footer.asp"-->
<!-- +++++++++++++++++++++++ -->
</body>
</html>
<%
'------------ RUN AFTER PAGE RENDER -----------
Set objPMod = Nothing
Set objCrumbs = Nothing
Set objTabControl = Nothing
'----------------------------------------------
%><!--#include file="common/globals_destructor.asp"-->