9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'app/models/logistics/core/break_bulk_storage_rate.rb', line 9
def self.generate_storage_rate(rate_period_id, effective_date)
transaction_types = TransactionType.all
break_bulk_units = BreakBulkUnit.all
content_types = ContentType.all
transaction_types.each { |tt|
break_bulk_units.each{ |bb|
content_types.each { |ct|
bsr = BreakBulkStorageRate.where('transaction_type_id' => tt.id, 'warehouse_rate_period_id' => rate_period_id,
'break_bulk_unit_id' => bb.id, 'content_type_id' => ct.id)
if bsr.count == 0
BreakBulkStorageRate.create('transaction_type_id' => tt.id, 'warehouse_rate_period_id' => rate_period_id,
'content_type_id' => ct.id,
'break_bulk_unit_id' => bb.id, 'rate' => 0, 'effective_date' => effective_date)
end
}
}
}
end
|