While updating employee you should choose the Action Sequence as Exit. For example employee last working day is Jan 31st 2020 you should give action sequence date as Feb 1st 2020. Which means employee is active till Jan 31st 2020 and payroll has to be processed till that date. 


Below is the screenshot for your reference 



Also you should choose the reason for Exit under Job Details section. Below is the screen for your reference.



Once you Exit the employee, he will be visible during the attendance and payroll process of his last working month only (Which is Jan 2020 in this example). Once you Exit the employee you can Re-hire the employee.