<%
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/GestorC.css" rel="stylesheet" />
<link href="css/Buscador.css" rel="stylesheet" />
<link href="css/IndicadorA.css" rel="stylesheet" />
<!-- JavaScript para enviar a una pagina emergente -->
<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, Rs18, Rs19
Dim Sql11, Sql12, Sql13, Sql14, Sql15, Sql16, Sql17, Sql18, Sql19
'***** 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>
<br><br><br><br>
</SECTION>
<SECTION>
<%
Dim ImporteA, TcambioA, MonedaP, Factura, Documento, Vpago, Pago, Moneda, SAldoR, Clacli, FechaP, Tpago, Tdestino, Mpago, ImporteP
Factura = Request("Factura")
Documento = Session.sessionid
ImporteA = Request("ImporteA")
TcambioA = Round(Request("TcambioA"),4)
MonedaP = Request("MonedaP")
Vpago = Request("Vpago")
FechaP = Request("FechaP")
Tpago = Request("Tpago")
Clacli = Request("Clacli")
Mpago = Request("Mpago")
If ImporteA = "" Then
ImporteA = 0
Else
ImporteA = ImporteA
End If
ImporteP= ImporteA
IF TcambioA = 0 or isnull(TcambioA) then
TcambioA = 1
Else
TcambioA = TcambioA
End IF
If Factura = "" Or Isnull(Factura) then
Factura = 0
Else
Factura = Factura
End If
If Clacli = "" Or Isnull(Clacli) then
Clacli = "00000000"
Else
Clacli = Clacli
End If
IF Vpago = "" then
Vpago = ImporteA
Else
Vpago = Vpago
End IF
IF Isnull(MonedaP) or MonedaP = "" then
MonedaP = 1
Else
MonedaP = MonedaP
End IF
IF Isnull(Mpago) or Mpago = "" then
Mpago = "PPD"
Else
Mpago = Mpago
End IF
IF Isnull(FechaP) or FechaP = "" then
FechaP = Date()
Else
FechaP = FechaP
End IF
If Isnull(Tpago) or Tpago = "" then
Tpago = 7
Else
Tpago = Tpago
End If
Pago = ImporteA
Set Rs12 = Server.CreateObject("ADODB.Recordset")
Sql12="Select * from Monedas Where Cladiv = "& MonedaP &";"
Rs12.Open Sql12,Cn1,1,2
Set Rs13 = Server.CreateObject("ADODB.Recordset")
Sql13="Select Numcxcc, Descxcc " &_
"From Cxccon where Tipcxcc = 'A' and Stacxcc='A' and Numcxcc = "& Tpago &";"
Rs13.Open Sql13,Cn1,1,2
Set Rs18 = Server.CreateObject("ADODB.Recordset")
Sql18="Select * from MetodoPago Where ClaveMP = '"& Sanea(Mpago) &"';"
Rs18.Open Sql18,Cn1,1,2
%>
<div id="page">
<a href="help/Guia_Llenado_REP.pdf" onclick="NewWindow(this.href,'Recibir','800','600','yes');return false;">
<b>Guia de llenado Comprobante de Recepcion Electronica de Pagos</a></b>
<br><br>
<form action="Cxcgepa.asp" method="post" name="AddGestor" id="AgregaGC">
<Table Class="Tableneg">
<Tr>
<Td>Importe:</Td>
<td>Tcambio</Td>
<td>Moneda</Td>
<td>Metodo Pago</Td>
</Tr>
<Tr>
<Td>
<input tabindex="1" type="Text" placeholder="ImporteA" Title="ImporteA" name="ImporteA" size="3px" id="ImporteA" value="<%= FormatNumber(ImporteA) %>" required/>
</Td>
<Td>
<input tabindex="2" type="Text" placeholder="TcambioA" Title="TcambioA" name="TcambioA" size="2px" id="TcambioA" value="<%= FormatNumber(TcambioA,4) %>" required/>
</Td>
<input type="Hidden" name="FechaP" value="<%= FechaP %>" >
<input type="Hidden" name="Tpago" value="<%= Tpago %>" >
<Td>
<%
'****** TABLA DE Monedas ****
Set Rs14 = Server.CreateObject("ADODB.Recordset")
Sql14="Select Cladiv, Desdiv " &_
"From Monedas;"
Rs14.Open Sql14,Cn1,1,2
If Rs14.EOF Then
Else
%>
<SELECT NAME="MonedaP" tabindex="3" class="Tableneg">
<option value=<%= Rs12("Cladiv") %> Selected><%= Rs12("Desdiv") %></Option>
<%
Do While Not Rs14.EOF
%>
<OPTION value="<%= Rs14("Cladiv") %>"> <%= Rs14("Desdiv") %> </Option>
<%
Rs14.Movenext
Loop
%>
</Select>
<%
End If
%>
</td>
<Td>
<%
'****** TABLA DE Monedas ****
Set Rs19 = Server.CreateObject("ADODB.Recordset")
Sql19="Select ClaveMP, DescripcionMP " &_
"From MetodoPago;"
Rs19.Open Sql19,Cn1,1,2
If Rs19.EOF Then
Else
%>
<SELECT NAME="MPago" tabindex="4" class="Tableneg">
<option value=<%= Rs18("ClaveMP") %> Selected><%= Rs18("ClaveMP") %></Option>
<%
Do While Not Rs19.EOF
%>
<OPTION value="<%= Rs19("ClaveMP") %>"> <%= Rs19("ClaveMP") %> </Option>
<%
Rs19.Movenext
Loop
%>
</Select>
<%
End If
%>
<Td align="center"><button tabindex="4" type="submit" name="Grabar" id="Grabar"/>Aceptar</button><br><br></Td>
</Tr>
</Table>
</form>
</div>
<%
If ImporteA = 0 then
%>
<%
Else
%>
<div id="page">
<form action="Cxcgepad.asp" method="post" name="AddGestor" id="AgregaGC">
<Table Class="Tableneg">
<Tr>
<Td>Factura:</Td>
<Td>
<input tabindex="1" type="Text" placeholder="Factura" Title="Numero de Factura" name="Factura" size="5px" id="Factura" value="<%= Factura %>" required/>
<input type="Hidden" name="ImporteA" value="<%= ImporteA %>" >
<input type="Hidden" name="TcambioA" value="<%= FormatNumber(TcambioA,4) %>" >
<input type="Hidden" name="Vpago" value="<%= Vpago %>" >
<input type="Hidden" name="MonedaP" value="<%= MonedaP %>" >
<input type="Hidden" name="FechaP" value="<%= FechaP %>" >
<input type="Hidden" name="Mpago" value="<%= Mpago %>" >
<input type="Hidden" name="Tpago" value="<%= Tpago %>" >
<input type="Hidden" name="Clacli" value="<%= Clacli %>" >
<Td align="center"><button tabindex="3" type="submit" name="Grabar" id="Grabar"/>Buscar</button><br><br></Td>
<Td>
</td>
<Td>
</Td>
<td >
Importe x aplicar <%= cdbl(Vpago) %>
</td>
</Tr>
</Table>
</form>
</div>
</SECTION>
<div Id="Resultados">
<%
'***** Conexion A la tabla temporal ****
Set Rs15 = Server.CreateObject("ADODB.Recordset")
Sql15="Select * from Cobdtem, Clientes, monedas " &_
"where SesCobtem = "& Documento &" and CliCobtem = Clacli and Cladiv = MonCobtem order by RegCobtem;"
Rs15.Open Sql15,Cn1,1,2
If Rs15.EOf Then
Else
%>
<Table Class="TablaRes" Width="800px">
<Tr>
<Td width="5" Align="left">Factura</Td>
<Td width="5" Align="left">Cliente</Td>
<Td width="5" Align="Left">Nombre Cliente</Td>
<Td width="5" Align="Left">Saldo Doc</Td>
<Td width="5" Align="Right">Saldo Aplicar</Td>
<Td width="5" Align="Right">Per/Gan</Td>
<Td width="5" Align="Right" >Accion</Td>
</Tr>
</Table>
<Table Class="Partidas" Width="800px">
<%
Dim Pergam, ColorL
Do While Not Rs15.Eof
Moneda = cdbl(Rs15("MonCobtem"))
'If Moneda = cdbl(MonedaP) and MonedaP = 1 Then
'ImporteA = cdbl(ImporteA) - cdbl(Rs15("ImpaCobtem"))
'SAldoR = ImporteA
'Else If Moneda = cdbl(MonedaP) and MonedaP = 2 Then
'ImporteA = cdbl(ImporteA) - cdbl(Rs15("ImpaCobtem"))
SAldoR = ImporteA
'Else If Moneda = 2 and MonedaP = 1 Then
'ImporteA = cdbl(ImporteA) - (cdbl(Rs15("ImpaCobtem")) * cdbl(Rs15("TcaACobtem")))
'SAldoR = SAldoR + ImporteA
'Else If Moneda = 1 and MonedaP = 2 Then
'ImporteA = cdbl(ImporteA) - (cdbl(Rs15("ImpaCobtem")) / cdbl(TcambioA))
'SAldoR = SAldoR + ImporteA
'End If
'End If
'End If
'End If
If cdbl(Rs15("PerganCobtem")) < 0 then
ColorL = "#FC1A03"
Else
ColorL = "#000000"
End If
%>
<Tr>
<form action="CxcpgMod.asp" method="post" name="AddGestor" id="AgregaGC">
<Td width="5" Align="Left"Id="CxcFactura" >
<a href="CxcHistdet.asp?Documento=<%= Rs15("FacCobtem") %>&Cliente=<%= Rs15("CliCobtem") %>"
onclick="NewWindow(this.href,'Recibir','800','600','yes');return false;"><%= Rs15("FacCobtem") %></a>
</Td>
<Td width="5" Align="Left"><%= Rs15("CliCobtem") %> </Td>
<Td width="5" Align="Left"><%= Rs15("Nomcli") %> </Td>
<Td width="5" Align="Left"><%= Formatnumber(Rs15("SalCobtem")) %> - <%=Rs15("Abrdiv")%> </Td>
<Td width="5" Align="Right"><input Type="text" placeholder="ImporteR" Title="ImporteR" name="ImporteR" id="ImporteR" Size="7" value="<%= Rs15("ImpaCobtem") %>"></Td>
<Td width="5" Align="Right" Style="color:<%= ColorL %>"><%= Formatnumber(Rs15("PerganCobtem")) %> </Td>
<Td width="5" Align="Right">
<input type="Hidden" name="Factura" value="<%= Factura %>" >
<input type="Hidden" name="ImporteA" value="<%= ImporteA %>" >
<input type="Hidden" name="TcambioA" value="<%= TcambioA %>" >
<input type="Hidden" name="Vpago" value="<%= Vpago %>" >
<input type="Hidden" name="MonedaP" value="<%= MonedaP %>" >
<input type="Hidden" name="FechaP" value="<%= FechaP %>" >
<input type="Hidden" name="Mpago" value="<%= Mpago %>" >
<input type="Hidden" name="Tpago" value="<%= Tpago %>" >
<input type="Hidden" name="Clacli" value="<%= Clacli %>" >
<input type="hidden" placeholder="RegistroP" Title="RegistroP" name="RegistroP" id="RegistroP" Size="2" Style="Text-Align:Right" value="<%= Rs15("RegCobtem") %>">
<input type="image" src="Icon/Modifica.gif" value="Accesar" Title="Modificar">
</td>
</FORM>
<Td width="5">
<a href="Cxcpgdel.asp?regi=<%= Rs15("RegCobtem") %>&Vpago=<%=Vpago%>&ImporteA=<%=ImporteA%>&TcambioA=<%=TcambioA%>&MonedaP=<%=MonedaP%>&Factura=<%=Factura%>&Tpago=<%=Tpago%>&FechaP=<%=FechaP%>&Mpago=<%=Mpago%>&Clacli=<%=Clacli%>">
<img src="Icon/Elimina.gif"></a> </Td>
</Tr>
<%
Pergam = Pergam + cdbl(Rs15("ImpaCobtem"))
Rs15.Movenext
Loop
%>
<Tr>
<Td colspan="5"> </td>
<td Align="Right" ><b> <%= Formatnumber(Pergam) %> </b></Td>
</Table>
<SECTION >
<form action="CxcPro.asp" method="post" name="AddGestor" id="AgregaGC">
<Table id="Comprobante">
<Tr>
<Td>Fecha Pago:</Td>
<Td>Tipo de pago:</Td>
<Td>Destino:</Td>
</TR>
<Tr>
<Td>
<a href="Bcalenp.asp?Vpago=<%=Vpago%>&ImporteA=<%=ImporteA%>&TcambioA=<%=TcambioA%>&MonedaP=<%=MonedaP%>&Factura=<%=Factura%>&FechaP=<%=FechaP%>&Mpago=<%=Mpago%>"
onclick="NewWindow(this.href,'BCliente','250','240','yes');return false;"">
<%= FechaP %> </a>
</td>
<Td >
<%
'****** TABLA Tpago ****
Set Rs16 = Server.CreateObject("ADODB.Recordset")
Sql16="Select Numcxcc, Descxcc " &_
"From Cxccon where Tipcxcc = 'A' and Stacxcc='A';"
Rs16.Open Sql16,Cn1,1,2
If Rs16.EOF Then
Else
%>
<SELECT NAME="Tpago" tabindex="2">
<option value=<%= Rs13("Numcxcc") %> Selected><%= Rs13("Numcxcc") %> -<%= Rs13("Descxcc") %></Option>
<%
Do While Not Rs16.EOF
%>
<OPTION value="<%= Rs16("Numcxcc") %>"> <%= Rs16("Numcxcc") %> - <%= Rs16("Descxcc") %> </Option>
<%
Rs16.Movenext
Loop
%>
</Select>
<%
End If
%>
</Td>
<Td >
<%
'****** TABLA Destino ****
Set Rs17 = server.CreateObject("ADODB.Recordset")
Sql17 = "select IdBan, ConBan, CtaBan From Bancos where StaBan='A'"
Rs17.Open Sql17,cn1,1,2
If Rs17.EOF Then
Else
%>
<SELECT NAME="Tdestino" tabindex="3">
<%
Do While Not Rs17.EOF
%>
<OPTION value="<%= Rs17("IdBan") %>"> <%= Rs17("IdBan") %> - <%= Rs17("ConBan") %> - <%=Rs17("CtaBan")%></Option>
<%
Rs17.Movenext
Loop
%>
</Select>
<%
End If
%>
</Td>
<Td>
<input tabindex="4" type="Text" placeholder="Observaciones" Title="Observaciones" name="Observaciones" size="10px" id="Observaciones" value="">
</Td>
</Tr>
<Tr>
<Td Colspan="4" Align="Center">
<input type="Hidden" name="TcambioA" value="<%= TcambioA %>" >
<input type="Hidden" name="MonedaP" value="<%= MonedaP %>" >
<input type="Hidden" name="FechaP" value="<%= FechaP %>" >
<input type="Hidden" name="Mpago" value="<%= Mpago %>" >
<input type="Hidden" name="ImporteP" value="<%= ImporteP %>" >
<button tabindex="5" type="submit" name="Grabar" id="Grabar"/>Aplicar</button><br><br></Td>
</Tr>
</Table>
</form>
</SECTION>
<%
End If
%>
</SECTION>
<%
End If
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
%>