Im working on engineering СRM system for processing of incoming orders for the manufacture of doors. So i was faced with the complexity in the design of the system of accounting for money and their distribution.
My business has three ways of receiving funds: cash, paypal, bills. When they are received, the funds are distributed through a financial system between the manager, the master, the administrator and possibly partners. In my business there are several partners, managers and masters and I want the money for a specific order to come exclusively to the participating persons, and not be distributed among all employees of the company.
Distributed money should be displayed by the masters and managers, however, payment is made once a month at the click of the button by the administrator, and the partner gets money on request from the partner's private office. The administrator has the right to withdraw money for advertising, his salary, fine managers, partners or masters for any amount.
click to watch scheme on image
All actions of this system should be logged: time, source and direction of operation.
So my question: How can I implement this scheme with the least amount of DB memory and computation?
Now I realized this as an "operation" class, which contains variables: source, direction, price, order ID, comment, master ID, engineer ID, partner ID. "Source and direction" is an instance of the "Opearation directions" class, which has all directions in it.
A transaction factory is a class that contains functions through the paypal, cash, check, all functions that calculate transfers on the financial system. These functions are called either by other functions by members of this class, or by forms from the interface.
Each function changes the value in the "engineer / manager award" column, "engineer / manager / partner / administrator salary", "advertising" in the order table, which also contains columns of addresses, names, contacts of clients and etc info.
When the payout date for the button arrives, all of these values are simply zeroed out (I lose information about the funds that were distributed last month, but i dont want it)
The transaction log is a class that is called in each function of the operations factory class and writes an action to a table that contains all the variable-column variables of the operation class.
I spend a lot of time for googling any standard patterns for this, but i found only the problem of lack of my knowledge.
I use PHP and MySQL for this project.
Aucun commentaire:
Enregistrer un commentaire