<%
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>
<script type="text/javascript" src="validacion.js"></script>
<script type="text/javascript">
<!--
function check(formname, submitbutton) {
var errors = '';
;
errors += checkRadio(formname, 'TipoProd', 'Tipo de Material');
errors += checkRadio(formname, 'Recoge', 'Cliente Recoge');
checkThisForm(formname, submitbutton, errors);
}
//-->
</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 Factura
Dim DifRevision, MyColor, Vencimiento, MyColorB
Factura = Request("Factura")
%>
<center>
<br>
<B>***** CAPTURA DE FACTURAS A REVISION *****</B>
<BR><BR>
<Form action="Revision.asp" method="post" name="PedidnoNuevo" id="PedidnoNuevo">
<Table Class="Pedido">
<Tr>
<Td>Factura:</Td>
<Td>
<input tabindex="1" type="Text" name="Factura" size="5" value="<%= Factura %>" style="Text-Align:Right" required/>
</Td>
</Tr>
</Table>
</Form>
<BR><BR>
<Form action="RevisionF.asp" method="post" name="PedidnoNuevo" id="PedidnoNuevo">
<Table Class="Pedido">
<Tr>
<Td Colspan="3" Align="Center">Reporte de Facturas</Td>
</Tr>
<Tr>
<Td>Fecha Inicial:</Td>
<Td>Fecha Final:</Td>
</Tr>
<Tr>
<Td>
<input tabindex="1" type="Text" name="FechaI" size="7" value="<%= Date() %>" style="Text-Align:Right" required/>
</Td>
<Td>
<input tabindex="2" type="Text" name="FechaF" size="7" value="<%= Date() %>" style="Text-Align:Right" required/>
</Td>
<Td>
<button tabindex="2" type="submit" name="Grabar" id="BuscarCli"/>Buscar</button>
</Td>
</Tr>
</Table>
</Form>
<%
'***** SI NO HAN CAPTURADO EL NUMERO DE FACTURA ****
If Isnull(Factura) or Factura = "" Then
%>
<%
Else
'***** BUSCA EL NUMERO DE FACTURA EN EL ENCABEZADO DE FACTURAS *****
Set Rs12 = Server.CreateObject("ADODB.Recordset")
Sql12="Select Numfface, Fecfface from Ffacenc " &_
"Where Numfface = "& Factura &";"
Rs12.Open Sql12,Cn1,1,2
'**** SI NO EXISTE EL NUMERO DE FACTRA EN EL ENCABEZADO DE FACTURAS *****
If Rs12.Eof Then
%>
<br><br>
***** El Numero de Factura <%= Factura %> No Existe *****
<%
'***** EN CASO DE QUE SI EXISTA EN EL ENCABEZADO DE LAS FACTURAS *****
Else
'***** BUSCA EL NUMERO DE FACTURA EN LA TABLA DE REVISION *****
Set Rs13 = Server.CreateObject("ADODB.Recordset")
Sql13="Select Numfface, Fecfface, Clifface, Nomcli, DiaCli, " &_
"Fecfrev, REFFREV, FREFREV, FORFREV, RESFREV, FPOFREV, OBRFREV, OBFFREV " &_
"From Frevision left join Ffacenc on Facfrev = Numfface " &_
"left Join Clientes on Clifface = Clacli " &_
"Where Facfrev = "& Factura &";"
Rs13.Open Sql13,Cn1,1,2
'***** SI NO LA ENCUENTRA ENTONCES LA AGREGA ****
If Rs13.Eof Then
Set Rs14 = Server.CreateObject("ADODB.Recordset")
Sql14="Insert Into Frevision " &_
"(Facfrev) " &_
"Values ("& Factura &");"
Cn1.Execute Sql14
Response.Redirect("Revision.asp?Factura="& Factura &"")
'***** SI EXISTE ENTONCES MUESTRA EL FORMULARIO DE ACTUALIZACION *****
Else
If Isnull(Rs13("FREFREV")) or Rs13("Fecfface") = "" Then
DifRevision = 0
Else
DifRevision = date() - Cdate(Rs13("Fecfface"))
End If
If DifRevision > 7 Then
Mycolor = "#EF2A2A"
Else
Mycolor = "#000000"
End If
Vencimiento = Cdate(Rs13("Fecfface")) + Rs13("DiaCli")
If Vencimiento < Date() Then
MyColorB = "#EF2A2A"
Else
MyColorB = "#000000"
End If
%>
<br><br>
<Form action="RevisionG.asp" method="post" name="RevisionG" id="PedidnoNuevo">
<Table Class="Pedido">
<Tr>
<Td>Factura:</Td>
<Td><input tabindex="1" type="Text" name="Factura" size="5" value="<%= Rs13("Numfface") %>" style="Text-Align:Right" Readonly></td>
</Tr>
<Tr>
<Td>Fecha Factura:</Td>
<Td><input tabindex="2" type="Text" name="FecFactura" size="7" value="<%= Rs13("Fecfface") %>" style="Text-Align:Right" Readonly></td>
</Tr>
<Tr>
<Td>Clave:</Td>
<Td><input tabindex="3" type="Text" name="Clave" size="7" value="<%= Rs13("Clifface") %>" style="Text-Align:Left" Readonly></td>
</Tr>
<Tr>
<Td>Nombre:</Td>
<Td><input tabindex="4" type="Text" name="Nombre" size="70" value="<%= Rs13("Nomcli") %>" style="Text-Align:Left" Readonly></td>
</Tr>
<Tr>
<Td>Fecha Entregado a Credito:</Td>
<Td><input tabindex="5" type="Text" name="FechaCred" size="7" value="<%= Rs13("Fecfrev") %>" style="Text-Align:Right"></td>
</Tr>
<Tr>
<Td>Numero Refacturacion:</Td>
<Td><input tabindex="6" type="Text" name="Refacturacion" size="5" value="<%= Rs13("REFFREV") %>" style="Text-Align:Right"></td>
</Tr>
<Tr>
<Td>Fecha Revision:</Td>
<Td><input tabindex="7" type="Text" name="FechaRev" size="5" value="<%= Rs13("FREFREV") %>" style="Text-Align:Right; Color:<%= Mycolor %>"></td>
</Tr>
<Tr>
<Td>Diferencia Dias Fecha Revision:</Td>
<Td><input tabindex="8" type="Text" name="DifRevision" size="5" value="<%= DifRevision %>" style="Text-Align:Right; Color:<%= Mycolor %>" Readonly></td>
</Tr>
<Tr>
<Td>Forma de Envio:</Td>
<Td>
<Select Name="FormaEnvio">
<option value="<%= Rs13("FORFREV") %>"><%= Rs13("FORFREV") %></option>
<option value="CORREO">CORREO</option>
<option value="PORTAL">PORTAL</option>
<option value="FISICAMENTE">FISICAMENTE</option>
<option value="DIRECTO POR FEP">DIRECTO POR FEP</option>
</Select>
</Td>
</Tr>
<Tr>
<Td>Responsable:</Td>
<Td>
<Select Name="Responsable">
<option value="<%= Rs13("RESFREV") %>"><%= Rs13("RESFREV") %></option>
<option value="RAUL MORALES">RAUL MORALES</option>
<option value="MAURICIO GARCIA">MAURICIO GARCIA</option>
</Select>
</Td>
</Tr>
<Tr>
<Td>Dias Credito:</Td>
<Td><input tabindex="10" type="Text" name="DiasCred" size="5" value="<%= Rs13("DiaCli") %>" style="Text-Align:Right;" Readonly></td>
</Tr>
<Tr>
<Td>Fecha Vencimiento :</Td>
<Td><input tabindex="11" type="Text" name="Vencimiento" size="7" value="<%= Vencimiento %>" style="Text-Align:Right;Color:<%= MyColorB %>" Readonly></td>
</Tr>
<Tr>
<Td>Fecha Prorroga :</Td>
<Td><input tabindex="12" type="Text" name="Prorroga" size="7" value="<%= Vencimiento + 20 %>" style="Text-Align:Right;"></td>
</Tr>
<Tr>
<Td>Observaciones Fecha Revision :</Td>
<Td><textarea name="OBRFREV" rows="5" cols="70"><%= Rs13("OBRFREV") %></textarea></td>
</Tr>
<Tr>
<Td>Observaciones Fecha Pago :</Td>
<Td><textarea name="OBFFREV" rows="5" cols="70"><%= Rs13("OBFFREV") %></textarea></td>
</Tr>
<Tr>
<Td Colspan="2" Align="Center">
<button tabindex="2" type="submit" name="Grabar" id="BuscarCli"/>Grabar</button>
</Td>
</Tr>
</Table>
</Form>
<%
'****** TERMINA EL RS13 *****
End If
%>
<%
'***** TERMINA EL RS 12 *****
End If
'***** TERMINA LA PRIMERA CONDICIONAL *****
End If
%>
</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
%>