felipe_ceg Posted July 14, 2010 Author Report Share Posted July 14, 2010 (edited) 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 July 14, 2010 by felipe_ceg Link to comment Share on other sites More sharing options...
Ra Posted July 14, 2010 Report Share Posted July 14, 2010 Viejo... jijiji... elimina esto $debe1 = 0; $haber1 = 0; que está dentro del ciclo while... :tonto: Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now