= page_header(t('.heading'))

= form_tag generate_report_timesheet_entries_path do
  .form-group
    label
      = t('.organisation')
      = select :report, :organisation_id, Organisation.order('name').map {|o| [ o.name, o.id ] }, {selected: params[:report] ? params[:report][:organisation_id] : nil}, class: 'form-control'
  .form-group
    label
      = t('.start_date')
      = date_select :report, :start, start_year: Date.today.year - 15, end_year: Date.today.year
  .form-group
    label
      = t('.end_date')
      = date_select :report, :end, start_year: Date.today.year - 15, end_year: Date.today.year
  .form-group
    = submit_tag t('.generate_report'), class: 'btn btn-primary'

- if @timesheet_entries
  p= "Total invoiced: #{number_to_currency(@timesheet_entries.select{|e|e.chargeable}.map{|e| e.invoice_value }.reduce(:+), unit: '£')}"
  = render 'timesheet_entries/table'

= page_header(t('.heading'))

= form_tag generate_report_timesheet_entries_path do
  .form-group
    label
      = t('.organisation')
      = select :report, :organisation_id, Organisation.order('name').map {|o| [ o.name, o.id ] }, {selected: params[:report] ? params[:report][:organisation_id] : nil}, class: 'form-control'
  .form-group
    label
      = t('.start_date')
      = date_select :report, :start, start_year: Date.today.year - 15, end_year: Date.today.year
  .form-group
    label
      = t('.end_date')
      = date_select :report, :end, start_year: Date.today.year - 15, end_year: Date.today.year
  .form-group
    = submit_tag t('.generate_report'), class: 'btn btn-primary'

- if @timesheet_entries
  - total_invoiced = @timesheet_entries.select{|e|e.chargeable}.map{|e| e.invoice_value }.reduce(:+)
  p= "Total invoiced: #{number_to_currency(total_invoiced, unit: '£')}"
  - hours = (@timesheet_entries.map{|e| e.minutes}.reduce(:+)/60.0).round(2)
  - per_hour = (total_invoiced / hours)
  p= "Total hours: #{hours} (#{number_to_currency(per_hour, unit: '£')} per hour)"
  = render 'timesheet_entries/table'

Include hours and per hour in report
Include hours and per hour in report

ianfleeton/yesl_info,ianfleeton/yesl_info,ianfleeton/yesl_info