Sha256: 56f668b3a15076a84f499195a56ff94920a0607d86a6ce7778dadd1379ae666f

Contents?: true

Size: 481 Bytes

Versions: 7

Compression:

Stored size: 481 Bytes

Contents

module PolishInvoicer
  class Vat
    def self.rates
      (0..27)
    end

    def self.valid?(rate)
      return true if zw?(rate)
      rates.include?(rate)
    end

    # Czy stawka VAT to "zwolniony"?
    def self.zw?(rate)
      rate == -1 # -1 oznacza zwolniony z VAT
    end

    def self.to_s(rate)
      return 'zw.' if zw?(rate)
      "#{rate}%"
    end

    # Potrzebne do obliczeń netto/vat/brutto
    def self.to_i(rate)
      zw?(rate) ? 0 : rate
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
polish_invoicer-0.0.26 lib/polish_invoicer/vat.rb
polish_invoicer-0.0.25 lib/polish_invoicer/vat.rb
polish_invoicer-0.0.24 lib/polish_invoicer/vat.rb
polish_invoicer-0.0.23 lib/polish_invoicer/vat.rb
polish_invoicer-0.0.22 lib/polish_invoicer/vat.rb
polish_invoicer-0.0.21 lib/polish_invoicer/vat.rb
polish_invoicer-0.0.20 lib/polish_invoicer/vat.rb