Subversion Repositories DevTools

Rev

Rev 25 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
13 rsolanki 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
4
'|                                                   |
5
'|			          XML BOM Gen				 	 |
6
'|                                                   |
7
'=====================================================
8
%>
9
<%
10
Option explicit
11
Response.Expires = 0	' always load the page, dont store
12
%>
13
<!--#include file="common/globals.asp"-->
14
<!--#include file="common/config.asp"-->
15
<!--#include file="common/common_subs.asp"-->
16
<!--#include file="common/_popup_window_common.asp"-->
17
 
18
<%
19
'------------ VARIABLE DEFINITION -------------
20
Dim objWSH
21
'------------ CONSTANTS DECLARATION -----------
22
'------------ VARIABLE INIT -------------------
23
'------------ CONDITIONS ----------------------
24
'----------------------------------------------
25
%>
26
<%
27
'--------------------------------------------------------------------------------------------------------------------------
28
 
29
'--------------------------------------------------------------------------------------------------------------------------
30
%>
31
<%
15 rsolanki 32
Function DateReversed ( dDate )
33
	' Ensures Reverse Date format YYYY-MM-DD
34
	If IsNull(dDate) Then Exit Function
35
	DateReversed = Year(dDate) &"-"&  Month(dDate) &"-"& Day(dDate)
36
End Function
13 rsolanki 37
'**************************** M  A  I  N ******************************
38
 
39
If Request("bom_id") <> "" Then
23 rsolanki 40
 
13 rsolanki 41
	Set objWSH = Server.CreateObject("WScript.Shell")
42
	objWSH.Run   "cmd.exe /c cscript.exe //B //NoLogo "& APP_ROOT &"\jobs\PostBOMRelease.wsf /bom_id:"& Request("bom_id") , 0, True 
43
 
15 rsolanki 44
	OraDatabase.Parameters.Add "BOM_ID", 	Request("bom_id"), 			ORAPARM_INPUT, ORATYPE_NUMBER
45
	OraDatabase.Parameters.Add "USER_ID", 	objAccessControl.UserId, 	ORAPARM_INPUT, ORATYPE_NUMBER 
13 rsolanki 46
 
15 rsolanki 47
	objEH.TryORA ( OraSession )
48
 
49
	OraDatabase.ExecuteSQL _
50
	"BEGIN   pk_Bom.Log_Bom_Trail ( :BOM_ID, 'XML BOM GENERATED', :USER_ID, NULL );   END;"
51
 
52
	objEH.CatchORA ( OraSession )
53
 
54
	OraDatabase.Parameters.Remove "BOM_ID"
55
	OraDatabase.Parameters.Remove "USER_ID"	
56
 
57
	Dim rsQry, objZIPObject
58
	Set rsQry = OraDatabase.DbCreateDynaset( "SELECT bn.BOM_NAME, br.BRANCH_NAME, bn.BOM_NAME ||''|| b.BOM_VERSION ||'.'|| b.BOM_LIFECYCLE AS VERSION FROM BOMS B, BRANCHES BR, BOM_NAMES BN WHERE B.BOM_ID = "& Request("bom_id") &" AND B.BRANCH_ID = BR.BRANCH_ID AND B.BOM_NAME_ID = BN.BOM_NAME_ID", cint(0))
59
 
60
	Set objZIPObject = Server.CreateObject("aspZip.EasyZIP")
61
 
62
	objZIPObject.ZipFileName = ""& Request.ServerVariables("APPL_PHYSICAL_PATH") &"deployment_manager\downloads\"& rsQry("branch_name") &"\"& rsQry("version") &"\"& DateReversed(Date) &".zip"
63
	objZIPObject.ArgsClear
64
	objZIPObject.ArgsAdd(""& Request.ServerVariables("APPL_PHYSICAL_PATH") &"deployment_manager\downloads\"& rsQry("branch_name") &"\"& rsQry("version") &"\"& DateReversed(Date) &"\*.*")
65
	objZIPObject.Zip
66
 
67
	Response.Write "Files Zipped=" & objZIPObject.SuccessCNT & " with Error="& objZIPObject.Error
68
	'Response.Write(""& Request.ServerVariables("APPL_PHYSICAL_PATH") &"deployment_manager\downloads\"& rsQry("bom_name") &"\"& rsQry("version") &"\"& DateReversed(Date) &".zip")
69
 
25 rsolanki 70
 
15 rsolanki 71
 
72
 
73
	Dim myMail, LocalPath
74
	Set myMail=Server.CreateObject("Persits.MailSender")
75
	LocalPath = ""& Request.ServerVariables("APPL_PHYSICAL_PATH") &"deployment_manager\downloads\"& rsQry("branch_name") &"\"& rsQry("version") &"\"& DateReversed(Date) &".zip"
76
 
77
	myMail.Host = SMTP_HOST
25 rsolanki 78
 
79
	Dim rsTemp
80
 
81
	Set rsTemp = OraDatabase.DbCreateDynaset( "SELECT * FROM BOMS WHERE BOM_ID = "& Request("bom_id"), cint(0))
82
 
83
	If rsTemp("is_readonly") = "Y" Then
84
		myMail.Subject="OFFICIAL XML BOMS Generated from Deployment Manager"
85
	Else
86
		myMail.Subject="THESE ARE NOT OFFICIAL XML BOMS!!!"
87
	End If
15 rsolanki 88
	myMail.From="releasem@erggroup.com"
89
	myMail.AddAddress objAccessControl.UserEmail
90
	' Attach the file
91
	myMail.AddAttachment LocalPath
92
	myMail.Body = "Your requested xml files .." 
93
	myMail.Send
94
 
19 rsolanki 95
	set myMail = nothing
96
	set objWSH = nothing
15 rsolanki 97
 
25 rsolanki 98
 
99
	rsTemp.Close()
100
	Set rsTemp = Nothing
101
	rsQry.Close()
15 rsolanki 102
	Set rsQry = nothing
103
 
104
	'Response.write "<br>You will be emailed shortly with the XML files generated.<br>"
105
	'Response.write "Go to <a href='\\auperaweb08\wwwTRD\manager_suite_DEVELOPMENT\deployment_manager\downloads'>\\auperaweb08\wwwTRD\manager_suite_DEVELOPMENT\deployment_manager\downloads</a>"
106
 
13 rsolanki 107
Else
108
	Response.write "Please specify bom_id. <br>Example:<br> "& SCRIPT_NAME &"?bom_id=1234"
109
End If
110
 
111
'**********************************************************************
112
%>
15 rsolanki 113
<script language="Javascript">
114
alert("You will be emailed shortly with the XML files generated. Click OK to Redirect to Previous Page...")
115
history.back()
116
</script>
13 rsolanki 117
<%
118
'------------ RUN AFTER CODE RUN --------------
119
'----------------------------------------------
120
%><!--#include file="common/globals_destructor.asp"-->