Subversion Repositories DevTools

Rev

Rev 62 | 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
%>
<%
'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 aProductList
Dim parProd_id_select
Dim parShowall
Dim numOfRows
Dim rowNum, Numrow, maxnumOfRows
Dim objFormCollector
Dim objFormComponent
Dim sMessage
Dim ProdId, PkgId, OldProdId, OsId
Dim ChangeType
Dim IsPatch
Dim rsTemp
Dim PkgVersion, CurrentPkgVersion, IsDisplay, Comments
'------------ 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 ----------------------
'----------------------------------------------
%>
<%
'--------------------------------------------------------------------------------------------------------------------------
Function CheckProduction (ProductionBOM, ComparisonBOM)

        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 )
        
        While (NOT rsTemp.BOF) AND (NOT rsTemp.EOF)
                PkgId = rsTemp("pkg_id")
                PkgVersion = rsTemp("pkg_version")

                
                
                
                OraDatabase.Parameters.Add "PKG_ID", PkgId, ORAPARM_INPUT, ORATYPE_NUMBER
                        
                Set rsQry = OraDatabase.DbCreateDynaset(GetQuery("ProdVersion.sql"), ORADYN_DEFAULT)
                                
                CurrentPkgVersion = rsQry("pkg_version")
                
                
                
                Dim MajorA, MajorB, MinorA, MinorB, PatchA, PatchB, pos
                                MajorA = NULL
                                MajorB = NULL
                                MinorA = NULL
                                MinorB = NULL
                                PatchA = NULL
                                PatchB = NULL
                                
                ' Find the first occurence of the dot in package version A
                                pos = InStr(PkgVersion, ".")
                                If pos <> 0 Then
                                        ' Extract the Major Version for A
                                        MajorA = Mid(PkgVersion, 1, pos - 1)
                                        ' Delete the Major Version Value from the string to get the minor and patch version
                                        PkgVersion = Mid(PkgVersion, pos + 1, Len(PkgVersion))
                                        ' Find the second occurence of the dot in package version A
                                        pos = InStr(PkgVersion, ".")
                                        ' Extract the Minor Version for A
                                        If pos <> 0 Then
                                                MinorA = Mid(PkgVersion, 1, pos - 1)
                                                ' Delete the Minor Version value from the string to get the patch version
                                                PkgVersion = Mid(PkgVersion, pos + 1, Len(PkgVersion))
                                                ' Find the last occurence of the dot in package version A
                                                pos = InStr(PkgVersion, ".")
                                                If pos <> 0 Then
                                                        ' Extract the Patch Version for A
                                                        PatchA = Mid(PkgVersion, 1, pos - 1)
                                                End If  
                                        End If  
                                End If  
                                                        
                                ' Find the first occurence of the dot in package version B
                                pos = InStr(CurrentPkgVersion, ".")
                                If pos <> 0 Then
                                        ' Extract the Major Version for B
                                        MajorB = Mid(CurrentPkgVersion, 1, pos - 1)
                                        ' Delete the Major Version Value from the string to get the minor and patch version
                                        CurrentPkgVersion = Mid(CurrentPkgVersion, pos + 1, Len(CurrentPkgVersion))
                                        ' Find the second occurence of the dot in package version B
                                        pos = InStr(CurrentPkgVersion, ".")
                                        ' Extract the Minor Version for B
                                        If pos <> 0 Then
                                                MinorB = Mid(CurrentPkgVersion, 1, pos - 1)
                                                ' Delete the Minor Version value from the string to get the patch version
                                                CurrentPkgVersion = Mid(CurrentPkgVersion, pos + 1, Len(CurrentPkgVersion))
                                                ' Find the last occurence of the dot in package version B
                                                pos = InStr(CurrentPkgVersion, ".")
                                                        If pos <> 0 Then
                                                        ' Extract the Patch Version for B
                                                        PatchB = Mid(CurrentPkgVersion, 1, pos - 1)
                                                End If
                                        End If
                                End If
                                
                                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 
                                
                                If MajorA = MajorB Then
                                        If MinorA = MinorB Then
                                                If IsNumeric(PatchA) AND IsNumeric(PatchB) Then
                                                        
                                                        If CDbl(PatchB) > CDbl(PatchA) Then
                                                        Else                                                                            
                                                                CheckProduction = True
                                                        End If
                                                End If
                                        Else
                                                If IsNumeric(MinorA) AND IsNumeric(MinorB) Then
                                                        If CInt(MinorB) > CInt(MinorA) Then
                                                        Else
                                                                CheckProduction = True                                                          
                                                        End If                                                                  
                                                End If
                                        End If
                                Else
                                        If IsNumeric(MajorA) AND IsNumeric(MajorB) Then
                                                If      CInt(MajorB) > CInt(MajorA) Then
                                                Else
                                                        CheckProduction = True
                                                End If  
                                        End If
                                End If          
        


                rsQry.Close()
                Set rsQry = Nothing

                OraDatabase.Parameters.Remove "PKG_ID"          
        
        rsTemp.MoveNext()
        Wend
        
        OraDatabase.Parameters.Remove "CURRENT_BOM"
        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, query, 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, query
        
        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, query
        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( 'PROD_'+ rowId, 'IMG_EXPAND_PROD_' + rowId, 'IMG_COLLAPSE_PROD_' + rowId );
        
        // Set ajax divname
        ajaxdivname = 'PROD_'+ 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 )
                        
                        
                        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()

                If (NOT IsNull(GetBomTreeList())) Then
                   numOfRows = UBound( GetBomTreeList(), 2 )
                Else
                   numOfRows = -1
                End If
                maxnumOfRows    =       numOfRows
                For  Numrow = 0 To numOfRows 
                Call GetFormDetails ( (GetBomTreeList()( 0, Numrow  )), 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>
                <a href="pdf\<%Call RenderTitleWithoutBold( objBomCollector )%>.pdf" class="body_link" target="_blank"><b>Click here to Download PDF</b></a>
            <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"), (GetBomTreeList()( 0, Numrow  ))) Then 
        %>
                <tr>
                <td colspan="4" class="body_txtr"><b>Found Matching BOM or Older Versions...Exiting Comparison</b></td></tr>
        <%
        Exit For
        End If    
                If Numrow = maxnumOfRows Then
                        Call GetProductList ( (GetBomTreeList()( 0, Numrow  )), 0, aProductList, TRUE )
                Else
                        Call GetProductList ( (GetBomTreeList()( 0, Numrow  )), (GetBomTreeList()( 0, Numrow + 1 )), aProductList, TRUE )       
                End     If  
                  If NOT IsNull( aProductList ) Then
                        numOfRows = UBound( aProductList, 2 )
                  Dim currentpkgId
                  currentpkgId = -1
        
                        For rowNum = 0 To numOfRows'For Next Loop Begins
                                
                                ProdId = aProductList( 0, rowNum )
                                PkgVersion = aProductList( 2, rowNum )
                                'ChangeType = aProductList( 3, rowNum )
                                IsPatch = aProductList( 3, rowNum )
                                PkgId = aProductList( 5, rowNum )
                                'Response.Write(PkgId)
                                
                                OraDatabase.Parameters.Remove   "PRODUCTION_BOM"
                                OraDatabase.Parameters.Add "PRODUCTION_BOM", dbPARbom_id, ORAPARM_INPUT, ORATYPE_NUMBER
                                OraDatabase.Parameters.Add "PKG_ID", PkgId, ORAPARM_INPUT, ORATYPE_NUMBER
                        
                                        Set rsQry = OraDatabase.DbCreateDynaset(GetQuery("ProdVersion.sql"), ORADYN_DEFAULT)
                                
                                OldProdId = rsQry("prod_id")
                                CurrentPkgVersion = rsQry("pkg_version")
                                Comments = rsQry("comments")
                                
                                OraDatabase.Parameters.Remove "CURRENT_BOM"
                                OraDatabase.Parameters.Remove "PKG_ID"
                                
                                IsDisplay = True
                                
                                If IsNull(IsPatch) Then
                                Dim MajorA, MajorB, MinorA, MinorB, PatchA, PatchB, pos
                                                MajorA = NULL
                                                MajorB = NULL
                                                MinorA = NULL
                                                MinorB = NULL
                                                PatchA = NULL
                                                PatchB = NULL
                                                
                                ' Find the first occurence of the dot in package version A
                                                pos = InStr(PkgVersion, ".")
                                                If pos <> 0 Then
                                                        ' Extract the Major Version for A
                                                        MajorA = Mid(PkgVersion, 1, pos - 1)
                                                        ' Delete the Major Version Value from the string to get the minor and patch version
                                                        PkgVersion = Mid(PkgVersion, pos + 1, Len(PkgVersion))
                                                        ' Find the second occurence of the dot in package version A
                                                        pos = InStr(PkgVersion, ".")
                                                        ' Extract the Minor Version for A
                                                        If pos <> 0 Then
                                                                MinorA = Mid(PkgVersion, 1, pos - 1)
                                                                ' Delete the Minor Version value from the string to get the patch version
                                                                PkgVersion = Mid(PkgVersion, pos + 1, Len(PkgVersion))
                                                                ' Find the last occurence of the dot in package version A
                                                                pos = InStr(PkgVersion, ".")
                                                                If pos <> 0 Then
                                                                        ' Extract the Patch Version for A
                                                                        PatchA = Mid(PkgVersion, 1, pos - 1)
                                                                End If  
                                                        End If  
                                                End If  
                                                                        
                                                ' Find the first occurence of the dot in package version B
                                                pos = InStr(CurrentPkgVersion, ".")
                                                If pos <> 0 Then
                                                        ' Extract the Major Version for B
                                                        MajorB = Mid(CurrentPkgVersion, 1, pos - 1)
                                                        ' Delete the Major Version Value from the string to get the minor and patch version
                                                        CurrentPkgVersion = Mid(CurrentPkgVersion, pos + 1, Len(CurrentPkgVersion))
                                                        ' Find the second occurence of the dot in package version B
                                                        pos = InStr(CurrentPkgVersion, ".")
                                                        ' Extract the Minor Version for B
                                                        If pos <> 0 Then
                                                                MinorB = Mid(CurrentPkgVersion, 1, pos - 1)
                                                                ' Delete the Minor Version value from the string to get the patch version
                                                                CurrentPkgVersion = Mid(CurrentPkgVersion, pos + 1, Len(CurrentPkgVersion))
                                                                ' Find the last occurence of the dot in package version B
                                                                pos = InStr(CurrentPkgVersion, ".")
                                                                        If pos <> 0 Then
                                                                        ' Extract the Patch Version for B
                                                                        PatchB = Mid(CurrentPkgVersion, 1, pos - 1)
                                                                End If
                                                        End If
                                                End If
                                                
                                                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 
                                                
                                                If MajorA = MajorB Then
                                                        If MinorA = MinorB Then
                                                                If IsNumeric(PatchA) AND IsNumeric(PatchB) Then
                                                                        
                                                                        If CDbl(PatchB) > CDbl(PatchA) Then
                                                                                IsDisplay = False
                                                                        Else                                                                            
                                                                                IsDisplay = True
                                                                        End If
                                                                End If
                                                        Else
                                                                If IsNumeric(MinorA) AND IsNumeric(MinorB) Then
                                                                        If CInt(MinorB) > CInt(MinorA) Then
                                                                                IsDisplay = False
                                                                        Else
                                                                                IsDisplay = True                                                                
                                                                        End If                                                                  
                                                                End If
                                                        End If
                                                Else
                                                        If IsNumeric(MajorA) AND IsNumeric(MajorB) Then
                                                                If      CInt(MajorB) > CInt(MajorA) Then
                                                                        IsDisplay = False
                                                                Else
                                                                        IsDisplay = True
                                                                End If  
                                                        End If
                                                End If          
                                        End If                                  
                                
                                
                        'If ProdId > NewProdId Then
                        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 ="&ProdId, ORADYN_DEFAULT )
                  %>
                  <%If IsNull(IsPatch) Then
                        If CDbl(currentpkgId) <> CDbl(pkgId) Then%>
                  <tr>
            <td nowrap valign="top">
                        <SPAN id="IMG_EXPAND_PRODUCT_<%=ProdId & ChangeType%>" name="IMG_EXPAND_PRODUCT_<%=ProdId & ChangeType%>" style="display:block;"><a href="javascript:;" class="menu_link" onClick="RequestProductLocation('?new_version=<%=aProductList( 2, rowNum )%>&new_prod_id=<%=ProdId%>&prod_id=<%=OldProdId%>&bom_id=<%=dbPARbom_id%>&compare_bom_id=<%=(GetBomTreeList()( 0, Numrow  ))%>&pkg_id=<%=PkgId%>&change_type=<%=ChangeType%>', '<%=ProdId & ChangeType%>');"><%=LIMG_EXPAND & GetProductIcon( rsTemp ) &  aProductList( 1, rowNum )%></a></SPAN>
                        <SPAN id="IMG_COLLAPSE_PRODUCT_<%=ProdId & ChangeType%>" name="IMG_COLLAPSE_PRODUCT_<%=ProdId & ChangeType%>" style="display:none;"><a href="javascript:;" class="menu_link" onClick="ToggleDisplay( 'PRODUCT_<%=ProdId & ChangeType%>', 'IMG_EXPAND_PRODUCT_<%=ProdId & ChangeType%>', 'IMG_COLLAPSE_PRODUCT_<%=ProdId & ChangeType%>');"><%=LIMG_COLLAPSE & GetProductIcon( aProductList( 4, rowNum ) ) &  aProductList( 1, rowNum )%></a></SPAN>
                        </td>
            <td nowrap class="body_row" valign="top">
                                <%=aProductList( 2, rowNum )%>                  </td>
                        <td class="body_rowlite"><%=rsTemp("comments")%> <!-- <a href="download_version.asp?prod_id=<%=ProdId%>&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="&ProdId&" 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=<%=ProdId%>&bom_id=<%=Request("bom_id")%>" onClick="popup = window.open('_wform_approval.asp?pv_id=<%=ProdId%>&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=<%=ProdId%>&bom_id=<%=Request("bom_id")%>" onClick="popup = window.open('_wform_approval.asp?pv_id=<%=ProdId%>&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_<%=ProdId & ChangeType%>" name="PRODUCT_<%=ProdId & ChangeType%>" style="display:none;"><%=enumLOADING%></DIV>
                                </td>
                  </tr>
                                   
                  <%If rowNum <> numOfRows 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(currentpkgId) <> CDbl(pkgId) Then
                  %>
          <tr>
                        <%If Numrow <> maxnumOfRows Then%>
            <td nowrap valign="top">
                        <SPAN id="IMG_EXPAND_PRODUCT_<%=ProdId & ChangeType%>" name="IMG_EXPAND_PRODUCT_<%=ProdId & ChangeType%>" style="display:block;"><a href="javascript:;" class="menu_link" onClick="RequestPatches('?pkg_id=<%=pkgId%>&bom_id=<%=(GetBomTreeList()( 0, Numrow  ))%>&compare_bom_id=<%=(GetBomTreeList()( 0, Numrow + 1  ))%>&current_bom_id=<%=dbPARbom_id%>', '<%=ProdId & ChangeType%>');"><%=LIMG_EXPAND & GetProductIcon( rsTemp ) &  aProductList( 1, rowNum )%></a></SPAN>
                        <SPAN id="IMG_COLLAPSE_PRODUCT_<%=ProdId & ChangeType%>" name="IMG_COLLAPSE_PRODUCT_<%=ProdId & ChangeType%>" style="display:none;"><a href="javascript:;" class="menu_link" onClick="ToggleDisplay( 'PRODUCT_<%=ProdId & ChangeType%>', 'IMG_EXPAND_PRODUCT_<%=ProdId & ChangeType%>', 'IMG_COLLAPSE_PRODUCT_<%=ProdId & ChangeType%>');"><%=LIMG_COLLAPSE & GetProductIcon( rsTemp ) &  aProductList( 1, rowNum )%></a></SPAN>
                        </td>
                        <%Else%>
            <td nowrap valign="top">
                        <SPAN id="IMG_EXPAND_PRODUCT_<%=ProdId & ChangeType%>" name="IMG_EXPAND_PRODUCT_<%=ProdId & ChangeType%>" style="display:block;"><a href="javascript:;" class="menu_link" onClick="RequestPatches('?pkg_id=<%=pkgId%>&bom_id=<%=(GetBomTreeList()( 0, Numrow  ))%>&compare_bom_id=<%=(GetBomTreeList()( 0, Numrow   ))%>&current_bom_id=<%=dbPARbom_id%>', '<%=ProdId & ChangeType%>');"><%=LIMG_EXPAND & GetProductIcon( rsTemp ) &  aProductList( 1, rowNum )%></a></SPAN>
                        <SPAN id="IMG_COLLAPSE_PRODUCT_<%=ProdId & ChangeType%>" name="IMG_COLLAPSE_PRODUCT_<%=ProdId & ChangeType%>" style="display:none;"><a href="javascript:;" class="menu_link" onClick="ToggleDisplay( 'PRODUCT_<%=ProdId & ChangeType%>', 'IMG_EXPAND_PRODUCT_<%=ProdId & ChangeType%>', 'IMG_COLLAPSE_PRODUCT_<%=ProdId & ChangeType%>');"><%=LIMG_COLLAPSE & GetProductIcon( rsTemp ) &  aProductList( 1, rowNum )%></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_<%=ProdId & ChangeType%>" name="PRODUCT_<%=ProdId & ChangeType%>" style="display:none;"><%=enumLOADING%></DIV>
                                </td>
                  </tr>
                  <%If rowNum <> numOfRows Then%>
                  <tr>
            <td colspan="4" background="images/bg_table_border.gif"><img src="images/spacer.gif" width="1" height="1"></td>
          </tr>
                  <%End If%>                      

      <%
                        currentpkgId = CDbl(pkgId)
                  End If
                  ' -------- END GROUP ------------------------
                  
                  
                  
                  End If%>
                  
                  <%
                 ' 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>
                  <%'Exit For%>
                  <%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>
                <%
                
                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"-->