Module: DoubleEntry::Reporting Private
- Extended by:
- Reporting
- Includes:
- Configurable
- Included in:
- Reporting
- Defined in:
- lib/double_entry/reporting.rb,
lib/double_entry/reporting/aggregate.rb,
lib/double_entry/reporting/day_range.rb,
lib/double_entry/reporting/hour_range.rb,
lib/double_entry/reporting/time_range.rb,
lib/double_entry/reporting/week_range.rb,
lib/double_entry/reporting/year_range.rb,
lib/double_entry/reporting/month_range.rb,
lib/double_entry/reporting/line_aggregate.rb,
lib/double_entry/reporting/aggregate_array.rb,
lib/double_entry/reporting/time_range_array.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Classes: Aggregate, AggregateArray, AggregateFunctionNotSupported, Configuration, DayRange, HourRange, LineAggregate, MonthRange, TimeRange, TimeRangeArray, WeekRange, YearRange
Instance Method Summary collapse
-
#aggregate(function, account, code, options = {}) ⇒ Money, Fixnum
private
Perform an aggregate calculation on a set of transfers for an account.
-
#aggregate_array(function, account, code, options = {}) ⇒ Array<Money, Fixnum>
private
Perform an aggregate calculation on a set of transfers for an account and return the results in an array partitioned by a time range type.
-
#reconciled?(account) ⇒ Boolean
private
This is used by the concurrency test script.
-
#scopes_with_minimum_balance_for_account(minimum_balance, account_identifier) ⇒ Array<Fixnum>
private
Identify the scopes with the given account identifier holding at least the provided minimum balance.
Methods included from Configurable
Instance Method Details
#aggregate(function, account, code, options = {}) ⇒ Money, Fixnum
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Perform an aggregate calculation on a set of transfers for an account.
The transfers included in the calculation can be limited by time range and provided custom filters.
69 70 71 |
# File 'lib/double_entry/reporting.rb', line 69 def aggregate(function, account, code, = {}) Aggregate.new(function, account, code, ).formatted_amount end |
#aggregate_array(function, account, code, options = {}) ⇒ Array<Money, Fixnum>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Perform an aggregate calculation on a set of transfers for an account and return the results in an array partitioned by a time range type.
The transfers included in the calculation can be limited by a time range and provided custom filters.
119 120 121 |
# File 'lib/double_entry/reporting.rb', line 119 def aggregate_array(function, account, code, = {}) AggregateArray.new(function, account, code, ) end |
#reconciled?(account) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This is used by the concurrency test script.
151 152 153 154 155 156 157 158 |
# File 'lib/double_entry/reporting.rb', line 151 def reconciled?(account) scoped_lines = Line.where(:account => "#{account.identifier}") scoped_lines = scoped_lines.where(:scope => "#{account.scope_identity}") if account.scoped? sum_of_amounts = scoped_lines.sum(:amount) final_balance = scoped_lines.order(:id).last[:balance] cached_balance = AccountBalance.find_by_account(account)[:balance] final_balance == sum_of_amounts && final_balance == cached_balance end |
#scopes_with_minimum_balance_for_account(minimum_balance, account_identifier) ⇒ Array<Fixnum>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Identify the scopes with the given account identifier holding at least the provided minimum balance.
136 137 138 139 140 141 142 143 |
# File 'lib/double_entry/reporting.rb', line 136 def scopes_with_minimum_balance_for_account(minimum_balance, account_identifier) select_values(sanitize_sql_array([" SELECT scope\n FROM \#{AccountBalance.table_name}\n WHERE account = ?\n AND balance >= ?\n SQL\nend\n", account_identifier, minimum_balance.cents])).map(&:to_i) |