Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Rohin Kansal
PLUS
Rohin Kansal
Courses Plus Student 642 Points

Inventory System in PHP?

Hi I am looking for an free inventory system in which I can keep records of sales and updates of the stock. I want multiple branch facility in it. I want it to be online.

Can you please help me know about it? Thanks

What you are describing can be done with php and sql quite easily. Can you provide more specifics on the actual functionality you want though? Do you only want to add, update and delete the records? Would you need the user to login first to do this? What kind of pages would you want the system to have? etc..

Describe as much as possible and I'll be happy to assist.

Rohin Kansal
Rohin Kansal
Courses Plus Student 642 Points

Hi Thanks! <p> I need an inventory system that has three levels: <ol> <li>1. Super Admin</li> <li>2. Admin</li> <li>3. Users</li> </ol> </p> Functionality: <ol> <li>

  1. The Admin and Super Admin should be able to track the sales and purchases and the stock details. </li> <li>2. The data report should be downloadable in excel and pdf format. </li> <li>3. The income report should be in the form of graphs that can be filtered on daily basis, weekly monthly, yearly ,lifetime and custom time. </li> <li>4. The super admin should also be able to update the discounts and all through it. </li> </ol> Till now I need just this thing.

So it looks like you need 2 or 3 tables in your database. One to store the users and their user-level. And 2 more to store the graph-data: 1 to store the info of the graph (graph name, x-axis name, y-axis name, etc), and 1 to store the "points" or dots of the graph. A good approach to this is to use a BCNF table with foreign keys.

The actual system would need a login system. If you want a secure and complete login, you can get the code and instructions here: http://www.wikihow.com/Create-a-Secure-Login-Script-in-PHP-and-MySQL

To render the graphs, I recommend Google Charts. It's free and really awesome.

Rohin Kansal
Rohin Kansal
Courses Plus Student 642 Points

Can you please elaborate how to create graph data tables? I am newbie so I am little bit confused.

check Answer below :)

3 Answers

When dealing with data that is nested inside other data I create 2 tables that are in BCNF and have the 2nd table use a foreign key to reference the first one.

For example, if you need wanted to make a system to store Actors and all the Movies they have starred in, you shouldn't store that information in 1 table. Tables are good for storing single-data entries for a given entity, for example an actors first name, last name, age, date of birth, etc. Basically stuff actors only can have 1 of (you can't have more than 1 age/name/etc). Sure, you could also make a column "movie", but that would only store 1 movie. So if the Actor has starred in 50 movies you'll end up with a messy table with 50 "movie-name" columns, and if you want to add the 51st you would have to go and edit the structure. -- not a good approach.

Another alternative would be to store all movies into just 1 column and separate them by commas and then when you load the data just split whenever a comma is encountered. But what do you do if you also want to save a movies release date, genre, imdb rating, etc? You get another problem...

So the best way, in my opinion, to solve this is by making 2 tables. Like this:

  ACTORS (id, first_name, last_name, age, country_of_residence)

--pretty straight-forward. The id is just a unique identifier that counts from 0 for each entry you add.

  MOVIES (id, actor_id, movie_name, release_date, genre, rating)

--as before the id here is a unique id for the movie. The actor_id points to the id of the ACTOR table and as such "links them" in a way. (Let's assume that we only save the protagonist of the movie, and not all actors).

When creating the MOVIES table, you need to make the actor_id a foreign-key (a reference basically). Also have the MOVIES table on update cascade and on delete cascade - this will update/delete all movies if their Actor has been updated/deleted.

So similarly for your program, you would have 1 table to save data about each graph (name, x-axis label, y-axis label, and any settings it may have), and another to store the "dots" on each graph which has a foreign-key pointing in which graph each dots "belongs to". (So if you delete Leonardo Di Caprio - the movie Titanic will also get deleted automatically - preventing accidental "stray" movies).

Read more about Foreign Keys here and how to create such table: http://www.w3schools.com/sql/sql_foreignkey.asp If you do some research on google, you'll find a ton of info.

Hope this makes sense. :)

Rohin Kansal
Rohin Kansal
Courses Plus Student 642 Points

I will try my best and get back to you if any problem occurs.

Thank You :)

you could also install free word press plugins or a full on open source shopping systems such as Magento, OScommerce (I believe).. google free shopping software or something for the

Rohin Kansal
PLUS
Rohin Kansal
Courses Plus Student 642 Points

shez azr, These doesnot pass my requirements. I dont want an ecommerce site.