Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class LineItem < ActiveRecord::Base
- belongs_to :quote
- belongs_to :part
- def calculate_price_from_gmpercent
- update_attribute(:price, self.part.cost/(1-self.gmpercent))
- end
- def set_gmpercent(gmtarget)
- update_attribute(:gmpercent, [gmtarget, 1-(self.part.cost/self.part.listprice)].min)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement