Sha256: f1d348a1e1b1ce19719a2d06a59839c2d711db206c9144708798bb4909d54e73

Contents?: true

Size: 670 Bytes

Versions: 4

Compression:

Stored size: 670 Bytes

Contents

module Skr

    # A pay
    class PaymentTerm < Skr::Model

        has_code_identifier

        def discount
            @discount_percnum ||= Numbers::PercNum.new( read_attribute('discount_amount') )
        end

        def discount_amount=(value)
            @discount_percnum = nil
            super(value)
        end

        def immediate?
            self.days.nil? || self.days.zero?
        end

        def discount_expires_at( start_date = Date.today )
            ( start_date + self.discount_days.days ).to_date
        end

        def due_date_from( start_date = Date.today )
            ( start_date + self.days.days ).to_date
        end

    end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
stockor-0.5.0 lib/skr/models/payment_term.rb
stockor-0.4.0 lib/skr/models/payment_term.rb
stockor-0.3.0 lib/skr/models/payment_term.rb
stockor-0.2 lib/skr/models/payment_term.rb