Module: Admin::EmployeeClientLaborRatesHelper
- Defined in:
- app/helpers/admin/employee_client_labor_rates_helper.rb
Instance Method Summary collapse
- #employee_client_labor_rate_client_form_column(record, options) ⇒ Object
- #employee_client_labor_rate_employee_form_column(record, options) ⇒ Object
- #employee_client_labor_rate_hourly_rate_column(record) ⇒ Object
- #employee_client_labor_rate_hourly_rate_form_column(record, options) ⇒ Object
Instance Method Details
#employee_client_labor_rate_client_form_column(record, options) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'app/helpers/admin/employee_client_labor_rates_helper.rb', line 44 def employee_client_labor_rate_client_form_column(record, ) unavail_emps = nil if record.employee_id clr_conditions = ['employee_id = ?',record.employee_id] if record.client_id clr_conditions[0] << ' AND client_id != ?' clr_conditions << record.client_id end unavail_emps = EmployeeClientLaborRate.find( :all, :select => 'client_id', :conditions => clr_conditions ).collect { |clr| "(id != %d)" % clr.client_id } end select_tag( [:name], ( (Client.find( :all, :select => 'id, company_name', :conditions => (!unavail_emps.nil? and unavail_emps.length > 0) ? "(%s)" % unavail_emps.join(' AND ') : nil, :order => 'company_name ASC' ).collect {|c| [ c.company_name, c.id ] })+[['(Select Client)',nil]], record.client_id ), {:id => 'record_client'} ) end |
#employee_client_labor_rate_employee_form_column(record, options) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/helpers/admin/employee_client_labor_rates_helper.rb', line 11 def employee_client_labor_rate_employee_form_column(record, ) unavail_clients = nil if record.client_id clr_conditions = ['client_id = ?',record.client_id] if record.employee_id clr_conditions[0] << ' AND employee_id != ?' clr_conditions << record.employee_id end unavail_clients = EmployeeClientLaborRate.find( :all, :select => 'employee_id', :conditions => clr_conditions ).collect { |clr| "(id != %d)" % clr.employee_id } end select_tag( [:name], ( (Employee.find_active( :all, :select => 'id, first_name, last_name', :conditions => (!unavail_clients.nil? and unavail_clients.length > 0) ? "(%s)" % unavail_clients.join(' AND ') : nil, :order => 'last_name ASC, last_name ASC' ).collect {|e| [ e.name, e.id ] })+[['(Select Employee)',nil]], record.employee_id ), {:id => 'record_employee'} ) end |
#employee_client_labor_rate_hourly_rate_column(record) ⇒ Object
3 4 5 |
# File 'app/helpers/admin/employee_client_labor_rates_helper.rb', line 3 def employee_client_labor_rate_hourly_rate_column(record) h "$%0.2f" % record.hourly_rate end |
#employee_client_labor_rate_hourly_rate_form_column(record, options) ⇒ Object
7 8 9 |
# File 'app/helpers/admin/employee_client_labor_rates_helper.rb', line 7 def employee_client_labor_rate_hourly_rate_form_column(record, ) text_field_tag [:name], "%0.2f" % ((@record.hourly_rate) ? @record.hourly_rate : 0), :size => 10, :id => 'record_hourly_rate' end |