<?php
$span = "colspan='" . count($fields) . (+ 1) . "'";
?>
   
    <?php
    if (!empty($group_by)) {
        ?>





        <tr>

            <td <?php echo $span; ?> class="Separator">&nbsp</td>

        </tr>



        <?php
    }

    $cur_grouped = array();

    $saved_grouped = array();

    $records = 0;

    $state = true; // flag for toggling

    
        /* Table headers **************************** */

        // the table header

        echo "<tr><td ></td>

          </tr>";

        // the columns header

        echo "<tr >";

        // drawing the other fields

        foreach ($group_by_source as $g) {

            echo "<td  align='center' class='ColumnHeaderBlock'><b>$labels[$g]</b> </td>";
        }

        foreach ($actual_fields_source as $key => $val) {
            $temp = explode('.', $val);
            $field_ = "";
            if (count($table) == 0) {
                $field_ = $val;
            } elseif (isset($temp [1])) {
                $field_ = $temp [1];
            }
            if (in_array($field_, $group_by))
                continue;
            else {

                echo "<td  align='center' class='ColumnHeaderBlock'><b>$labels[$val]</b> </td>";
            }
        }

        echo "<td class='ColumnHeader' align='center'><!-- Detail View header --></td>";
        echo "</tr>";
 
    /* header ends here ******************************* */

    /*     * *********************************************** */


