Sha256: a341bc3f49fc2ea27d7c1835ae4a0604486e0156684ceac9c200d89cd06dd368
Contents?: true
Size: 1.42 KB
Versions: 9
Compression:
Stored size: 1.42 KB
Contents
module Logistics module Core class BreakBulkRate < ApplicationRecord belongs_to :chargeable_service_unit_of_charge belongs_to :transaction_type def self.get_chargeable_services_for_service_delivery_unit(service_delivery_unit_id) unit_of_charge_id = UnitOfCharge.select(:id).where('code' => 'FT') 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_break_bulk(effective_date) service_delivery_units = ServiceDeliveryUnit.all transaction_types = TransactionType.all service_delivery_units.each { |sdu| transaction_types.each { |tt| chargeable_services = get_chargeable_services_for_service_delivery_unit(sdu.id) chargeable_services.each { |cs| service_delivery_unit_rate = BreakBulkRate.where('chargeable_service_unit_of_charge_id' => cs.id, 'transaction_type_id' => tt.id) if service_delivery_unit_rate.count == 0 BreakBulkRate.create('chargeable_service_unit_of_charge_id' => cs.id, 'transaction_type_id' => tt.id, 'low' => 0, 'medium' => 0, 'high' => 0 , 'margin' => 0,'effective_date' => effective_date) end } } } end end end end
Version data entries
9 entries across 9 versions & 1 rubygems