Tema: Reporte
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/09/2009, 22:19
lutedi
 
Fecha de Ingreso: abril-2009
Mensajes: 6
Antigüedad: 15 años
Puntos: 0
Reporte

Holas, tengo un problema necesito hacer un reporte que me salga de forma horizontal, con este código si salen los calculos, el problema es para cuadrarlo
me sale asi:

codigo dia1 dia2 dia3
xxx 50 0 0
yyy 45 0 0
zzz 30 0 0
xxx 0 20 0
yyy 0 30 0
zzz 0 50 0
xxx 0 0 75
yyy 0 0 60
zzz 0 0 80

y yo quiero que me salga asi:

codigo dia1 dia2 dia3
xxx 50 20 75
yyy 45 30 60
zzz 30 50 80

echo "<table border=1>";
echo "<tr>";
echo "<td>codigo</td>";
echo "<td>nombre</td>";
echo "<td>nombre</td>";
echo "</tr>";
$i=0;
while ($i <= 1){
$i++;
$dias=1;
$di1= $di1 + 0;
$di2= $di2 + 1;
$prue= date("Y-m-d", strtotime("$fecha5 -$dias day"));
$prue2= date("Y-m-d", strtotime("$prue +$di1 day"));
$prue3= date("Y-m-d", strtotime("$prue +$di2 day"));
$di1 = $di1 + 1;
echo $prue2;
echo $prue3;
echo $i;
$link=Conectarse();
$sql = "select idser,fecini,m1,m2,m3,e1,e2,e3,jac1,jac2 from movimiento where fecini= '".$prue3."'";
$result = mysql_query($sql, $link);
while ($row = mysql_fetch_array($result))
{
$link = Conectarse();
$query = "SELECT m1 from movimiento where idser = '$row[0]' and fecini = '".$prue2."'";
$result1 = mysql_query($query);
list($mm1) = mysql_fetch_array($result1);
$query = "SELECT m2 from movimiento where idser = '$row[0]' and fecini = '".$prue2."'";
$result2 = mysql_query($query);
list($mm2) = mysql_fetch_array($result2);
$query = "SELECT m3 from movimiento where idser = '$row[0]' and fecini = '".$prue2."'";
$result3 = mysql_query($query);
list($mm3) = mysql_fetch_array($result3);
$query = "SELECT jac1 from movimiento where idser = '$row[0]' and fecini = '".$prue2."'";
$result7 = mysql_query($query);
list($ee4) = mysql_fetch_array($result7);
$mis_dias = array(
$i=>($row[2] - $mm1) - ($row[3] - $mm2) - ($row[8] - $ee4));
echo "<tr>";
echo "<td> $row[0] </td>";
echo "<td> $mis_dias[1]</td>";
echo "<td> $mis_dias[2]</td>";
echo "</tr>";
}}
echo "</table>";
?>

Ayuda porfavor.

Última edición por lutedi; 07/09/2009 a las 08:36