<script type="text/javascript">
  $(document).ready(function() {
      $(".accordion").accordion(
          { autoHeight: false,
            navigation: true
            });
      $("#tabs").tabs();
  });
</script>
<div class="module">Vergebene Bonuspunkte</div>
<?

  $lastmonth=0;
  $firstdate = '2004-01-01';
  List($firstyear, $firstmonth, $firstday) = explode('-',$firstdate);
  $thismonth = date('m', time());
  $thisyear = date('Y', time());

?>
    <div id="tabs">
      <ul>
<? for ($year = $thisyear; $year>=$firstyear; $year--) { ?>
        <li><a href="#year<?=$year?>"><span><?=$year?></span></a></li>
<? } ?>
      </ul>
<? for ($year = $thisyear; $year>=$firstyear; $year--) { ?>
    <div class="accordion" id="year<?=$year?>">
<?
    if ($year == $firstyear) {
        $startmonth = $firstmonth;
    } else {
        $startmonth = $lastmonth;
    }

    for ($i=12; $i >= $firstmonth; $i--) {
      if ($year == $thisyear && ($i > $thismonth +0)) {
        continue;
      }
      $month = substr("0$i",-2);
      $bonusstatistics = new bonusstatistics("$year-$month-01");
      #$bonusstatistics->updatecategories();

      $unterkategorien = $bonusstatistics->fetchunterkategorien();
?>
    <h3><a href="#"><?=$year?>-<?=substr("0$i",- 2)?></a></h3>
    <div>
      <table class="statistics">
        <tr>
          <td>Ma&szlig;nahme</td><td>Anzahl</td><td>Punkte</td>
        </tr>
<?
foreach(getCategories() as $category)
{
    print "<tr><td colspan='3'><strong>" . $category->name . "</strong></td></tr>\n";
    $result = $bonusstatistics->fetchpunkte($category);
    while ($row = dbFetchRow($result, MYSQL_ASSOC) )
    {
        print '<tr><td>' . $unterkategorien[$row['unterkategorie']] . '</td><td>' . $row['anzahl'] . '</td><td>' . $row['wertsum'] . "</td></tr>\n";
    }
}
?>
</table></div>

<? } ?>
    </div> <!-- accordeon -->
<? } ?>
</div><!-- tabs -->

<script type="text/javascript">
  $(".tableheader").mouseover(function() {
      $(this).css("cursor", "hand");
      $(this).children(".tooltip").show();
  });
  $(".tableheader").mouseout(function() {
      $(this).css("cursor", "pointer");
      $(this).children(".tooltip").hide();
  });

</script>
