1

I've try to search this, but I haven't found it yet.
I have a case of payment online system.

Let's say I have an item named "A"
"A" stocks is 30
but, from the "A" stocks..
I buy 20 of "A" for $10 each from supplier
and the rest 10 of "A", I buy $15 each from supplier
and then I sell "A" $20 each

Now, How do I design the item table in the database for "A" so I able to count
the exact profit for "A"

am I have to input 2 row in "item" table which contain
"A.1" for $10 of capital and
"A.2" for $15 of capital

If that's the conclusion, that means..
When a customer buy "A" 25 pieces.
Then I have to decrease A.1 stock to 0
and A.2 to 5

Are you guys have a better solution from me ?
Sorry for my bad English and knowledge.

Ridho
  • 23
  • 3
  • A lot of your design will depend on how advanced you want the application to be. For a simple app you can store the purchase price in item, but since it will vary over time that's not a flexible design. You'll need a purchase history table if you really want to go for that. – Simon Verhoeven Mar 07 '16 at 09:21
  • I agree with the history table.I wonder how the big retail company do this stuff, are they use static prize or history table like you said. I don't know, I'm a newbie, but I've try to search this, everyone use static buy prize. anyway, thx for ur answer. – Ridho Mar 07 '16 at 17:40
  • Big retail companies use a purchase order system. – Simon Verhoeven Mar 09 '16 at 07:09
  • would you mind give me a short detail of purchase order system, I mean the ERD ?, pls – Ridho Mar 16 '16 at 08:30

0 Answers0