Sha256: 23759ce4cec86f62d7745ba8a4f200943dcba827cdd27cd520c83e43c2f1cbbd

Contents?: true

Size: 754 Bytes

Versions: 5

Compression:

Stored size: 754 Bytes

Contents

class Admin::PayrollController < ApplicationController

  def index
    @users = User.with_unpaid_work_units
    @work_units = WorkUnit.unpaid
  end

  def show
    @user = User.find(params[:id])
    @work_units = @user.work_units.unpaid
    redirect_to admin_payroll_index_path, :notice => "All payroll is filled for user " + @user.to_s unless @work_units.size > 0
    @clients = @work_units.collect { |wu| wu.client }.uniq
  end

  def update
    params[:work_unit].each do |key, value|
      if key =~ /\d+/
        unless value.blank?
          work_unit = WorkUnit.find(key.to_i)
          if work_unit
            work_unit.update_attributes(:paid => value)
          end
        end
      end
    end

    redirect_to admin_payroll_path
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
xrono-1.0.4 app/controllers/admin/payroll_controller.rb
xrono-1.0.3 app/controllers/admin/payroll_controller.rb
xrono-1.0.2 app/controllers/admin/payroll_controller.rb
xrono-1.0.1 app/controllers/admin/payroll_controller.rb
xrono-1.0.0 app/controllers/admin/payroll_controller.rb