"Kasper Johansen" <kasper@johansen.tdcadsl.dk> skrev i en meddelelse
news:42a9778f$0$18649$14726298@news.sunsite.dk...
> Se evt. følgende link (det kan tage op til 20 sek for databasen, at gå al
> dataen igennem):
>
>
http://kasperj.lir.dk/regnskab/?show=hmm
Anyways, så ser koden til nævnte side således ud:
<table class="rs_status_table" border="0" width="100%" cellspacing="0"
cellpadding="2">
<?
$rid = "12";
$count = 0;
$f_gf = mysql_query("
SELECT
rs_afstemte.nr,
SUM(rs_navi.beloeb) AS navi_beloeb,
SUM(rs_unitel.beloeb) AS unitel_beloeb
FROM
rs_navi,
rs_unitel,
rs_afstemte
WHERE
rs_afstemte.regnskabid = '$rid' &&
rs_navi.regnskabid = '$rid' &&
rs_unitel.regnskabid = '$rid' &&
rs_navi.afstemtid = rs_afstemte.nr &&
rs_unitel.afstemtid = rs_afstemte.nr
GROUP BY
rs_afstemte.nr,
rs_unitel.afstemtid,
rs_navi.afstemtid
HAVING
navi_beloeb != unitel_beloeb
ORDER BY
rs_afstemte.nr
") or die(mysql_error());
while($d_gf = mysql_fetch_array($f_gf)){
$count++;
$navis = "";
$unitels = "";
$f_gn = mysql_query("SELECT * FROM rs_navi WHERE afstemtid = '$d_gf[nr]'")
or die(mysql_error());
while($d_gn = mysql_fetch_array($f_gn)){
$navis[] = $d_gn;
}
$f_gu = mysql_query("SELECT * FROM rs_unitel WHERE afstemtid =
'$d_gf[nr]'") or die(mysql_error());
while($d_gu = mysql_fetch_array($f_gu)){
$unitels[] = $d_gu;
}
$countf = 0;
if (count($navis) > count($unitels)){
$countt = count($navis);
}else{
$countt = count($unitels);
}
$navi_fullbeloeb = 0;
$unitel_fullbeloeb = 0;
while($countf < $countt){
$navid = $navis[$countf];
$uniteld = $unitels[$countf];
?><tr><?
if ($navid){
?><td><?=number_format($navid[beloeb], 2, ",", ".");?></td><?
$navi_fullbeloeb += $navid[beloeb];
}else{
?><td></td><?
}
if ($uniteld){
?><td><?=number_format($uniteld[beloeb], 2, ",", ".");?></td><?
$unitel_fullbeloeb += $uniteld[beloeb];
}else{
?><td></td><?
}
?></tr><?
$countf++;
}
?><tr><td style="font-size: 1px; padding: 0px;"> </td></tr><?
?><tr><?
?><td style="color: red; text-decoration:
underline;"><?=number_format($navi_fullbeloeb, 2, ",", ".");?></td><?
?><td style="color: red; text-decoration:
underline;"><?=number_format($unitel_fullbeloeb, 2, ",", ".");?></td><?
?></tr><?
?><tr><?
?><td style="color: red; text-decoration:
underline;"><?=number_format($d_gf[navi_beloeb], 2, ",", ".");?></td><?
?><td style="color: red; text-decoration:
underline;"><?=number_format($d_gf[unitel_beloeb], 2, ",", ".");?></td><?
?></tr><?
?><tr><td> </td></tr><?
}
echo "Der blev fundet " . $count . " fejl i beløbs-afstemte.";
?>
</table>
--
Mvh Kasper Johansen