Subversion Repositories DevTools

Rev

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

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'|                                                   |
'|                RequestProductLocation             |
'|                                                   |
'=====================================================
%>
<%
Option explicit
Response.Expires = 0
%>
<!--#include file="common/globals.asp"-->
<!--#include file="common/config.asp"-->
<!--#include file="common/common_subs.asp"-->
<%
'------------ VARIABLE DEFINITION -------------
Dim IsProductInNewBom
Dim QueryName

' parameters refering to production BOM items
Dim parProdBomId
Dim parProdBomProdId

' parameters refering this BOM items
Dim parThisBomId
Dim parThisProdId
Dim parThisPkgId
Dim parThisVersion

'------------ CONSTANTS DECLARATION -----------
'------------ VARIABLE INIT -------------------
parProdBomId     = Request("bom_id")
parProdBomProdId = Request("prod_id")

parThisBomId     = Request("compare_bom_id")
parThisProdId    = Request("new_prod_id")
parThisPkgId     = Request("pkg_id")
parThisVersion   = Request("new_version")

'------------ CONDITIONS ----------------------
'----------------------------------------------
%>
<%
'--------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------
%>
<%
'------------ RUN BEFORE PAGE RENDER ----------
'If (Request("change_type") = "R") Then
'   QueryName = "BomRemovedProductLocation.sql"
'   IsProductInNewBom = FALSE

'ElseIf (Request("change_type") = "U") Then
'   QueryName = "BomUpdatedProductLocation.sql"
'   IsProductInNewBom = FALSE
'Else

   QueryName = "BomAddedProductLocation.sql"
'   IsProductInNewBom = TRUE

'End If
'----------------------------------------------
%>


<table width="100%"  border="0" cellspacing="3" cellpadding="0">
   <tr>
      <td background="images/bg_form_lightgray.gif" nowrap class="body_txt">
         <SPAN id="IMG_EXPAND_PRODNOTES_<%=parThisBomId%>_<%=parThisProdId%>" style="display:block;">
            <a href="javascript:;" class="menu_link" onClick="RequestProductNotes('?prod_id=<%=parProdBomProdId%>&new_prod_id=<%=parThisProdId%>', '<%=parThisBomId%>_<%=parThisProdId%>');">
               <img src="icons/i_plus.gif" border="0" align="absmiddle" hspace="3">
               <img src="icons/i_product.gif" border="0" align="absmiddle" hspace="3">Product Notes
            </a>
         </SPAN>
         <SPAN id="IMG_COLLAPSE_PRODNOTES_<%=parThisBomId%>_<%=parThisProdId%>" style="display:none;">
            <a href="javascript:;" class="menu_link" onClick="ToggleDisplay( 'PRODNOTES_<%=parThisBomId%>_<%=parThisProdId%>', 'IMG_EXPAND_PRODNOTES_<%=parThisBomId%>_<%=parThisProdId%>', 'IMG_COLLAPSE_PRODNOTES_<%=parThisBomId%>_<%=parThisProdId%>');">
               <img src="icons/i_minus.gif" border="0" align="absmiddle" hspace="3">
               <img src="icons/i_product.gif" border="0" align="absmiddle" hspace="3">Product Notes
            </a>
         </SPAN>
      </td>
   </tr>
   <tr>
      <td nowrap valign="top" class="body_row" colspan="3">
         <DIV id="PRODNOTES_<%=parThisBomId%>_<%=parThisProdId%>" name="PRODNOTES_<%=parThisBomId%>_<%=parThisProdId%>" style="display:none;"><%=enumLOADING%></DIV>
      </td>
   </tr>
   <%
   ' parThisBomId is the ID of the BOM under which exists the package version that was clicked that led to this file being processed.
   ' It is not the production BOM, which is referred to by parProdBomId.
   ' parThisProdId is the ID of the product in the BOM refered to by parThisBomId
   ' parThisPkgId is the ID of the package of which the product is just one instance (version) of.
   OraDatabase.Parameters.Add "BOM_ID",   parThisBomId,  ORAPARM_INPUT, ORATYPE_NUMBER
   OraDatabase.Parameters.Add "PROD_ID",  parThisProdId, ORAPARM_INPUT, ORATYPE_NUMBER
   OraDatabase.Parameters.Add "PKG_ID",   parThisPkgId,  ORAPARM_INPUT, ORATYPE_NUMBER

   Dim rsQryThisBom
   Set rsQryThisBom = OraDatabase.DbCreateDynaset( GetQuery ( QueryName ), ORADYN_DEFAULT )

   Dim bgColor
   bgColor = NULL

   If rsQryThisBom.RecordCount < 1 Then
      %>
      <tr>
         <td <%=bgColor%> nowrap valign="top" class="body_row" colspan="2">Product not found.</td>
      </tr>
      <%
   End If

   While (NOT rsQryThisBom.BOF) AND (NOT rsQryThisBom.EOF)

      If IsNull( bgColor ) Then
         bgColor = "bgcolor='#F5F5F5'"
      Else
         bgColor = NULL
      End If

      If parProdBomId <> "" AND parThisProdId <> "" Then

         ' Get information from package_versions table for this product
         Dim rsQryThisBomPkgVer, ThisBomPkgName, ThisBomPkgVersion, ThisBomPkgId

         Set rsQryThisBomPkgVer = OraDatabase.DbCreateDynaset( "select * from package_versions pv, packages pkg where pv.pv_id = "&parThisProdId&" and pkg.pkg_id = pv.pkg_id", cint(0))

         ThisBomPkgName    = rsQryThisBomPkgVer("pkg_name")
         ThisBomPkgVersion = rsQryThisBomPkgVer("pkg_version")
         ThisBomPkgId      = rsQryThisBomPkgVer("pkg_id")

         rsQryThisBomPkgVer.Close()
         Set rsQryThisBomPkgVer = nothing

         ' Get the project and branch name for the production BOM
         Dim rsQryProdBom, ProdBomProjName, ProdBomBranchName
         Set rsQryProdBom = OraDatabase.DbCreateDynaset( "select br.branch_name, prj.proj_name from boms bm, branches br, dm_projects prj where bm.bom_id = "&parProdBomId&" and br.BRANCH_ID = bm.RTAG_ID_FK and prj.PROJ_ID = br.PROJ_ID", cint(0))

         ProdBomProjName   = rsQryProdBom("proj_name")
         ProdBomBranchName = rsQryProdBom("branch_name")

         rsQryProdBom.Close()
         Set rsQryProdBom = nothing

         ' Get the OS name
         Dim rsOS, OSName
         Set rsOS = OraDatabase.DbCreateDynaset( "select bt.bos_type from os_base_env obe, base_env be, bos_types bt where obe.OS_ID = "&rsQryThisBom("os_id")&" and be.BASE_ENV_ID = obe.BASE_ENV_ID and bt.BOS_ID = be.BOS_ID", cint(0))

         OSName = rsOS("bos_type")

         If OSName = "Windows" OR OSName = "MOS" Then
            OSName = "win32"
         Else
            OSName = "sparc"
         End If

         rsOS.Close()
         Set rsOS = nothing

      End If

      ' Now display the information we have gathered
      %>
      <tr>
         <td <%=bgColor%> nowrap valign="top" class="body_row" colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;
            <%'If IsProductInNewBom Then%>
            <img hspace="4" src="icons/<%=rsQryThisBom("node_icon")%>" align="absmiddle" border="0"><a href="NodeDefault.asp?node_id=<%=rsQryThisBom("node_id")%>&bom_id=<%=parThisBomId%>" class="body_link"><%=rsQryThisBom("node_name")%></a>
            &nbsp;/&nbsp;<a href="OsDefault.asp?os_id=<%=rsQryThisBom("os_id")%>&bom_id=<%=parThisBomId%>" class="body_link"><%=rsQryThisBom("os_name") %></a>
            &nbsp;/&nbsp;<%=rsQryThisBom("pkg_name") &" "& rsQryThisBom("pkg_version")%>
            <%'Else%>
            <%If InStr(APP_ROOT, "DEPLOYMAN_WWW") > 0 Then%>
               &nbsp;&nbsp;<a href="LogDownload.asp?url=http://bms:8002/manager_suite/production_manager/downloads/<%=ThisBomPkgName%>-<%=ThisBomPkgVersion%>-<%=OSName%>.zip&pkg_id=<%=ThisBomPkgId%>&pkg_version=<%=ThisBomPkgVersion%>"  target="_blank" class="body_link">Download Version: <%=Request("new_version") %></a>&nbsp;&nbsp;
            <%Else%>
               &nbsp;&nbsp;<a href="LogDownload.asp?url=http://bms:8002/releases/<%=ProdBomProjName%>/<%=ProdBomBranchName%>/<%=ThisBomPkgName%>/<%=OSName%>/<%=ThisBomPkgVersion%>/<%=ThisBomPkgName%>-<%=ThisBomPkgVersion%>-<%=OSName%>.zip&pkg_id=<%=ThisBomPkgId%>&pkg_version=<%=ThisBomPkgVersion%>"  target="_blank" class="body_link">Download Version: <%=parThisVersion %></a>&nbsp;&nbsp;
            <%End If%>
            <%'End If%>

         </td>
      </tr>
      <%
      rsQryThisBom.MoveNext
   WEnd

   OraDatabase.Parameters.Remove "BOM_ID"
   OraDatabase.Parameters.Remove "PROD_ID"
   OraDatabase.Parameters.Remove "PKG_ID"

   rsQryThisBom.Close
   Set rsQryThisBom = Nothing
   %>

</table>

<%
'------------ RUN AFTER PAGE RENDER -----------
'----------------------------------------------
%><!--#include file="common/globals_destructor.asp"-->