Hello everyone, and thank you in advance for your attention. I do have a problem

I will try to present it as simple as possible.

We have a list of 10 customers. We charge each customer, each month for certain services so we issue at least on invoice/customer/month.

However the invoices don't have always full payment. So for example:

Customer "Alpha" Invoice #1 Amount $300 Pending $300
Customer "Alpha" Invoice #2 Amount $350 Pending $300
Customer "Alpha" Invoice #3 Amount $340 Pending $300

and payments

Customer "Alpha" Payment #1 Amount $500

So I want to enter the payment, and the payment somehow to divided into two different invoices and update the invoices. I do this manually for now but it's not safe and I have done mistakes in the past.

So after the payment the invoices will look like this:

Customer "Alpha" Invoice #1 Amount $300 Pending $0
Customer "Alpha" Invoice #2 Amount $350 Pending $150
Customer "Alpha" Invoice #3 Amount $340 Pending $340

Any help or idea it will be highly appreciated, thank you.