}
         $bill_price = str_replace(".", ",", sprintf("%.05f", $bill_thisprice));
         if (@$_REQUEST["view"] == "csv") {
             echo "" . $bill_row["formatteddate"] . ";";
             echo "'" . $bill_dest . "';";
             echo "" . $disposition_text . ";";
             echo "" . sec_to_hours($bill_row["billsec"]) . ";";
             echo "" . str_replace(".", ",", $real_price_novat) . ";";
             echo "" . $bill_price . ";";
             echo "" . 100 * $vat_value . "\n";
         } else {
             echo "<tr class=\"" . $oddeven_class . "\">";
             echo "<td>" . htmlEnt($bill_row["formatteddate"]) . "</td>";
             echo "<td>" . htmlEnt($bill_dest) . "</td>";
             echo "<td>" . htmlEnt($disposition_text) . "</td>";
             echo "<td>" . htmlEnt(sec_to_hours($bill_row["billsec"])) . "</td>";
             echo "<td>" . $billing_currency . " " . htmlEnt($bill_price) . "</td>";
             echo "</td>\n";
             echo "</tr>\n";
         }
         //echo "<pre>"; print_r($bill_row); echo "</pre>";
     }
     if (@$_REQUEST["view"] != "csv") {
         echo "</tbody>\n";
         echo "</table><br />\n";
     }
 }
 if (@$_REQUEST["view"] != "csv") {
     $bill_sum_brutto = $bill_base + $bill_minutes_sum * $real_price;
     $bill_base_novat = round($bill_base / (1 + $vat_value), 5);
     echo "<table cellspacing=\"1\" class=\"phonebook\">\n";
?>
:</th>
	<td class="r"><?php 
$where = trim($query_string);
if (strToUpper(subStr($where, 0, 5)) == 'WHERE') {
    $where = $where . ' AND `billsec` > 0';
} else {
    $where = 'WHERE `billsec` > 0';
}
$num_total_with_talktime = $CDR_DB->executeGetOne('SELECT COUNT(*) FROM `ast_cdr` ' . $where);
if ($num_total_with_talktime > 0) {
    echo sec_to_hours($sum_talktime / $num_total_with_talktime);
} else {
    echo '<i>', sec_to_hours(0), '</i>';
}
?>
</td>
</tr>
<tr>
	<th><?php 
echo __('Verbindungszeit');
?>
:</th>
	<td class="r"><?php 
echo sec_to_hours($sum_calltime);
?>
</td>
</tr>
</tbody>
</table>
	<td class="r" style="min-width:6em;"><?php echo $num_total; ?></td>
</tr>
<tr>
	<th><?php echo __('Anrufdauer insgesamt'); ?>:</th>
	<td class="r"><?php echo sec_to_hours( $sum_talktime ); ?></td>
</tr>
<tr>
	<th><?php echo __('Anrufdauer im Durchschnitt'); ?>:</th>
	<td class="r"><?php
		
		$where = trim( $query_string );
		if (strToUpper(subStr($where,0,5)) == 'WHERE')
			$where = $where.' AND `billsec` > 0';
		else
			$where = 'WHERE `billsec` > 0';
		
		$num_total_with_talktime = $CDR_DB->executeGetOne( 'SELECT COUNT(*) FROM `ast_cdr` '. $where );
		
		if ($num_total_with_talktime > 0)
			echo sec_to_hours( $sum_talktime / $num_total_with_talktime );
		//else echo '<i>', __('keine Anrufe'), '</i>';
		else echo '<i>', sec_to_hours( 0 ), '</i>';

	?></td>
</tr>
<tr>
	<th><?php echo __('Verbindungszeit'); ?>:</th>
	<td class="r"><?php echo sec_to_hours( $sum_calltime ); ?></td>
</tr>
</tbody>
</table>