Buenas gente,no se si este tema es de php o pertenece a esta seccion, les comento mi problema tengo una tabla la cual lleno de la base de datos segun la fecha seleccionada por medio de un datepicker, lo cual lo hago atravez de un post en jquery y si me fuinciona me muestra los resultados deseados, el problema esta en que antes de incluir el el datepicker tenia un paginador el cual me funcionaba de maravilla pero dejo de funcionar al momento de incluir el date picker y no entiendo por que ya que la tabla sigue siendo la misma.
Alguien que pueda ayudarme, se lo agradeceria, les dejare el script que utilizo para el post de fecha.
el archivo js de la paginacion lo tome de esta pagina
http://www.algunascosas.com/paginacion-simple-con-javascript
script calendario
Código Javascript
:
Ver original<script>
$(function() {
$( "#datepicker" ).datepicker({dateFormat : 'yy-mm-dd'});
});
</script>
<script>
function fecha()
{
var date = $("#datepicker" ).val();
if(date)
{
$.post("get_ventasAnual.php", {datepicker:date}, function(resultado)
{
$("#resultados").html(resultado);
}
);
}
}
</script>
<script>
function Load()
{
var date = $("#datepicker" ).val();
if(date)
{
$.post("get_ventasAnual.php", {datepicker:date}, function(resultado)
{
$("#resultados").html(resultado);
}
);
}
}
</script>
Esta es mi tabla a la que le mando la informacion
Código HTML:
Ver original<table id="tabla" class="table2">
<th scope="col">Sucursal
</th> <th scope="col">Nombre de Sucursal
</th> <th scope="col">Venta 2 Años Ant
</th> <th scope="col">Venta Año Anterior
</th> <th scope="col">Venta del Dia
</th> <th scope="col">Difer
<?php echo $fe3,"-",$fe2; ?></th> <th scope="col">% Crecim
<?php echo $fe3,"-",$fe2; ?></th> <th scope="col">Difer
<?php echo $fe2,"-",$fe1; ?></th> <th scope="col">% Crecim
<?php echo $fe2,"-",$fe1; ?></th>
<?php
require_once "get_ventasAnual.php";
?>
ESTO ES LO QUE MUESTRA EL PAGINADOR
<div style="isplay:none; border: 0px;" id="NavPosicion"></div> <script type="text/javascript"> var pager = new Pager("tabla", 10);
pager.init();
pager.showPageNav("pager", "NavPosicion");
pager.showPage(1);
Y este es mo archivo get_ventasAnual.php
Código PHP:
<?php
include_once "../Class/conexion2.php";
@$f = $_REQUEST['datepicker'];
$f1 = date("Y-m-d");
$f2=strtotime('-1 day',strtotime($f1));
$f3=date("Y-m-d", $f2);
$sql = "SELECT
(SELECT Nombre FROM Sucursal WHERE (Sucursal = VentasSucursal.Sucursal)) AS NombreSucursal,
Sucursal,
ROUND(SUM(VentaActual) / 1000, 3) AS VentaActual,
ROUND(SUM(VentaAnoAnt) / 1000, 3) AS VentaAnoAnt,
ROUND(SUM(VentaBisAnt) / 1000, 3) AS VentaBisAnt,
ROUND(SUM(VentaDiaAnt) / 1000, 3) AS VentaDiaAnt,
ROUND(SUM(VentaSemAnt) / 1000, 3) AS VentaSemAnt
FROM
VentasSucursal
WHERE
FechaEmision BETWEEN CONVERT(Date, CONVERT(Varchar, YEAR('$f')) + '-01-01') AND '$f'
GROUP BY Sucursal
ORDER BY 2";
$resultado = odbc_exec($conn,$sql);
while($row=odbc_fetch_array($resultado))
{
$x = $row['VentaBisAnt'];
$y = $row['VentaAnoAnt'];
$z = $row['VentaActual'];
$rs = $y - $x;
@$rs2 = (1-$x/$y)*100;
$rs3=$z-$y;
@$cr = (1-$y/$z)*100;
echo "<tr>";
echo "<td>",$row['Sucursal'],"</td>";
echo "<td>",utf8_encode($row['NombreSucursal']),"</td>";
echo "<td>",round($row['VentaBisAnt'],2),"</td>";
echo "<td>",round($row['VentaAnoAnt'],2),"</td>";
echo "<td>",round($row['VentaActual'],2),"</td>";
if($rs > 0)
{
echo "<td>",round($rs,2),"</td>";
}
else
{
echo "<td><font color=red>",round($rs,2),"</font></td>";
}
if($rs2 < 0)
{
echo "<td><font color=red>",round($rs2,2),"</font></td>";
}
else
{
echo "<td>",round($rs2,2),"</td>";
}
if($rs3 < 0)
{
echo "<td><font color=red>",round($rs3,2),"</font></td>";
}
else
{
echo "<td>",round($rs3,2),"</td>";
}
if($cr < 0)
{
echo "<td><font color=red>",round($cr,2),"</font></td>";
}
else
{
echo "<td>",round($cr,2),"</td>";
}
echo "</tr>";
}
?>
Como ya se menciono todo funciona perfectamente pero el paginador no funciona en conjunto con el datepicker y quisiera saber si alguien me puede ayudar