"
if REQUEST("type")="excel" then
response.Write "" & PrepareForExcel("N_Buono") & " | "
response.Write "" & PrepareForExcel("titolo") & " | "
response.Write "" & PrepareForExcel("cognome_nome") & " | "
response.Write "" & PrepareForExcel("importo") & " | "
response.Write "" & PrepareForExcel("durata_num") & " | "
response.Write "" & PrepareForExcel("durata_let") & " | "
response.Write "" & PrepareForExcel("titolare") & " | "
response.Write "" & PrepareForExcel("scade") & " | "
response.Write "" & PrepareForExcel("data_emissione") & " | "
response.Write "" & PrepareForExcel("chiuso") & " | "
else
response.Write "N_Buono | "
response.Write "titolo | "
response.Write "cognome_nome | "
response.Write "importo | "
response.Write "durata_num | "
response.Write "durata_let | "
response.Write "titolare | "
response.Write "scade | "
response.Write "data_emissione | "
response.Write "chiuso | "
end if
response.Write "
"
set totals = CreateObject("Scripting.Dictionary")
'// write data rows
iNumberOfRows = 0
while (nPageSize=0 or iNumberOfRows"
response.Write ""
fformat=""
response.Write my_htmlspecialchars(GetData(rs,"N_Buono",fformat))
response.Write " | "
if REQUEST("type")="excel" then
response.Write ""
else
response.Write " | "
end if
if len(rs("titolo"))>0 then
strdata = make_db_value("titolo",rs("titolo"),"","")
LookupSQL="SELECT "
LookupSQL=LookupSQL & "[titolo]"
LookupSQL=LookupSQL & " FROM [titolo] WHERE [titolo] = " & strdata
LogInfo(LookupSQL)
rss.Open LookupSQL,dbConnection
lookupvalue=rs("titolo")
if not rss.eof then _
lookupvalue=rss(0)
strValue=GetDataInt(lookupvalue,rs,"titolo", "")
rss.Close
if REQUEST("type")="excel" then
response.Write PrepareForExcel(strValue)
else
response.Write my_htmlspecialchars(strValue)
end if
end if
response.Write " | "
if REQUEST("type")="excel" then
response.Write ""
else
response.Write " | "
end if
fformat=""
if REQUEST("type")="excel" then
response.Write PrepareForExcel(GetData(rs,"cognome_nome",fformat))
else
response.Write my_htmlspecialchars(GetData(rs,"cognome_nome",fformat))
end if
response.Write " | "
response.Write ""
fformat="Number"
response.Write my_htmlspecialchars(GetData(rs,"importo",fformat))
response.Write " | "
response.Write ""
fformat=""
response.Write my_htmlspecialchars(GetData(rs,"durata_num",fformat))
response.Write " | "
if REQUEST("type")="excel" then
response.Write ""
else
response.Write " | "
end if
fformat=""
if REQUEST("type")="excel" then
response.Write PrepareForExcel(GetData(rs,"durata_let",fformat))
else
response.Write my_htmlspecialchars(GetData(rs,"durata_let",fformat))
end if
response.Write " | "
if REQUEST("type")="excel" then
response.Write ""
else
response.Write " | "
end if
if len(rs("titolare"))>0 then
strdata = make_db_value("titolare",rs("titolare"),"","")
LookupSQL="SELECT "
LookupSQL=LookupSQL & "[titolare]"
LookupSQL=LookupSQL & " FROM [titolare] WHERE [titolare] = " & strdata
LogInfo(LookupSQL)
rss.Open LookupSQL,dbConnection
lookupvalue=rs("titolare")
if not rss.eof then _
lookupvalue=rss(0)
strValue=GetDataInt(lookupvalue,rs,"titolare", "")
rss.Close
if REQUEST("type")="excel" then
response.Write PrepareForExcel(strValue)
else
response.Write my_htmlspecialchars(strValue)
end if
end if
response.Write " | "
response.Write ""
fformat="Short Date"
if REQUEST("type")="excel" then
response.Write PrepareForExcel(GetData(rs,"scade",fformat))
else
response.Write my_htmlspecialchars(GetData(rs,"scade",fformat))
end if
response.Write " | "
response.Write ""
fformat="Short Date"
if REQUEST("type")="excel" then
response.Write PrepareForExcel(GetData(rs,"data_emissione",fformat))
else
response.Write my_htmlspecialchars(GetData(rs,"data_emissione",fformat))
end if
response.Write " | "
response.Write ""
fformat=FORMAT_NONE
response.Write my_htmlspecialchars(GetData(rs,"chiuso",fformat))
response.Write " | "
response.Write ""
iNumberOfRows=iNumberOfRows+1
rs.MoveNext
wend
end sub
function XMLNameEncode(strValue)
dim arr(18)
arr(0)=" "
arr(1)="#"
arr(2)="'"
arr(3)="/"
arr(4)="\\"
arr(5)="("
arr(6)=")"
arr(7)=","
arr(8)="["
arr(9)="]"
arr(10)="+"
arr(11)="\"""
arr(12)="-"
arr(13)="_"
arr(14)="|"
arr(15)="}"
arr(16)="{"
arr(17)="="
dim strTemp
strTemp=strValue
for i=0 to ubound(arr)
strTemp=replace(strTemp,arr(i),"")
next
XMLNameEncode = strTemp
end function
function PrepareForExcel(str)
ret = my_htmlspecialchars(str)
if mid(ret,1,1)= "=" then ret = "=" & mid(ret,2)
PrepareForExcel = ret
end function
%>
<%
sub ExportToPDF
Dim pdf
Set pdf=CreateJsObject("FPDF")
pdf.CreatePDF()
pdf.SetPath("libs/fpdf/")
pdf.SetFont "Courier","",8
pdf.Open()
pdf.LoadModels("include/buono_models.asp")
pdf.AddPage()
' write data rows
iNumberOfRows = 0
while (nPageSize=0 or iNumberOfRowspdf.maxheight then
pdf.maxheight=pdf.GetY()-pdf.y0
end if
pdf.SetY(pdf.y0)
pdf.SetX(x)
if len(rs("titolo"))>0 then
strdata = make_db_value("titolo",rs("titolo"),"","")
LookupSQL="SELECT "
LookupSQL=LookupSQL & "[titolo]"
LookupSQL=LookupSQL & " FROM [titolo] WHERE [titolo] = " & strdata
LogInfo(LookupSQL)
rss.Open LookupSQL,dbConnection
lookupvalue=rs("titolo")
if not rss.eof then _
lookupvalue=rss(0)
pdf.Cell pdf.GetColWidth("titolo"),pdf.rowheight,GetDataInt(lookupvalue,rs,"titolo", "")
rss.Close
end if
x=x+pdf.GetColWidth("titolo")
if pdf.GetY()-pdf.y0>pdf.maxheight then
pdf.maxheight=pdf.GetY()-pdf.y0
end if
pdf.SetY(pdf.y0)
pdf.SetX(x)
pdf.MultiCell pdf.GetColWidth("cognome_nome"),pdf.rowheight,GetData(rs,"cognome_nome","")
x=x+pdf.GetColWidth("cognome_nome")
if pdf.GetY()-pdf.y0>pdf.maxheight then
pdf.maxheight=pdf.GetY()-pdf.y0
end if
pdf.SetY(pdf.y0)
pdf.SetX(x)
pdf.MultiCell pdf.GetColWidth("importo"),pdf.rowheight,GetData(rs,"importo","Number")
x=x+pdf.GetColWidth("importo")
if pdf.GetY()-pdf.y0>pdf.maxheight then
pdf.maxheight=pdf.GetY()-pdf.y0
end if
pdf.SetY(pdf.y0)
pdf.SetX(x)
pdf.MultiCell pdf.GetColWidth("durata_num"),pdf.rowheight,GetData(rs,"durata_num","")
x=x+pdf.GetColWidth("durata_num")
if pdf.GetY()-pdf.y0>pdf.maxheight then
pdf.maxheight=pdf.GetY()-pdf.y0
end if
pdf.SetY(pdf.y0)
pdf.SetX(x)
pdf.MultiCell pdf.GetColWidth("durata_let"),pdf.rowheight,GetData(rs,"durata_let","")
x=x+pdf.GetColWidth("durata_let")
if pdf.GetY()-pdf.y0>pdf.maxheight then
pdf.maxheight=pdf.GetY()-pdf.y0
end if
pdf.SetY(pdf.y0)
pdf.SetX(x)
if len(rs("titolare"))>0 then
strdata = make_db_value("titolare",rs("titolare"),"","")
LookupSQL="SELECT "
LookupSQL=LookupSQL & "[titolare]"
LookupSQL=LookupSQL & " FROM [titolare] WHERE [titolare] = " & strdata
LogInfo(LookupSQL)
rss.Open LookupSQL,dbConnection
lookupvalue=rs("titolare")
if not rss.eof then _
lookupvalue=rss(0)
pdf.Cell pdf.GetColWidth("titolare"),pdf.rowheight,GetDataInt(lookupvalue,rs,"titolare", "")
rss.Close
end if
x=x+pdf.GetColWidth("titolare")
if pdf.GetY()-pdf.y0>pdf.maxheight then
pdf.maxheight=pdf.GetY()-pdf.y0
end if
pdf.SetY(pdf.y0)
pdf.SetX(x)
pdf.MultiCell pdf.GetColWidth("scade"),pdf.rowheight,GetData(rs,"scade","Short Date")
x=x+pdf.GetColWidth("scade")
if pdf.GetY()-pdf.y0>pdf.maxheight then
pdf.maxheight=pdf.GetY()-pdf.y0
end if
pdf.SetY(pdf.y0)
pdf.SetX(x)
pdf.MultiCell pdf.GetColWidth("data_emissione"),pdf.rowheight,GetData(rs,"data_emissione","Short Date")
x=x+pdf.GetColWidth("data_emissione")
if pdf.GetY()-pdf.y0>pdf.maxheight then
pdf.maxheight=pdf.GetY()-pdf.y0
end if
pdf.SetY(pdf.y0)
pdf.SetX(x)
pdf.MultiCell pdf.GetColWidth("chiuso"),pdf.rowheight,GetData(rs,"chiuso","Checkbox")
x=x+pdf.GetColWidth("chiuso")
if pdf.GetY()-pdf.y0>pdf.maxheight then
pdf.maxheight=pdf.GetY()-pdf.y0
end if
' draw lines
x=pdf.leftmargin
pdf.Rect x,pdf.y0,pdf.GetColWidth("N_Buono"),pdf.maxheight
x=x+pdf.GetColWidth("N_Buono")
pdf.Rect x,pdf.y0,pdf.GetColWidth("titolo"),pdf.maxheight
x=x+pdf.GetColWidth("titolo")
pdf.Rect x,pdf.y0,pdf.GetColWidth("cognome_nome"),pdf.maxheight
x=x+pdf.GetColWidth("cognome_nome")
pdf.Rect x,pdf.y0,pdf.GetColWidth("importo"),pdf.maxheight
x=x+pdf.GetColWidth("importo")
pdf.Rect x,pdf.y0,pdf.GetColWidth("durata_num"),pdf.maxheight
x=x+pdf.GetColWidth("durata_num")
pdf.Rect x,pdf.y0,pdf.GetColWidth("durata_let"),pdf.maxheight
x=x+pdf.GetColWidth("durata_let")
pdf.Rect x,pdf.y0,pdf.GetColWidth("titolare"),pdf.maxheight
x=x+pdf.GetColWidth("titolare")
pdf.Rect x,pdf.y0,pdf.GetColWidth("scade"),pdf.maxheight
x=x+pdf.GetColWidth("scade")
pdf.Rect x,pdf.y0,pdf.GetColWidth("data_emissione"),pdf.maxheight
x=x+pdf.GetColWidth("data_emissione")
pdf.Rect x,pdf.y0,pdf.GetColWidth("chiuso"),pdf.maxheight
x=x+pdf.GetColWidth("chiuso")
pdf.y0 = pdf.y0+pdf.maxheight
iNumberOfRows=iNumberOfRows+1
rs.MoveNext
wend
Response.ContentType = "application/pdf"
Response.AddHeader "Content-Disposition", "attachment;Filename=buono.pdf"
pdf.Close()
response.write pdf.buffer
end sub
sub OutputImage(img)
response.binarywrite img
end sub
%>