I'm designing the database for a products rental. I'm using Laravel 8 framework.
I live in a country where prices changes all the time.
The rental order require a quote generated by the client. The prices are stored but not listed in the user view, they are only for reference in the admin order quote generator view. The client wants to be able to change the price for each quote before sending it as their specific client may need special treatment.
So, summing up, I need:
- To store a record for the price of a specific order quote.
- To store a base price and a history record of this price.
- To be able to list the available products in between two dates filtered by the status of the order, which will change until the final approval of the quote. Also filtered by the stock available.
- Have additional costs associated to the specific order.
- Different total price for deferred payment.
This is what I came up to, I have a table for:
- Orders
- Products
- Order_Product (this name format is required by laravel's eloquent)
- Products_Prices
- Additionals
- Orders_statuses
- In the order_product table I'm planning to store the price defined for the client, and the count of rented products. Also foreign keys for a many-to-many between products and orders.
- In the order I'm planning to store the "pickup" and "return dates to query first WHERE "orders with approved status" BETWEEN the two dates selected by the user. Finally get order_products with a NOT IN to display the available products.
- The products_prices table I use it to store the changes record.
- In the products table I have availability because the product may not be available for rent for many reasons for a period. Stock and colors that I will use for ordering the list because of a requirement from the client so I go first for primary color, secondary and tertiary afterwards.
I'm not sure if this is the most efficient way to achieve what I'm looking for. Since I will need to check products availability all the time I need to be sure that this is the fastest and more reliable one.
I'm not english speaker so I feel the need to clarify this:
- The client = My client.
- User = My client's client.
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire