8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'app/models/logistics/core/break_bulk_demurrage_rate.rb', line 8
def self.generate_demurage_rate(rate_period_id, effective_date)
transaction_types = get_transaction_types
break_bulk_units = get_break_bulk_units
transaction_types.each { |tt|
break_bulk_units.each{ |bb|
bdr = BreakBulkDemurrageRate.where('transaction_type_id' => tt.id, 'demurage_rate_period_id' => rate_period_id,
'break_bulk_unit_id' => bb.id)
if bdr.count == 0
BreakBulkDemurrageRate.create('transaction_type_id' => tt.id, 'demurage_rate_period_id' => rate_period_id,
'break_bulk_unit_id' => bb.id, 'rate' => 0, 'effective_date' => effective_date)
end
}
}
end
|