<%@language=vbscript%>
<%
Response.Buffer=True
If Session("ID")=0 then
Response.Redirect("http:// www.materialdelsureste.com.")
Response.End
Else
%>
<%Session.LCID=2058%>
<!--#include file="fpdf.asp"-->
<%
Dim Rs11, Sql11, Rs12, Sql12, Rs13, Sql13
Dim Vendedor, Empresa
Empresa = Request("Empresa")
Vendedor = Request("Vendedor")
FechaImp = date()
Set Cn1 = Server.CreateObject( "ADODB.Connection" )
Cn1.Open "DRIVER={SQL Server};SERVER=172.17.0.5;UID=ADMIMSIS;PWD=ST2108GP;Database=" & Empresa &""
Set Rs11 = Server.CreateObject("ADODB.Recordset")
Sql11="Select * From Empresa"
Rs11.Open Sql11,Cn1,1,2
B1 = Rs11("Nombre")
B2 = Rs11("Direccion")
B3 = Rs11("Colonia")
B4 = Rs11("Poblacion")
B5 = Rs11("Telefono")
B6 = Rs11("Fax")
B7 = Rs11("website")
If Vendedor = 0 Then
Set Rs12 = Server.CreateObject("ADODB.Recordset")
Sql12="Select Cvevend, Nomvend " &_
"From Vendedores;"
Rs12.Open Sql12,Cn1,1,2
Else
Set Rs12 = Server.CreateObject("ADODB.Recordset")
Sql12="Select Cvevend, Nomvend " &_
"From Vendedores where Cvevend = "& Vendedor &";"
Rs12.Open Sql12,Cn1,1,2
End If
Set pdf=CreateJsObject("FPDF")
pdf.CreatePDF "P", "mm", "Letter"
pdf.SetPath("fpdf/")
pdf.SetFont "Arial","",7
pdf.SetFillColor 216,216,216
pdf.Open()
pdf.LoadModels("Clidet")
pdf.ln(4)
Do While Not Rs12.Eof
Pdf.AddPage()
ClaveV = Rs12("Cvevend")
NombreV = Rs12("Nomvend")
Pdf.Cell 10,4,"( " & ClaveV & " ) ",0,0,"L",0
Pdf.Cell 40,4,NombreV,0,0,"L",0
Pdf.ln(4)
Pdf.Cell 210,4,"_______________________________________________________________________________________________________________________________________________",0,0,"L",0
pdf.ln(4)
Pdf.Cell 15,4,"Clave",0,0,"L",0
Pdf.Cell 45,4,"Nombre",0,0,"L",0
Pdf.Cell 45,4,"Direccion",0,0,"L",0
Pdf.Cell 35,4,"Poblacion",0,0,"L",0
Pdf.Cell 25,4,"Telefonos",0,0,"L",0
Pdf.Cell 35,4,"Contacto",0,0,"L",0
pdf.ln(1)
Pdf.Cell 210,4,"_______________________________________________________________________________________________________________________________________________",0,0,"L",0
Set Rs13 = Server.CreateObject("ADODB.Recordset")
Sql13="Select Clacli, Nomcli, Calcli, NumCli, Numicli, Colcli, Pobcli, Cpcli, Tcocli, Tpacli, Fcocli, RfcCli, Tcocli, Concli " &_
"From Clientes " &_
"Left Join Vendedores on Cvevend = vencli " &_
"Where Vencli = "& ClaveV &" " &_
"Order by Clacli;"
Rs13.Open Sql13,Cn1,1,2
Do While Not Rs13.Eof
pdf.ln(4)
ClaveC = Rs13("Clacli")
NombreC = Rs13("Nomcli")
DireccionC = Rs13("Calcli") & " " & Rs13("Numcli") & " " & Rs13("Numicli") & " " & Rs13("colcli")
PoblacionC = Rs13("Pobcli")
CodigoC = Rs13("Cpcli")
ContactoC = Rs13("Concli")
TelefonoA = Rs13("Tcocli")
TelefonoB = Rs13("Tpacli")
TelefonoF = Rs13("Fcocli")
RFC = Rs13("RFCcli")
NombreCa = Mid(NombreC,1,27)
NombreCb = Mid(NombreC,28,27)
NombreCd = Mid(NombreC,55,27)
DireCa = Mid(DireccionC,1,27)
DireCb = Mid(DireccionC,28,27)
DireCd = Mid(DireccionC,55,27)
PoblaCa = Mid(PoblacionC,1,20)
PoblaCb = Mid(PoblacionC,21,20)
Conta = Mid(ContactoC,1,20)
Contb = Mid(ContactoC,21,20)
Contd = Mid(ContactoC,41,20)
Pdf.Cell 15,4,ClaveC,0,0,"L",0
Pdf.Cell 45,4,NombreCa,0,0,"L",0
Pdf.Cell 45,4,DireCa,0,0,"L",0
Pdf.Cell 35,4,PoblaCa,0,0,"L",0
Pdf.Cell 25,4,TelefonoA,0,0,"L",0
Pdf.Cell 35,4,Conta,0,0,"L",0
pdf.ln(4)
Pdf.Cell 15,4,"",0,0,"L",0
Pdf.Cell 45,4,NombreCb,0,0,"L",0
Pdf.Cell 45,4,DireCb,0,0,"L",0
Pdf.Cell 35,4,PoblaCb,0,0,"L",0
Pdf.Cell 25,4,TelefonoB,0,0,"L",0
Pdf.Cell 35,4,Contb,0,0,"L",0
pdf.ln(4)
Pdf.Cell 15,4,"",0,0,"L",0
Pdf.Cell 45,4,NombreCd,0,0,"L",0
Pdf.Cell 45,4,DireCd,0,0,"L",0
Pdf.Cell 35,4,"C.P: " & CodigoC,0,0,"L",0
Pdf.Cell 25,4,"FAX: " & TelefonoF,0,0,"L",0
Pdf.Cell 35,4,RFC,0,0,"L",0
pdf.ln(4)
Rs13.Movenext
Loop
Rs12.Movenext
Loop
pdf.ln(4)
pdf.Output()
end if
%>
<%= Empresa %>