Click here to Skip to main content
15,888,802 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Quote:


I'm creating POS system for electronic shop (phones , computers ,xbox , phones covers , phone chargers ..., etc)

I have table in database called materials:

-MID
-MaterialBarCode
-category
-MaterialName
-QuantityAvailable
-boughtPrice
-SellingPrice
-profit
-DataMa
-Ml
-Invoices_ID
Every thing is good until now, my problem is:

how can I add phones to the materials when the phones have barcode number and also have IEMI number (unique number for every phone).

In this way I can't add the IEMI number to the materials because in this way I'll need to add every single phone in one record.

what is the best way to add the same phones in the same record like :

barcode ---- category ---- MaterialName ---- quantity
1111 ----------------- phones-------------------iphone x ---------------------------5

And add the IEMI number to each phone,



What I have tried:

Quote:
what I'm have now is another IEMI table :

-barcode
-IEMI
And every time the user inserts phones he will add the IEMI number for each phone from `datagridview``

what I have now is like this

materials table :

barcode ---- category ---- MaterialName ---- quantity
1111 phones iphone x 5
IEMI table:

barcode ---------- IEMI
1111 111111
1111 111112
1111 111113
1111 111114
1111 111115
But I think there is better way to do It. I need your suggestions ..thank you.
Posted
Updated 26-Oct-18 1:54am
v2

1 solution

It sounds like you are at the beginning of creating a complete tracking system, so your company can tell who they sold each IEMI to. Otherwise, why track individual IEMI numbers?

If that is the case, you will probably want to break your tables apart to fully normalize them. In this case, from your description, you will want something like the following tables:

- Category: ID, CategoryName

- Barcode: ID, BarcodeType

- MaterialsProduct: ID, ProductName, CategoryID, BarcodeID (of the barcode used for that product)

- Purchases: ID, SupplierID [ID from another table], PurchaseDate, MaterialID, Quantity, Price

- IEMIs: ID, PurchaseID, IEMI

- Sales: ID, IEMI_ID, Date, SalesPrice

...
You will also probably have a Customers table.

From the above, you could track a final IEMI back to the original purchase, unless I've missed anything.

Putting everything in one table, as you appear to have done based on your question phrasing, is a good learning experience, but quickly becomes totally unmanageable as you are realizing. It will lead to headache for you. Even though the above seems like a lot of work and learning, it is best to do so as soon as possible, to eliminate a ton of work in the end.

Good luck with it!

(PS - I renamed 'Materials' to 'Products,' as that better describes your meaning (unless I missed something else))
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900