Sha256: c6291a8916bc08580ba8623818d91dad75ac5d3ae74518eb16c586ad642bca1c

Contents?: true

Size: 1.87 KB

Versions: 2

Compression:

Stored size: 1.87 KB

Contents

class Admin::ClientAccountingController < ApplicationController
  include AdminLayoutHelper
  include ExtensibleObjectHelper

  active_scaffold :client do |config|
    config.label = "Accounts Ledger"
    
    config.create.link = nil
    config.update.link = nil
    config.delete.link = nil

    config.columns = [:company_name, :address1, :address2, :city, :state, :zip, :phone_number, :fax_number, :is_active, :uninvoiced_activities_balance, :balance, :created_at, :updated_at]
    
    config.columns[:balance].label = 'Outstanding Balance'
    
    config.columns[:is_active].label = 'Active?'
    
    config.list.columns = [:company_name, :uninvoiced_activities_balance, :balance]
    
    config.columns[:uninvoiced_activities_balance].label = 'Unposted Activity'
    config.columns[:uninvoiced_activities_balance].sort_by :sql => 'uninvoiced_activities_balance_in_cents'

    config.columns[:balance].sort_by :sql => 'balance_in_cents'
    
    config.list.sorting = [{:company_name => :asc}]

    config.create.columns = [:company_name, :address1, :address2, :city, :state, :zip, :phone_number, :fax_number ]
    config.update.columns = [:company_name, :address1, :address2, :city, :state, :zip, :phone_number, :fax_number, :is_active]

    config.nested.add_link "Invoices", :invoices
    config.nested.add_link "Payments", :payments
    config.nested.add_link "Labor Rates", :employee_client_labor_rates
    config.nested.add_link "Transactions", :client_financial_transactions

    config.full_list_refresh_on = [:update, :destroy]
  end
  
  def self.active_scaffold_controller_for(klass)
    # A hack since there's a view in use on this controller
    (klass == Invoice) ? Admin::InvoicesController : super(klass)
  end
  
  def conditions_for_collection
    ['is_active = ?', true]
  end

  def custom_finder_options
    {:from => 'clients_with_balances AS clients'}
  end

  handle_extensions
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
brisk-bills-0.8.2 app/controllers/admin/client_accounting_controller.rb
brisk-bills-0.8.1 app/controllers/admin/client_accounting_controller.rb