Can I use the writeoff function in a/r to move an o/s balance in a/r to be applied and reduce the payment of an invoice in a/p for the same vendor?

If not is there another way to do in beside adjusting a/r and then entering credit in a/p?

Thanks