Sha256: 841c97a68ffb6f28f790da61a1f1e4a0552fe5e453b1366aa852421c7acb5e34
Contents?: true
Size: 1.45 KB
Versions: 9
Compression:
Stored size: 1.45 KB
Contents
module Logistics module Core class AirCargoLimit < ApplicationRecord belongs_to :chargeable_service_unit_of_charge belongs_to :transaction_type def self.get_chargeable_services(service_delivery_unit_id) unit_of_charge_id = UnitOfCharge.select(:id).where('code' => 'KG') csuocs = ChargeableServiceUnitOfCharge.where('service_delivery_unit_id' => service_delivery_unit_id, 'unit_of_charge_id' => unit_of_charge_id ) return csuocs end def self.generate_rate_for_air_cargo_services(effective_date) transaction_types = get_transaction_types service_delivery_units = get_delivery_units service_delivery_units.each { |sdu| transaction_types.each { |transaction_type| chargeable_services = get_chargeable_services(sdu.id) chargeable_services.each { |chargeable_service| air_cargo_rate = AirCargoLimit.where('transaction_type_id' =>transaction_type.id, 'chargeable_service_unit_of_charge_id' => chargeable_service.id) if air_cargo_rate.count == 0 AirCargoLimit.create('transaction_type_id' => transaction_type.id,'chargeable_service_unit_of_charge_id' => chargeable_service.id, 'lower_limit' => 0, 'upper_limit' => 0,'over_charge_rate' => 0,'effective_date' => effective_date) end } } } end end end end
Version data entries
9 entries across 9 versions & 1 rubygems