%@ LANGUAGE = VBScript %>
<%
Option Explicit
%>
<%
dim pre_mo
dim numPerPage, numPerColumn, sec_len
numPerColumn = 7 'HOW MANY EVENTS TO DISPLAY IN EACH COLUMN
sec_len = 27 'HOW MANY CHARACTERS TO DISPLAY IN EACH LINE BEFORE WRAP
numPerPage = 5 * numPerColumn 'HOW MANY EVENTS PER PAGE (5 = NUMBER OF COLUMNS)
Dim font
Dim oPDF
Dim buf
dim path
path = server.mappath(".\")
dim filesys
Set filesys = CreateObject("Scripting.FileSystemObject")
If filesys.FileExists(path & "\" & monthname(datepart("M",date())) & "calendar.pdf") Then
'response.redirect (path & "\" & monthname(datepart("M",date())) & "calendar.pdf")
else
path = path & "\" & monthname(datepart("M",date())) & "calendar.pdf"
end if
Set oPDF = Server.CreateObject("PDFlib_com.PDF")
' Open new PDF file
'oPDF.open_file path
oPDF.open_file ""
oPDF.set_info "Creator", "autopdf.asp"
oPDF.set_info "Author", "TAPPI"
oPDF.set_info "Title", "TAPPI Calendar"
' start a new page
oPDF.begin_page 595, 842
draw_header_footer
drawpage
dim rs_det, ix, strSQL, chk_date,cur_mo, cur_yr, dates, date_nfo, title, cur_rec, section, text_x, text_y, pos_x, pos_y, llx, lly, urx, ury, url
ix = 0
cur_rec = 0
text_x = 8
text_y = 780
oPDF.set_text_pos text_x, text_y
cur_mo = valuecheck("periodx", datepart("M", now()))
cur_yr = valuecheck("periody", datepart("YYYY", now()))
chk_date = cur_mo & "/" & "01" & "/" & cur_yr
set rs_det = server.CreateObject("ADODB.Recordset")
strSQL = "sp_get_calendar '" & chk_date & "'"
set rs=conn.execute(strSQL)
if not rs.eof then
cur_mo = DatePart("M", rs("Date_Start"))
cur_yr = DatePart("YYYY", rs("Date_Start"))
end if
while not rs.eof
'Response.Write "current record: " & cur_rec & "== num per page: " & numPerPage & " == "& cur_rec mod numPerPage&"
"
if cur_rec mod numPerPage = 0 and cur_rec = numPerPage then 'CREATE SUBSEQUENT PAGES
oPDF.end_page
oPDF.begin_page 595, 842
draw_header_footer
font = oPDF.findfont("Helvetica-Bold", "winansi", 0)
oPDF.setfont font, 8
text_x = 10
drawpage
oPDF.setcolor "both", "rgb", 1, 1, 1, 0
oPDF.set_text_pos text_x+4, text_y+18
if not isNull(rs("Date_Start")) then
oPDF.show MonthName(DatePart("M",cdate(rs("Date_Start")))) &" "& DatePart("YYYY", cdate(rs("Date_Start")))
cur_mo = DatePart("M", rs("Date_Start"))
cur_yr = DatePart("YYYY", rs("Date_Start"))
end if
oPDF.setcolor "both", "rgb", 0, 0, 0, 0
oPDF.set_text_pos text_x, text_y
elseif cur_rec mod numPerColumn = 0 and cur_rec > 0 then 'NEW COLUMN
text_x = text_x + 120
font = oPDF.findfont("Helvetica-Bold", "winansi", 0)
oPDF.setfont font, 8
oPDF.setcolor "both", "rgb", 1, 1, 1, 0
oPDF.set_text_pos text_x+4, text_y+18
if not isNull(rs("Date_Start")) then
oPDF.show MonthName(DatePart("M",cdate(rs("Date_Start")))) &" "& DatePart("YYYY", cdate(rs("Date_Start")))
cur_mo = DatePart("M", rs("Date_Start"))
cur_yr = DatePart("YYYY", rs("Date_Start"))
end if
'if cur_mo = DatePart("M", rs("Date_Start")) AND cur_yr = DatePart("YYYY", rs("Date_Start")) then
if cur_mo = pre_mo then
oPDF.show " (cont'd)"
if len(request("sql")) > 0 then
oPDF.show pre_mo
end if
end if
oPDF.setcolor "both", "rgb", 0, 0, 0, 0
oPDF.set_text_pos text_x, text_y
elseif cur_rec = 0 then 'CREATE INITIAL PAGE
font = oPDF.findfont("Helvetica-Bold", "winansi", 0)
oPDF.setfont font, 8
oPDF.setcolor "both", "rgb", 1, 1, 1, 0
oPDF.set_text_pos text_x+4, text_y+18
if not isNull(rs("Date_Start")) then
oPDF.show MonthName(DatePart("M",cdate(rs("Date_Start")))) &" "& DatePart("YYYY", cdate(rs("Date_Start")))
end if
oPDF.setcolor "both", "rgb", 0, 0, 0, 0
oPDF.set_text_pos text_x, text_y
end if
font = oPDF.findfont("Helvetica-Bold", "winansi", 0)
oPDF.setfont font, 8
if cur_mo <> DatePart("M", rs("Date_Start")) OR cur_yr <> DatePart("YYYY", rs("Date_Start")) AND (cur_rec mod numPerColumn <> 0) then
cur_mo = DatePart("M", rs("Date_Start"))
cur_yr = DatePart("YYYY", rs("Date_Start"))
pos_x = oPDF.get_value("textx", 0)
pos_y = oPDF.get_value("texty", 0)
drawbox pos_x-10, pos_y-18
oPDF.setcolor "both", "rgb", 1, 1, 1, 0
oPDF.set_text_pos pos_x, pos_y-10
oPDF.show MonthName(DatePart("M",cdate(rs("Date_Start")))) &" "& DatePart("YYYY", cdate(rs("Date_Start")))
oPDF.setcolor "both", "rgb", 0, 0, 0, 0
oPDF.set_text_pos text_x, pos_y - 20
end if
pre_mo = cur_mo
cur_rec = cur_rec + 1
title = rs("long_name")
sec_len = 25
while len(title) > 0
if len(title)> sec_len then
section = left(title, instrrev(left(title, sec_len), " "))
oPDF.continue_text section
title = right(title,(len(title) - len(section)))
else
oPDF.continue_text title
title = ""
end if
wend
rs_det.open "select * from product_detail where product_id = " & rs("product_id") & " and active_ind = 1 and Product_Detail_Type = 1 order by sequence ", conn, 3
while not rs_det.eof
font = oPDF.findfont("Helvetica", "winansi", 0)
oPDF.setfont font, 8
if trim(lcase(rs_det("name"))) = "date" then
dates = split(rs_det("description"), " to ")
if ubound(dates)>0 then
if isdate(dates(0)) and isdate(dates(1)) then
date_nfo = MonthName(datepart("M", dates(0))) & " " & datepart("D", dates(0)) & " "
if datediff("M", dates(0), dates(1)) > 0 then
date_nfo = date_nfo & " - " & MonthName(datepart("M", dates(1))) & " "
end if
if datediff("M", dates(0), dates(1)) <= 0 then ' check to see if it spans two diff. months
if datepart("D", dates(0)) <> datepart("D", dates(1)) then 'nrm if statement 1/11/05
date_nfo = date_nfo & " - " & datepart("D", dates(1)) & vbcrlf
oPDF.continue_text date_nfo
else
date_nfo = date_nfo & vbcrlf
oPDF.continue_text date_nfo
End If
else
if datepart("D", dates(0)) <> datepart("D", dates(1)) then 'nrm if statement 1/11/05
date_nfo = date_nfo & datepart("D", dates(1)) & vbcrlf
oPDF.continue_text date_nfo
else
date_nfo = date_nfo & vbcrlf
oPDF.continue_text date_nfo
End If
end if
end if
end if
else
if isNull(rs_det("name")) then
rs_det("name") = ""
end if
if isNull(rs_det("description")) then
rs_det("description") = ""
end if
title = rs_det("description") '& vbcrlf
while len(title) > 0
if len(title)> sec_len then
section = left(title, instrrev(left(title, sec_len), " "))
oPDF.continue_text section
title = right(title,(len(title) - len(section)))
else
oPDF.continue_text title
title = ""
end if
wend
end if
rs_det.movenext
wend
rs_det.close
oPDF.continue_text rs("internal_id")
oPDF.setColor "both", "rgb", 0, 0, 1, 0
oPDF.set_parameter "underline", "true"
oPDF.continue_text "Click for more information!"
oPDF.set_parameter "underline", "false"
pos_x = oPDF.get_value("textx", 0)
pos_y = oPDF.get_value("texty", 0)
oPDF.continue_text vbcrlf
llx = pos_x - 75
lly = pos_y - 1
urx = llx + 80
ury = lly + 5
oPDF.set_border_style "solid", 0
url = "http://www.tappi.org/index.asp?pid="& rs("Product_ID") &"&ch=4"
oPDF.add_weblink llx, lly, urx, ury, url
oPDF.setColor "both", "rgb", 0, 0, 0, 0
rs.movenext
wend
rs.close
oPDF.end_page
oPDF.close
buf = oPDF.get_buffer()
Response.Expires = 0
Response.Buffer = true
Response.ContentType = "application/pdf"
Response.Addheader "Content-Disposition", "inline; filename=" & "hello2.vbs.asp.pdf"
Response.Addheader "Content-Length", LenB(buf)
Response.BinaryWrite(buf)
Response.End()
Set oPDF = nothing
sub drawpage()
'COLUMN SEPARATORS
oPDF.rect 120,160,1,648
oPDF.fill
oPDF.rect 240,160,1,648
oPDF.fill
oPDF.rect 360,160,1,648
oPDF.fill
oPDF.rect 479,160,1,648
oPDF.fill
'COLUMN HEADERS
drawbox 3, 790
drawbox 123, 790
drawbox 242, 790
drawbox 362, 790
drawbox 481, 790
end sub
sub draw_header_footer()
font = oPDF.findfont("Arial Black", "winansi", 0)
oPDF.setfont font, 10
oPDF.set_text_pos 25, 820
oPDF.show "TAPPI Conference/Symposium/Short Course/Virtual Seminar/Local Section/Committee Schedule"
font = oPDF.findfont("Arial", "winansi", 0)
oPDF.setfont font, 6
oPDF.set_text_pos 20, 110
oPDF.setColor "both", "rgb", 0, 0, 0, 0
oPDF.set_parameter "underline", "true"
oPDF.show " "
oPDF.set_parameter "underline", "false"
oPDF.continue_text ""
oPDF.continue_text "A - ABTCP - (Brazil). B- PAPTAC (formerly CPPA/TS) C- PITA (UK). CPD- Corrugated Packaging Division. D- I. I. P. (India). E- ATIP (France). F- OZEPA (Austria). G- SPCI (Sweden)."
oPDF.continue_text "H- ZELLCHEMING (Germany). I-NACE. J- Japan TAPPI. K- SPI (Finland). L-PIRA (UK). M- ACCCSA (Caribbean). N- IPE (Spain). O- ATCP-Chile. P- ATCP (Mexico). Q- CTAPI (China)."
oPDF.continue_text "R- European Federation of Corrosion. T- FICEPA (Latin Am). U- Atipca (Argentina). W- APPITA - (Australian and NZ). X- ATICELCA (Italy). Y- IAPMA (India). Z- TAPPI."
oPDF.continue_text "AA- USDA Forest Service, Forest Products Lab. BB- Korea TAPPI. CC-AICC. DD- Acotepac (Colombia)."
oPDF.set_parameter "underline", "true"
oPDF.continue_text " "
oPDF.set_parameter "underline", "false"
oPDF.continue_text ""
oPDF.continue_text "Earn 1,000 Sky Miles for flying Delta. Learn now today by visiting http://www.tappi.org/content/events/delta.htm."
oPDF.set_parameter "underline", "true"
oPDF.continue_text " "
oPDF.set_parameter "underline", "false"
oPDF.continue_text ""
oPDF.continue_text "TAPPI's toll-free Member Connection: 1-800-332-8686 (US), 1-800-446-9431 (Canada); or (770) 446-6947 (Fax); or (770) 446-1400 (Worldwide)"
oPDF.set_parameter "underline", "true"
oPDF.continue_text " "
oPDF.set_parameter "underline", "false"
oPDF.continue_text ""
oPDF.continue_text "For an up-to-date calendar or to register on-line, please re-visit http://www.tappi.org/content/pdf/events/autopdf.asp"
end sub
sub drawbox(pos_x, pos_y)
oPDF.setlinecap(0)
oPDF.setlinejoin(2)
oPDF.setmiterlimit(10)
oPDF.setlinewidth(2)
oPDF.rect pos_x,pos_y,115,18
oPDF.fill
oPDF.setcolor "both", "rgb", .8, .8, .8, 0
oPDF.moveto pos_x, pos_y+3
oPDF.lineto pos_x+112, pos_y+3
oPDF.moveto pos_x+112, pos_y+18
oPDF.lineto pos_x+112, pos_y+3
oPDF.stroke
oPDF.setcolor "both", "rgb", .6, .6, .6, 0
oPDF.moveto pos_x, pos_y+2
oPDF.lineto pos_x+113, pos_y+2
oPDF.moveto pos_x+113, pos_y+18
oPDF.lineto pos_x+113, pos_y+2
oPDF.stroke
oPDF.setcolor "both", "rgb", 0, 0, 0, 0
oPDF.initgraphics
end sub
sub underline(llx, lly)
oPDF.moveto llx, lly
oPDF.lineto llx+80, lly
oPDF.fill
end sub
function valuecheck(variable_name,default_value)
if 1=0 then
if variable_name = cstr(variable_name) then
if len(trim(session(variable_name))) > 0 then
valuecheck = session(variable_name)
elseif len(trim(request(variable_name))) > 0 then
valuecheck = request(variable_name)
else
valuecheck = default_value
end if
else
valuecheck = variable_name
end if
else 'testing
if variable_name = cstr(variable_name) then
if len(trim(request.form(variable_name))) > 0 then
valuecheck = request.form(variable_name)
else
if len(trim(request.querystring(variable_name))) > 0 then
valuecheck = request.querystring(variable_name)
else
if len(trim(session(variable_name))) > 0 then
valuecheck = session(variable_name)
else
valuecheck = default_value
end if
end if
end if
else
valuecheck = variable_name
end if
end if
end function
%>