Loan Repayment Deduction Does Not Reduce Salary Payable in ERPNext v 14

Issue Description:
When an employee has a loan deduction from their salary, ERPNext does not correctly reduce the Salary Payable amount. Instead, the loan repayment is recorded separately in the Loan Account, but the total Salary Payable still reflects the full gross salary.

This causes an overpayment issue where the employee receives their full salary instead of the net salary after loan deductions.

Steps to Reproduce the Issue:
Create a Loan:

Issue a loan of 1,000 to an employee.
The loan balance appears under Loan Account as a company receivable.
Process Payroll:

Employee’s Gross Salary: 5,000
Loan Deduction: 1,000
Expected Net Pay: 4,000

Check GL Entries After Submit Salary Processing:
Salary Payable (Credit): 5,000

Check GL Entries After Loan Repayment Processing
Loan Account (Debit): 1,000

Check GL Entries After Salary Make a Bank Entry Processing
Salary Payable (Credit): 5,000 (Debit): 5,000

Execute Salary Payment:

System pays 5,000 instead of the correct 4,000.
Loan balance is reduced, but employee still gets overpaid.
Expected Behavior:
The Salary Payable account when making the bank entry from payroll entry doctype should reflect the net salary after loan deductions.
or The Loan Repayment deduction should reduce Salary Payable directly instead of being a separate GL entry.
When salary is paid, the employee should receive only 4,000, not 5,000.