Friends,

    I have this situation:
    My customers quote products and all products in the quote has a
separated cost. The sum of all cost for all products of a quote is the
price of product for this customer.

To map this scenario, I these tables:

a) customer
   id
   name

Example Date:
id | name
1  | Google
2  | IBM
3  | Oracle

b) products
   id
   internal_code
   description

Example Date:
id | internal_code | description
1  | A001               | Website
2  | A002               | CRM
3  | B001               | Mobile App

c) quotes
  id
  quote_date
  customer_id

Example Date:
id | quote_date | customer_id
1  | 2010-10-01 | 1
2  | 2010-10-02 | 2

d) quote_products
   id
   quote_id
   product_id

Example Date:
id | quote_id | product_id
1  | 1        | 3
2  | 1        | 2
3  | 1        | 1

e) product cost
   id
   quote_products_id
   human_cost
   external_cost
   total_cost

Example Date:
id | quote_products_id | human_cost | external_cost | total_cost
1  | 1                 | 2.00       | 5.00          | 7.00
2  | 2                 | 1.00       |                  | 1
3  | 3                 | 5.00       | 6.00          | 11.00

PS:
    For each item in quote_products table...I can have a record in the
table product_cost.
    And the SUM() of the all 'total_cost columns' grouped by
quote_products_id is the total value for a quote.
    For example, the cost of the quote in the date 2010-10-01 (id=01)
is $ 19.00

Then, How to implements this in a model in web.py ?

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to