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.7.5 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.7.4 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.7.2 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.7.1 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.7.0 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.6.1 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.6.0 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.5.2 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.5.1 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.5.0 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.4.0 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.3.0 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.2.0 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.1.7 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.1.6 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.1.5 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.1.4 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.1.3 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.1.2 app/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.1.1 app/services/dorsale/billing_machine/quotation/statistics.rb