The price changes with time. You need to store how much each user paid
for the item at the time of sale. It is not just for promotions.

On Apr 26, 6:43 am, Stodge <[email protected]> wrote:
> Why not move the 'promotion' field out of the 'inventory' table into a
> new table? That way you don't have to store a promotion value for
> every item. You might also then need to add a reference to the
> promotion in the order. If that all makes sense.
>
> On Apr 24, 7:44 pm, JoshC <[email protected]> wrote:
>
>
>
>
>
>
>
> > good news! We have our model and are starting to work on the
> > controllers. Thanks for the advice.
>
> > db.define_table('users',
> > #    Field('id','string'), ID is implicit
> >     Field('first', 'string'),
> >     Field('last', 'string'),
> >     Field('address', 'string'),
> >     Field('email', 'string'),
> >     Field('pw', 'password'),
> >     Field('role', 'string'))
>
> > db.define_table('inventory',
> >     Field('item','string'),
> >     Field('type','string'),
> >     Field('price', 'decimal(9,2)'),
> >     Field('qty','integer'),
> >     Field('promotion','integer'))
>
> > db.define_table('cart',
> >     Field('uid', db.users),
> >     Field('item', db.inventory),
> >     Field('qty','integer'))
>
> > db.define_table('orders',
> >     Field('uid', db.users),
> >     Field('orderid', 'string'),
> >     Field('item', db.inventory),
> >     Field('qty','integer'),
> >     Field('date','date'),
> >     Field('status','string'),
> >     Field('total', 'decimal(9,2)'))
>
> > On Apr 24, 8:52 am, Stifan Kristi <[email protected]>
> > wrote:
>
> > > hi, josh
>
> > > please read the book first and keep your code dry (don't repeat yourself)
> > > and kis (keep it simple). if you want to build your application there are 
> > > a
> > > lot of samples on the book e.g.http://web2py.com/book/default/chapter/03
> > >  <http://web2py.com/book/default/chapter/03>and there are a lot of
> > > appliances too onhttp://web2py.com/appliances
> > >  <http://web2py.com/appliances>if you are new in web2py, welcome, i'll
> > > shared my course appliance code (please see attached file), you can 
> > > download
> > > it too on :http://web2py.com/appliances/default/show/76
> > > please focus first on models first, then controllers and then your views.
>
> > > On Sun, Apr 24, 2011 at 12:12 PM, JoshC 
> > > <[email protected]>wrote:
>
> > > > Dear Friends,
>
> > > > My partner and I are working on a small store website for a databases
> > > > class. I have found that there is a lot of information about Web2py on
> > > > the site and in the book. What I hope to find out from you guys is
> > > > some pointers to specific parts of the technology and parts of the
> > > > book that we will need to put this project together. In other words,
> > > > there's a lot of stuff in the book that we seem not to need.
>
> > > > On one hand, I'm not asking anyone to do our homework for us. On the
> > > > other, we can borrow code (like from existing apps, plugins, etc) as
> > > > long as we design the SQL part.
>
> > > > This leads to another question. We need to know how difficult it will
> > > > be on us since we need to do raw SQL to demonstrate our knowledge of
> > > > it (and the prof wasn't very clear on how raw it needs to be). Advice
> > > > on that is very helpful.
>
> > > > That's all. I'm just going to paste the relevant part of the
> > > > assignment below. Please feel free to help even if you only have
> > > > advice on one part.
>
> > > > Yours,
> > > > Josh Cason
> > > > ---------------------------
>
> > > > Objectives
> > > > The aim of this project is to implement a client-side database e-
> > > > commerce application. You may implement this in any language. You are
> > > > also responsible for setting up the server-side database. You are
> > > > required to team up with another student. Let’s assume that you have
> > > > been hired by Big Blue Nation gift store to set up an online store.
> > > > The company sells two types of products: books and toys.
>
> > > > Requirements
>
> > > > Your goal is to create an online store for the Big Blue Nation gift
> > > > store. There will be three types of users:
> > > >        • customers
> > > >        • staff
> > > >        • manager
>
> > > > Customers In order to purchase from the store, customers must first
> > > > register. Once they are registered, they query and purchase books or
> > > > toys. These items are first placed in a shopping basket, and then
> > > > ordered. Customers can see the status of orders (i.e., pending or
> > > > shipped).
> > > > Staff can check inventory, re-stock the online store with more
> > > > components, view all customer orders, and ship orders to customers. A
> > > > staff member has an on-line ID and a password that he/she can use to
> > > > login into the company’s website to perform the previous listed tasks
> > > > Manager can do all tasks a staff member can do. In addition, manager
> > > > can (1) view statistics about sale information (in the previous week,
> > > > month, or year), and (2) decide sales promotions. Manager needs to
> > > > login into the company’s website to perform the tasks.
>
> > > > Your project must include the following functionality:
>
> > > > Customer Forms
> > > >        Register Allows a new customer to register with the store.
> > > >        Shopping Allows a registered customer to list books or toys. The
> > > > purchased items may be stored in a shopping basket.
> > > >        Purchase Allows a registered customer to view their shopping 
> > > > basket
> > > > and click "Purchase". This creates an order for the items that can
> > > > then be viewed (and filled) by the store staff.  The staff cannot see
> > > > shopping baskets.
> > > >        Orders Allows a registered customer to view the orders they have
> > > > places and see the status (either Pending or Shipped).
>
> > > > Staff Forms
> > > >        Login Screen Staff must login in order to perform these 
> > > > functions. A
> > > > single login for all staff is fine.
> > > >        View Inventory See a list of all items and their quantity.
> > > >        Update Inventory Same as above, but with editable text boxes to
> > > > change the quantity of any component.
> > > >        Ship Pending Orders View the list of pending orders (components,
> > > > price, customer info).
> > > >        The staff member can click a "Ship It" button and, if all the
> > > > components are available, the status of the order changes from
> > > > "Pending" to "Shipped" and the quantities in the inventory are
> > > > decreased. If the components are not available, some error page
> > > > listing the missing components is generated and the order remains
> > > > "Pending".
>
> > > > Manager Forms
> > > >        Login Screen may use the staff login form
> > > >        View Inventory, Update Inventory, Ship Pending Orders: the same 
> > > > as
> > > > those of staff
> > > >        Sales Statistics View the list of all items and sales history in 
> > > > the
> > > > previous (week, month, or year)
> > > >        Sales Promotion View the list of all items and decide the 
> > > > promotion
> > > > rate.
>
> > >  course.zip
> > > 55KViewDownload

Reply via email to