8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'app/models/logistics/core/freight_ton_storage_rate.rb', line 8
def self.generate_storage_rate(rate_period_id, effective_date)
transaction_types = TransactionType.all
content_types = ContentType.all
transaction_types.each { |tt|
content_types.each { |ct|
fsr = FreightTonStorageRate.where('transaction_type_id' => tt.id, 'warehouse_rate_period_id' => rate_period_id,
'content_type_id' => ct.id)
if fsr.count == 0
FreightTonStorageRate.create('transaction_type_id' => tt.id, 'warehouse_rate_period_id' => rate_period_id,
'content_type_id' => ct.id,'rate' => 0, 'effective_date' => effective_date)
end
}
}
end
|