im_customers_bids_out db { coverage " " } { report_date " " } { purpose " " }What it does:
Returns a string that gives a list of bids given out to customersDefined in: /web/philip/tcl/intranet-status-report-defs.tcl
Source code:
set selection [ns_db select $db "select g.group_id, g.group_name, to_char(c.status_modification_date, 'Mon DD, YYYY') as bid_out_date, u.first_names||' '||u.last_name as contact_name, u.email, decode(uc.work_phone,null,uc.home_phone,uc.work_phone) as contact_phone from user_groups g, im_customers c, users_active u, users_contact uc where g.parent_group_id=[im_customer_group_id $db] and g.group_id=c.group_id and c.primary_contact_id=u.user_id(+) and c.primary_contact_id=uc.user_id(+) and c.customer_status_id=(select customer_status_id from im_customer_status where upper(customer_status) = 'BID OUT') order by lower(group_name)"] set return_list [list] while {[ns_db getrow $db $selection]} { set_variables_after_query if {$purpose == "web_display"} { lappend return_list "<a href=[im_url_stub]/customers/view.tcl?[export_url_vars group_id]>$group_name</a>, $bid_out_date[util_decode $contact_name " " "" ", $contact_name"][util_decode $email "" "" ", <a href=mailto:$email>$email</a>"][util_decode $contact_phone "" "" ", $contact_phone"]" } else { lappend return_list "$group_name, $bid_out_date[util_decode $contact_name " " "" ", $contact_name"][util_decode $email "" "" ", $email"][util_decode $contact_phone "" "" ", $contact_phone"]\n" } } if {[llength $return_list] == 0} { return "No bids out. \n" } if {$purpose == "web_display"} { return "<ul><li>[join $return_list "<li>"]</ul>" } else { return "\n[join $return_list "\n"] " }