<%
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/Pedidos.css" rel="stylesheet" />
<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, Rs15, Rs16, Rs17
Dim Sql11, Sql12, Sql13, Sql14, Sql15, Sql16, Sql17
'***** 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
Dim Pedido, Tpedido, Status, RequiC
Dim Pendiente, FechaProm, FechaHoy, DiasVencidos
Dim ColorFila
Dim TipoProducto, Emdire
Pedido = Request("Pedido")
FechaHoy = date()
%>
<SECTION Class="HeaderGes">
<div Id="DivHeadGes">
<%= Rs11("Nombre") %><br>
<%= Rs11("Direccion") %>, <%= Rs11("colonia") %><br>
<%= Rs11("Poblacion") %>
</div>
</SECTION>
<SECTION>
<!---menu --->
<br><br>
</SECTION>
<Center>
<Form action="ConsultaPed.asp" method="Post" name="ConsultaPed" id="AgregaGC">
<Table Class="Tableneg" Align="center">
<Tr>
<Td><input Tabindex="1" Type="Text" Placeholder="Pedido" Title="Pedido" name="Pedido" Size="5px" Id="Pedido" Value="<%= Pedido %>" Style="Text-align:Right"></Td>
<Td><input type="Submit" Value="Buscar"></Td>
</Tr>
</Table>
</Form>
<%
If Pedido = "" Or Isnull(Pedido) Then
Else
'***** Conexion A la Tabla Pedidos Encabezado ****
Set Rs12 = Server.CreateObject("ADODB.Recordset")
Sql12="Select Numfpede As Pedido, CliFpede as Clave, Nomcli as Nombre, Fecfpede as Fecha, Labfpede as PedidoC, " &_
"Confpede as Condiciones, Desdiv as Moneda, Tpedido, Stafpede as Status, Fdvfpede, Fdcfpede, Notasaut, " &_
"Nomvend as Vendedor, Usufpede as UsuarioC, UsoCFDIP, Embfpede, Obsfpede, Obscom, Tipoprod, Embarcar, ReqcFpede, EdirFpede " &_
"From Fpedenc " &_
"left join Clientes on Clacli = CliFpede " &_
"left join Monedas on Cladiv = Monfpede " &_
"Left join Vendedores on Vencli = Cvevend " &_
"Where Numfpede = "& Pedido &";"
Rs12.Open Sql12,Cn1,1,2
If Rs12.Eof Then
Else
'***** TIPO DE PEDIDOS *****
If Rs12("Tpedido") = 0 Then
Tpedido = "Pedido Completo"
Else If Rs12("Tpedido") = 1 Then
Tpedido = "Pedido Parcial"
Else If Rs12("Tpedido") = 2 Then
Tpedido = "Partidas Completas"
End If
End If
End If
'***** STATUS DE PEDIDO ******
If Rs12("Status") = "A" Then
Status = "Activo"
Else If Rs12("Status") = "R" Then
Status = "Apartado Sin Remision"
Else If Rs12("Status") = "P" Then
Status = "Surtido Parcialmente"
Else If Rs12("Status") = "T" Then
Status = "Pedido Terminado"
Else If Rs12("Status") = "C" Then
Status = "Pedido Cancelado"
End If
End If
End If
End If
End If
'****** TIPO DE PRODUCTO ******
If Rs12("Tipoprod") = 0 Then
TipoProducto = "TUBERIA"
Else If Rs12("Tipoprod") = 1 Then
TipoProducto = "CONEXIONES"
Else If Rs12("Tipoprod") = 2 Then
TipoProducto = "RECUBRIMIENTOS"
End If
End If
End If
If Rs12("ReqcFpede") = true then
RequiC = "Si"
Else
RequiC= "No"
End If
If Rs12("EdirFpede") = true then
Emdire = "Si"
Else
Emdire= "No"
End If
%>
<br>
<Table Align="center">
<Tr Id="Encabezado">
<Td>Pedido</Td>
<Td Align="Left" Colspan="3">Cliente</Td>
<Td>Fecha</Td>
<Td>Pedido Cliente</Td>
</Tr>
<Tr>
<Td Align="Right"><b><font color="#D16363"><%= Rs12("Pedido") %></b></font></Td>
<Td Align="Left" Colspan="3">( <%= Rs12("Clave") %> ) <%= Rs12("Nombre") %> </Td>
<Td Align="Left"><%= Rs12("Fecha") %></Td>
<Td Align="Left"><%= Rs12("PedidoC") %></Td>
</Tr>
<Tr Id="Encabezado">
<Td>Plazo</Td>
<Td>Moneda</Td>
<Td>Tipo Surtimiento</Td>
<Td>Status Pedido</Td>
<Td Colspan="2">Orden Compra</Td>
</Tr>
<Tr>
<Td Align="Right"><%= Rs12("Condiciones") %></Td>
<Td Align="Left"><%= Rs12("Moneda") %></Td>
<Td Align="Left"><font color="#D16363"><b><%= Tpedido %></font></b></Td>
<Td Align="Left"><font color="#D16363"> <b><%= Status %></font></b></Td>
<Td Align="Left" Colspan="2">
<%
Set Rs13 = Server.CreateObject("ADODB.Recordset")
Sql13 = "Select PedidoP, AnexoP " &_
"From ocpedidos " &_
"Where PedidoP = "& Pedido &";"
Rs13.Open Sql13,Cn1,1,2
If Rs13.Eof Then
Else
%>
<a href="Ocpedido/<%= Rs13("AnexoP") %>" onclick="NewWindow(this.href,'Pedido','790','470','yes');return false;""><%= Rs13("AnexoP") %></a>
<%
End If
%>
</Td>
</Tr>
<Tr Id="Encabezado">
<Td>Autorizacion Ventas</Td>
<Td>Autorizacion Credito</Td>
<Td>Notas Autorizacion</Td>
<Td>Vendedor</Td>
<Td Colspan="2">Capturo</Td>
</Tr>
<Tr>
<Td Align="Right"><%= Rs12("Fdvfpede") %></Td>
<Td Align="Left"><%= Rs12("Fdcfpede") %></Td>
<Td Align="Left"><font color="#D16363"> <b><%= Rs12("NotasAut") %></font></b></Td>
<Td Align="Left"><%= Rs12("Vendedor") %></Td>
<Td Align="Left" Colspan="2"><font color="#D16363"> <b><%= Rs12("UsuarioC") %></b></font></Td>
</Tr>
<Tr Id="Encabezado">
<Td>Tipo Producto</Td>
<Td>Emb. Directo</Td>
<Td>Req Completa</Td>
<Td>Uso CFDI</Td>
<Td>Embarcar A</Td>
<Td>Hoja de Embarque</Td>
</Tr>
<Tr>
<Td Align="Left"><%= tipoproducto %></Td>
<Td Align="Left"><%= Emdire %></Td>
<Td Align="Left"><%= RequiC %></Td>
<Td Align="Left"><%= Rs12("UsoCFDIP") %></Td>
<Td Align="Left"><%= Rs12("Embfpede") %></Td>
<Td Align="Center">
<%
If Rs12("Embarcar") = False Then
Else
%>
<Font Color="Red"><b>
<a href="EtiEmbarqueP.asp?PedidoNum=<%= Rs12("Pedido") %>" onclick="NewWindow(this.href,'<%= Rs12("Pedido") %>','800','600','yes');return false;">
<%= Rs12("Pedido") %>
</a>
</b>
</Font>
<%
End If
%>
</Td>
<Td>
<a href="Mantoemb.asp?PedidoNum=<%= Rs12("Pedido") %>" onclick="NewWindow(this.href,'GestorImp','1024','800','yes');return false;">
<img src="Icon/Modificar.gif" Border="0"></a>
</Td>
</Tr>
<Tr Id="Encabezado">
<Td Colspan="5">Observaciones Pedido</Td>
</Tr>
<Tr>
<Td Align="Left" Colspan="5"><%= Rs12("Obsfpede") %></Td>
</Tr>
<Tr Id="Encabezado">
<Td Colspan="5">Observaciones Compras</Td>
</Tr>
<Tr>
<Td Align="Left" Colspan="5"><%= Rs12("Obscom") %></Td>
</Tr>
</Table>
<%
'***** Conexion A la Tabla De Detalle ****
Set Rs14 = Server.CreateObject("ADODB.Recordset")
Sql14="Select Secfpedd as Partida, Codfpedd as Codigo, Nominv as Descripcion, Udminv as UDM, " &_
"Canfpedd as Cantidad, Csufpedd as Surtido, Cpefpedd as Pendiente, ClaveProdP, ClaveUnidadP, " &_
"Ocfpedd as OCpedido, Regfpedd as Registro, (Exirmul - Capmul - Rsem) as Disponible, Fpefpedd As FechaProm, Antfpedd " &_
"From Fpeddet " &_
"left join inventarios on Cveinv = Codfpedd " &_
"Left join Multialmacen on Codfpedd = Artmul and Almfpedd = Almmul " &_
"Where Npefpedd = "& Pedido &" " &_
"Order By secfpedd asc;"
Rs14.Open Sql14,Cn1,1,2
If Rs14.EOF Then
Else
%>
<Table Align="center">
<Tr Id="Detalles">
<Td>Partida</Td>
<Td>Codigo</Td>
<Td>Descripcion</Td>
<Td>UDM</Td>
<Td>Cantidad</Td>
<Td>Surtido</Td>
<Td>Pendiente</Td>
<Td>Disponible</Td>
<Td>Fecha Promesa</Td>
<Td>Dias Vencido</Td>
<Td>Cotizacion</Td>
</Tr>
<%
Do While NOT Rs14.Eof
Pendiente = Cdbl(Rs14("Pendiente"))
FechaProm = Rs14("FechaProm")
If Pendiente = 0 Then
DiasVencidos = ""
ColorFila = "#FFFFFF"
Else
DiasVencidos = FechaHoy - FechaProm
If Cdbl(DiasVencidos) > 0 Then
ColorFila = "#FF6652"
Else If Cdbl(DiasVencidos) >= -11 and Cdbl(DiasVencidos) < 1 Then
ColorFila = "#F8FA71"
Else If Cdbl(DiasVencidos) < -11 Then
ColorFila = "#16FA26"
End If
End If
End If
End If
%>
<Tr Bgcolor=<%= ColorFila %>>
<Td Align="Right">
<a href="ConsulaPedD.asp?Registro=<%= Rs14("Registro") %>&Pedido=<%= Pedido %>" onclick="NewWindow(this.href,'ConsulaPedD','800','500','yes');return false;"><%= Rs14("Partida") %></a>
</Td>
<Td Align="Left"><%= Rs14("Codigo") %></Td>
<Td Align="Left"><%= Rs14("Descripcion") %></Td>
<Td Align="Left"><%= Rs14("UDM") %></Td>
<Td Align="Right"><%= Formatnumber(Rs14("Cantidad")) %></Td>
<Td Align="Right"><%= Formatnumber(Rs14("Surtido")) %></Td>
<Td Align="Right"><%= Formatnumber(Rs14("Pendiente")) %></Td>
<Td Align="Right"><%= Formatnumber(Rs14("Disponible")) %></Td>
<Td Align="Left"><%= Rs14("FechaProm") %></Td>
<Td Align="Right"><%= DiasVencidos %></Td>
<Td Align="Right"><%= Rs14("antfpedd") %></Td>
</Tr>
<%
Rs14.Movenext
Loop
%>
</Table>
<%
End If
%>
<%
'***** FIN CUANDO SI EXISTE EL PEDIDO *****
End If
%>
<%
'***** FIN CUANDO NO ESTA VACIO EL CAMPO PEDIDO *****
End If
%>
</center>
</SECTION>
</div>
<%
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
%>