D
D
Delphi1592016-11-07 18:43:25
Delphi
Delphi159, 2016-11-07 18:43:25

How to store the cost price and VAT of the goods in the database and store them at all?

There is a warehouse program.
Interbase 2009. There are Income and Outcome tables in the database.
Income(receipt):
Cost(cost),
Vat(vat),
IncomeDate(date of receipt),
Qty(quantity of receipt),
QtyCurr(quantity now).
For example, 01/11/2016, registered as a VAT payer. But at this point there are remnants of the old parishes. In old records that have balances for those goods that are subject to VAT, you need to change the cost and VAT numbers, for example, if the price was $ 2. and and was distributed as follows:
Cost-2; Vat-0
will now become
Cost-1.695; vat-0.305.
But then the profit from old sales (before 01/11/16) will be calculated incorrectly - instead of (sales.price-2) it will be (sales.price-1,695)!
What changes can be made in the database, and not in the queries, to get around this problem?
There are several options:
1. write off the old balance with 0 VAT and accept the same amount with VAT and a different cost?
But then 2 records will appear in the "header" table of incomes, and there was only one income.
2. add a table (VatVersion) with a time period to the database. that is, the final purchase price (InPrice), cost price and VAT will remain in the Income records table.
Income: Income_id,IncomeDate, cost, vat, Qty, InPrice...
VatVersion: id,StartDate, EndDate,VatPayable(0 or 1).
But then it turns out that on the old balances in Income I continue to store the goods at the old cost price and zero VAT!!!
3. Do not store the cost price and VAT in the database, but calculate it in the program. To do this, create a table with time periods and a taxation flag (spends-1, does not spend-0):
Income_Ex: In_id, VatPayable(0 or 1), StartDate, EndDate
Criticize these options and offer another solution if there is one.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question