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 = {}) ⇒ Object
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 = {}) ⇒ Object
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.
62 63 64 |
# File 'lib/double_entry/reporting.rb', line 62 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.
105 106 107 |
# File 'lib/double_entry/reporting.rb', line 105 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.
135 136 137 138 139 140 141 |
# File 'lib/double_entry/reporting.rb', line 135 def reconciled?(account) scoped_lines = Line.where(:account => "#{account.identifier}", :scope => "#{account.scope}") 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.
121 122 123 124 125 126 127 128 |
# File 'lib/double_entry/reporting.rb', line 121 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 {|scope| scope.to_i } |