Help with pricing

Looking for some advice with my app.
I’ve got it to a stage where I’m happy but I need to do a more
“programmy” type thing and I’d very much appreciate some advice.

It’s a language school. They have Courses.

Each course has a price plan associated with it which has things like
price1 (price for 1 to 2 weeks) price2 (price for 3 to 4 weeks) price3
etc as well as exam_fee and reg_fee. Means I can do things like…


It’s all working nicely, but I want to solve the problem below.

We have an enquiry form, the enquiror selects the “Course” and the
duration of their stay (just an integer 1 to 52 weeks).

I’m trying to figure out how to elegantly (and easily) link the duration
and the price plan and store the resulting total price in the enquiry
record for archival (I also email an invoice to the enquiror). So price1
is for example 1-2 weeks, price2 for 3-4 weeks.

I think I’ve done it right so far, don’t want to slip up now.

I figure on something in the create method for the enquiry that computes
the total price and stores it in a new field called “total-price” in
that record…

any tips, expecially how to handle the computation of the price and
storage of it and where to do it?



Anyone ?