Employee promotion and Internal work history table

Hello Guys,

I facing some problems with employee promotion and the Internal work history of employees in the company.

While submitting employee promotion the internal history of the employee is automatically updated but some fields are missing there.

For eg: I’m doing a promotion with the designation and it updated my internal work history table.

This is my promotion details

This is my updated internal history table

In the first row branch, department, designation all values are present and “from date” selected as the employee joined date, but “to date” is not filled .in the second-row branch and designation values are not present, designation and “from date” select as promotion date and promoted designation which is selected in employee promotion doc.

but in this case branch and the department are not changed so I want to repeat the branch and department in each row. and “to date” select as one day less promoted date.

and this all wants to automatically update in employee internal history.

Please have any solution for this?