Sha256: 6743c96ff12001db8c862ec38fd9ea502fdc8d1859f388c4a9081392abfefc7d

Contents?: true

Size: 733 Bytes

Versions: 9

Compression:

Stored size: 733 Bytes

Contents

module Logistics
  module Core
    class FreightTonDemurrageRate < ApplicationRecord
      belongs_to :demurrage_rate_period
      belongs_to :transaction_type

      def self.generate_demurage_rate(rate_period_id, effective_date)
        transaction_types = get_transaction_types
        transaction_types.each { |tt|
          tdr = FreightTonDemurrageRate.where('transaction_type_id' => tt.id, 'demurage_rate_period_id' => rate_period_id)
          if tdr.count == 0
            FreightTonDemurrageRate.create('transaction_type_id' => tt.id, 'demurage_rate_period_id' => rate_period_id,
                                           'rate' => 0, 'effective_date' => effective_date)
          end
        }
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
logistics_core-21.11.2 app/models/logistics/core/freight_ton_demurrage_rate.rb
logistics_core-21.11.1 app/models/logistics/core/freight_ton_demurrage_rate.rb
logistics_core-21.08.1 app/models/logistics/core/freight_ton_demurrage_rate.rb
logistics_core-21.03.1 app/models/logistics/core/freight_ton_demurrage_rate.rb
logistics_core-20.10.3 app/models/logistics/core/freight_ton_demurrage_rate.rb
logistics_core-20.10.2 app/models/logistics/core/freight_ton_demurrage_rate.rb
logistics_core-20.10.1 app/models/logistics/core/freight_ton_demurrage_rate.rb
logistics_core-20.9.1 app/models/logistics/core/freight_ton_demurrage_rate.rb
logistics_core-20.8.1 app/models/logistics/core/freight_ton_demurrage_rate.rb