<%
Session.LCID = 2058
'***** SI NO HA INICIADO SESION ***
If Session("Mybussiness") = "" then
Response.redirect("default.asp")
Else
Session.Timeout = 1200
%>
<!--#include file="fpdf.asp"-->
<%
Dim Cn1
Dim Rs11, Rs12
Dim Sql11, Sql12
Dim OrdenC, FiltraA, FiltraB, FiltraC
Dim msa, msb
Dim Empresa, Fecha
Dim NombreE, DireccionE, ColoniaE, PoblacionE, TelefonoE, FaxE, WebsiteE
OrdenC = Request("OrdenC")
FiltroA = Request("FiltroA")
FiltroB = Request("FiltroB")
FiltroC = Request("FiltroC")
Empresa = Session("Mybussiness")
Fecha = Date()
Fecha = Cstr(Fecha)
If OrdenC = "" Or Isnull(OrdenC) then
OrdenC = "Nombre"
Else
OrdenC = OrdenC
End If
If FiltroA = " " or Isnull(FiltroA) then
FiltroA = ""
FiltroB = ""
FiltroC = ""
OrdenP = 0
Else
FiltroA = FiltroA
If FiltroC = "" Or Isnull(FiltroC) then
FiltroA = ""
FiltroB = ""
FiltroC = ""
OrdenP = 0
msa = ""
Else
If FiltroA = "RFC" Then
FiltroA = "rfcprv"
Else If FiltroA = "Clave" Then
FiltroA = "Cveprv"
Else If FiltroA = "Nombre" Then
FiltroA = "Nomprv"
Else If FiltroA = "Status" Then
FiltroA = "Staprv"
Else If FiltroA = "Limite" Then
FiltroA = "Limprv"
Else If FiltroA = "Dias" Then
FiltroA = "Diaprv"
End If
End If
End If
End If
End If
End If
If FiltroB = "Like" then
FiltroD = "'%" & UCase(Request("FiltroC")) & "%'"
Else
FiltroD = FiltroC
FiltroD = "'"&FiltroD&"'"
End If
Msa = " and " & FiltroA & " " & Filtrob & " " & FiltroD
End If
End If
If OrdenP = "" or Isnull(OrdenP) then
OrdenP = 0
Else
OrdenP = OrdenP
End If
If OrdenP = 0 Then
msb = " Asc"
OrdenP = OrdenP + 1
Else If OrdenP = 1 Then
msb = " DESC"
OrdenP = 0
End If
End If
'***** Conexion a la Base de Datos
Set Cn1 = Server.CreateObject( "ADODB.Connection" )
Cn1.Open "DRIVER={SQL Server};SERVER=172.17.0.5;UID="& Session("MyName") &";PWD="& Session("MyPass") &";Database="& Session("Mybussiness") &""
Set Rs11 = Server.CreateObject("ADODB.Recordset")
Sql11="Select Nombre, Direccion, Colonia, Poblacion, Telefono, Fax, Website from Empresa;"
Rs11.Open Sql11,Cn1,1,2
NombreE = Rs11("Nombre")
DireccionE = Rs11("Direccion")
ColoniaE = Rs11("Colonia")
PoblacionE = Rs11("Poblacion")
TelefonoE = Rs11("Telefono")
FaxE = Rs11("Fax")
WebsiteE = Rs11("Website")
Set Rs12 = server.CreateObject("ADODB.Recordset")
Sql12="Select Cveprv As Clave, Nomprv as Nombre, Staprv as Status, rfcprv AS RFC, Limprv as Limite, Diaprv as Dias " &_
"From proveedores, status " &_
"Where staprv = Clasta "& msa &" " &_
"Order By " & OrdenC & " "& msb &";"
Rs12.Open Sql12,Cn1,1,2
Set pdf=CreateJsObject("FPDF")
pdf.CreatePDF "P", "mm", "Letter"
pdf.SetPath("fpdf/")
pdf.SetFillColor 13,16,121
pdf.Open()
pdf.LoadModels("Proveedores")
pdf.SetLeftMargin(8.0)
pdf.AddPage()
pdf.SetFont "Arial","",8
pdf.Setautopagebreak true,20
Do While Not Rs12.Eof
Clave = Rs12("Clave")
Nombre = Rs12("Nombre")
Status = Rs12("Status")
RFC = Rs12("RFC")
Limite = Rs12("Limite")
Dias = Rs12("Dias")
pdf.Cell 20,4, Clave,0,0,"L",0
pdf.Cell 120,4, Nombre,0,0,"L",0
pdf.Cell 5,4, Status,0,0,"C",0
pdf.Cell 20,4, RFC,0,0,"L",0
pdf.Cell 25,4, Formatnumber(Limite),0,0,"R",0
pdf.Cell 10,4, Cstr(Dias),0,0,"R",0
pdf.Ln(4)
Rs12.Movenext
Loop
pdf.Output ()
%>
<%
'FIN DE SESION
End If
%>