im_num_employees db { since_when " " } { report_date " " } { purpose " " }What it does:
Returns string that gives # of employees and full time equivalentsDefined in: /web/philip/tcl/intranet-defs.tcl
Source code:
set num_employees [database_to_tcl_string $db "select count(time.percentage_time)
from im_employees_active emp, im_employee_percentage_time time
where (time.percentage_time is not null and time.percentage_time > 0)
and (emp.start_date < sysdate)
and time.start_block = to_date(next_day(sysdate-8, 'SUNDAY'), 'YYYY-MM-DD')
and time.user_id=emp.user_id"]
set num_fte [database_to_tcl_string $db "select sum(time.percentage_time) / 100
from im_employees_active emp, im_employee_percentage_time time
where (time.percentage_time is not null and time.percentage_time > 0)
and (emp.start_date < sysdate)
and time.start_block = to_date(next_day(sysdate-8, 'SUNDAY'), 'YYYY-MM-DD')
and time.user_id=emp.user_id"]
if { [empty_string_p $num_fte] } {
set num_fte 0
}
set return_string "We have $num_employees [util_decode $num_employees 1 employee employees] ($num_fte full-time [util_decode $num_fte 1 $num_fte equivalent equivalents])"
if {$purpose == "web_display"} {
return "<blockquote>$return_string</blockquote>"
} else {
return "$return_string"
}