Ver Mensaje Individual
  #7 (permalink)  
Antiguo 27/11/2009, 15:59
Avatar de urgido
urgido
 
Fecha de Ingreso: febrero-2005
Mensajes: 2.351
Antigüedad: 19 años, 2 meses
Puntos: 25
Respuesta: While o for o no se

Código PHP:
Ver original
  1. $sql = "select * from ((ventas inner join prendas on ventas.codigo = prendas.codigo)inner join factura on ventas.idfactura = factura.idfactura) where ventas.fecha = '$fecha'";
  2.  
  3.  
  4. while ($row = pg_fetch_row($result)) {                
  5.                 $fac = $row[8];
  6.                 $tot_pesos= $row[30] + $tot_pesos;
  7.                
  8.                 $facts[]=$row[0];              
  9.                
  10.                 ?>
  11.     <tr>
  12.    
  13.     <?php if ($row[9] == "CONTADO" || $row[9] == "SENA")
  14.     {
  15.         $conta = $conta + $row[31];
  16.    
  17.         ?>
  18.         <td class="ingresodatos"><?php echo cambiaf_a_normal($row[1]);?></td>
  19.         <td class="ingresodatos1"><?php echo $row[2];?></td>
  20.         <td class="ingresodatos"><?php echo $row[13];?></td>
  21.         <td class="ingresodatos1"><?php echo $row[5];?></td>
  22.         <td class="ingresodatos"><?php echo $row[4];?></td>
  23.         <td class="ingresodatos1"></td>
  24.         <td class="ingresodatos1"><?php echo $row[9];?></td>
  25.            
  26.         </tr>
  27.       <?php
  28.     }
  29.     elseif ($row[9] == "TARJETA")
  30.     {
  31.         $tar = $tar+ $row[31];
  32.     ?>
  33.         <td class="ingresodatos"><?php echo cambiaf_a_normal($row[1]);?></td>
  34.         <td class="ingresodatos1"><?php echo $row[2];?></td>
  35.         <td class="ingresodatos"><?php echo $row[13];?></td>
  36.         <td class="ingresodatos1"><?php echo $row[5];?></td>
  37.         <td class="ingresodatos"><?php echo $row[4];?></td>
  38.         <td class="ingresodatos1"></td>
  39.         <td class="ingresodatos1"><?php echo $row[9];?></td>
  40.    
  41. <?php
  42. }
  43.            
  44.     else
  45.     {
  46.         $otro = $otro + $row[30];
  47.     ?>    
  48.         <td class="ingresodatos"><?php echo cambiaf_a_normal($row[1]);?></td>
  49.         <td class="ingresodatos1"><?php echo $row[2];?></td>
  50.         <td class="ingresodatos"><?php echo $row[13];?></td>
  51.         <td class="ingresodatos1"><?php echo $row[5];?></td>
  52.         <td class="ingresodatos"><?php echo $row[4];?></td>
  53.         <td class="ingresodatos1"></td>
  54.         <td class="ingresodatos"><?php echo $row[9];?></td>
  55.  
  56.     <?php
  57.             }
  58.  
  59.            
  60.     ?>
  61.         <tr>
  62.             <td class="ingresodatos2"><?php echo "factura N: $fac";?></td>
  63.             <td class="ingresodatos2" colspan="4" align="right"><?php echo $row[30];?></td>
  64.             <td class="ingresodatos2" align="right" ><?php echo $row[30];?></td>
  65.             <td class="ingresodatos2" ></td>
  66.         </tr>
  67.     <?php        
  68.             }
  69.         echo "Total de facturas: ".array_sum($facts);
  70.     ?>

OJO: puse $row[0] pero cambiala por el campo que quieras sumar,
__________________
Hospedaje Web al mejor costo!