Loan Repayment from Sales Payment module

Is it possible to pay the loan amount at the same time when we create a sales invoice and make payment. The rest of the loan application and disbursement and the process of giving loan will be the same. If there is not a way suggest me a possible solution.