Exercise 2: Stock Keeping
On this page
erDiagram
product {
string name
string producer
decimal sale_price
int key PK "id_product"
}
management {
string name
int key PK "id_management"
}
management_journal {
int stock
decimal value
string label
int key PK "id_management_journal"
int id_management FK "id_management"
int id_product FK "id_product"
}
product one--many management_journal : has
management one--many management_journal : has
Description
Create an application to manage stock keeping for products. The application should keep track of products, their management, and journal entries for stock transactions.
Products have a name, producer, and sale price. Management entities are identified by name.
Each journal entry records stock entries and exits along with their values, linked to specific products and management entities.
Management journal labels can be “Entry” or “Exit”.
Tasks
product/management/management_journal: Add, Edit, Delete.
Create a catalog for entities: “product”, “management”.
Create event listeners for tables that needs validations (e.g., adding a product without a name, journal entry without stock values, etc., should not be allowed):
Add a new entity action at the journal level “Revert journal entry”:
- It will revert the stock values of a journal entry (it will create a new management journal entry with the opposite effects);
- A journal entry cannot be reverted if it results in negative stock → warning message.
Sales report: situation of sales over a period (total profit, management details).
Product sales report: situation of product sales over a period (total profit, product details).
Interval sales evolution report: track sales evolution per product on a specific interval.
Stock report: stock situation per management entity as of a specific date.
Management journal report: journal entries per each label and management entity.