Moin,
da ich ja täglich meinen Reichtum mittels Hibiscus-Server abfrage, brauchte ich auch was was mir meinen Reichtum anzeigt. Dabei ist folgendes PHP-Script entstanden:
<?php
// AGPL - x8Bit.de - 2013 - V1.0
$db = mysql_connect('127.0.0.1', 'hibiscus', 'hibiscus') or die(mysql_error());
mysql_select_db('hibiscus') or die(mysql_error());
mysql_query("SET NAMES 'utf8'") or die(mysql_error());
function db_select($query)
{
$daten = null;
$result = mysql_query($query);
if (!$result)
{
die(mysql_error());
$daten[] = "";
} else
{
while ($row = mysql_fetch_assoc($result)) $daten[] = $row;
}
return $daten;
}
function nameconverter($knr) {
if (!strcmp($knr, "BLZ.KNR")) return "mein altes Konto";
return "Konto ist neu";
}
$konto = db_select("SELECT * FROM hibiscus.konto ORDER BY blz, kontonummer");
?>
<html>
<head>
<title>Kontostände</title>
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">
</head>
<script type="text/javascript">
function anzeigen(das){
if(document.getElementById(das).style.display=='none') {
document.getElementById(das).style.display='block';
} else {
document.getElementById(das).style.display='none';
}
}
</script>
<style type="text/css">
body { font-family: Ubuntu, Arial Narrow, Helvetica; }
#footer { width: 100%; text-align: center; font-size: 10px; color: #888; }
.kontoauszug { }
.kontohead { width: 500px; background-color: #fff; border-top: 1px solid #888; }
.kontohead:hover { background-color: #eee; }
.kontoname { font-size: 16px; text-shadow: 1px 1px #aaa; }
.kontonumbers { font-size: 12px; color: #888; }
.saldo { font-size: 16px; width: 100px; text-align: right; text-shadow: 1px 1px #eee; padding-right: 5px; }
.details { font-size: 12px; width: 75px; text-align: right; cursor: help; color: #00f; text-shadow: 1px 1px #aaa; }
.betrag { font-size: 16px; width: 100px; text-align: right; padding-right: 5px; }
.datum { font-size: 10px; color: #888; }
.zweck { font-size: 12px; width: 400px; }
.empfaenger { font-size: 12px; color: #888; }
.umsatz { border-top: 1px dotted #ccc; }
.umsatz:hover { background-color: #eee; }
.colorred { color: #f00; }
.colorgreen { color: #0c0; }
</style>
<body>
<?php
for($i = 0; $i < count($konto); $i++) {
$query = "SELECT * FROM hibiscus.umsatz WHERE konto_id = ".$konto[$i]["id"]." ORDER BY datum DESC LIMIT 0,10";
$umsatz = db_select($query);
$color = "colorgreen";
if ($konto[$i]["saldo"] < 0) $color = "colorred";
?>
<div class="kontoauszug">
<table class="kontohead" onClick="anzeigen('<?php echo $konto[$i]["kontonummer"] ?>')">
<tr>
<td rowspan="2" class="saldo <?php echo $color; ?>"><?php echo number_format($konto[$i]["saldo"], 2, ',', '.')."€"; ?></td>
<td colspan="2" class="kontoname"><?php echo nameconverter($konto[$i]["blz"].".".$konto[$i]["kontonummer"]); ?></td>
</tr>
<tr class="kontonumbers">
<td><?php echo "BLZ ".$konto[$i]["blz"]." - KNR ".$konto[$i]["kontonummer"] ?></td>
<td class="details">(Details)</td>
</tr>
</table>
<div class="kontodetails" id="<?php echo $konto[$i]["kontonummer"] ?>" style="display: none">
<?php
for($j = 0; $j < count($umsatz); $j++) {
$color = "colorgreen";
if ($umsatz[$j]["betrag"] < 0) $color = "colorred";
?>
<table class="umsatz">
<tr>
<td class="betrag <?php echo $color; ?>" rowspan="4">
<?php echo number_format($umsatz[$j]["betrag"], 2, ',', '.')."€" ?>
<div class="datum">
<?php echo $umsatz[$j]["datum"] ?>
</div>
</td>
<td class="zweck"><?php echo $umsatz[$j]["zweck"] ?></td>
</tr>
<tr>
<td class="zweck"><?php echo ($umsatz[$j]["zweck2"] == null ? " " : $umsatz[$j]["zweck2"]) ?></td>
</tr>
<tr>
<td class="zweck"><?php echo ($umsatz[$j]["zweck3"] == null ? " " : $umsatz[$j]["zweck3"]) ?></td>
</tr>
<tr>
<td class="empfaenger"><?php echo ($umsatz[$j]["empfaenger_name"] == null ? " " : $umsatz[$j]["empfaenger_name"]) ?></td>
</tr>
</table>
<?php
}
?>
</div>
</div>
<?php
}
?>
</body>
</html>
ist sicherlich Verbesserungswürdig, aber das liegt im Detail am Auge dessen wer da rauf schaut. Mir reicht es zumindest um vom Tablet schnell mal die Kontostände zu checken (geraade was EC-Karte angeht).
hand, mogel