hours_sum_for_user db user_id { on_which_table " " } { on_what_id " " } { number_days " " }What it does:
Returns the total number of hours the specified user logged for whatever else is included in the arg listDefined in: /web/philip/tcl/intranet-defs.tcl
Source code:
set criteria [list "user_id=$user_id"]
if { ![empty_string_p $on_which_table] } {
lappend criteria "on_which_table='[DoubleApos $on_which_table]'"
}
if { ![empty_string_p $on_what_id] } {
lappend criteria "on_what_id = $on_what_id"
}
if { ![empty_string_p $number_days] } {
lappend criteria "day >= sysdate - 7"
}
set where_clause [join $criteria "\n and "]
set num [database_to_tcl_string $db "select sum(hours) from im_hours where $where_clause"]
return [util_decode $num "" 0 $num]