<%
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 CREDITO POR REFACTURACION O DEVOLUCION (DOWNLOAD) >>>>>
<BR>
<hr>
<Form action="PolMCre.asp" name="PolMfCre" 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
Dim DiaA, LineaA, lineaB
Dim Anticipo, Iva, Ivatotal
Dim CoiClientes, CoiAnticipo, CoiIvanti, Ivacoi, Ivadiv
' para crear archivo texto
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.OpenTextFile(Server.MapPath("Polizas\PolCFDCre.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 NUMNCR, COICLI, ANTCOI, ((ImpNcr * TcaNcr) - (AntNcr * TanNcr)) as IMPORTE, " &_
"((AntNcr * TanNcr)/(1 +(IvaNcr/100))) AS ANTICIPO, " &_
"(((AntNcr * TanNcr)/(1 +(IvaNcr/100))) * (IvaNcr/100)) AS IVA " &_
"FROM CxcNCR, CLIENTES " &_
"WHERE CLACLI = CliNcr AND TIPOD = 1 AND NumNcr >= '"& NumeroP &"' AND FecNcr BETWEEN '"& Finicial &"' AND '"& Ffinal &"' " &_
"ORDER BY NumNcr;"
Rs11.Open Sql11, Cn1, 1, 2
DiaA = Day(date())
If DiaA < 10 Then
DiaA = " " & DiaA
Else
DiaA = DiaA
End If
LineaA = "Notas Credito del Dia " & DiaA
LineaB = "."
f.WriteLine("Dr")
f.WriteLine(DiaA)
f.WriteLine(LineaA)
f.WriteLine(LineaB)
do while not Rs11.EOF
Anticipo = Rs11("Anticipo")
CoiClientes = Rs11("COICLI")
CoiClientes = CoiClientes & " "
f.WriteLine CoiClientes & "," & 0
f.WriteLine "Nota Cre: " & Rs11("NumNcr")
f.WriteLine ""
f.WriteLine Round(Rs11("Importe"),2)
If Cdbl(anticipo) > 0 Then
CoiAnticipo = Rs11("antcoi")
CoiAnticipo = CoiAnticipo & " "
f.WriteLine CoiAnticipo & "," & 0
f.WriteLine "Nota Cre: " & Rs11("NumNcr")
f.WriteLine ""
f.WriteLine Round(Rs11("anticipo"),2)
CoiIvanti = "037-001-001-0000"
CoiIvanti = CoiIvanti & " "
f.WriteLine CoiIvanti & "," & 0
f.WriteLine "IVA PENDIENTE DE TRANSLADAR"
f.WriteLine ""
f.WriteLine Round(Rs11("iva"),2)
Else
End IF
Rs11.Movenext
Loop
Set Rs12 = server.CreateObject("ADODB.Recordset")
' para leer la tabla
Sql12 = "SELECT SUM(IvTNcr * TcaNcr) AS IVA " &_
"FROM CxcNCR " &_
"WHERE TIPOD = 1 AND NumNcr >= '"& NumeroP &"' AND FecNcr BETWEEN '"& Finicial &"' AND '"& Ffinal &"';"
Rs12.Open Sql12, Cn1, 1, 2
Ivacoi = "037-001-001-0000"
Ivacoi = Ivacoi & " "
f.WriteLine Ivacoi & "," & 0
f.WriteLine "IVA PENDIENTE DE TRANSLADAR"
f.WriteLine Round(Rs12("iva"),2)
Set Rs13 = server.CreateObject("ADODB.Recordset")
' para leer la tabla
Sql13 = "SELECT coivend, divvend, SUM(SubNcr * TcaNcr) AS VENTA " &_
"FROM CxcNCR, CLIENTES, VENDEDORES " &_
"WHERE clincr = clacli AND TIPOD = 1 and vencli = CVEVEND and NumNcr >= '"& NumeroP &"' AND FecNcr BETWEEN '"& Finicial &"' AND '"& Ffinal &"' " &_
"group by COIVEND, DIVVEND;"
Rs13.Open Sql13, Cn1, 1, 2
Do While Not Rs13.EOF
Ivadiv = Rs13("COIVEND")
Ivadiv = Ivadiv & " "
f.WriteLine Ivadiv & "," & 0
f.WriteLine "VENTA DIVISION " & Rs13("divvend")
f.WriteLine Round(Rs13("venta"),2)
Rs13.Movenext
Loop
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/PolCFDCre.xls">Poliza Notas de Credito</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()
%>