<%@language=vbscript%>
<%
Session.LCID = 2058
'***** SI NO HA INICIADO SESION ***
If Session("Mybussiness") = "" then
Response.redirect("default.asp")
Else
Session.Timeout = 1200
'******* EN CASO DE ERROR ****
Err.Clear
On Error Resume Next
'*** REMPLAZA
Function Sanea(Texto)
Sanea = Replace(Texto, "'", "''")
End Function
%>
<!--#include file="fpdf.asp"-->
<!--#include file="fpdf/numeros.asp"-->
<%Session.LCID=2058%>
<%
'***** Variables a la base de datos ****
Dim Cn1
Dim Rs11, Rs12, Rs13, Rs14
Dim Sql11, Sql12, Sql13, Sql14
Dim Cotizacion
Dim Tcliente, E1, StatusD
Dim NombreE, DireccionE, ColoniaE, PoblacionE, TelefonoE, FaxE, WebsiteE
Dim ClaveC, NombreC, NumeroC, CalleC, NumeroCC, NumeroIC, FechaC, ColoniaC, PoblacionC, EstadoC, MonedaC, CodigoPC, RFCC, StatusC
Dim SubtotalC, IvaTC, IVARC, TotalC, ReferenciaC, CondicionesC, AtencionC
Cotizacion = Request("Cotizacion")
'***** 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 Rs12 = server.CreateObject("ADODB.Recordset")
Sql12="SELECT Clifcote FROM fcotenc where numfcote = "& Cotizacion &";"
Rs12.open Sql12,cn1,1,2
Tcliente = Rs12("Clifcote")
If Tcliente = "99999" then
Response.redirect("fcotespn.asp?Cotizacion="& Cotizacion &"")
Else
E1= Session("Mybussiness")
'******************** VARIABLES EMPRESA ***********
'***** Conexion A la Tabla Empresa ****
Set Rs11 = Server.CreateObject("ADODB.Recordset")
Sql11="Select * 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")
'***************** VARIABLES ENCABEZADO *******
Set Rs13 = server.CreateObject("ADODB.Recordset")
Sql13="SELECT numfcote, clifcote, Fecfcote, Fvafcote, Stafcote, monfcote, Totfcote, IVtFCOTE, SUBFCOTE, tcafcote, desdiv, " &_
"OBSFCOTE, EMBFCOTE, LABFCOTE, ATEFCOTE, usufcote, confcote, IMRFCOTE, clacli, nomcli," &_
"calcli, numcli, numicli, colcli, Pobcli, Edocli, Cpcli, RFCcli, Cladiv, desdiv, ABRDIV, Cvevend, Nomvend, cOTIZADOR, autfcote " &_
"FROM Fcotenc, clientes, Monedas, vendedores " &_
"where numfcote = "& Cotizacion &" and clacli = clifcote and monfcote = cladiv and cvevend = vencli;"
Rs13.Open Sql13,Cn1,1,2
ClaveC = Rs13("Clifcote")
NombreC = Rs13("Nomcli")
NumeroC = Cstr(Rs13("Numfcote"))
CalleC = Rs13("Calcli")
NumeroCC = Rs13("Numcli")
NumeroIC = Rs13("Numicli")
FechaC = Cstr(Rs13("Fecfcote"))
ColoniaC = Rs13("Colcli")
PoblacionC= Rs13("Pobcli")
EstadoC = Rs13("Edocli")
MonedaC = Rs13("Desdiv")
CodigoPC = Rs13("Cpcli")
RFCC = Rs13("RFCCli")
StatusC = Rs13("Stafcote")
COTIZADOR = Rs13("cOTIZADOR")
If StatusC ="A" then
StatusD = "ACTIVO"
Else if StatusC = "C" then
StatusD = "CANCELADO"
else if StatusC = "T" then
StatusD = "COMPLETO"
Else If StatusC = "P" then
StatusD = "PARCIAL"
End if
End if
End if
End if
SubtotalC = Formatnumber(Rs13("Subfcote"))
IvaTC = Formatnumber(Rs13("Ivtfcote"),2)
IVARC =Formatnumber(Rs13("Imrfcote"))
TotalC = Formatnumber(Rs13("Totfcote"))
ReferenciaC = Rs13("LABFCOTE")
CondicionesC = Rs13("conFCOTE")
AtencionC = Rs13("ATEFCOTE")
Autfcote = Rs13("Autfcote")
Fe14=Rs13("desdiv")
Fe15=Formatcurrency(Rs13("tcafcote"),4)
Fe15a=Formatnumber(Rs13("tcafcote"),4)
Fe16=Rs13("ABRdiv")
Fe21=Rs13("EMBFCOTE")
Fe22=Rs13("OBSFCOTE")
Fe26=Formatnumber(Rs13("MONFCOTE"))
'**************** COLORES POR 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
'************** CREACION DEL ARCHIVO PDF ***
Set pdf=CreateJsObject("FPDF")
pdf.CreatePDF "P", "mm", "Letter"
pdf.SetPath("fpdf/")
pdf.SetFont "Arial","",8
pdf.SetFillColor 216,216,216
Pdf.SetAutoPageBreak true,20
pdf.Open()
pdf.LoadModels("Fcot")
pdf.AddPage()
pdf.SetFont "Arial","",8
If Isnull(Autfcote) or Autfcote = "" then
pdf.Ln(8)
pdf.Cell 20,4,"UNA O MAS PARTIDAS NO CUMPLEN CON LA POLITICA DE VENTAS",0,0,"l",Colorfila
pdf.Ln(4)
Else
Set Rs14 = server.CreateObject("ADODB.Recordset")
Sql14="select ncofcotd, secfcotd, almfcotd, codfcotd, cpefcotd, canfcotd, fpefcotd, unifcotd, obsfcotd, cveinv, nominv, udminv, " &_
"pesoinv, claalm, desalm, abrdiv, ClaveProd, ClaveUnidad From fcotdet, inventarios, almacenes, monedas " &_
"where codfcotd = cveinv and claalm = almfcotd and ncofcotd = "& Cotizacion &" and monfcotd = cladiv order by secfcotd, REGFCOTD;"
Rs14.Open Sql14,Cn1,1,2
Do while Not Rs14.EOF
PartidaD = Cstr(Rs14("Secfcotd"))
CantidadD = Formatnumber(Rs14("Canfcotd"))
UDMD = Rs14("Udminv")
DescripcionD = Rs14("Nominv")
UnitarioD = Formatnumber(Rs14("Unifcotd"))
FechaED = Rs14("Fpefcotd")
ImporteD = Formatnumber(UnitarioD * CantidadD)
ObservacionD = Rs14("obsfcotd")
Peso = Cdbl(Rs14("Pesoinv")) * Cdbl(Rs14("canfcotd"))
Mone = Rs14("abrdiv")
CodigoSat = Rs14("ClaveProd")
UnidadSat = Rs14("ClaveUnidad")
LargoD = Len(DescripcionD)
If FechaED = 1 Then
Fen = "STOCK"
else iF FechaED = 0 then
Fen = "P/CONFIRMAR"
else
Fen = FechaED & " DIAS HAB"
End If
End If
pdf.Cell 10,4,PartidaD,0,0,"R",0
pdf.Cell 16,4,CantidadD,0,0,"R",0
pdf.Cell 9,4,UDMD,0,0,"L",0
pdf.Cell 104,4,Left(DescripcionD,59),0,0,"L",0
pdf.Cell 20,4,Fen,0,0,"R",0
pdf.Cell 20,4,UnitarioD,0,0,"R",0
pdf.Cell 20,4,ImporteD,0,0,"R",0
If LargoD > 60 then
pdf.Ln(4)
pdf.Cell 10,4,"",0,0,"R",0
pdf.Cell 16,4,"",0,0,"R",0
pdf.Cell 9,4,"",0,0,"R",0
pdf.Cell 104,4,Mid(DescripcionD,60,130),0,0,"L",0
pdf.Cell 20,4,"",0,0,"R",0
pdf.Cell 20,4,"",0,0,"R",0
pdf.Cell 20,4,"",0,0,"R",0
End If
If Isnull(ObservacionD) or ObservacionD = "" then
pdf.Ln(4)
pdf.Cell 10,4,"",0,0,"R",0
pdf.Cell 16,4,"",0,0,"R",0
pdf.Cell 9,4,"",0,0,"R",0
pdf.Cell 64,4,"PESO: " & Formatnumber(Peso) & " KILOS",0,0,"L",0
pdf.Cell 60,4,"CODIGO SAT: " & CODIGOSAT,0,0,"L",0
pdf.Cell 20,4,"",0,0,"R",0
pdf.Cell 20,4,"",0,0,"R",0
pdf.Ln(4)
Else
pdf.Ln(4)
pdf.Cell 10,4,"",0,0,"R",0
pdf.Cell 16,4,"",0,0,"R",0
pdf.Cell 9,4,"",0,0,"R",0
pdf.MultiCell 104,4,ObservacionD,0,"J",0
pdf.Cell 10,4,"",0,0,"R",0
pdf.Cell 16,4,"",0,0,"R",0
pdf.Cell 9,4,"",0,0,"R",0
pdf.Cell 104,4,"PESO: " & Formatnumber(Peso) & " KILOS",0,0,"L",0
pdf.Cell 20,4,"",0,0,"R",0
pdf.Cell 20,4,"",0,0,"R",0
pdf.Cell 20,4,"",0,0,"R",0
pdf.Ln(4)
End If
PESOT = Cdbl(PESOT) + Cdbl(PESO)
Rs14.Movenext
Loop
pdf.Cell 199,4,"______________________________________________________________________________________________________________________________",0,0,"C",0
pdf.Ln(4)
Call CONVERTIR(TotalC)
Fd19=Session("valor")
pdf.Cell 154,4,"***** PRECIOS SUJETOS A CAMBIOS SIN PREVIO AVISO *****",0,0,"C",0
pdf.Cell 25,4,"SUBTOTAL:",0,0,"L",0
pdf.Cell 20,4,SubtotalC,0,0,"R",0
pdf.Ln(4)
pdf.Cell 154,4,"PESO TOTAL: " & Formatnumber(PESOT) & " KILOS ",0,0,"L",0
pdf.Cell 25,4,"I.V.A.:",0,0,"L",0
pdf.Cell 20,4,IvaTC,0,0,"R",0
pdf.Ln(4)
pdf.Cell 154,4,"",0,0,"L",0
pdf.Cell 25,4,"I.V.A. RETENIDO:",0,0,"L",0
pdf.Cell 20,4,IVARC,0,0,"R",0
pdf.Ln(4)
pdf.Cell 154,4,Fd19,0,0,"L",0
pdf.Cell 25,4,"Total:",0,0,"L",0
pdf.Cell 20,4,TotalC,0,0,"R",0
pdf.Ln(2)
pdf.Cell 199,4,"______________________________________________________________________________________________________________________________",0,0,"C",0
pdf.Ln(4)
pdf.Cell 50,4,"REFERENCIA CLIENTE",0,0,"l",0
pdf.Cell 50,4,ReferenciaC,0,0,"l",0
pdf.Cell 50,4,"CONDICIONES DE PAGO:",0,0,"l",0
pdf.Cell 50,4,CondicionesC,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.MultiCell 195,4,"OBSERVACIONES: " & Fe22,0,"J",0
If Fe26 = 1 Then
msg = "LOS PRECIOS SON EN MONEDA NACIONAL."
Else iF fE26 = 2 THEN
msg = "LOS PRECIOS SON EN " & FE14 & " USD."
ELSE
msg = "LOS PRECIOS SON EN " & FE14 & ""
end If
END iF
pdf.MultiCell 195,4,msg,0,0,"l",0
Pdf.Cell 195,4,"EXISTENCIAS Y PRECIOS SUJETOS A CAMBIOS SIN PREVIO AVISO",0,0,"l",0
pdf.Ln(4)
Pdf.Cell 195,4,"SIN MAS POR EL MOMENTO Y EN ESPERA DE VERNOS FAVORECIDOS CON SU PEDIDO, NOS REITERAMOS A SUS ORDENES",0,0,"l",0
pdf.Ln(2)
pdf.Cell 199,4,"______________________________________________________________________________________________________________________________",0,0,"C",0
pdf.Ln(4)
Pdf.Cell 195,4,"CONSULTAR LA POLITICA DE RECLAMACION Y DEVOLUCION DE PRODUCTO EN LA PAGINA www.grupo-mim.com",0,0,"l",0
pdf.Ln(2)
pdf.Cell 199,4,"______________________________________________________________________________________________________________________________",0,0,"C",0
pdf.Ln(12)
Pdf.Cell 100,4,"ATENTAMENTE",0,0,"C",0
Pdf.Cell 100,4,"AUTORIZA",0,0,"C",0
pdf.Ln(10)
Pdf.Cell 100,4,"_____________________",0,0,"C",0
Pdf.Cell 100,4,"_____________________",0,0,"C",0
pdf.Ln(4)
Pdf.Cell 100,4,Cstr(Rs13("Cotizador")),0,0,"C",0
Pdf.Cell 100,4,"DIRECTOR DE VENTAS",0,0,"C",0
pdf.Ln(24)
End If
pdf.Output()
End If
%>
<!DOCTYPE html>
<HTML>
<HEAD>
<meta charset="ISO-8859-1" />
<TITLE>SISTEMA MIM <%= Session("Mybussiness") %> USUARIO: <%= Session("MyName") %></TITLE>
<link href="css/Modulos.css" rel="stylesheet" />
<link href="css/Buscador.css" rel="stylesheet" />
</HEAD>
<BODY>
<%
If Err.Number <> 0 Then
%>
<br><br>
Número de Error: <%= Err.Number %><BR>
Descripción: <%= Err.Description %><BR>
Origen: <%= Err.Source %><BR>
Linea: <%= Err.Line %><BR>
<br>
<%
Else
'****** FIN DE LOS ERRORES ***
End If
%>
</BODY>
</HTML>
<%
'FIN DE SESION
End If
%>