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,
lib/double_entry/reporting/line_aggregate_filter.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, LineAggregateFilter, MonthRange, TimeRange, TimeRangeArray, WeekRange, YearRange
Instance Method Summary collapse
-
#aggregate(function, account, code, range, 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, range, 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.
81 82 83 |
# File 'lib/double_entry/reporting.rb', line 81 def aggregate(function, account, code, range, = {}) Aggregate.formatted_amount(function, account, code, range, ) 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.
131 132 133 |
# File 'lib/double_entry/reporting.rb', line 131 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.
163 164 165 166 167 168 169 170 |
# File 'lib/double_entry/reporting.rb', line 163 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.
148 149 150 151 152 153 154 155 |
# File 'lib/double_entry/reporting.rb', line 148 def scopes_with_minimum_balance_for_account(minimum_balance, account_identifier) select_values(sanitize_sql_array([<<-SQL, account_identifier, minimum_balance.cents])).map(&:to_i) SELECT scope FROM #{AccountBalance.table_name} WHERE account = ? AND balance >= ? SQL end |