homerun4711
19th January 2011, 08:10
Hello!
I am working on a small software to manage invoices and customers.
Now I am not sure which is the correct place to do some calculations and if the results should be stored within the SQLite database.
Some examples:
1.) If I add entries to an invoice (article number, article name, price/net, VAT,...) should I also add the total price (price/net + VAT) to the database?
2.) After finishing an invoice, should I add its total value and total VAT to the record that contains the rest of the invoice data (customer, date,...)?
3.) While adding an article I just take the values of QLineEdits (Quantity, VAT, Price one item) that send textChanged()-signals to re-calculate the value of another QLineEdit that contains the value of all-items-incl.VAT.
The calculation is done by using QVariant's toString and toDouble and afterwards the values are written into the QLineEdits and if the user klicks "Add Entry" the values are written from the QLineEdits to the database (converted to REAL).
But somehow I feel that this is not the correct way to do something like this...
Do you have some ideas how this is done the right way?
Kind regards,
HomeR
I am working on a small software to manage invoices and customers.
Now I am not sure which is the correct place to do some calculations and if the results should be stored within the SQLite database.
Some examples:
1.) If I add entries to an invoice (article number, article name, price/net, VAT,...) should I also add the total price (price/net + VAT) to the database?
2.) After finishing an invoice, should I add its total value and total VAT to the record that contains the rest of the invoice data (customer, date,...)?
3.) While adding an article I just take the values of QLineEdits (Quantity, VAT, Price one item) that send textChanged()-signals to re-calculate the value of another QLineEdit that contains the value of all-items-incl.VAT.
The calculation is done by using QVariant's toString and toDouble and afterwards the values are written into the QLineEdits and if the user klicks "Add Entry" the values are written from the QLineEdits to the database (converted to REAL).
But somehow I feel that this is not the correct way to do something like this...
Do you have some ideas how this is done the right way?
Kind regards,
HomeR