Subject Re: [firebird-support] Best approach to storing suppliers' barcodes and map them to products in a database
Author Alexandre Benson Smith
Fidel Viegas wrote:
> Hi all,
>
> I have implemented a POS system a while ago, and now I have added
> support for barcodes. Since I had a field for the item code, I have
> used that to generate barcodes. I managed to get that working. But,
> unfortunately, the client wants to be able to insert into the system
> the barcodes that come with the products, and from what I could see
> each item has its own barcode. So, my question is what is the best
> approach to allow it to associate the items with the supplier's
> barcodes. Shall I create a table that will map the item id to the
> barcode? What would be the best approach to solve this problem?
>
> I look forward to hearing from your suggestions.
>
> Thanks in advance,
>
> Fidel.
>

That depends on your needs...

Take as an example a market, each product has a unique identifier (EAN13
bar code) that identify the product/supplier pair.

You could have a ketchup bottle from supplier A and B, perhaps in you
system you only have one product Ketchup, and does not have 2 distinct
records (and thereafter codes) for each supplier, if this is the case
you will need a 1:N table between your "generic" product and each
barcode for each supplier.

ProductID InternalCode Description
1 001.001 Ketchup
2 001.005 Mayonnaise

ProductID SupplierBarCode Supplier
1 7891008231007 A
1 7891234456890 B
1 7890987654321 C
2 7891008231008 A
2 7890987654320 C


If you have a distinct record on your table for each supplier, than you
only need a new column for the supplier barcode.

ProductID InternalCode Description SupplierBarCode
1 001.001 Ketchup (Supplier A) 7891008231007
2 001.005 Mayonnaise (Supplier A) 7891008231008
3 001.010 Ketchup (Supplier B) 7891234456890
4 001.015 Mayonnaise (Supplier C) 7890987654320
5 001.020 Ketchup (Supplier C) 7890987654321

see you !

--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br