How to implement product returns?

1

I'm having difficulty implementing a requirement in database modeling, this requirement corresponds to product returns.

This is the scenario where returns and different ways of returning products occur:

  • Customer buys only one product and returns it ;
  • Customer buys two or more products and returns only one of them ;
  • Customer purchases a Kit containing several products and returns the Kit integer ;
  • Customer purchases a Kit containing several products and returns some products of this Kit ;

I created an example to illustrate the modeling of the sales module, so that you understand the logic, it follows the image:

The diagram above illustrates how my database is in relation to product sales, but I did not put all the fields if it was not going to contain a lot of information making it difficult to understand, but the logic is this, I also did not put the Sales and Customer , but both are related to the Sales table.

You will need to register the following return information :

    Developed products or Kits ;

  • The customer responsible for the return ;

  • The seller to whom the customer returned the product (s) ;

  • The corresponding sale ;

  • Return Time and Date ;

The id_kit field in the Item table may contain 0 (null) values, this table may represent an Item as the product of the sale or a Kit as a product. p>

With the information above how can I model the table (s) corresponding to product returns?

    
asked by anonymous 16.01.2016 / 17:40

1 answer

2

I believe that modeling returns should be thought about products, also because the customer can return a product from a kit today and after a few days return another product from the same kit. That way, when the customer returns an entire kit, all products of the kit must be registered as returned separately. Also for stock control. If the product does not have a kit in the return table the reference column will be null.

Table example:

Returns

id_devolucao - id_item - table column ITEM that already had the sales reference;
id_cliente - who returned,
id_vendedor - o
id_produto - the product returned,
id_kit - if you have a kit,
dthr_devolucao

    
16.01.2016 / 19:24