Optimization of the Invoice Posting for Improved Efficiency and Speed

Invoice Posting plays a critical role in receiving payments from customers and paying the vendors.

The Client

The client is headquartered in Georgia and operates in every U.S. state and all 10 Canadian provinces. It is one of the largest independent fuel distribution networks delivering over 3 billion gallons of fuel and complementary products annually to 8,000+ customers.

The Challenges

The initial invoicing process was very slow and heavily loaded the system resources. It used to time out frequently and caused other business processes in the system to perform slowly.

There were some defects in the current process, causing many invoices to get stuck during each month’s closeouts. The business users had to spend many hours manually making the stuck invoices to process.

The process was also lacking automation testing. It was hard to do the regression. So, if a solution was implemented or a patch was done for a business use case, sometimes it caused other business use cases to break or fail.

The Objective

Efficient and faster processing of invoices and no issues during monthly closeouts for manual intervention.

The Solution

The current process was written in a large SQL procedure. All the business logic and processing logic were contained in the same SProc. This SProc was getting called through a background job that processed 100 invoices at a time. Sometimes it was very slow, to even process 10 invoices.

With a team size of 3 developers and 1 tester, we refactored the current process into a modernized .net core API. All the business logic was refactored into smaller units of C# methods and database calls were made only to read the data. The team made sure the database did not contain any business logic. For the master data which does not change frequently, caching was applied to avoid the database calls. Unit tests were written around the business logic. Best coding practices were performed. To maintain the code quality, tools like SonarQube were used for static code analysis and code coverage.

For the integration and regression testing, postman automation tests were written which captured each business use case.

For the migration of the current process to the new process, a toggle switch was implemented in the background job. If the switch was ON, it would use the new modern API approach for processing the invoice and if the switch was OFF, the current process would be used as is.

Once the process was tested and deployed, the speed was increased many folds without putting extra load on the system. The issues that required manual intervention during monthly closeout almost became negligible. We were able to set the new batch size to 500 in the live environment which was previously set to 100 and it was still many times faster than the existing process.

Also, when a new business use case was implemented later once the new system was live, we were easily able to verify that the new implementation did not break any existing business use cases with the help of unit tests and postman automation tests.

Business Process Diagram:
Optimization of the Invoice Posting for Improved Efficiency and Speed-1

The Benefits

The major benefit was improved system performance and faster processing of the invoices. In the new process, many existing defects were also resolved which business users had to resolve manually. The new process saved many business hours of users during the monthly closeout process.

After the release of the new process, the product owner said that he had never seen such a smooth closeout month without any issues in many years.