Sha256: 9f99cedf760729f14f54d6ec83b0a1652ace6b578ec3642a732daaa2c5518ba9

Contents?: true

Size: 719 Bytes

Versions: 1

Compression:

Stored size: 719 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)
      .compact
      .sum
  end

  def vat_amount
    @vat_amount ||= @quotations
      .where.not(state: "canceled")
      .pluck(:vat_amount)
      .compact
      .sum
  end

  def total_including_taxes
    @total_including_taxes ||= @quotations
      .where.not(state: "canceled")
      .pluck(:total_including_taxes)
      .compact
      .sum
  end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dorsale-4.0.0 app/services/dorsale/billing_machine/quotation/statistics.rb