Payroll From Multiple Companies

Good Day Everyone,
I’m facing an issue about Payroll.

Payroll (TimeSheet-based) on Different Companies Case Scenario:
An employee starts working on Company A from the start of the month, and continues working for 10 days, each day has its own TimeSheet.
Then, the Employee gets transferred to another company called Company B, works for the rest of the month, each day has its own TimeSheet as well.
After that, at the time of creating the Salary Slips through Payroll Entry, however, the employee is not included with the other employees in both companies A and B.
The employee has a Salary Structure Assignment in Company A, but cannot create a Salary Structure assignment under Company B.
Anyhow, if the employee gets transferred back to Company A, and gets his payroll, all the TimeSheets are calculated in the Salary Slip, the TimeSheets spent in Company B are calculated as well.
P.S: Salary Structure and Payroll Entry are both Based on TimeSheet.
How to calculate each TimeSheets in Payroll for the Companies the TimeSheets belongs to?

Thank You.

Here’s the issue on GitHub:

smells like a bug to me

Anyone found a solution to this?