Class: Dorsale::BillingMachine::Invoice::Statistics
- Inherits:
-
Object
- Object
- Dorsale::BillingMachine::Invoice::Statistics
- Defined in:
- app/services/dorsale/billing_machine/invoice/statistics.rb
Instance Attribute Summary collapse
-
#invoice ⇒ Object
Returns the value of attribute invoice.
Instance Method Summary collapse
-
#initialize(invoices) ⇒ Statistics
constructor
A new instance of Statistics.
- #t(*args) ⇒ Object
- #total_excluding_taxes ⇒ Object
- #total_including_taxes ⇒ Object
- #vat_amount ⇒ Object
Constructor Details
#initialize(invoices) ⇒ Statistics
Returns a new instance of Statistics.
4 5 6 |
# File 'app/services/dorsale/billing_machine/invoice/statistics.rb', line 4 def initialize(invoices) @invoices = invoices end |
Instance Attribute Details
#invoice ⇒ Object
Returns the value of attribute invoice.
2 3 4 |
# File 'app/services/dorsale/billing_machine/invoice/statistics.rb', line 2 def invoice @invoice end |
Instance Method Details
#t(*args) ⇒ Object
29 30 31 |
# File 'app/services/dorsale/billing_machine/invoice/statistics.rb', line 29 def t(*args) ::Dorsale::BillingMachine::Invoice.t(*args) end |
#total_excluding_taxes ⇒ Object
8 9 10 11 12 13 |
# File 'app/services/dorsale/billing_machine/invoice/statistics.rb', line 8 def total_excluding_taxes @total_excluding_taxes ||= @invoices .pluck(:total_excluding_taxes) .delete_if(&:blank?) .sum end |
#total_including_taxes ⇒ Object
22 23 24 25 26 27 |
# File 'app/services/dorsale/billing_machine/invoice/statistics.rb', line 22 def total_including_taxes @total_including_taxes ||= @invoices .pluck(:total_including_taxes) .delete_if(&:blank?) .sum end |
#vat_amount ⇒ Object
15 16 17 18 19 20 |
# File 'app/services/dorsale/billing_machine/invoice/statistics.rb', line 15 def vat_amount @vat_amount ||= @invoices .pluck(:vat_amount) .delete_if(&:blank?) .sum end |