Jump to content

desplegar linea despues de datos


Recommended Posts

ragys,

este es el codigo completo desde el while, el problema ahora solo es que no me "suma" devuelve cero los totales...

y aparece un "TOTAL ES" arriba del primer <td> $idcom_print

 

esta todo odenado ragys, endenante me falto sacar una cosilla.

 

$debe1 = 0;
$haber1 = 0;

   while ($con = mysql_fetch_array($sql)) 
    {
    $fecha = $con[fecha];
    $idcom = $con[idcom];
    $tipoval = $con[tipoval];
    $numcuenta = $con[numcuenta];
    $descripcion = $con[descripcion];
    $debe = $con[debe];
    $haber = $con[haber];
    $glosa = $con[glosa];
    $cont=$cont+1;
    $debe1 = 0;
    $haber1 = 0;
    
    if( $idcom !=$last_fecha2){
              $last_fecha2 = $idcom;
              $idcom_print = $idcom;
              $descripcion_print = $descripcion;
              $estilo = "style=\"border-top: solid 1px black;\"";
              
$mostrartotal = "<TR><TD colspan=\"2\" align=\"left\">EL TOTAL ES:</TD><TD align=\"left\"><font size=\"2\">" . $debe1 . "</font></TD><TD align=\"left\"><font size=\"2\">" . $haber1 . "</font></TD></TR>"; 
              
              $debe1 = 0;
              $haber1 = 0;
                          
          } else {
              $idcom_print = " ";
              $descripcion_print = "";
              $estilo = "";
               $debe1 += $debe;
              $haber1 += $haber;

              $mostrartotal = "";
          } 
    
   
?>

<table width="100%" border="0" bordercolor="#99CCFF" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<? echo $mostrartotal; ?>

<TR>
<TD width="7%"align="left"<? echo $estilo; ?> ><font size="2" ><? echo $idcom_print ?></font></TD> 
<TD width="11%" align="left"<? echo $estilo; ?> ><font size="2" ><? echo substr($descripcion_print,0,10) ?> </font></TD>
<? if($descripcion_print != ""){ $cont= $cont + 1;  ?>
</tr><tr>
    <td colspan="2" <? echo $estilo; ?>></td>
    
<? }  ?> 
<TD width="8%"align="left" <? echo $estilo; ?>><font size="2" ><? echo $fecha ?></font></TD> 
<TD width="8%"align="left" <? echo $estilo; ?>><font size="2" ><? echo $numcuenta ?> </font></TD>
<TD width="3%" align="left" <? echo $estilo; ?>><font size="2" ><? echo substr($tipoval,0,1) ?> </font></TD>
<TD width="15%"align="left" <? echo $estilo; ?>><font size="2" ><? echo substr($glosa,0,15) ?> </font></TD>
<TD width="8%" align="right" <? echo $estilo; ?>><font size="2" ><? echo number_format("$debe", 2, ",", ".") ?> </font></TD>
<TD width="10%" align="right" <? echo $estilo; ?>><font size="2" ><? echo number_format("$haber", 2, ",", ".") ?>  </font></TD>
<TD width="15%" align="right" <? echo $estilo; ?>><font size="2" ></font></TD>
<TD width="15%" align="right" <? echo $estilo; ?>><font size="2" ></font></TD>


</TR>
<? }  ?>

  </TABLE>

Edited by felipe_ceg
Link to comment
Share on other sites

  • Replies 21
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...