T
T
Timur Kalimullin2015-08-05 14:45:24
Database
Timur Kalimullin, 2015-08-05 14:45:24

How to properly organize a database for accounting for the transfer of funds between accounts?

Good afternoon,
there is a database that contains records with account transactions: income, expense
structure:
id | type | account | money | date |
type - type of operation (debit, credit)
account - from which account
money - how much
the task was to make the third type of operation, transfer from one account to another
if you don’t think it over well, I suspect that there will be many problems that will affect, for example, reports transactions and accounts.
Suppose we transfer 10,000 from the "Bank" account to the "Card" account.
What algorithm should be applied?
If you write off 10,000 from the bank and add 10,000 to the Card, then the reports will not be correct.
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan, 2015-08-05
@LiguidCool

Transactions ? Well, it would be nice to log transactions / operations.

A
Alexey Skahin, 2015-08-05
@pihel

Usually, operations are a directory.
Entries can be generated by documents, a receipt document, an expense document and a transfer document, which, when posting, generates 2 receipt and expense records.
In the reference book of operations, a link is made to a document from which, in which case, you can pull out data on the posting event (user, date, etc. - a kind of log of operations). You can make a reverse route for the document, which would delete operations in the directory.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question