Open PaulPoberezhniy opened 6 years ago
Deadline Fr 22.12
I have a question. What do we need the date inputs for? It seems we don't need to make a history of transactions. If we need just to show all customers' balances, we don't need the dates. The current balance would be enough. Any suggestions?
Yes we don't have payment history (for now) - there is only debts in balance. Payment is not in the system. These inputs are needed for convenience (admin can see debts of user for last month, or last week, starting from some date)
One correction. In fact, there is a system history of payments. This is certainly not a real payment system but all of transactions are stored. Table History
needed to calculate the balance of user and store all payment transactions.
This is a function that calculates the balance: https://github.com/AlexandrBursak/cookdrive-sb-gh/blob/8c107a075d8b6c9c3993f952f4af43f2edeeb8ce/models/History.php#L32
And we don't need to create a field balance
in the table Users
1) UI
Users balance page includes:
2) take data from the table "history" (group by user ,order by sum)
3) add a field (balance) to the "user" table - the default value 0.00 (double) to store balance in this field, and then admin just insert it manually (for now), when the money is paid by user. Calculation for user.balance = balance (user table) - sum (history table). (it would depends on future payment history of transactions). Data can be modified, and viewed by admin only.