<%
Option Explicit
%>
<%
Session.LCID = 2058
%>
<!--#include file="User.asp"-->
<!--#include file="general.asp"-->
<html>
<head>
<title>Grupo MIM</title>
<link rel=stylesheet href="vista.css">
</head>
<BODY>
<!--#INCLUDE FILE="BARRA.asp"-->
<div class="normalw" style="position:absolute; top:1px">
<center>
<!--#include file="empresa.asp"--><br>
<hr>
</center>
</div>
<div class="normalw" style="position:absolute; top:1px;">
Bienvenido: <%= nombre %>. <br>
Hora Actual: <%= time %>
</div>
<div class="normalw" style="position:absolute; top:34px; left:1">
<!--#include file="mpro.asp"-->
</div>
<div class="normalw" style="position:absolute; top:1px;">
Bienvenido: <%= nombre %>. <br>
Hora Actual: <%= time %>
</div>
<div class="normalw" style="position:absolute; top:34px; left:1">
<!--#include file="mpro.asp"-->
</div>
<div class="normal" style="position:absolute; top:60px; left:10">
<%
dim rs5, sql5
set rs5 = server.CreateObject("ADODB.Recordset")
sql5 = "select * from CXcM where (usuario like'" & nombre & "')"
rs5.open sql5,cn1,1,2
%>
<%
do while not rs5.EOF
%>
<a href="<%=rs5.fields("cxcm")%>.asp"><img src="Image/<%=rs5.fields("cxcn")%>.gif" border=0 ALT="<%=rs5.fields("cxCn")%>"></a>
<%
rs5.MoveNext
loop
%>
</div>
<div style="position:absolute; top:95px; left:10">
<center>
<hr>
<%
Dim Rs10, Sql10, Rs11, Sql11, Rs12, Sql12, Rs13, Sql13, Rs14, Sql14, Rs15, Sql15
Dim Rs16, Sql16, Rs17, Sql17, Rs18, Sql18, Rs19, Sql19, Rs20, Sql20
Dim Clacli, Moneda, Pago, Tcambio, Aplicar, Tpago, DocuP, Destino, Fcap, ImpOri
Dim Proceso, ImporteC, Observaciones, Concepto, Ipesos, ncobranza, Idls, ImporteDls
Dim ValorO, ValorC, TcambioF, DifeC, Naplica, SaldoD, DocuApli, ImporteA, PesosDet
Dim MonedaDoc, feccap
Dim DocApliS, Movi, Facdoc
Docup = Request("Docup")
Pago = Request("Pago")
ImpOri = Request("ImpOri")
aplicar = Request("Aplicar")
Tpago = Request("Tpago")
Moneda = Request("Moneda")
feccap = date()
Fcap = Request("Fcap")
Observaciones = request("Observa")
'************************* PROCESO PARA APLICAR EL PAGO ********************
%>
<%
If Cdbl(DocuP) = 0 or Docup ="" then
%>
Msg 1.- Favor de seleccionar un Documento a Aplicar <br>
<a href="javascript:history.back(1)">Regresar</a>
<%
Else
IF Cdbl(Pago) = 0 then
%>
Msg 2.- Favor de introducir el importe <br>
<a href="javascript:history.back(1)">Regresar</a>
<%
Else
IF Cdbl(Pago) > Cdbl(ImpOri) then
%>
Msg 3.- El Importe a Aplicar No Puede ser Mayor al Saldo del Documento Original<br>
<a href="javascript:history.back(1)">Regresar</a>
<%
Else
IF Cdbl(Aplicar) > Cdbl(ImpOri) then
%>
Msg 4.- El Importe No Puede ser Mayor al Saldo del Documento Original<br>
<a href="javascript:history.back(1)">Regresar</a>
<%
Else
IF Cdbl(Pago) < (-1*(Cdbl(ImpOri))) then
%>
Msg 5.- El Importe a Aplicar No Puede ser Mayor al Saldo del Documento Original<br>
<a href="javascript:history.back(1)">Regresar</a>
<%
Else
IF Cdbl(Aplicar) < (-1*(Cdbl(ImpOri))) then
%>
Msg 6.- El Importe No Puede ser Mayor al Saldo del Documento Original<br>
<a href="javascript:history.back(1)">Regresar</a>
<% else
Set Rs17 = server.CreateObject("ADODB.Recordset")
Sql17= "Select Regcxcg, Clicxcg, Nfacxcg, Salcxcg, Tcacxcg, imtcxcg, Moncxcg From Cxcgen where Regcxcg = "& DocuP &";"
Rs17.open Sql17,Cn1,1,2
TcambioF = Rs17("Tcacxcg")
MonedaDoc = Rs17("Moncxcg")
Ipesos = cdbl(Pago) * cdbl(TcambioF)
Clacli = rs17("Clicxcg")
Set Rs13 = server.CreateObject("ADODB.Recordset")
SQL13="SELECT * FROM CXCCON where regcxcc > 8 and Numcxcc = "& Tpago &";"
Rs13.open Sql13,Cn1,1,2
Movi = rs13("Tipcxcc")
If Movi = "A" then
Ipesos = cdbl(Pago) * cdbl(TcambioF)
Set Rs11 = server.CreateObject("ADODB.Recordset")
Sql11 = "Insert into Cxcdet " &_
"(Movcxcd, Clicxcd, nfacxcd, refcxcd, doccxcd, Frecxcd, fpacxcd, moncxcd, tcacxcd, " &_
"impcxcd, imdcxcd, tcdcxcd, idcxcg, stacxcd, obscxcd) " &_
"Select "& Tpago &", clicxcg, nfacxcg, doccxcg, doccxcg, '"& Feccap &"', '"& Fcap &"', "& Moneda &", tcacxcg, " &_
"("& -1 * Ipesos &"), ("& -1 * Pago &"), Tcacxcg, idrcxcg,'C', '"& Observaciones &"' from cxcgen " &_
"where regcxcg = "& DocuP &";"
Cn1.Execute Sql11
Set Rs15 = server.CreateObject("ADODB.Recordset")
Sql15= "Update cxcgen " &_
"Set Salcxcg = (Salcxcg - "& Pago &"), imtcxcg = (imtcxcg - "& Ipesos &"), Pagcxcg = (Pagcxcg + "& Pago &") " &_
"from cxcgen where regcxcg = "& DocuP &";"
Cn1.Execute Sql15
Set Rs16 = server.CreateObject("ADODB.Recordset")
Sql16= "Update CLIENTES " &_
"Set Salcli = (Salcli - "& Pago &") where Clacli = '"& Clacli &"';"
Cn1.Execute Sql16
Else
Ipesos = cdbl(Aplicar) * cdbl(TcambioF)
PesosDet = cdbl(Pago) * cdbl(TcambioF)
Set Rs11 = server.CreateObject("ADODB.Recordset")
Sql11 = "Insert into Cxcdet " &_
"(Movcxcd, Clicxcd, nfacxcd, refcxcd, doccxcd, Frecxcd, fpacxcd, moncxcd, tcacxcd, " &_
"impcxcd, imdcxcd, tcdcxcd, idcxcg, stacxcd, obscxcd) " &_
"Select "& Tpago &", clicxcg, nfacxcg, doccxcg, doccxcg, '"& Feccap &"', '"& Fcap &"', "& Moneda &", tcacxcg, " &_
"("& PesosDet &"), ("& Pago &"), Tcacxcg, idrcxcg, 'C', '"& Observaciones &"' from cxcgen " &_
"where regcxcg = "& DocuP &";"
Cn1.Execute Sql11
Set Rs15 = server.CreateObject("ADODB.Recordset")
Sql15= "Update cxcgen " &_
"Set Salcxcg = (Salcxcg + "& Pago &"), imtcxcg = (imtcxcg + "& PesosDet &"), Pagcxcg = (Pagcxcg - "& Pago &") " &_
"from cxcgen where regcxcg = "& DocuP &";"
Cn1.Execute Sql15
Set Rs16 = server.CreateObject("ADODB.Recordset")
Sql16= "Update CLIENTES " &_
"Set Salcli = (Salcli + "& Pago &") where Clacli = '"& Clacli &"';"
Cn1.Execute Sql16
End If
Response.Redirect("CxcMovCli.asp")
End If
End If
End If
End If
End If
End if %>
<%=Impori%><%=Movi%>
<%
End Sub
'Add the chosen course to the cart
Call AddUsuario()
'Display contents of electronic shopping cart
Call DisplayUsuario()
%>