<%
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 NOTAS DE CARGO (DOWNLOAD) >>>>>
<BR>
<hr>
<Form action="PolMCar.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
Dim DiaA, LineaA, lineaB, CuentaCoi, Iva, IvaTotal
Dim Anticipo
' para crear archivo texto
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.OpenTextFile(Server.MapPath("Polizas\PolCFDCar.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 COICLI, clinca, NumNCa, (ImpNca * TcaNca) AS IMPORTE, " &_
"((((ImpNca * TcaNca))/(1+(IvaNca/100))) * (IvaNca/100)) AS IMPUESTOS, " &_
"0 AS ANTICIPO " &_
"FROM CxcNca, CLIENTES " &_
"WHERE CliNca = CLACLI " &_
"AND NumNCa >= '"& NumeroP &"' AND FecNca BETWEEN '"& Finicial &"' AND '"& Ffinal &"' " &_
"ORDER BY NumNCa;"
Rs11.Open Sql11, Cn1, 1, 2
DiaA = Day(date())
If DiaA < 10 Then
DiaA = " " & DiaA
Else
DiaA = DiaA
End If
LineaA = "Notas de Cargo del Dia " & DiaA
LineaB = "."
f.WriteLine("Dr")
f.WriteLine(DiaA)
f.WriteLine(LineaA)
f.WriteLine(LineaB)
Ivatotal = 0
do while not Rs11.EOF
Iva = Rs11("Impuestos")
Anticipo = Rs11("Anticipo")
CuentaCoi = Rs11("Coicli")
CuentaCoi = Cuentacoi & " "
' graba campo de la tabla en archivo texto
f.WriteLine Cuentacoi & "," & 0
f.WriteLine "Notas de Cargo: " & Rs11("NumNCa")
f.WriteLine Round(Rs11("Importe"),2)
If Cdbl(Anticipo) > 0 then
' graba campo de la tabla en archivo texto
f.WriteLine Cuentacoi & "," & 0
f.WriteLine "AMORT ANTI: " & Rs11("NumNCa")
f.WriteLine round(Rs11("ANTICIPO"),2)
Else
End If
Ivatotal = Cdbl(Ivatotal) + Cdbl(Iva)
Rs11.Movenext
loop
f.WriteLine "037-001-001-0000 ," & 0
f.WriteLine "Iva del dia " & DiaA
f.WriteLine ""
f.WriteLine Round(Ivatotal,2)
' cierras la tabla
Set Rs12 = server.CreateObject("ADODB.Recordset")
' para leer la tabla
Sql12 = "select DIVVEND AS DIVISIONES, sum((((ImpNca - 0) * TcaNca))/(1+(IvaNca/100))) AS IMPORTE " &_
"FROM CLIENTES, CxcNca, VENDEDORES " &_
"WHERE CliNca = CLACLI AND VENCLI = CVEVEND " &_
"AND NumNCa >= '"& NumeroP &"' AND FecNca BETWEEN '"& Finicial &"' AND '"& Ffinal &"' " &_
"GROUP BY DIVVEND " &_
"ORDER BY DIVVEND;"
Rs12.Open Sql12, Cn1, 1, 2
do while not Rs12.EOF
f.WriteLine "037-001-001-0000 ," & 0
f.WriteLine "Notas de Cargo Division " & Rs12("divisiones")
f.WriteLine ""
f.WriteLine Round(Rs12("Importe"),2)
' cierras la tabla
Rs12.Movenext
loop
Rs12.Close
set Rs12=nothing
set Rs11=nothing
f.WriteLine("FIN")
' cierras archivo texto
f.Close
Set f=Nothing
Set fs=Nothing
%>
<A href="Polizas/PolCFDCar.xls">Poliza Notas de Cargo</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()
%>