<%
Option Explicit
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
%>
<!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" />
<script LANGUAGE="JavaScript">
<!--
var cuenta=0;
function enviado() {
if (cuenta == 0)
{
cuenta++;
return true;
}
else
{
alert("El formulario ya esta siendo enviado, por favor aguarde un instante.");
return false;
}
}
// -->
</script>
<!--- PARA ABRIR LAS VENTANAS EMERGENTES --->
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
// End -->
</script>
</HEAD>
<BODY>
<%
'***** Variables a la base de datos ****
Dim Cn1
Dim Rs11, Rs12, Rs13, Rs14
Dim Sql11, Sql12, Sql13, Sql14
'***** 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") &""
'***** Conexion A la Tabla Empresa ****
Set Rs11 = Server.CreateObject("ADODB.Recordset")
Sql11="Select * from Empresa;"
Rs11.Open Sql11,Cn1,1,2
%>
<SECTION Class="HeaderGes">
<div Id="DivHeadGes">
<%= Rs11("Nombre") %><br>
<%= Rs11("Direccion") %>, <%= Rs11("colonia") %><br>
<%= Rs11("Poblacion") %>
</div>
</SECTION>
<SECTION>
<%
Dim Cotizacion, Almacen
Dim Tcambio, Importe, Cotizador
Dim PrecioLista, CampoLectura
Dim Codigo, Descripcion
Dim MyColor, TipoCliente
Dim DescuentoG
Dim ClienteDesc, ClienteDmsg
Dim DescuentoVal
DescuentoG = Request("DescuentoG")
If DescuentoG= "" or Isnull(DescuentoG) Then
DescuentoG = 0
Else
DescuentoG = DescuentoG
End If
Codigo = Request("Codigo")
Descripcion = Request("Descripcion")
Cotizacion = Request("Cotizacion")
Almacen = Request("Almacen")
Set Rs12 = Server.CreateObject("ADODB.Recordset")
Sql12 ="Select Numfcote, Clifcote, Nomcli, fecfcote, Desdiv, Iva, Retencion, Subfcote, Ivtfcote, Imrfcote, Totfcote, Tcaven as TcambioCot, Confcote, TipoCli, " &_
"Labfcote, Embfcote, Obsfcote, Atefcote, Confcote, Cotizador, Descli " &_
"From Fcotenc, Clientes, Monedas, EsquemaIva " &_
"Where Clifcote = Clacli and Numfcote = "& Cotizacion &" and Monfcote = Cladiv and Esqfcote = Regiva;"
Rs12.Open Sql12, Cn1
Tcambio = Rs12("Tcambiocot")
TipoCliente = Rs12("TipoCli")
ClienteDesc = Rs12("Descli")
If CInt(ClienteDesc) = 1 Then
ClienteDmsg = "Readonly"
Else
ClienteDmsg = ""
End If
%>
<BR>
<CENTER>
<b>***** CAPTURA DE COTIZACIONES *****</B>
<br><br>
<Table Class="Pedido">
<Tr>
<Td Colspan="3">Cliente:</Td>
<Td>Cotizacion:</Td>
<Td>Fecha:</Td>
</Tr>
<Tr>
<Td Colspan="3">
<a href="Fcotmcli.asp?Cotizacion=<%= Cotizacion %>&Almacen=<%= Almacen %>&Codigo=<%= Codigo %>&Descripcion=<%= Descripcion %>">
( <%= Rs12("Clifcote") %> ) <%= Rs12("Nomcli") %></a>
</Td>
<Td Align="Right">
<a href="Fcotesp.asp?Cotizacion=<%= Rs12("numfcote") %>" target="Fcotesp"
onClick="window.open(this.href, this.target, 'width=1000,height=500,scrollbars=yes,resizable=yes'); return false;">
<%= Rs12("Numfcote") %>
</Td>
<Td Align="Right"><%= Rs12("fecfcote") %></Td>
</Tr>
<Tr>
<Td>Moneda:</Td>
<Td Align="Right">Tipo De Cambio:</Td>
<Td Align="Right">Dias De Credito:</Td>
<Td Align="Right">Iva:</Td>
<Td Align="Right">Retencion:</Td>
</Tr>
<Tr>
<Td>
<a href="Fcotmmon.asp?Cotizacion=<%= Cotizacion %>&Almacen=<%= Almacen %>&Codigo=<%= Codigo %>&Descripcion=<%= Descripcion %>&Tcambio=<%= Tcambio %>">
<%= Rs12("Desdiv") %></a>
</Td>
<Td Align="Right"><%= Formatnumber(Rs12("TcambioCot")) %></Td>
<Td Align="Right"><%= Rs12("Confcote") %></Td>
<Td Align="Right"><%= Rs12("Iva") %> %</Td>
<Td Align="Right"><%= Rs12("Retencion") %> %</Td>
</Tr>
<Form action="FcotdescG.asp" method="post" name="FcotdescG" id="FcotdescG">
<Tr>
<Td Align="Right">
<a href="FcotConClicxc.asp?Clave=<%= Rs12("Clifcote") %>" target="FcotConClicxc"
onClick="window.open(this.href, this.target, 'width=1000,height=500,scrollbars=yes,resizable=yes'); return false;">
Credito Cliente</Td>
<Td></Td>
<Td Align="Right">Descuento Global:</Td>
<Td Align="Right">
<input type="Hidden" placeholder="Cotizacion" Title="Cotizacion" name="Cotizacion" id="Cotizacion" Size="7" Style="Text-Align:Right" value="<%= Cotizacion %>"> %
<input type="text" placeholder="Descuento Global" Title="Descuento Global" name="DescuentoG" id="DescuentoG" Size="4" Style="Text-Align:Right" value="<%= DescuentoG %>" <%= ClienteDmsg %>> %
</Td>
<Td Align="Right"><button tabindex="3" type="submit" name="Grabar" id="BuscarCli"/>Aplicar</button></Td>
</Tr>
</Table>
</Form>
<%
Set Rs13 = Server.CreateObject("ADODB.Recordset")
Sql13 ="Select Regfcotd, Almfcotd, Codfcotd, Desmul, UDMinv, Canfcotd, Prefcotd, SecFcotd, desfcotd, Unifcotd, Fpefcotd, marca, " &_
"(Exirmul -Capmul + Embdire -Rsem) as Disponible, Cprfcotd as Cpromedio, Tcafcotd, (Plainv * Tcaven) as Precio, Cpmul " &_
"From Fcotdet, Multialmacen, Inventarios, Monedas " &_
"where Ncofcotd = "& Cotizacion &" and ALmfcotd = Almmul and Codfcotd = Artmul and Codfcotd = Cveinv and Mplinv = cladiv " &_
"Order by Secfcotd, Regfcotd;"
Rs13.Open Sql13,Cn1,1,2
%>
<br>
<b><a href="Fcotpar.asp?Cotizacion=<%= Cotizacion %>&Almacen=<%= Almacen %>&Codigo=<%= Codigo %>&Descripcion=<%= Descripcion %>&Tcambio=<%= Tcambio %>"><Font color="Red">+ Agregar Partidas </font></a></b>
<br><br>
<Table Class="Pedido" Width="1024px">
<Tr>
<Td>Partida</td>
<Td>Codigo</td>
<Td>Descripcion</td>
<Td>Existencias</td>
<Td>Cantidad</td>
<Td>UDM</td>
<Td>Precio</td>
<Td>% Desc</td>
<Td>Unitario</td>
<Td></td>
<Td>Importe</td>
<Td>F. Entr</td>
<Td Colspan="3" Align="Center">Accion</td>
</Tr>
<%
If Rs13.EOF Then
Else
Do While Not Rs13.Eof
PrecioLista = Rs13("Precio")
If Cdbl(PrecioLista) = 0 then
PrecioLista = 0.0001
Else
PrecioLista = PrecioLista
End If
Importe = Cdbl(Rs13("Canfcotd")) * Cdbl(Rs13("Unifcotd"))
'If TipoCliente = "F" Then
'CampoLectura = ""
'Else If Cdbl(PrecioLista) = 0 Then
' CampoLectura = ""
'Else
' CampoLectura = "readonly"
'End If
'End If
If Cdbl(PrecioLista) = 0 or Cdbl(PrecioLista) = 0.0001 OR TipoCliente = "P" Then
MyColor = "FF1004"
CampoLectura = ""
Else If (1 - (Cdbl(Rs13("Unifcotd"))) / (Cdbl(PrecioLista) / Cdbl(Rs13("Tcafcotd")))) >.11 and Rs13("Marca") = "WORCESTER" Then
MyColor = "FF1004"
CampoLectura = "Readonly"
Else if (1 - (Cdbl(Rs13("Unifcotd"))) / (Cdbl(PrecioLista) / Cdbl(Rs13("Tcafcotd")))) >.21 and Rs13("Marca") = "" Then
MyColor = "FF1004"
CampoLectura = "Readonly"
Else
MyColor = "000000"
CampoLectura = "Readonly"
End If
End If
End If
If Rs13("Marca") = "TEROFOX" THEN
DescuentoVal = "Readonly"
Else
DescuentoVal = ""
End If
%>
<Tr onmouseover="this.className = 'resaltar'" onmouseout="this.className = null">
<Form action="Fcotmod.asp" method="post" name="Cotizaciones" id="PedidnoNuevo">
<Td valign="Top">
<input type="text" placeholder="Partida" Title="Partida" name="Partida" id="Partida" Size="1" Style="Text-Align:Right" value="<%= Rs13("secfcotd") %>">
</td>
<Td valign="Top">
<a href="Distribucion.asp?Codigo=<%= Rs13("Codfcotd") %>" onclick="NewWindow(this.href,'Distro','600','450','yes');return false;">
<%= Rs13("Codfcotd") %>
</td>
<Td valign="Top"><%= Rs13("Desmul") %></td>
<Td valign="Top" Align="Right"><%= Formatnumber(Rs13("Disponible")) %></td>
<Td valign="Top">
<input type="text" placeholder="Cantidad" Title="Cantidad" name="Cantidad" id="Cantidad" Size="3" Style="Text-Align:Right" value="<%= Rs13("Canfcotd") %>">
</td>
<Td valign="Top"><%= Rs13("UDMinv") %></td>
<Td valign="Top">
<input type="text" placeholder="Precio" Title="Precio" name="Precio" id="Precio" Size="7" <%= CampoLectura %> Style="Text-Align:Right" value="<%= Rs13("Prefcotd") %>">
</td>
<Td valign="Top">
<input type="text" placeholder="Descuento" Title="Descuento" name="Descuento" id="Descuento" Size="2" Style="Text-Align:Right" value="<%= Rs13("desfcotd") %>" <%= ClienteDmsg %>>
</td>
<Td Align="Right" valign="Top"><Font color="<%= MyColor %>"><%= Formatnumber(Rs13("Unifcotd")) %></td>
<Td Align="Right" valign="Top"> </td>
<Td Align="Right" valign="Top"><%= Formatnumber(Importe) %></td>
<Td valign="Top">
<input type="text" placeholder="Fecha Entrega" Title="Fecha Entrega" name="Fentrega" id="Fentrega" Size="2" Style="Text-Align:Right" value="<%= Rs13("Fpefcotd") %>">
</td>
<Td valign="Top">
<input type="hidden" placeholder="Codigo" Title="Codigo" name="Codigo" id="Codigo" Size="7" Style="Text-Align:Right" value="<%= Codigo %>">
<input type="hidden" placeholder="Descripcion" Title="Descripcion" name="Descripcion" id="Descripcion" Size="7" Style="Text-Align:Right" value="<%= Descripcion %>">
<input type="hidden" placeholder="Tcambio" Title="Tcambio" name="Tcambio" id="Tcambio" Size="7" Style="Text-Align:Right" value="<%= Tcambio %>">
<input type="hidden" placeholder="Cotizacion" Title="Cotizacion" name="Cotizacion" id="Cotizacion" Size="7" Style="Text-Align:Right" value="<%= Cotizacion %>">
<input type="hidden" placeholder="Almacen" Title="Almacen" name="Almacen" id="Almacen" Size="2" Style="Text-Align:Right" value="<%= Almacen %>">
<input type="hidden" placeholder="RegistroCot" Title="RegistroCot" name="RegistroCot" id="RegistroCot" Size="2" Style="Text-Align:Right" value="<%= Rs13("Regfcotd") %>">
<input type="image" src="Icon/Modifica.gif" value="Accesar" Title="Modificar">
</td>
</form>
<Td valign="Top">
<a href="Fcotdel.asp?Cotizacion=<%= Cotizacion %>&Almacen=<%= Almacen %>&RegFcot=<%= Rs13("Regfcotd") %>&Codigo=<%= Codigo %>&Descripcion=<%= Descripcion %>"&Tcambio=<%= Tcambio %>>
<img src="Icon/Elimina.gif" Border="0"></a>
</td>
<Td valign="Top">
<a href="Fcotobs.asp?Cotizacion=<%= Cotizacion %>&Almacen=<%= Almacen %>&RegFcot=<%= Rs13("Regfcotd") %>&Codigo=<%= Codigo %>&Descripcion=<%= Descripcion %>&Tcambio=<%= Tcambio %>"
onclick="NewWindow(this.href,'Fcotpnot','1024','500','yes');return false;">
<img src="icon/notasb.gif" border="0"></a>
</td>
</Tr>
<%
Rs13.Movenext
Loop
End If
%>
</Table>
<a name="Upartida"></a>
<br>
<b><a href="Fcotpar.asp?Cotizacion=<%= Cotizacion %>&Almacen=<%= Almacen %>&Codigo=<%= Codigo %>&Descripcion=<%= Descripcion %>&Tcambio=<%= Tcambio %>"><Font color="Red">+ Agregar Partidas </font></a></b>
<br><br>
<Table Class="Pedido" Width="1024px">
<Tr>
<Td Align="Right" Width="870px"> </td>
<Td Align="Right">Subtotal:</td>
<Td Align="Right"><%= Formatnumber(Rs12("subfcote")) %></td>
<Td Align="Right" Width="154px"> </td>
</Tr>
<Tr>
<Td Align="Right" Width="870px"> </td>
<Td Align="Right">I.V.A.:</td>
<Td Align="Right"><%= Formatnumber(Rs12("ivtfcote")) %></td>
<Td Align="Right" Width="154px"> </td>
</Tr>
<Tr>
<Td Align="Right" Width="870px"> </td>
<Td Align="Right">Retencion:</td>
<Td Align="Right"><%= Formatnumber(Rs12("Totfcote")) %></td>
<Td Align="Right" Width="154px"> </td>
</Tr>
<Tr>
<Td Align="Center"><b><A Href="Fcotemb.asp?Cotizacion=<%= cotizacion %>&Almacen=<%= Almacen %>&Codigo=<%= Codigo %>&Descripcion=<%= Descripcion %>"><FONT COLOR="Red">+ MODIFICAR DATOS DEL DOCUMENTO</FONT></a></td>
</Tr>
<Tr>
<Td Align="left">Referencia: <%= Rs12("Labfcote") %></td>
</Tr>
<Tr>
<Td Align="left">Embarcar: <%= Rs12("Embfcote") %></td>
</Tr>
<Tr>
<Td Align="left">Observaciones: <%= Rs12("Obsfcote") %></td>
</Tr>
<Tr>
<Td Align="left">Condiciones de Pago: <%= Rs12("confcote") %></td>
</Tr>
<%
Set Rs13 = Server.CreateObject("ADODB.Recordset")
Sql13 ="Select Cotizador From Fcotnew " &_
"Where Numfcotn = "& Cotizacion &";"
Rs13.Open Sql13, Cn1
If Rs13.Eof Then
Cotizador = Rs12("Cotizador")
Else
Cotizador = Rs13("Cotizador")
End If
%>
<Tr>
<Td Align="left">Cotizo: <%= Cotizador %></td>
<Td Align="Right"> </td>
</Tr>
</Table>
</SECTION>
<%
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
%>