<%
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">
<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>
<!--#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 style="position:absolute; top:34px; left:1">
<!--#include file="mpro.asp"-->
</div>
<div class="normal" style="position:absolute; top:80px; left:10">
<center>
<b><<<<< POLIZAS DE COBRANZA (DOWNLOAD) >>>>>
<BR>
<hr>
<Form action="PolMCob.asp" name="PolMCar" method="Post">
<TABLE border="0" cellspacing="2" cellpadding="2" class="normal">
<Tr>
<TD align="Left" class="normalw" bgcolor="#006699">Fecha Inicial</td>
<TD align="Left" class="normalw" bgcolor="#006699">Fecha Final</td>
<TD align="Left" class="normalw" bgcolor="#006699">Poliza Inicial</td>
</tr>
<tr>
<Td align="center" class="normal">
<input type="text" class="normalb" Value="<%= date() %>" name="Finicial" size="12" style="text-align:right;" onChange="javascript:this.value=this.value.toUpperCase();">
</Td>
<Td align="center" class="normal">
<input type="text" class="normalb" Value="<%= date() %>" name="FFinal" size="12" style="text-align:right;" onChange="javascript:this.value=this.value.toUpperCase();">
</Td>
<Td align="center" class="normal">
<input type="text" class="normalb" Value="" name="NumeroP" size="7">
</Td>
</Tr>
<Tr>
<Td align="center" class="normal" Colspan="3">
<input type="submit" value="Buscar" class="normalc">
</Td>
</Tr>
</Table>
</Form>
<Hr>
<%
Dim Finicial, Ffinal, NumeroP
Finicial = Request("FInicial")
Ffinal = Request("Ffinal")
NumeroP = Request("NumeroP")
If Finicial = "" and FFinal ="" and NumeroP ="" Then
%>
<<<<< BUSCAR POR FECHA O POR FOLIO >>>>>
<BR>
<%
Else
'------- CODIGO PARA GENERAR LA POLIZA MODELO DEL COFIDI -------->
Dim Cn2
Dim F, Fs
Dim Rs11, Sql11, Rs12, Sql12, Rs13, Sql13, Rs14, Sql14
Dim DiaA, LineaA, lineaB, CuentaCoi, Iva, IvaTotal
Dim Anticipo
Dim Coiban, Coiper, Coigan
Dim ImpoPer, Impogan
' para crear archivo texto
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.OpenTextFile(Server.MapPath("Polizas\PolCFDCob.xls"), 2, true)
'aqui creas la conexion a la DB y hace el recordset
Set Rs11 = server.CreateObject("ADODB.Recordset")
' para leer la tabla
Sql11 = "SELECT CLACLI, coacli, FecCob, CapCob, FolCob, TipCob, DocCob, ImpCob as Importe, TpaCob, DesCob, CoaBan " &_
"FROM Cobranza left join CLIENTES on CliCob = CLACLI left join Bancos on DesCob = IdBan " &_
"WHERE feccob BETWEEN '"& Finicial &"' AND '"& Ffinal &"' " &_
"ORDER BY Tipcob, CliCob, DocCob;"
Rs11.Open Sql11, Cn1, 1, 2
DiaA = Day(date())
If DiaA < 10 Then
DiaA = " " & DiaA
Else
DiaA = DiaA
End If
LineaA = "COBRANZA DEL DIA " & DiaA
LineaB = "."
f.WriteLine("Dr")
f.WriteLine(DiaA)
f.WriteLine(LineaA)
f.WriteLine(LineaB)
Ivatotal = 0
do while not Rs11.EOF
CuentaCoi = Rs11("Coacli")
CuentaCoi = Cuentacoi & " "
' graba campo de la tabla en archivo texto
f.WriteLine Cuentacoi & "," & 0
f.WriteLine "PAGO FAC: " & Rs11("DocCob")
f.WriteLine ""
f.WriteLine Round(Rs11("Importe"),2)
Rs11.Movenext
loop
Set Rs12 = server.CreateObject("ADODB.Recordset")
' para leer la tabla
Sql12 = "Select Coaban, CLACLI, SUM(ImpCob) AS IMPORTE " &_
"FROM Cobranza left join CLIENTES on CliCob = CLACLI left join Bancos on DesCob = IdBan " &_
"WHERE (tipcob <> 23 AND tipcob <> 24) AND CapCob BETWEEN '"& Finicial &"' AND '"& Ffinal &"' " &_
"GROUP BY CoaBan, CLACLI " &_
"ORDER BY CoaBan;"
Rs12.Open Sql12, Cn1, 1, 2
do while not Rs12.EOF
Coiban = Rs12("Coaban")
Coiban = Coiban & " "
' graba campo de la tabla en archivo texto
f.WriteLine Coiban & "," & 0
f.WriteLine "PAGO cli: " & Rs12("Clacli")
f.WriteLine Round(Rs12("Importe"),2)
Rs12.Movenext
loop
Set Rs13 = server.CreateObject("ADODB.Recordset")
' para leer la tabla
Sql13 = "SELECT '6000-003-000' as COIPER, SUM(ImpCob) AS IMPORTE " &_
"FROM Cobranza left join CLIENTES on CliCob = CLACLI left join Bancos on DesCob = IdBan " &_
"WHERE tipcob = 23 AND CapCob BETWEEN '"& Finicial &"' AND '"& Ffinal &"';"
Rs13.Open Sql13, Cn1, 1, 2
If Isnull(Rs13("Importe")) Then
Impoper = 0
Else
Impoper = Rs13("Importe")
End IF
Coiper = Rs13("Coiper")
Coiper = Coiper & " "
' graba campo de la tabla en archivo texto
f.WriteLine Coiper & "," & 0
f.WriteLine "PERDIDA CAMBIARIA "
f.WriteLine Round(Impoper,2)
' ******** PARA LA GANANCIA CAMBIARIA ******
Set Rs14 = server.CreateObject("ADODB.Recordset")
' para leer la tabla
Sql14 = "SELECT '7000-002-000' as COIGAN, SUM(ImpCob) AS IMPORTE " &_
"FROM Cobranza left join CLIENTES on CliCob = CLACLI left join Bancos on DesCob = IdBan " &_
"WHERE tipcob = 24 AND CapCob BETWEEN '"& Finicial &"' AND '"& Ffinal &"';"
Rs14.Open Sql14, Cn1, 1, 2
If Isnull(Rs14("Importe")) Then
ImpoGAN = 0
Else
ImpoGAN = Rs14("Importe")
End IF
CoiGAN = Rs14("CoIGAN")
CoiGAN = CoiGAN & " "
' graba campo de la tabla en archivo texto
f.WriteLine CoiGAN & "," & 0
f.WriteLine "GANANCIA CAMBIARIA "
f.WriteLine Round(ImpoGAN,2)
set Rs13=nothing
set Rs13=nothing
set Rs12=nothing
set Rs11=nothing
f.WriteLine("FIN")
' cierras archivo texto
f.Close
Set f=Nothing
Set fs=Nothing
%>
<A href="Polizas/PolCFDCob.xls">Poliza de Cobranza</a>
<%
End If
%>
</div>
</body>
</html>
<%
End Sub
'Add the chosen course to the cart
Call AddUsuario()
'Display contents of electronic shopping cart
Call DisplayUsuario()
%>