File: /home/asjudine/public_html/afinanciera/factu_consul_ran.php
<?php
global $dbi;
require_once("../Conectarse.php");
$sql = mysql_query('SELECT * FROM vendedores order by vendedor ');
if (!$sql) {
die('Invalid query 12: ' . mysql_error());
}
$row_sql = mysql_fetch_assoc($sql);
$totalRows_sql = mysql_num_rows($sql);
?>
.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Consulta General por Rango</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.titulos {font: 16px; color: red; font-family:Arial; font-weight:bold}
.boton {background-color: #FFCCCC; color:#FFFFFF; width:90px; height:25; border: 3px solid #0000CC; font-family:Arial; color:#990000;}
.texto {background-color: #CCFFCC; font-size: 10px; font-family: Arial; color:#0000CC; display: block;}
.fecha {font-size: 12px; font-family: Arial; color:#990000; display: block; }
.campo {background-color:#FFFFFF; width: 100px; border:2px solid #990000;}
.lista {font-family: Arial; font-size: 12px; color: #003333;}
.lista2 {font-family: Arial; font-size: 16px; color: #FF6600;}
.boton2 {
font-family: Verdana;
font-size: 8 pt;
color: #000080;
background-color: #C0C0C0;
border-style: solid;
width:90px;
height:22px;
}
body {
background-image: url();
}
.Estilo50 {color: #CC3333;
font-family: "Arial Narrow";
font-weight: bold;
}
.Estilo51 {
color: #3366FF;
font-weight: bold;
}
.boton1 {background-color: #FFCCCC; color:#FFFFFF; width:90px; height:25; border: 3px solid #0000CC; font-family:Arial; color:#990000;}
.boton11 {background-color: #FFCCCC; color:#FFFFFF; width:90px; height:25; border: 3px solid #0000CC; font-family:Arial; color:#990000;}
.Estilo53 {color: #000099; font-weight: bold; }
</style>
<script languaje="JavaScript">
function Mostrar_Fecha()
{
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new Array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado")
var montharray=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre")
document.write("<b><font face='Arial, Helvetica, sans-serif'>"+dayarray[day]+" "+daym+" de "+montharray[month]+" de "+year+"</font></b>")
}
</script>
<script language="javascript">
function AbreGral()
{
var menu;
menu=window.open("mostrar_ingreso.php","","toolbar=no,scrollbars=no,width=800,height=500,status=yes");
menu.focus();
var ventana = window.self;
ventana.opener = window.self;
ventana.close();
}
</script>
</head>
<body onLoad="document.formulario.cedula.focus()" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form id="form1" name="form1" method="post" action="">
<div align="center">
<table width="391" class="recaudo">
<tr bgcolor="#CCFFFF">
<th colspan="4" bgcolor="#FFFFCC" scope="col"><label>CONSULTA FACTURAS POR RANGO</label></th>
</tr>
<tr bgcolor="#ECE9D8">
<th colspan="4" scope="col"><label>Fechas aņo-mes-dia </label></th>
</tr>
<tr bgcolor="#CCFFFF">
<td width="84" height="29"><div align="right"><span class="Estilo2">Del: </span></div></td>
<td width="108"><span class="Estilo52">
<input name="fecha1" type="text" class="campo" id="fecha1" value="0000-00-00" size="10" maxlength="10" />
</span></td>
<td width="37" align="right"><span class="Estilo2" >Al:</span></td>
<td width="142">
<input name="fecha2" type="text" class="campo" id="fecha2" value="0000-00-00" size="10" maxlength="10" />
</span></td>
</tr>
<tr bgcolor="#CCFFFF">
<td colspan="4"><div align="center">
<input name="consultar" type="submit" class="Estilo53" id="consultar" value="Consultar" />
</div></td>
</tr>
</table>
<p>
<input name="menu2" type="button" class="Estilo50" id="menu2" onclick="window.location.href='menu_facturacion.php'" value="IR AL MENU" />
</p>
</div>
</form>
</body>
</html>
<?php
if(isset($_POST["consultar"]))
{
echo "<form name='form' action='' method='post'>";
global $dbi;
$fec = ($_POST[ano1]."-".$_POST[mes1]."-".$_POST[dia1]);
$mssql = mysql_query('SELECT factura , nit, razon, direccion , ciudad, fecha FROM facturacion WHERE fecha >= "' . $_POST["fecha1"] . '" and fecha <= "' . $_POST["fecha2"] . '" ');
if (!$mssql) {
die('Invalid query: ' . mysql_error());
}
if($mssql)
{
$filas = mysql_num_rows($mssql);
if ($filas > 0)
{
$contro2 = mysql_query('SELECT factura , nit, razon, direccion , ciudad, fecha FROM facturacion WHERE fecha >= "' . $_POST["fecha1"] . '" and fecha <= "' . $_POST["fecha2"] . '"');
if (!$contro2) {
die('Invalid query: ' . mysql_error());
}
if ((mysql_num_rows($contro2)!=0))
{
echo "<TABLE width='900' border='' align='center' cellpadding='' cellspacing=''>
<TR>
<TD bgcolor='#000066'><div align='center'><span class='texto'>No FACTURA</span></div></TD>
<TD bgcolor='#000066'><div align='center'><span class='texto'>NIT</span></div></TD>
<TD bgcolor='#000066'><div align='center'><span class='texto'>RAZON</span></div></TD>
<TD bgcolor='#000066'><div align='center'><span class='texto'>DIRECCION</span></div></TD>
<TD bgcolor='#000066'><div align='center'><span class='texto'>CIUDAD</span></div></TD>
<TD bgcolor='#000066'><div align='center'><span class='texto'>FECHA FACTURA</span></div></TD>";
while(list($fact, $nit, $razon, $diret, $ciud, $fecha) = mysql_fetch_row($contro2))
{
printf("<tr>
<td bgcolor='#FFFFCC'><div align='center' class='lista'>".$fact."</span></div></td>
<TD bgcolor='#ECE9D8'><div align='center' class='estilo3'><input type='button' value=$nit name='nit' class=Estilo53 onClick =window.open('facturacion_consulta.php?cedula=$nit&factura=$fact','','top=50,left=100,toolbar=yes,scrollbars=yes,width=950,height=650,status=yes')></a></span></div></TD>
<td bgcolor='#FFFFCC'><div align='center' class='lista'>".$razon."</span></div></td>
<td bgcolor='#FFFFCC'><div align='center' class='lista'>".$diret."</span></div></td>
<td bgcolor='#FFFFCC'><div align='center' class='lista'>".$ciud."</span></div></td>
<td bgcolor='#FFFFCC'><div align='center' class='lista'>".$fecha."</span></div></td>
");
}
echo "</table>";
}
}
}
echo "</form>";
}
?>