Witam, mam problem nie mam pojecia jak obliczyc saldo tzn:
Mamy tabelke
Data|.......|Wartość|Saldo|
2007|...... |300 |?Saldo
2007 |......|96 |?saldo
W kazdym wpisie jeszcze są dane czy to rozchód czy przychód
kod:
<?
$zapytanie = sql("SELECT * FROM sys_przychody_rozchody order by id");
$sql_nazwa = $rekord['nazwa'];
$sql_kontrahent = $rekord['kontrahent'];
$sql_typ = $rekord['typ'];
$sql_mac = $rekord['mac'];
$sql_dokument = $rekord['dokument'];
$sql_platnosc = $rekord['platnosc'];
$sql_wartosc = $rekord['wartosc'];
$sql_data = $rekord['data'];
$sql_opis = $rekord['opis'];
$sql_mac = $rekord['mac'];
$saldo ="xxx:)";
if($sql_mac == 'Rozchod'){$d = "-";}
<td height=\"19\" width=\"92\" align=\"center\">
<font face=\"Verdana\" style=\"font-size: 8pt\">$sql_data</font></td>
<td height=\"19\" width=\"338\" align=\"center\">
<font face=\"Verdana\" style=\"font-size: 8pt\">$sql_nazwa</font></td>
<td height=\"19\" width=\"187\" align=\"center\">
<font face=\"Verdana\" style=\"font-size: 8pt\">$sql_kontrahent</font></td>
<td height=\"19\" width=\"122\" align=\"center\">
<font face=\"Verdana\" style=\"font-size: 8pt\" color=\"#FF0000\">$d$sql_wartosc zł</font></td>
<td height=\"19\" width=\"108\" align=\"center\">
<font face=\"Verdana\" style=\"font-size: 8pt\" color=\"#FF0000\">$d$saldo zł</font></td>
</tr>";
}
?>
JAk to obliczyc?!?!?