Class: LedgerDetailAccount
- Inherits:
-
LedgerAccount
- Object
- ActiveRecord::Base
- ApplicationRecord
- LedgerAccount
- LedgerDetailAccount
- Includes:
- Models::Auditable
- Defined in:
- app/models/ledger_detail_account.rb
Overview
== Schema Information
Table name: ledger_accounts
Database name: primary
id :integer not null, primary key
classification :string(255)
closed :boolean default(FALSE), not null
description :text
name :string(50) not null
number :integer not null
type :string(255) not null
visible :boolean default(TRUE), not null
created_at :datetime
updated_at :datetime
parent_id :integer
Indexes
idx_id_type (id,type)
idx_la_parent_id (parent_id)
index_ledger_accounts_on_number (number)
Constant Summary collapse
- VALID_CLASSIFICATIONS =
%w[supplier customer fixed_assets inventory].freeze
Constants included from Models::Auditable
Models::Auditable::ALWAYS_IGNORED
Instance Attribute Summary collapse
- #classification ⇒ Object readonly
Has many collapse
- #ledger_company_accounts ⇒ ActiveRecord::Relation<LedgerCompanyAccount>
- #tax_rates ⇒ ActiveRecord::Relation<TaxRate>
Methods inherited from LedgerAccount
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Models::Auditable
#all_skipped_columns, #audit_reference_data, #creator, #should_not_save_version, #stamp_record, #updater
Methods inherited from LedgerAccount
available, company_account_array, #requires_business_unit?, select_account, select_bank_balance_account, #summary_name, types_for_select
Methods included from Models::Lineage
#ancestors, #ancestors_ids, #children_and_roots, #descendants, #descendants_ids, #ensure_non_recursive_lineage, #family_members, #generate_full_name, #generate_full_name_array, #lineage, #lineage_array, #lineage_simple, #root, #root_id, #self_ancestors_and_descendants, #self_ancestors_and_descendants_ids, #self_and_ancestors, #self_and_ancestors_ids, #self_and_children, #self_and_descendants, #self_and_descendants_ids, #self_and_siblings, #self_and_siblings_ids, #siblings, #siblings_ids
Methods inherited from ApplicationRecord
ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation
Methods included from Models::EventPublishable
Instance Attribute Details
#classification ⇒ Object (readonly)
32 |
# File 'app/models/ledger_detail_account.rb', line 32 validates :classification, inclusion: { in: VALID_CLASSIFICATIONS, message: 'is not a valid classification', allow_nil: true } |
Class Method Details
.classifications_for_select ⇒ Object
34 35 36 |
# File 'app/models/ledger_detail_account.rb', line 34 def self.classifications_for_select [['Supplier (A/P)', 'supplier'], ['Customer (A/R)', 'customer'], ['Fixed Assets', 'fixed_assets'], %w[Inventory inventory]] end |
.readable_type ⇒ Object
38 39 40 |
# File 'app/models/ledger_detail_account.rb', line 38 def self.readable_type 'Detail' end |
.select_options ⇒ Object
42 43 44 |
# File 'app/models/ledger_detail_account.rb', line 42 def self. all.order(:number).pluck("concat(number, ' ', name)".sql_safe, :id) end |
Instance Method Details
#company_account_ids_for(company) ⇒ Object
50 51 52 |
# File 'app/models/ledger_detail_account.rb', line 50 def company_account_ids_for(company) ledger_company_accounts.where(company_id: company).pluck(:id) end |
#company_accounts_for(company) ⇒ Object
46 47 48 |
# File 'app/models/ledger_detail_account.rb', line 46 def company_accounts_for(company) ledger_company_accounts.where(company_id: company) end |
#ledger_company_accounts ⇒ ActiveRecord::Relation<LedgerCompanyAccount>
29 |
# File 'app/models/ledger_detail_account.rb', line 29 has_many :ledger_company_accounts |
#tax_rates ⇒ ActiveRecord::Relation<TaxRate>
30 |
# File 'app/models/ledger_detail_account.rb', line 30 has_many :tax_rates |