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.1.0 app/services/dorsale/billing_machine/quotation/statistics.rb