<%@language=vbscript%>
<%
Session.LCID = 2058
%>
<!--#include file="fpdf.asp"-->
<%
Dim Cn1
Dim Rs11, Sql11, Rs12, Sql12
Dim Almacen, Empresa
Dim Mitabla
Dim AlmacenB, Codigo, Descripcion, Existencia, UDM, Ucosto
Dim Subtotal
Dim Nombre, Dire, Colonia, Poblacion
Almacen = Request("Almacen")
Empresa = Cstr(Request.querystring("Empresa"))
E1 = Empresa
If E1 = "Toluca" or E1 = "Guadalajara" then
Co1 = 251
Co2 = 85
Co3 = 20
Else if E1 = "Bajio" THEN
Co1 = 215
Co2 = 1
Co3 = 21
else
Co1 = 25
Co2 = 4
Co3 = 180
END IF
END IF
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
Nombre = Rs11("Nombre")
Dire = Rs11("Direccion")
Colonia = Rs11("Colonia")
Poblacion = Rs11("Poblacion")
'Para recorrer el vector
Sql12="Select Desalm, Artmul, Desmul, Exirmul, Udminv, ucomul, (exirmul * Ucomul) as Importe " &_
"from Multialmacen, Inventarios, Almacenes where Almmul = "& Almacen &" and Almmul = ClaAlm and Artmul = Cveinv " &_
" order by Artmul asc;"
Set Rs12 = Cn1.Execute(Sql12)
MiTabla = Rs12.GetRows
'Liberamos los objetos ya!!
Rs12.Close
Set Rs12 = Nothing
Cn1.Close
Set Cn1 = Nothing
Set pdf=CreateJsObject("FPDF")
pdf.CreatePDF "P", "mm", "Letter"
pdf.SetPath("fpdf/")
pdf.SetFont "Arial","",9
pdf.SetFillColor 216,216,216
Pdf.SetAutoPageBreak true,20
pdf.Open()
pdf.LoadModels("Exis")
pdf.AddPage()
pdf.SetFont "Arial","",7
AlmacenB = 0
Codigo = 1
Descripcion = 2
Existencia = 3
UDM = 4
Ucosto = 5
Importe = 6
Subtotal = 0
for I = 0 to UBound(miTabla,2)
Response.Buffer = True
pdf.Cell 25,4,MiTabla(AlmacenB, I),0,0,"L",0
pdf.Cell 30,4,MiTabla(Codigo, I),0,0,"L",0
pdf.Cell 90,4,MiTabla(Descripcion, I),0,0,"L",0
pdf.Cell 15,4," ",0,0,"R",0
pdf.Cell 4,4," ",0,0,"L",0
pdf.Cell 15,4,"___________",0,0,"R",0
pdf.Cell 3,4," ",0,0,"L",0
pdf.Cell 15,4,"___________",0,0,"R",0
pdf.Ln(4)
Subtotal = Cdbl(Subtotal) + Cdbl(Mitabla(Importe,I))
Next
pdf.Output()
%>