I am building a personal finance mobile app that supposed to generate monthly reports, now I have a problem, confused about how to design the database to be monthly, I need the wallet to get archived after a month from the day it's created and transfer the remains/loss to the new wallet ( next month ) if exist.
Now my idea is to generate one wallet with xx money and let the user change the start date and make the mobile app automatically generate a new wallet every month on that day with the necessary transactions like there a loss/remain from the old wallet, and archive or prevent the user to make any transaction to the old wallets.
does my logic make sense or …? ( Note I'm still learning and this my first app using SQL/Database so please be patient with me )
Best Answer
From what I'm understanding you need to design a database which will be record transactions of a user and draw some conclusion like a profit/loss at the end of a month. To achieve this you don't necessarily need to create a wallet every month this is just basic accounting. You will need
Transaction
table andTransaction_History_Log
andCharts_Of_Accounts
for more detail check this. YourTransaction
table will have aone-to-many
relationship to yourTransaction_History_Log
andTransaction_History_Log
will havemany-to-one
with yourCharts_Of_Accounts
. So just basically you will need to record journal entries this will help you get a more understanding about what journal entries are in accounting. You can set acreateDate
attribute in yourTransaction_History_Log
to just get the a snapshot of month or a whole year or whatever the user likes.