<%@language=vbscript%>
<meta name="robots" content="noindex">
<%
Response.Buffer=True
If Session("ID")=0 then
Response.Redirect("http://www.grupo-mim.com")
Response.End
Else
Session.LCID=2058
%>
<!--#include file="fpdf.asp"-->
<!--#include file="fpdf/numeros.asp"-->
<%
Dim Cn1
Dim Rs12, Rs13
Dim Sql12, Sql13
Dim Empresa
Dim Ffacnum
Empresa = request("Empresa")
Ffacnum = request("ffacnum")
Set Cn1 = Server.CreateObject( "ADODB.Connection" )
Cn1.Open "DRIVER={SQL Server};SERVER=172.17.0.5;UID=ADMIMSIS;PWD=ST2108GP;Database=" & Empresa &""
'****** RECORDSET ENCABEZADOS *****
Set Rs12 = server.CreateObject("ADODB.Recordset")
Sql12="select * from ffacenc, clientes, monedas, vendedores, ffacdet, users " &_
"where numfface = "& ffacnum &" and clacli = clifface and cladiv = monfface " &_
"and vencli = cvevend and numfface = nfaffacd and usufface = clausr;"
Rs12.open Sql12,Cn1,1,2
'****** RECORDSET PARA PARTIDAS *****
Set Rs13 = server.CreateObject("ADODB.Recordset")
SQL13="select secffacd, codffacd, nominv, CANFFACD, udminv, uniffacd, obsffacd, monffacd, abrdiv, antffacd, yearp, ADUANAP, PEDIMENTOP " &_
"from Ffacdet, Inventarios, Monedas " &_
"where cveinv = CODFFACD and monffacd = ClaDiv and nfaffacd = "& ffacnum &" order by secffacd;"
Rs13.Open Sql13,Cn1,1,2
'******* DATOS PARA EL ARCHIVO MODELO (FFAC) *****
Clave = Rs12("Clifface")
Nombre = Rs12("Nomcli")
Calle = Rs12("calcli")
Numero = Rs12("numcli")
Interior = Rs12("numicli")
Colonia = Rs12("colcli")
Poblacion = Rs12("Pobcli")
Estado = Rs12("Edocli")
Cpostal = Rs12("Cpcli")
RFC = Rs12("rfccli")
Factura = Cstr(Rs12("numfface"))
Fecha = Cstr(Rs12("Fecfface"))
Vendedor = cstr(Rs12("vencli"))
Emarcar = Rs12("embfface")
Revision = rs12("revcli")
Fe100=rs12("desdiv")
Remision = Rs13("ANTFFACD")
Condiciones = Rs12("CONFFACE")
Referencia = Rs12("LABFFACE")
Subtotal = Formatnumber(Rs12("SUBfface"))
IVA = Formatnumber(Rs12("ivtfface"),2)
Total = Formatnumber(Rs12("Totfface"))
Anticipo = Formatnumber(Rs12("antifface"))
Neto = Total - Anticipo
Neto = Formatnumber(Neto,2)
EmbarcarA = Mid(Emarcar,1,40)
EmbarcarB = Mid(Emarcar,41,40)
EmbarcarC = Mid(Emarcar,81,40)
EmbarcarD = Mid(Emarcar,121,40)
EmbarcarF = Mid(Emarcar,161,40)
Set pdf=CreateJsObject("FPDF")
pdf.CreatePDF "P", "mm", "Letter"
pdf.SetPath("fpdf/")
pdf.SetFont "Arial","",7
PDF.OPEN()
pdf.LoadModels("Ffac")
pdf.SetLeftMargin(6.0)
pdf.AddPage()
pdf.SetFont "Arial","",7.5
pdf.SetFillColor 197,229,213
'******** BUCLE DE LAS PARTIDAS ******
Do while Not Rs13.EoF
Partida = Rs13("Secffacd")
Codigo = Rs13("codffacd")
Cantidad = Formatnumber(Rs13("CANFFACD"))
UDM = Rs13("UDMINV")
Descripcion = Rs13("Nominv")
Unitario = FormatNumber(Rs13("uniffacd"))
Importe =Cdbl(Cantidad) * Cdbl(Unitario)
Observaciones = Rs13("obsffacd")
Moneda = Rs13("monffacd")
Abrevia= Rs13("abrdiv")
YearP = Rs13("Yearp")
AduanaP = Rs13("AduanaP")
PedimentoP = Rs13("PedimentoP")
If Isnull(Yearp) Then
YearP = ""
Else
Yearp = Yearp
End If
If Isnull(AduanaP) Then
AduanaP = ""
Else
AduanaP = AduanaP
End If
If Isnull(PedimentoP) Then
PedimentoP = ""
Else
PedimentoP = PedimentoP
End If
If Moneda = 1 then
msg = Moneda
msg = " "
Else
msg = "U.S."
End if
pdf.Cell 3,4,"",0,0,"L",0
pdf.Cell 8,4,Partida,0,0,"L",0
pdf.Cell 20,4,Codigo,0,0,"L",0
pdf.Cell 13,4,Cantidad,0,0,"R",0
pdf.Cell 10,4,"",0,0,"L",0
pdf.Cell 11,4,UDM,0,0,"L",0
pdf.Cell 82,4,Descripcion,0,0,"L",0
pdf.Cell 22,4,"$" & Unitario,0,0,"R",0
pdf.Cell 13,4,msg,0,0,"L",0
pdf.Cell 20,4,"$" & Formatnumber(Importe),0,0,"R",0
if (Observaciones = "" or isnull(Observaciones))then
pdf.Ln(4)
pdf.Cell 190,4,"FECHA: " & YEARP & " ADUANA: " & AduanaP & " PEDIMENTO: " & PedimentoP,0,0,"L",0
pdf.Ln(4)
else
pdf.Ln(4)
pdf.Cell 68,4," ",0,0,"L",ColorFila
pdf.MultiCell 94,4,"",0,"J",Colorfila
pdf.Cell 190,4,"FECHA: " & YEARP & " ADUANA: " & AduanaP & " PEDIMENTO: " & PedimentoP,0,0,"L",0
pdf.Ln(4)
End If
Rs13.Movenext
Loop
pdf.Cell 170,4,"Subtotal:",0,0,"R",0
pdf.Cell 32,4,"$" & Subtotal,0,0,"R",0
pdf.Ln(4)
pdf.Cell 170,4,"Iva:",0,0,"R",0
pdf.Cell 32,4,"$" & IVA,0,0,"R",0
pdf.Ln(4)
pdf.Cell 170,4,"Total:",0,0,"R",0
pdf.Cell 32,4,"$" & Total,0,0,"R",0
pdf.Ln(10)
If Anticipo = 0 Then
Subanticipo = 0
IvaAnticipo =0
TotalAnticipo = 0
Else
Subanticipo = Cdbl(Anticipo) / 1.16
IvaAnticipo = (Cdbl(Anticipo) / 1.16 ) * .16
TotalAnticipo = Anticipo
End If
pdf.Cell 170,4,"Subtotal Anticipo:",0,0,"R",0
pdf.Cell 32,4,"$" & Formatnumber(Subanticipo),0,0,"R",0
pdf.Ln(4)
pdf.Cell 170,4,"Iva Anticipo:",0,0,"R",0
pdf.Cell 32,4,"$" & Formatnumber(IvaAnticipo),0,0,"R",0
pdf.Ln(4)
pdf.Cell 170,4,"Total Anticipo:",0,0,"R",0
pdf.Cell 32,4,"$" & TotalAnticipo,0,0,"R",0
pdf.Ln(10)
pdf.Cell 150,4,"***TODA DEVOLUCION CAUSARA UN 20% DE CARGO POR MANEJO DE MATERIAL***",0,0,"C",0
pdf.Ln(8)
pdf.Cell 170,4,"Neto a Pagar:",0,0,"R",0
pdf.Cell 32,4,"$" & neto,0,0,"R",0
pdf.Ln(4)
if Moneda = 1 then
nota = fd9
nota = " "
nota2 = " "
nota3 = " "
else
nota = "NOTA:EL VALOR DE ESTA FACTURA ES EN DOLARES AMERICANOS SI EL"
nota2 = "PAGO SE REALIZA EN MONEDA NACIONAL, SERA AL TIPO DE CAMBIO DEL"
nota3 = "MERCADO CAMBIARIO DEL DIA DE SU PAGO "
end if
pdf.Cell 150,4,nota,0,0,"C",0
pdf.Ln(4)
pdf.Cell 150,4,nota2,0,0,"C",0
pdf.Ln(4)
pdf.Cell 150,4,nota3,0,0,"C",0
pdf.output()
End If
%>