mathieu_cupryk
asked on
Need to write this in asp.net vb..net
Function Main
Dim strTemp, strSQL, strFilterList, varTemp, rstTemp, lngTemp,varParameters
Dim strURLReport
Dim strFileName, strTimeFlag
Dim FS, i, strUniqueID
dim blnNoResult
dim strTemplate, strReportName, strParameters, strReportFormat
Dim rstMain
strReportFormat = ".PDF"
'Log file name
mstrReportFilePath = GetCDPath
strLogFIle = mstrReportFilePath & "\" & TEMP_FOLDER & LOG_FILE & ".log"
'-----------
if mblnAutoRun then
strStringtoAppend = "------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---" & vbCrLf
lngErr = AppendStringToFile(strStri ngToAppend , strLogFile)
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | " & strActiveDivisionName & " | PROCESS STARTED"
lngErr = AppendStringToLog(strStrin gToAppend, strLogFile)
end if
strParamConnection = Replace(CONN_STRING, REPLACE_SERVER_NAME, APP_SERVER_NAME)
strParamConnection = Replace(strParamConnection , REPLACE_DATABASE_NAME, DIVISION_DB_NAME)
strParamConnection = Replace(strParamConnection , REPLACE_USERNAME, IIS_USERNAME)
strParamConnection = Replace(strParamConnection , REPLACE_PASSWORD, IIS_PASSWORD)
strActiveDBConnection = Replace(CONN_STRING, REPLACE_SERVER_NAME, APP_SERVER_NAME)
strActiveDBConnection = Replace(strActiveDBConnect ion, REPLACE_DATABASE_NAME, APP_DB_NAME)
strActiveDBConnection = Replace(strActiveDBConnect ion, REPLACE_USERNAME, IIS_USERNAME)
strActiveDBConnection = Replace(strActiveDBConnect ion, REPLACE_PASSWORD, IIS_PASSWORD)
strActiveIHConnection = Replace(CONN_STRING, REPLACE_SERVER_NAME, strActiveIHServerName)
strActiveIHConnection = Replace(strActiveIHConnect ion, REPLACE_DATABASE_NAME, strActiveIHDBName)
strActiveIHConnection = Replace(strActiveIHConnect ion, REPLACE_USERNAME, IIS_USERNAME)
strActiveIHConnection = Replace(strActiveIHConnect ion, REPLACE_PASSWORD, IIS_PASSWORD)
strActiveMWConnection = Replace(CONN_STRING, REPLACE_SERVER_NAME, strActiveMWServerName)
strActiveMWConnection = Replace(strActiveMWConnect ion, REPLACE_DATABASE_NAME, strActiveMWDBName)
strActiveMWConnection = Replace(strActiveMWConnect ion, REPLACE_USERNAME, IIS_USERNAME)
strActiveMWConnection = Replace(strActiveMWConnect ion, REPLACE_PASSWORD, IIS_PASSWORD)
strActiveMAConnection = Replace(CONN_STRING, REPLACE_SERVER_NAME, strActiveMAServerName)
strActiveMAConnection = Replace(strActiveMAConnect ion, REPLACE_DATABASE_NAME, strActiveMADBName)
strActiveMAConnection = Replace(strActiveMAConnect ion, REPLACE_USERNAME, IIS_USERNAME)
strActiveMAConnection = Replace(strActiveMAConnect ion, REPLACE_PASSWORD, IIS_PASSWORD)
strActiveAWConnection = Replace(CONN_STRING, REPLACE_SERVER_NAME, strActiveAWServerName)
strActiveAWConnection = Replace(strActiveAWConnect ion, REPLACE_DATABASE_NAME, strActiveAWDBName)
strActiveAWConnection = Replace(strActiveAWConnect ion, REPLACE_USERNAME, IIS_USERNAME)
strActiveAWConnection = Replace(strActiveAWConnect ion, REPLACE_PASSWORD, IIS_PASSWORD)
'------------------------- ---------- ---------- ---------- ----------
'Get last completed week ending date
if mblnAutoRun then
'strWeekDate = FormatDateTime(DateAdd("ww ", -1, DateAdd("d", 7 - DatePart("w", Now), Now)), vbShortDate)
strWeekDate = FormatDateTime(DateAdd("ww ", 0, DateAdd("d", 7 - DatePart("w", Now-1), Now-1)), vbShortDate)
strSQL = SQL_GET_SELECTED_WEEK
strSQL = replace(strSQL,REPLACE_WEE K_DATE,str WeekDate)
Set rstTemp = ExecSQL(strActiveMWConnect ion, strSQL, 900, true)
strCurrYear = rstTemp("merch_year").valu e
strCurrPeriod = rstTemp("merch_period").va lue
mstrYearPeriod = strCurrYear & RIGHT("00" & strCurrPeriod,2)
else
strSQL = SQL_GET_CURRENT_YEAR_PERIO D
strSQL = replace(strSQL,REPLACE_YEA R_PERIOD,m strYearPer iod)
Set rstTemp = ExecSQL(strActiveMWConnect ion, strSQL, 900, true)
strWeekDate = rstTemp("WEEK_DATE").value
strCurrYear = rstTemp("merch_year").valu e
strCurrPeriod = rstTemp("merch_period").va lue
end if
if mblnAutoRun then
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | RUN WEEK: " & strWeekDate
AppendStringToLog strStringToAppend, strLogFile
end if
'------------------------- ---------- ---------- ---------- ----------
strTemp = GetCDPath() & "\" & SQL_FILE_SELECT_PERIOD
strSQL = ReadTextFile(strTemp)
strSQL = replace(strSQL,REPLACE_WEE K_DATE,str WeekDate)
Set rstTemp = ExecSQL(strActiveMWConnect ion, strSQL, 900, true)
rstTemp.filter = "calendar_year_code = " & strCurrYear & " and period_code = " & strCurrPeriod
if not rstTemp.eof then
mstrFromDate = rstTemp("period_start_date ").value
mstrToDate = rstTemp("period_end_date") .value
end if
'----------GLOBAL_APPS---- -
Set cnnGlobalApps = CreateObject("ADODB.Connec tion")
cnnGlobalApps.Open strActiveDBConnection
if mblnAutoRun then
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | DROP TEMP TABLES - GLOBAL_APPS"
lngErr = AppendStringToLog(strStrin gToAppend, strLogFile)
end if
'Drop temporary tables
call DropTmpTable(cnnGlobalApps ,1)
if mblnAutoRun then
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | CREATE TEMP TABLES - GLOBAL_APPS"
lngErr = AppendStringToLog(strStrin gToAppend, strLogFile)
end if
'-----CREATE TEMPORARY TABLE-----
strTemp = GetCDPath() & "\" & SQL_FILE_CREATE_TEMP_TABLE
strSQL = ReadTextFile(strTemp)
cnnGlobalApps.Execute strSQL
'----------MW-----
Set cnnMW = CreateObject("ADODB.Connec tion")
cnnMW.Open strActiveMWConnection
if mblnAutoRun then
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | DROP TEMP TABLES - MW"
lngErr = AppendStringToLog(strStrin gToAppend, strLogFile)
end if
'Drop temporary tables
call DropTmpTable(cnnMW,2)
if mblnAutoRun then
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | CREATE TEMP TABLES - MW"
lngErr = AppendStringToLog(strStrin gToAppend, strLogFile)
end if
'-----CREATE TEMPORARY TABLE-----
strTemp = GetCDPath() & "\" & SQL_FILE_CREATE_TEMP_TABLE _MW
strSQL = ReadTextFile(strTemp)
cnnMW.Execute strSQL
'-------Main SQL
if mblnAutoRun then
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | EXTRACT DATA"
lngErr = AppendStringToLog(strStrin gToAppend, strLogFile)
end if
'-----Extract SL Components from IH to MW
strTemp = GetCDPath() & "\" & SQL_FILE_MW_SL_COMPONENT
strSQL = ReadTextFile(strTemp)
Set rstTemp = ExecSQL(strActiveIHConnect ion, strSQL, 900, true)
if not rstTemp.eof then
'Insert into GlobalApps DB
lngTemp = TransferDataBetweenServer( "", cnnMW, "", TMP_TBL_MW_SL_COMPONENT, "", rstTemp, , False, 120)
'lngTemp = TransferDataBetweenServer( "", cnnMW, "", "TMP_MW_SL_COMPONENT" , "", rstTemp, , False, 120)
end if
'------------------------- ---------- ---------- -------
strTemp = GetCDPath() & "\" & SQL_FILE_LOCATION_AW
strSQL = ReadTextFile(strTemp)
strSQL = replace(strSQL,REPLACE_BEG IN_DATE,ms trFromDate )
strSQL = replace(strSQL,REPLACE_END _DATE,mstr ToDate)
if mblnAutoRun then 'Add by Ivan Guentchev #0001610
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | SQL_FILE_LOCATION_AW"
lngErr = AppendStringToLog(strStrin gToAppend, strLogFile)
end if
Set rstTemp = ExecSQL(strActiveAWConnect ion, strSQL, 1800, true)
if not rstTemp.eof then
'Insert into GlobalApps DB
lngTemp = TransferDataBetweenServer( "", cnnGlobalApps, "", TMP_TBL_AW_DATA, "", rstTemp, , False, 120)
'lngTemp = TransferDataBetweenServer( "", cnnGlobalApps, "", "TMP_AW_DATA" , "", rstTemp, , False, 120)
end if
'-------Main SQL
strTemp = GetCDPath() & "\" & SQL_FILE_LOCATION_MA
strSQL = ReadTextFile(strTemp)
strSQL = replace(strSQL,REPLACE_BEG IN_DATE,ms trFromDate )
strSQL = replace(strSQL,REPLACE_END _DATE,mstr ToDate)
strSQL = replace(strSQL,REPLACE_YEA R_PERIOD,m strYearPer iod)
if mblnAutoRun then 'Add by Ivan Guentchev #0001610
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | SQL_FILE_LOCATION_MA"
lngErr = AppendStringToLog(strStrin gToAppend, strLogFile)
end if
Set rstTemp = ExecSQL(strActiveMAConnect ion, strSQL, 1800, true)
if not rstTemp.eof then
'Insert into GlobalApps DB
lngTemp = TransferDataBetweenServer( "", cnnGlobalApps, "", TMP_TBL_MA_DATA, "", rstTemp, , False, 120)
'lngTemp = TransferDataBetweenServer( "", cnnGlobalApps, "", "TMP_MA_DATA" , "", rstTemp, , False, 120)
end if
'------------------------- ---------- -------
'-------Main SQL
strTemp = GetCDPath() & "\" & SQL_FILE_LOCATION_MW
strSQL = ReadTextFile(strTemp)
strSQL = replace(strSQL,REPLACE_DIV ISION_LEVE L_ID,Divis ionLevel)
strSQL = replace(strSQL,REPLACE_BEG IN_DATE,ms trFromDate )
strSQL = replace(strSQL,REPLACE_END _DATE,mstr ToDate)
strSQL = replace(strSQL,REPLACE_YEA R_PERIOD,m strYearPer iod)
if mblnAutoRun then 'Add by Ivan Guentchev #0001610
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | SQL_FILE_LOCATION_MW"
lngErr = AppendStringToLog(strStrin gToAppend, strLogFile)
end if
Set rstTemp = ExecSQL(cnnMW, strSQL, 1800, true)
if not rstTemp.eof then
'Insert into GlobalApps DB
lngTemp = TransferDataBetweenServer( "", cnnGlobalApps, "", TMP_TBL_MW_DATA, "", rstTemp, , False, 120)
'lngTemp = TransferDataBetweenServer( "", cnnGlobalApps, "", "TMP_MW_DATA" , "", rstTemp, , False, 120)
end if
'------------------------- ---------- --
'-------Main SQL
strTemp = GetCDPath() & "\" & SQL_FILE_MAIN
strSQL = ReadTextFile(strTemp)
if mblnAutoRun then 'Add by Ivan Guentchev #0001610
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | FINAL QUERY"
lngErr = AppendStringToLog(strStrin gToAppend, strLogFile)
end if
Set rstMain = ExecSQL(cnnGlobalApps, strSQL, 1800, true)
If Not (rstMain Is Nothing) Then
if rstMain.recordcount = 0 then
if strLanguage = "F" then
strMessage = "Aucun résultat trouvé pour les critères sélectionné."
else
strMessage = "No data found for the selected criteria."
end if
if mblnAutoRun then
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | " & strMessage
lngErr = AppendStringToLog(strStrin gToAppend, strLogFile)
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | PROCESS ENDED"
AppendStringToLog strStringToAppend, strLogFile
strStringtoAppend = "------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---" & vbCrLf
AppendStringToFile strStringToAppend, strLogFile
end if
else
Call GenerateReport(rstMain, strReportFormat)
Server.ScriptTimeout = iScriptTimeout
end if
end if
'Drop temporary tables
call DropTmpTable(cnnGlobalApps ,1)
'Close connection
if isobject(cnnGlobalApps) then
if not cnnGlobalApps is nothing then
if cnnGlobalApps.State <> adStateClosed then
cnnGlobalApps.Close
end if
Set cnnGlobalApps = Nothing
end if
end if
'Drop temporary tables
call DropTmpTable(cnnMW,2)
'Close connection
if isobject(cnnMW) then
if not cnnMW is nothing then
if cnnMW.State <> adStateClosed then
cnnMW.Close
end if
Set cnnMW = Nothing
end if
end if
Server.ScriptTimeout = iScriptTimeout 'reset to default timeout
if mblnAutoRun then
Response.Write "<script LANGUAGE='javascript'>"
Response.Write "window.history.go(-2);" 'must put this because if not the report is processed another time!!
Response.Write "window.opener = '';"
Response.Write "window.close();"
Response.Write "</script>"
else
Response.Write "<script LANGUAGE='javascript'>"
Response.Write "alert('" & strMessage & "');"
Response.Write "history.back();"
Response.Write "</script>"
end if
End function
Dim strTemp, strSQL, strFilterList, varTemp, rstTemp, lngTemp,varParameters
Dim strURLReport
Dim strFileName, strTimeFlag
Dim FS, i, strUniqueID
dim blnNoResult
dim strTemplate, strReportName, strParameters, strReportFormat
Dim rstMain
strReportFormat = ".PDF"
'Log file name
mstrReportFilePath = GetCDPath
strLogFIle = mstrReportFilePath & "\" & TEMP_FOLDER & LOG_FILE & ".log"
'-----------
if mblnAutoRun then
strStringtoAppend = "-------------------------
lngErr = AppendStringToFile(strStri
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | " & strActiveDivisionName & " | PROCESS STARTED"
lngErr = AppendStringToLog(strStrin
end if
strParamConnection = Replace(CONN_STRING, REPLACE_SERVER_NAME, APP_SERVER_NAME)
strParamConnection = Replace(strParamConnection
strParamConnection = Replace(strParamConnection
strParamConnection = Replace(strParamConnection
strActiveDBConnection = Replace(CONN_STRING, REPLACE_SERVER_NAME, APP_SERVER_NAME)
strActiveDBConnection = Replace(strActiveDBConnect
strActiveDBConnection = Replace(strActiveDBConnect
strActiveDBConnection = Replace(strActiveDBConnect
strActiveIHConnection = Replace(CONN_STRING, REPLACE_SERVER_NAME, strActiveIHServerName)
strActiveIHConnection = Replace(strActiveIHConnect
strActiveIHConnection = Replace(strActiveIHConnect
strActiveIHConnection = Replace(strActiveIHConnect
strActiveMWConnection = Replace(CONN_STRING, REPLACE_SERVER_NAME, strActiveMWServerName)
strActiveMWConnection = Replace(strActiveMWConnect
strActiveMWConnection = Replace(strActiveMWConnect
strActiveMWConnection = Replace(strActiveMWConnect
strActiveMAConnection = Replace(CONN_STRING, REPLACE_SERVER_NAME, strActiveMAServerName)
strActiveMAConnection = Replace(strActiveMAConnect
strActiveMAConnection = Replace(strActiveMAConnect
strActiveMAConnection = Replace(strActiveMAConnect
strActiveAWConnection = Replace(CONN_STRING, REPLACE_SERVER_NAME, strActiveAWServerName)
strActiveAWConnection = Replace(strActiveAWConnect
strActiveAWConnection = Replace(strActiveAWConnect
strActiveAWConnection = Replace(strActiveAWConnect
'-------------------------
'Get last completed week ending date
if mblnAutoRun then
'strWeekDate = FormatDateTime(DateAdd("ww
strWeekDate = FormatDateTime(DateAdd("ww
strSQL = SQL_GET_SELECTED_WEEK
strSQL = replace(strSQL,REPLACE_WEE
Set rstTemp = ExecSQL(strActiveMWConnect
strCurrYear = rstTemp("merch_year").valu
strCurrPeriod = rstTemp("merch_period").va
mstrYearPeriod = strCurrYear & RIGHT("00" & strCurrPeriod,2)
else
strSQL = SQL_GET_CURRENT_YEAR_PERIO
strSQL = replace(strSQL,REPLACE_YEA
Set rstTemp = ExecSQL(strActiveMWConnect
strWeekDate = rstTemp("WEEK_DATE").value
strCurrYear = rstTemp("merch_year").valu
strCurrPeriod = rstTemp("merch_period").va
end if
if mblnAutoRun then
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | RUN WEEK: " & strWeekDate
AppendStringToLog strStringToAppend, strLogFile
end if
'-------------------------
strTemp = GetCDPath() & "\" & SQL_FILE_SELECT_PERIOD
strSQL = ReadTextFile(strTemp)
strSQL = replace(strSQL,REPLACE_WEE
Set rstTemp = ExecSQL(strActiveMWConnect
rstTemp.filter = "calendar_year_code = " & strCurrYear & " and period_code = " & strCurrPeriod
if not rstTemp.eof then
mstrFromDate = rstTemp("period_start_date
mstrToDate = rstTemp("period_end_date")
end if
'----------GLOBAL_APPS----
Set cnnGlobalApps = CreateObject("ADODB.Connec
cnnGlobalApps.Open strActiveDBConnection
if mblnAutoRun then
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | DROP TEMP TABLES - GLOBAL_APPS"
lngErr = AppendStringToLog(strStrin
end if
'Drop temporary tables
call DropTmpTable(cnnGlobalApps
if mblnAutoRun then
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | CREATE TEMP TABLES - GLOBAL_APPS"
lngErr = AppendStringToLog(strStrin
end if
'-----CREATE TEMPORARY TABLE-----
strTemp = GetCDPath() & "\" & SQL_FILE_CREATE_TEMP_TABLE
strSQL = ReadTextFile(strTemp)
cnnGlobalApps.Execute strSQL
'----------MW-----
Set cnnMW = CreateObject("ADODB.Connec
cnnMW.Open strActiveMWConnection
if mblnAutoRun then
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | DROP TEMP TABLES - MW"
lngErr = AppendStringToLog(strStrin
end if
'Drop temporary tables
call DropTmpTable(cnnMW,2)
if mblnAutoRun then
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | CREATE TEMP TABLES - MW"
lngErr = AppendStringToLog(strStrin
end if
'-----CREATE TEMPORARY TABLE-----
strTemp = GetCDPath() & "\" & SQL_FILE_CREATE_TEMP_TABLE
strSQL = ReadTextFile(strTemp)
cnnMW.Execute strSQL
'-------Main SQL
if mblnAutoRun then
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | EXTRACT DATA"
lngErr = AppendStringToLog(strStrin
end if
'-----Extract SL Components from IH to MW
strTemp = GetCDPath() & "\" & SQL_FILE_MW_SL_COMPONENT
strSQL = ReadTextFile(strTemp)
Set rstTemp = ExecSQL(strActiveIHConnect
if not rstTemp.eof then
'Insert into GlobalApps DB
lngTemp = TransferDataBetweenServer(
'lngTemp = TransferDataBetweenServer(
end if
'-------------------------
strTemp = GetCDPath() & "\" & SQL_FILE_LOCATION_AW
strSQL = ReadTextFile(strTemp)
strSQL = replace(strSQL,REPLACE_BEG
strSQL = replace(strSQL,REPLACE_END
if mblnAutoRun then 'Add by Ivan Guentchev #0001610
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | SQL_FILE_LOCATION_AW"
lngErr = AppendStringToLog(strStrin
end if
Set rstTemp = ExecSQL(strActiveAWConnect
if not rstTemp.eof then
'Insert into GlobalApps DB
lngTemp = TransferDataBetweenServer(
'lngTemp = TransferDataBetweenServer(
end if
'-------Main SQL
strTemp = GetCDPath() & "\" & SQL_FILE_LOCATION_MA
strSQL = ReadTextFile(strTemp)
strSQL = replace(strSQL,REPLACE_BEG
strSQL = replace(strSQL,REPLACE_END
strSQL = replace(strSQL,REPLACE_YEA
if mblnAutoRun then 'Add by Ivan Guentchev #0001610
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | SQL_FILE_LOCATION_MA"
lngErr = AppendStringToLog(strStrin
end if
Set rstTemp = ExecSQL(strActiveMAConnect
if not rstTemp.eof then
'Insert into GlobalApps DB
lngTemp = TransferDataBetweenServer(
'lngTemp = TransferDataBetweenServer(
end if
'-------------------------
'-------Main SQL
strTemp = GetCDPath() & "\" & SQL_FILE_LOCATION_MW
strSQL = ReadTextFile(strTemp)
strSQL = replace(strSQL,REPLACE_DIV
strSQL = replace(strSQL,REPLACE_BEG
strSQL = replace(strSQL,REPLACE_END
strSQL = replace(strSQL,REPLACE_YEA
if mblnAutoRun then 'Add by Ivan Guentchev #0001610
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | SQL_FILE_LOCATION_MW"
lngErr = AppendStringToLog(strStrin
end if
Set rstTemp = ExecSQL(cnnMW, strSQL, 1800, true)
if not rstTemp.eof then
'Insert into GlobalApps DB
lngTemp = TransferDataBetweenServer(
'lngTemp = TransferDataBetweenServer(
end if
'-------------------------
'-------Main SQL
strTemp = GetCDPath() & "\" & SQL_FILE_MAIN
strSQL = ReadTextFile(strTemp)
if mblnAutoRun then 'Add by Ivan Guentchev #0001610
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | FINAL QUERY"
lngErr = AppendStringToLog(strStrin
end if
Set rstMain = ExecSQL(cnnGlobalApps, strSQL, 1800, true)
If Not (rstMain Is Nothing) Then
if rstMain.recordcount = 0 then
if strLanguage = "F" then
strMessage = "Aucun résultat trouvé pour les critères sélectionné."
else
strMessage = "No data found for the selected criteria."
end if
if mblnAutoRun then
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | " & strMessage
lngErr = AppendStringToLog(strStrin
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | PROCESS ENDED"
AppendStringToLog strStringToAppend, strLogFile
strStringtoAppend = "-------------------------
AppendStringToFile strStringToAppend, strLogFile
end if
else
Call GenerateReport(rstMain, strReportFormat)
Server.ScriptTimeout = iScriptTimeout
end if
end if
'Drop temporary tables
call DropTmpTable(cnnGlobalApps
'Close connection
if isobject(cnnGlobalApps) then
if not cnnGlobalApps is nothing then
if cnnGlobalApps.State <> adStateClosed then
cnnGlobalApps.Close
end if
Set cnnGlobalApps = Nothing
end if
end if
'Drop temporary tables
call DropTmpTable(cnnMW,2)
'Close connection
if isobject(cnnMW) then
if not cnnMW is nothing then
if cnnMW.State <> adStateClosed then
cnnMW.Close
end if
Set cnnMW = Nothing
end if
end if
Server.ScriptTimeout = iScriptTimeout 'reset to default timeout
if mblnAutoRun then
Response.Write "<script LANGUAGE='javascript'>"
Response.Write "window.history.go(-2);" 'must put this because if not the report is processed another time!!
Response.Write "window.opener = '';"
Response.Write "window.close();"
Response.Write "</script>"
else
Response.Write "<script LANGUAGE='javascript'>"
Response.Write "alert('" & strMessage & "');"
Response.Write "history.back();"
Response.Write "</script>"
end if
End function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Function Main
Dim strTemp, strSQL, strFilterList, varTemp, rstTemp, lngTemp,varParameters
Dim strURLReport
Dim strFileName, strTimeFlag
Dim FS, i, strUniqueID
dim blnNoResult
dim strTemplate, strReportName, strParameters, strReportFormat
Dim rstMain
strReportFormat = ".PDF"
'Log file name
mstrReportFilePath = GetCDPath
strLogFIle = mstrReportFilePath & "\" & TEMP_FOLDER & LOG_FILE & ".log"
'-----------
if mblnAutoRun then
strStringtoAppend = "-------------------------
lngErr = AppendStringToFile(strStri
strStringtoAppend = PAGENAME & "-" & METHODNAME & " | " & strActiveDivisionName & " | PROCESS STARTED"
lngErr = AppendStringToLog(strStrin
end if
strParamConnection = Replace(CONN_STRING, REPLACE_SERVER_NAME, APP_SERVER_NAME)
strParamConnection = Replace(strParamConnection
strParamConnection = Replace(strParamConnection
strParamConnection = Replace(strParamConnection