diff --git a/app/models/venue_management_bill.rb b/app/models/venue_management_bill.rb index 565410e..6f0e283 100644 --- a/app/models/venue_management_bill.rb +++ b/app/models/venue_management_bill.rb @@ -73,10 +73,18 @@ class VenueManagementBill i = find_insert_index(days,delay_in_days) ref = JSON.parse(\"{\\\"annual_interest\\\": #{1/365.0},\\\"double_dividend\\\": #{1/2.0},\\\"daily_interest\\\": #{1/1.0}}\") if(days[i-1] < delay_in_days && interest_types[i-1] != undefined ){ - result = _interests[i - 1] * (delay_in_days * ref[interest_types[i-1]]).ceil() + if(interest_types[i-1] == 'double_dividend'){ + result = _interests[i - 1] * (delay_in_days * ref[interest_types[i-1]]).ceil() + }else{ + result = _interests[i - 1] * (delay_in_days * ref[interest_types[i-1]]) + } }else{ if(i != 1 && days[i-2] < delay_in_days && interest_types[i-2] != undefined ){ - result = _interests[i - 2] * (delay_in_days * ref[interest_types[i-2]]).ceil() + if(interest_types[i-2] == 'double_dividend'){ + result = _interests[i - 2] * (delay_in_days * ref[interest_types[i-2]]).ceil() + }else{ + result = _interests[i - 2] * (delay_in_days * ref[interest_types[i-2]]) + } }else{ result = 0 }