A
A
Alexander Pankov2020-01-19 09:33:38
Database design
Alexander Pankov, 2020-01-19 09:33:38

How to build a delivery architecture in an online store?

How to organize the storage architecture to implement the following features:
Given:
1) there is a list of products
2) each product has a cost price, price1, price2, price3, stock balance (all these parameters are now stored in one row of the table, we have a table " goods", and in it the columns "name", "pictures", "description" .... etc.)
It is necessary to make a current feature:
in different months there should be a different cost of goods, for example, in the next batch of 500 pieces, the cost will be 1000 rubles , and now the balance in the warehouse is 12 pieces and they have a cost price of 920 rubles, how can I store and sell all this?
and the most interesting thing is that when starting a new batch
(as I imagine it is a table with a product id, cost price, date)
the old balance should be "sold" at the old cost until we run out
of those we have a chocolate bar in the table and its price \ cost \ balance is 100 \ 40 \ 12, respectively
, we must somehow indicate that a batch of 1000 pieces of these chocolates has arrived at the warehouse, but their cost is no longer 40, but 45.
And the old 12 chocolates should be sold at 100 rubles with a cost of 40 (according to the old parameters), and as soon as they run out, chocolates from a new batch with a cost of 45 should be sold, how to record all this in reports?
now reports are built by krone, in the order there is a link to the product ID, (product\price\qty\date that's the whole table), at night krone is launched and we will recalculate parameters important for business, passing through orders..
how and what should I store now in order to understand that order No. 999 was at the old cost, and order No. 1000 was already at the new one, and No. 1001 at the third?
I thought of somehow introducing the essence of the delivery, where to fill in which catalog product in what quantity and at what price arrived at the warehouse, but here's how I can take into account that "we sell the rest of 10 pieces at the old cost price and only then sales come from the new batch at the new cost price "?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question