How to design a reconciliation system, what should the logic be?

our company wants to set up a financial reconciliation system because of the rise in business, and then give it to me to design.

data currently available: sales orders and bank flows.
requires reconciliation once a month to check whether the customer has any delinquency or bad debts by automatically matching the amount in the order according to the bank flow.

sales order data is as follows: order number, product number, quantity, unit price, total amount, customer

data of bank flow is like this: payment date, customer, total amount

the only thing in common between the two data is the customer, but if you make a fuzzy query on the customer, there are too many orders repeated by the customer, and the reconciliation workload is still very large.

how to solve this problem here, or how is the general reconciliation system designed?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b358cc-2bfaf.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b358cc-2bfaf.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?