<%@language=vbscript%>
<%
Response.Buffer=True
If Session("ID")=0 then
Response.Redirect("http://www.grupo-mim.com")
Response.End
Else
%>
<!--#include file="fpdf/numeros.asp"-->
<%Session.LCID=2058%>
<!--#include file="fpdf.asp"-->
<%
Dim Cn1, Rs1, sql1
Dim Empresa, Fpednum, Stacot
Response.Buffer=True
Empresa = Session("Mybussiness")
Fpednum = request("Fpednum")
Set Cn1 = Server.CreateObject( "ADODB.Connection" )
Cn1.Open "DRIVER={SQL Server};SERVER=172.17.0.5;UID=ADMIMSIS;PWD=ST2108GP;Database=" & Empresa &""
set rs1 = server.CreateObject("ADODB.Recordset")
SQL1="Select * from empresa"
rs1.open sql1,cn1,1,2
Folio = Fpednum
Dim colorFila, Color
Dim Rs2, Sql2, rs3, sql3
set rs2 = server.CreateObject("ADODB.Recordset")
SQL2="SELECT numfpede, clifpede, Fecfpede, Fenfpede, Stafpede, monfpede, Totfpede, confpede, IVtFpedE, SUBFpedE, ATEFPEDE, IMRFPEDE, tcafpede, tpedido, " &_
"OBSFpedE, EMBFpedE, LABFpedE, OBSCOM, Certificado, Factura, Pedido, Anticipo, Inspeccion, Penalizado, Restricciones, Otros, FLETEXC, usufpede, Impalma, " &_
"Fecimp, Hrecibo, Consolidar, Recoge, Embarcar, Fmodfpede, FDVFPEDE, FDCFPEDE, Regalped, CLausr, nomusr, clacli, nomcli, Seguridad, Centrega, " &_
"calcli, NUMCLI, colcli, Pobcli, Edocli, Cpcli, RFCcli, diacli, Cladiv, desdiv, ABRDIV, nomvend, usocfdip, Cpfpede " &_
"FROM Fpedenc, clientes, Monedas, Users, Vendedores " &_
"where numfpede = "& Folio &" and clacli = clifpede and monfpede = cladiv and usufpede = clausr and Vencli = Cvevend;"
rs2.open sql2,cn1,1,2
set rs3 = server.CreateObject("ADODB.Recordset")
SQL3="select npefpedd, almfpedd, codfpedd, canfpedd, unifpedd, obsfpedd, secfpedd, tcafpedd, Fpefpedd, ucofpedd, cveinv, nominv, udminv, " &_
"pesoinv, claalm, desalm, DESMUL From fpeddet, inventarios, almacenes, MULTIALMACEN where codfpedd = cveinv and claalm = almfpedd " &_
"AND ARTMUL = CODFPEDD AND ALMMUL = ALMFPEDD and npefpedd = "& Folio &" order by secfpedd, REGFPEDD;"
rs3.open sql3,cn1,1,2
E1= Empresa
Nomdoc = Folio
B1=rs1("Nombre")
B2=rs1("Direccion")
B3=rs1("Colonia")
B4=rs1("Poblacion")
B5=rs1("Telefono")
B6=rs1("Fax")
B7=rs1("website")
Fe0=rs2("tpedido")
Fe1=rs2("Clifpede")
Fe2=rs2("Nomcli")
Fe3=rs2("calcli")
Fe3A=rs2("NUMcli")
Fe4=rs2("colcli")
Fe5=rs2("Pobcli")
iF FE5 = "" THEN
FE5 = ""
ELSE IF ISNULL(FE5) THEN
FE5=""
ELSE
FE5=FE5
END IF
END IF
Fe6=rs2("Edocli")
Fe7=rs2("Cpcli")
Fe8=rs2("rfccli")
Fe9=Cstr(rs2("numfpede"))
Fe10=Cstr(rs2("Fecfpede"))
Fe11=cSTR(rs2("Fenfpede"))
Fe12= Cstr(rs2("stafpede"))
if fe0 = 1 then
ftipo = "PARCIAL"
ELSE IF FE0 = 2 THEN
FTIPO = "PTDAS COMPLETAS"
ELSE IF FE0 = 0 THEN
FTIPO = "COMPLETO"
END IF
END IF
END IF
if fe12 ="A" then
fe13 = "Activo"
Else if fe12 = "C" then
fe13 = "Cancelado"
else if fe12 = "E" then
fe13 = "Entregado"
else if fe12 = "R" then
fe13 = "Apartado"
else if fe12 = "T" then
fe13 = "Completo"
else if fe12 = "P" then
fe13 = "Parcial"
End If
End If
End If
End if
End if
End if
Fe100=rs2("desdiv")
Fe14=rs2("desdiv")
Fe15=Formatcurrency(rs2("tcafpede"),4)
Fe16=rs2("ABRdiv")
Fe17=Formatnumber(rs2("Totfpede"))
Fe19=Formatnumber(rs2("ivtfpede"),2)
Fe18=Formatnumber(rs2("SUBfpede"))
Fe20=rs2("LABFpedE")
Fe21=rs2("EMBFpedE")
Fe22=rs2("OBSFpedE")
Fe23=rs2("confpede")
Fe24=rs2("Certificado")
Fe25=rs2("Factura")
Fe26=rs2("Pedido")
Fe27=rs2("anticipo")
FE28=rs2("Inspeccion")
Fe29=rs2("Penalizado")
Fe30=rs2("Restricciones")
Fe31=rs2("Otros")
Fe32=Formatnumber(rs2("IMRfpede"),2)
Fe40=rs2("ATEFPEDE")
Fe41=rs2("OBSCOM")
Fe42=rs2("FLETEXC")
Fe43 = Rs2("Consolidar")
Fe44 = Rs2("Recoge")
Fe45 = Rs2("Embarcar")
Fe46 = Cstr(Rs2("Fmodfpede"))
Hrecibo = Rs2("Hrecibo")
CodigoPostal = Rs2("Cpfpede")
FDVENTAS = Rs2("FDVFPEDE")
FDCREDITO = Rs2("FDCFPEDE")
Impalma = Rs2("Impalma")
Regalped = Rs2("Regalped")
seguridad = Rs2("Seguridad")
Centrega = Rs2("Centrega")
Vendedor = Rs2("Nomvend")
Usocfdi = Rs2("Usocfdip")
If Fe24 = 0 then
Certificado = "No"
Else
Certificado = "Si"
End If
If Fe25 = 0 then
Factura = "No"
Else
Factura = "Si"
End If
If Fe26 = 0 then
Pedido = "No"
Else
Pedido = "Si"
End If
If Fe27 = 0 then
Anticipo = "No"
Else
Anticipo = "Si"
End If
If Fe28 = 0 then
Inspeccion = "No"
Else
Inspeccion = "Si"
End If
If Fe29 = 0 then
Penalizado = "No"
Else
Penalizado = "Si"
End If
If Fe30 = 0 then
Restricciones = "No"
Else
Restricciones = "Si"
End If
If Fe31 = 0 then
Otros = "No"
Else
Otros = "Si"
End If
If Fe43 = 0 then
Consolidar = "No"
Else
Consolidar = "Si"
End If
If Fe44 = 0 then
Recoge = "No"
Else
Recoge = "Si"
End If
If Fe45 = 0 then
Embarcar = "No"
Else
Embarcar = "Si"
End If
If Seguridad = 0 then
Seguridad = "No"
Else
seguridad = "Si"
End If
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 = 1
Co2 = 33
Co3 = 254
END IF
END IF
Set pdf=CreateJsObject("FPDF")
pdf.CreatePDF "P", "mm", "Letter"
pdf.SetPath("fpdf/")
pdf.SetFont "Arial","",7
pdf.SetFillColor 216,216,216
pdf.setAutoPagebreak true, 18
pdf.Open()
pdf.LoadModels("Fped")
pdf.AddPage()
pdf.SetFont "Arial","",6
Do while Not(rs3.EOF)
Fd1=Formatnumber(rs3("canfpedd"))
Fd2=(rs3("DESMUL"))
Tcode = Fd2
Prod = len(fd2)
Inicia = 1
Termina = 70
Nom = Mid(Tcode,Inicia,Termina)
Fd2= Cstr(fd2)
fd3=Cstr(rs3("fpefpedd"))
fd4=FormatNumber(rs3("unifpedd"))
fd5=FormatNumber(Fd4 * Fd1)
Fd620=rs3("Almfpedd")
Fd6=rs3("codfpedd")
Fd7=rs3("obsfpedd")
Fd8=Formatnumber(rs3("secfpedd"),0)
Fd9=rs3("ucofpedd")
tcaped=rs3("tcafpedd")
Kilos = cdbl(rs3("pesoinv")) * cdbl(fd1)
Kilos = formatnumber(Kilos)
'fd10=Formatnumber((1-(cdbl(fd9)/(cdbl(fd4)*Cdbl(tcaped))))* 100)
If Cdbl(Fd4) = 0 Then
Fd10 = 0
ELSE
fd10= (1 - (Cdbl(Fd9) / Cdbl(Fd4))) * 100
End IF
fd10 = Formatnumber(fd10)
if colorfila = 0 then
color ="#d8d8d8"
colorfila = 1
else
color ="#c5e5d5"
colorfila = 0
end if
'pdf.Cell 12,4,Fd10 & " %",0,0,"R",Colorfila
pdf.Cell 12,4,Fd8,0,0,"R",Colorfila
pdf.Cell 13,4,Fd1,0,0,"R",Colorfila
pdf.Cell 27,4,Fd620 & " - " & Fd6,0,0,"L",Colorfila
pdf.Cell 106,4,Nom,0,0,"L",Colorfila
pdf.Cell 8,4,Fd3,0,0,"R",Colorfila
pdf.Cell 14,4,Fd4,0,0,"R",Colorfila
pdf.Cell 17,4,Fd5,0,0,"R",Colorfila
Inicia = Inicia + 70
Termina = Termina + 70
If PROD > Inicia then
Nom = Mid(Tcode,Inicia,Termina)
pdf.Ln(4)
pdf.Cell 8,4,"",0,0,"R",0
pdf.Cell 15,4,"",0,0,"R",0
pdf.Cell 6,4,"",0,0,"L",0
pdf.Cell 25,4,"",0,0,"L",0
pdf.Cell 70,4,NOM,0,0,"L",0
pdf.Cell 14,4,"" ,0,0,"L",0
pdf.Cell 10,4,"",0,0,"L",0
pdf.Cell 5,4,"",0,0,"L",0
pdf.Cell 17,4,"",0,0,"R",0
pdf.Cell 17,4,"",0,0,"R",0
pdf.Cell 10,4,"",0,0,"R",0
Else
Inicia =0
Termina = 0
End If
if isnull(fd7) then
pdf.Ln(4)
pdf.Cell 15,4,Kilos & " KILOS",0,0,"L",Colorfila
pdf.Ln(4)
else
pdf.Ln(4)
pdf.Cell 15,4,Kilos & " KILOS",0,0,"L",Colorfila
pdf.Ln(4)
pdf.Cell 66,4,"",0,0,"R",Colorfila
pdf.multiCell 81,4,fd7,0,"L",colorfila
End If
rs3.Movenext
KiloT = Cdbl(KiloT) + Cdbl(Kilos)
loop
pdf.Cell 176,4,"Subtotal:",0,0,"R",0
pdf.Cell 21,4,FE18,0,0,"R",0
pdf.Ln(4)
pdf.Cell 176,4,"Iva:",0,0,"R",0
pdf.Cell 21,4,FE19,0,0,"R",0
pdf.Ln(4)
pdf.Cell 176,4,"Iva Retenido:",0,0,"R",0
pdf.Cell 21,4,FE32,0,0,"R",0
pdf.Ln(4)
pdf.Cell 15,4,"Peso Total: " & Formatnumber(KiloT) & " KILOS",0,0,"L",0
pdf.Cell 161,4,"Total:",0,0,"R",0
pdf.Cell 21,4,Fe17,0,0,"R",0
pdf.Ln(4)
Call CONVERTIR(Fe17)
Fd19=Session("valor")
pdf.MultiCell 197,4,Fd19,0,"J",0
pdf.Ln(10)
pdf.Cell 50,4,"PEDIDO CLIENTE",0,0,"l",0
pdf.Cell 145,4,FE20,0,0,"l",0
pdf.Ln(4)
pdf.Cell 50,4,"EMBARCAR A:",0,0,"l",0
pdf.Multicell 145,4,FE21,0,0,"l",0
pdf.SetFont "Arial","B",7.5
pdf.Cell 50,4,"CONDICIONES DE PAGO",0,0,"l",0
pdf.Cell 145,4,FE23 ,0,0,"l",0
pdf.Ln(4)
pdf.Cell 50,4,"USO CFDI",0,0,"l",0
pdf.Cell 145,4,Usocfdi ,0,0,"l",0
pdf.Ln(4)
pdf.SetFont "Arial","",7.5
pdf.Cell 50,4,"ATENCION:",0,0,"l",0
pdf.Cell 145,4,FE40 ,0,0,"l",0
pdf.Ln(4)
pdf.MultiCell 195,4,"OBSERVACIONES CLIENTE: " & Fe22,0,"J",0
pdf.MultiCell 195,4,"OBSERVACIONES COMPRAS: " & Fe41,0,"J",0
pdf.Cell 195,4,"ELABORADO POR: " & rs2("nomusr"),0,0,"l",0
pdf.Ln(4)
pdf.Cell 195,2," ",0,0,"l",1
pdf.Ln(2)
pdf.SetFont "Arial","B",7
pdf.Cell 47,4,"CERTIFICADOS DE CALIDAD",0,0,"l",0
pdf.Cell 7,4,Certificado,0,0,"l",0
pdf.Cell 47,4,"REQUIERE INSPECCION",0,0,"l",0
pdf.Cell 7,4,Inspeccion,0,0,"l",0
pdf.Cell 47,4,"ENTREGAR CON FACTURA ORIGINAL",0,0,"l",0
pdf.Cell 7,4,Factura,0,0,"l",0
pdf.Ln(4)
pdf.Cell 47,4,"PEDIDO DEL CLIENTE PENALIZADO",0,0,"l",0
pdf.Cell 7,4,Penalizado,0,0,"l",0
pdf.Cell 47,4,"COPIA DEL PEDIDO DEL CLIENTE",0,0,"l",0
pdf.Cell 7,4,Pedido,0,0,"l",0
pdf.Cell 47,4,"SIN RESTRICCIONES",0,0,"l",0
pdf.Cell 7,4,Restricciones,0,0,"l",0
pdf.Ln(4)
pdf.Cell 47,4,"APLICAR ANTICIPO",0,0,"l",0
pdf.Cell 7,4,Anticipo,0,0,"l",0
pdf.Cell 47,4,"OTROS",0,0,"l",0
pdf.Cell 7,4,Otros,0,0,"l",0
pdf.Cell 47,4,"REQUISITOS DE SEGURIDAD",0,0,"l",0
pdf.Cell 7,4,SEGURIDAD,0,0,"l",0
pdf.Ln(4)
pdf.Cell 195,2," ",0,0,"l",1
pdf.Ln(2)
pdf.Cell 47,4,"CONSOLIDAR EMBARQUES",0,0,"l",0
pdf.Cell 7,4,Consolidar,0,0,"l",0
pdf.Cell 47,4,"RECOGE EL CLIENTE",0,0,"l",0
pdf.Cell 7,4,Recoge,0,0,"l",0
pdf.Cell 47,4,"EMBARCAR",0,0,"l",0
pdf.Cell 7,4,Embarcar,0,0,"l",0
pdf.Ln(4)
pdf.Cell 195,2," ",0,0,"l",1
pdf.Ln(2)
pdf.Cell 150,4,"HORARIO DE RECIBO : " & Hrecibo,0,0,"l",0
pdf.Ln(4)
pdf.Cell 150,4,"CONTACTO DE ENTREGA : " & Centrega,0,0,"l",0
pdf.Ln(4)
pdf.Cell 150,4,"CODIGO POSTAL DE ENTREGA : " & CodigoPostal,0,0,"l",0
pdf.Ln(4)
IF Cdbl(FE42) = 0 then
Fe55 = B1
Else
Fe55 = FE2
END iF
pdf.Cell 47,4,"FLETE PAGADO POR: " & FE55,0,0,"l",0
pdf.Ln(8)
pdf.SetFont "Arial","",7
If FDVENTAS = "" or Isnull(FDVENTAS) THEN
FDVENTAS = "NO AUTORIZADO"
Else
FDVENTAS = FDVENTAS
End If
If FDCREDITO = "" or Isnull(FDCREDITO) THEN
FDCREDITO = "NO AUTORIZADO"
Else
FDCREDITO = FDCREDITO
End If
Pdf.Cell 100,4,"AUTORIZACION VENTAS : " & FDVENTAS,0,0,"L",0
Pdf.Cell 95,4,"AUTORIZACION CREDITO : " & FDCREDITO,0,0,"L",0
pdf.Ln(4)
If Impalma = "" or Isnull(Impalma) THEN
Impalma = ""
Else
Impalma = Impalma
End If
If Regalped = "" or Isnull(Regalped) THEN
Regalped = ""
Else
Regalped = Regalped
End If
Pdf.Cell 100,4,"HORA IMPRESION ALMACEN : " & IMPALMA,0,0,"L",0
Pdf.Cell 95,4,"HORA RECIBO DEPTO. REMISIONES: " & REGALPED,0,0,"L",0
pdf.Ln(4)
pdf.Output ()
End If
%>