Hi,
Newbie here. After a few days of sleep depravation i gave up and
decides to ask for help, so anything you can do for me will be much
apreciated, what i´´m trying to do is organize the results in a table
and then add the xolumns by credit terms:
table looks like this:
CLIENTE/FACTURA/TERMINO/ADEUDO
000001 /1111111/30 DIAS / 1500
000002 /1111112/30 DIAS / 3000
000002 /1111113/60 DIAS/ 2000
000001 /1111114/90 DIAS / 2500
000002 /1111115/60 DIAS / 1000
and the desired display would look like:
CLIENTE 000002
FACTURA/30 dias /60dias/90 dias/ No especificado/ TOTAL
1111112/1500 / ____ /______/ ____________/ 1500
1111113/______/2000 / _____/ ____________ / 2000
1111115/______ /1000 /_____ /_____________ / 1000
TOTAL 1500 / 3000 /_____/ ____________ / 4500
So far what i have is the next code:
echo "<table>";
$resultado=mysql_query("select * from cliente_facturas where
cliente=$cliente order by cliente,factura");
$t30=0; // total 30 días
$t60=0; // total 60 días
$t90=0; // total 90 días
$tind=0; // total no especificado
while ($filas=mysql_fetch_array($resultado))
{
echo "<tr><td>$filas['factura']</td>";
switch ($termino) {
case '30 DIAS':
$t30+=$filas["adeudo"];
echo "<td>$filas['adeudo']</td><td> </td><td> </td><td>
</td>";
break;
case '60 DIAS':
$t60+=$filas["adeudo"];
echo "<td> </td><td>$filas['adeudo']</td><td> </td><td>
</td>";
break;
case '90 DIAS':
$t90+=$filas["adeudo"];
echo "<td> </td><td> </td><td>$filas['adeudo']</td><td>
</td>";
break;
default:
$tind+=$filas["adeudo"];
echo "<td> </td><td> </td><td>
</td><td>$filas['adeudo']</td>";
break;
}
echo "</tr>";
}
echo "<tr><td>TOTAL:</td><td>$t30</td><td>$t60</td><td>$t90</td><td>$tind</td><td>$t30+$t60+$t90+$tind</td></tr></table>";
Thanks!!