one of the documented procedures in this installation of the ACS
hours_sum   db   on_which_table   on_what_id   { number_days "" }
What it does:
Returns the total hours registered for the specified table and id. 'on_what_id in' is used so that we can sum over a group of projects if desired.
Defined in: /web/philip/tcl/intranet-defs.tcl

Source code:

    if { [empty_string_p $number_days] } {
	set days_back_sql ""
    } else {
	set days_back_sql " and day >= sysdate-$number_days"
    set num [database_to_tcl_string $db  "select sum(hours)
               from im_hours
              where on_what_id in $on_what_id
                and on_which_table='[DoubleApos $on_which_table]'$days_back_sql"]
    return [util_decode $num "" 0 $num]