I have an inventory management system using laravel and mysql. The system has more than 2000 products.
The system calculates daily stock balance and stores it an excel file.
The problem is there are frequent errors when the users add new invoices, either they select wrong products or wrong quantity. But they dispatch the correct product and quantity from the warehouse. Wrong records only in the system.
So apparently stocks in the system and the warehouse differ due to this. It takes about 2-3 weeks to find these errors.
In here, if I want to replace the wrong entry with the correct one, the daily stock report that the system had been storing everyday would become useless. I will have to recalculate the daily balance from the wrong entry date until now, and replace them.
Creating new stock report means, the system has to go through all the products unnecessarily to create a daily stock report to store in the system. This process consumes huge amount of processing power and is unnecessary.
Possible solution: I could save the closing balance of all the products in a db table everyday, Instead of storing the daily stock report as a file. So if there is a correction, I will have to go through only that specific product and adjust the closing balances for each day from the wrong entry date. But this solution comes at a cost of 2000 new entries everyday. In long term use the size of table will be gigantic.
Is this approach correct? Or is there a better solution??