Salary Calculation Based on Joining Date and Attendance

If an employee’s joining date is January 15, 2025, the salary should ideally be calculated for 16 days. However, the system is calculating it based on 31 days, and payroll is being processed based on attendance. How can we ensure that the salary is correctly calculated for the actual working days?

Can anyone suggest a solution for this?