<%@language=vbscript%>
<!--#include virtual="/mdb-database/inc_parole.asp"-->
<!--#include virtual="/mdb-database/inc_variabili.asp"-->
<!--#include virtual="ita/include/inc_db.asp"-->
<!--#include virtual="ita/include/inc_libreria.asp"-->
<!--#include virtual="ita/include/fpdf.asp"-->
<%
Set pdf=CreateJsObject("FPDF")
pdf.CreatePDF()
PDF.SetPath("/public/fpdf/")
pdf.Open()
pdf.AddPage()
Dim QSID, SQL, SQL1, SQL2, SQL3, SQL4, RS, RS1, RS2, RS3, RS4, PuntiScontoUsati, SpeseSpedizione, Totale, QSOrdinaPer, SQLTipologia, Valore RSTipologia,numfatt,domiciliofiscale,sedeoperativa,pivaesercente,codfisc,tel,fax,percentuale,scontoeuro
Dim ora, minuto, secondo, w_iva
QSID = Request.QueryString("ID")
SQL = " SELECT * FROM Ordini WHERE ID = " & QSID
Set RS = Conn.Execute(SQL)
If Not RS.EOF Then
dataordine = RS("Data")
ggordine = right(dataordine,2)
mmordine = mid(dataordine,5,2)
aaordine = left(dataordine,4)
dataordine = ggordine & "/" & mmordine & "/" & aaordine
uidcliente = RS("UserID")
pagamento = RS("Pagamento")
IDCliente = RS("ID")
PuntiScontoUsati = RS("PuntiScontoUsati")
SpeseSpedizione = RS("TotaleSpeseSpedizione")
totale = RS("Totale")
numfat=RS("fattura")
percentuale=RS("percentuale")
scontoeuro=("scontoeuro")
SQL1 = " SELECT * FROM Utenti WHERE UserID = " & uidcliente
set RS1 = Conn.execute(SQL1)
Importi = RS1("Importi")
Cognome = RS1("Cognome")
nomecliente = RS1("Nome") & " " & RS1("Cognome")
pdf.sety 1
pdf.setx 126
pdf.SetFont "Arial","",16
pdf.MultiCell 90,20,Importi, 0, 0 , "", 0
SQL2 = " SELECT * FROM Ringraziamento WHERE ID = 1 "
Set RS2 = Conn.execute(SQL2)
Pulsanti = RS2("pulsanti")
Contenuto = RS2("contenuto")
'regola il contenuto delle colonne centrali
pdf.SetFont "Arial","",13
pdf.sety 32
pdf.setx 25
pdf.MultiCell 160,5,dataordine,0,"J"
pdf.sety 47
pdf.setx 25
pdf.MultiCell 160,160,"",0,1
pdf.sety 47
pdf.setx 25
pdf.MultiCell 160,6,"Gentile Sig. " &Cognome,0,"J"
pdf.sety 52
pdf.setx 25
pdf.MultiCell 160,6,contenuto,0,"J"
pdf.sety 230
pdf.setx 80
pdf.MultiCell 27,6,"All'ordine di: ",0,"J"
pdf.sety 230
pdf.setx 107
pdf.MultiCell 100,6, nomecliente,0,"J"
pdf.sety 245
pdf.setx 80
pdf.MultiCell 70,6,"Cod. sconto Bronzo 5%: ",0,"J"
'---Recupero il codice sconto dal database e lo stampo a video
SQL3 = " SELECT TOP 1 * FROM promo_pdf WHERE categoria = 'bronzo' ORDER BY ID ASC"
Set RS3 = Conn.Execute (SQL3)
Valore = (RS3.Fields.Item("Valore").Value)
pdf.sety 245
pdf.setx 132
pdf.SetFont"Courier","B",14
pdf.MultiCell 110,6,valore,0,"J"
pdf.sety 275
pdf.setx 30
pdf.SetFont "Arial","",13
pdf.MultiCell 70,6,"Da incassare entro il:",0,"J"
pdf.sety 280
pdf.setx 35
pdf.SetFont"Arial","B",12
pdf.MultiCell 70,6,"30 Giugno 2010",0,"J"
response.Write ("Ok il codice è questo: " & Valore)
if Valore <> " " then
SQL4 = "DELETE FROM promo_pdf WHERE valore ="& Valore
Set RS4 = Conn.Execute (SQL4)
end if
pdf.Close()
pdf.Output Server.MapPath("/public/fpdf/fattura.pdf"), True
Conn.Close
Set Conn = Nothing
Response.Redirect "/public/fpdf/fattura.pdf"
end if
Conn.Close
Set Conn= Nothing
%>