case '4':
                $sql = "select KDGIAT, sum(JUMLAH) as pagu_giat from {$table} WHERE THANG='{$th}' group by KDGIAT order by KDGIAT";
                break;
            default:
                $sql = "select KDGIAT, sum(JUMLAH) as pagu_giat from {$table} WHERE THANG='{$th}' group by KDGIAT order by KDGIAT";
                break;
        }
        $aGiat = mysql_query($sql);
        while ($Giat = mysql_fetch_array($aGiat)) {
            $kdgiat = $Giat['KDGIAT'];
            $pagu_51 = pagudipa_giat_jnsbel($th, $kdgiat, 51);
            $pagu_52 = pagudipa_giat_jnsbel($th, $kdgiat, 52);
            $pagu_53 = pagudipa_giat_jnsbel($th, $kdgiat, 53);
            $real_51 = realisasi_giat_jnsbel($th, $kdgiat, 51);
            $real_52 = realisasi_giat_jnsbel($th, $kdgiat, 52);
            $real_53 = realisasi_giat_jnsbel($th, $kdgiat, 53);
            $real_tot = $real_51 + $real_52 + $real_53;
            ?>
    <tr class="row6"> 
      <td align="center" valign="top"><?php 
            echo $Giat['KDGIAT'];
            ?>
</td>
      <td align="left" valign="top"><?php 
            echo nm_giat($Giat['KDGIAT']);
            ?>
</td>
      <td align="right" valign="top" class="row6"><?php 
            echo number_format($Giat['pagu_giat'] / 1000, "0", ",", ".");
            ?>
</td>
  </thead>
  <tbody>
    <tr class="<?php 
echo $class;
?>
"> 
      <td width="6%" align="center"><font color="#0FA40B"><strong><?php 
echo $kdgiat;
?>
</strong></font></td>
      <td colspan="5" align="left"><font color="#0FA40B"><strong><?php 
echo nm_giat($kdgiat);
?>
</strong></font></td>
      <td width="12%" align="right"><font color="#0FA40B"><strong><?php 
echo number_format(realisasi_giat_jnsbel($th, $kdgiat, '53'), "0", ",", ".");
?>
</strong></font></td>
    </tr>
    <?php 
$sql = "select KDOUTPUT from {$table} WHERE THANG='{$th}' and KDSATKER='{$kdsatker}' and KDGIAT='{$kdgiat}' group by KDOUTPUT order by KDOUTPUT";
$aOutput = mysql_query($sql);
while ($Output = mysql_fetch_array($aOutput)) {
    $kdoutput = $Output['KDOUTPUT'];
    $real_output = realisasi_output_jnsbel($th, $kdgiat, $kdoutput, '53');
    if ($real_output != 0) {
        ?>
    <tr class="<?php 
        echo $class;
        ?>
">