Sha256: 24a0bf31878de68203abb4000b00a3ba324b56a9026c81a466e4462391b0a71a

Contents?: true

Size: 755 Bytes

Versions: 61

Compression:

Stored size: 755 Bytes

Contents

class Dorsale::BillingMachine::Quotation::Statistics
  attr_accessor :quotation

  def initialize(quotations)
    @quotations = quotations
  end

  def total_excluding_taxes
    @total_excluding_taxes ||= @quotations
      .where.not(state: "canceled")
      .pluck(:total_excluding_taxes)
      .delete_if(&:blank?)
      .sum
  end

  def vat_amount
    @vat_amount ||= @quotations
      .where.not(state: "canceled")
      .pluck(:vat_amount)
      .delete_if(&:blank?)
      .sum
  end

  def total_including_taxes
    @total_including_taxes ||= @quotations
      .where.not(state: "canceled")
      .pluck(:total_including_taxes)
      .delete_if(&:blank?)
      .sum
  end

  def t(*args)
    ::Dorsale::BillingMachine::Quotation.t(*args)
  end
end

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
dorsale-3.20.0 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.19.1 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.19.0 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.18.0 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.17.0 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.16.0 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.15.0 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.14.11 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.14.10 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.14.9 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.14.8 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.14.7 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.14.6 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.14.5 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.14.4 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.14.3 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.14.2 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.14.1 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.14.0 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.13.0 app/services/dorsale/billing_machine/quotation/statistics.rb