Ver Mensaje Individual
  #19 (permalink)  
Antiguo 12/05/2009, 12:19
Avatar de colote
colote
 
Fecha de Ingreso: julio-2008
Ubicación: Rosario - Santa Fe - Argentina
Mensajes: 729
Antigüedad: 15 años, 10 meses
Puntos: 8
Respuesta: Contar cantidad de <tr>, pero en PHP !!!

Ahora es como que quiere andar pero no del todo bien !!!
Sorry por el lio que te estoy haciendo Gator!!!!!!
Aca te dejo el codigo y en el link anterior podes ver lo que hace

Saludos
Código PHP:
<?php
ob_start
();
?>


<?php

$pagina
=1;


$clientes=mysql_query("SELECT * FROM clientes WHERE cod_cli between $desde and $hasta AND cod_cli IN (SELECT cod_cli FROM pedidos)",$conexion);

//$clientes=mysql_query("select * from clientes where cod_cli between $desde and $hasta");
while($cli=mysql_fetch_array($clientes)){

?>
    <table id="tablaped">
    <tr><td class='l1' colspan='6'><?php echo "(".$cli['cod_cli'].")"?> - <?echo $cli['razon_soc']?></b></td></tr>

<?php

$pedidos
=mysql_query("select * from pedidos  where cod_cli=$cli[cod_cli] order by codigo DESC" ,$conexion);
while(
$ped=mysql_fetch_array($pedidos)){


$suma=mysql_query("SELECT SUM(cantp) as total, SUM(cant_ent) as ent, SUM(cant_rest) as rest FROM sub_pedidos where cod_pedido=$ped[codigo]" ,$conexion);
$datos=mysql_fetch_array($suma);

$fec_ped explode("-"$ped['fecha_ped']);
$fec_ent explode("-"$ped['fecha_ent']);


?>
    <tr><td class='l1' colspan='6'><?php echo $ped['tipo'?> - <?php echo $ped['codigo'?> - <?echo "$fec_ped[2]/$fec_ped[1]/$fec_ped[0]"?></td></tr>


<?php

$sub_ped
=mysql_query("select * from sub_pedidos where cod_pedido=$ped[codigo] order by fecha_ent");
while(
$sped=mysql_fetch_array($sub_ped)){

$piezas=mysql_query("select * from items where cod_item=$sped[cod_item]");
while(
$pie=mysql_fetch_array($piezas)){


$fec_ent_ped explode("-"$sped['fecha_ent']);

?>

<tr>
<td class="l3"><font color="red"></font></td>
<td class="l2"><?echo $pie['cod_item']?> - <?echo $pie['nombre_item']?></td>
<td class="l3"><?echo $sped['cantp']?></td>
<td class="l3"><?echo $sped['cant_ent']?></td>
<td class="l3"><?echo $sped['cant_rest']?></td>
<td class="l4"><?echo "$fec_ent_ped[2]/$fec_ent_ped[1]/$fec_ent_ped[0]";?></td>
</tr>

<?php

}
}

?>
<tr>
<td class="l3"></td>
<td class="l3"><b>TOTAL</b></td>
<td class="l3"><?echo $datos['total']?></td>
<td class="l3"><?echo $datos['ent']?></td>
<td class="l3"><?echo $datos['rest']?></td>
<td class="l4"></td>
</tr>



<?php
$contenido 
ob_get_contents();
$cant_tr=substr_count($contenido"<tr>");

// cierre while clientes

echo $cant_tr;

for(
$i=0;$i<=$cant_tr;$i++){
if ((
$i &#37; 10) == 0) { 
echo "<div style='page-break-after: always;'><p align='center'><b>- Pagina $pagina valor de i: $i -</b></p></div>";
$pagina++;
}}


//cierre while pedidos
echo "</table>";
echo 
"CANT TR : ".$cant_tr;
?>


</form>
__________________
Mail: [email protected]