Subject Re: [firebird-support] Invoice Detail: Design / Normalization
Author Fulvio Senore
Il 23/09/2014 22:48, shg_sistemas@... [firebird-support] ha
scritto:
>
>
> Hello, I've posted this question in the "general" but the moderator told
> me it's a "support" question. So here I go again!
>
> It's a design / normalization question: How to save Invoice detail
> correctly?
>
> Each line on the invoice detail has its FK pointing to the Article's ID,
> but sometimes the user needs to modify or add some text to the article
> description just for that invoice. Or sometimes he/she needs to insert a
> "free" line (pointing to no article at all) just filling the description.
>
> So my "big" doubt is: Is this a case for "denormalization" ? Should I
> add a "description" field to the invoice detail (and 90% of the time
> having exactly the same description of the article's table!!)
>
> Or should I have the "description" field in a separate table. In this
> case I don't imagine how to update that table, as the user enters the
> data in a DBGrid (I work with Delp hi / IBDac)
>
> I hope I'm clear with my question!
>
> Thanks!
>

I keep a "description" column in the invoice details. If the user
chooses an article I copy the article's description. If the user wants a
free line he can simply write what he wants.

There is another reason for doing things in this way: if you print again
the invoice at a later time the printed output must be the same ad
before. If the users change the article's description the description in
the invoice must not change, so you need an autonomous description in
the invoice.

Fulvio Senore