Ver Mensaje Individual
  #4 (permalink)  
Antiguo 02/04/2008, 13:13
monycaco
 
Fecha de Ingreso: enero-2008
Mensajes: 15
Antigüedad: 16 años, 4 meses
Puntos: 0
Re: Dulpicados en tabla dinámica

Perdona.
Este es el código:

<table width="700" border="1" align="center" bgcolor="#00FF00">
<tr bgcolor="#E8FFE8">
<td><strong>Nombre</strong></td>
<td><strong>Fecha</strong></td>
<td><strong>Horas</strong></td>
<td><strong>Dietas</strong></td>
<td><strong>Gastos de viaje</strong></td>
<td><strong>Kilometros</strong></td>
</tr>
<?php do { ?>
<tr bgcolor="#FFFFFF">
<td><?php echo $row_DETALLE_GASTOS['nombre']; ?></td>
<td align="right">
<?php $fecha = cambiaf_a_normal($row_DETALLE_GASTOS['fecha']);
echo $fecha; ?></td>
<td align="right"><?php echo number_format($row_DETALLE_GASTOS['Horas'], 2, ',', '.'); ?></td>
<td align="right"><?php echo number_format($row_DETALLE_GASTOS['Dietas'], 2, ',', '.').' €'; ?></td>
<td align="right"><?php echo number_format($row_DETALLE_GASTOS['Gastos_viaje'], 2, ',', '.').' €'; ?></td>
<td align="right"><?php echo number_format($row_DETALLE_GASTOS['Kilometros'], 2, ',', '.'); ?></td>
</tr>
<?php } while ($row_DETALLE_GASTOS = mysql_fetch_assoc($DETALLE_GASTOS)); ?>
</table>

quedando algo así:

|Nombre |Fecha |Horas |Dietas |Gastos de viaje|Kilómetros |
|--------------------------------------------------------------------------------------------|
|Nombre1 |01/01/2008 | 3 | 20 | 20 | 10 |
|Nombre1 |01/01/2008 | 3 | 20 | 20 | 10 |
|Nombre1 |01/01/2008 | 3 | 20 | 20 | 10 |
|Nombre2 |01/01/2008 | 3 | 20 | 20 | 10 |
|Nombre2 |01/01/2008 | 3 | 20 | 20 | 10 |
|Nombre2 |01/01/2008 | 3 | 20 | 20 | 10 |

Lo que me gustaría hacer sería ocultar duplicados en la columna Nonbre y poner subtotales por Nombre al final de dada uno de ellos.
Es decir, algo así:

|Nombre |Fecha |Horas |Dietas |Gastos de viaje|Kilómetros |
|--------------------------------------------------------------------------------------------|
|Nombre1 |01/01/2008 | 3 | 20 | 20 | 10 |
| |01/01/2008 | 3 | 20 | 20 | 10 |
| |01/01/2008 | 3 | 20 | 20 | 10 |
|SUBTOTAL | | 9 | 60 | 60 | 30 |
|Nombre2 |01/01/2008 | 3 | 20 | 20 | 10 |
|Nombre2 |01/01/2008 | 3 | 20 | 20 | 10 |
|Nombre2 |01/01/2008 | 3 | 20 | 20 | 10 |
|SUBTOTAL | | 9 | 60 | 60 | 30 |