Calculation of simple hours, holiday hours and night hours

First I would like to congratulate for the help you are offering…
I have a little bit of a situation here…
As you can see on the example that you can find HERE:
, I have a file that calculate the money every doctor should take based on the working hours.
Nights, holidays and holiday night have different price/hour.
The excel is working fine…but now I have to make a formula that separate automatically based on the start time and the end time of the doctor’s shift the hours tha belongs to night pricelist, the hours that belongs to holiday price list and the hours that belong to holiday nights price list.
In the excel I have fill the hours Manuscript, I need a formula to do that for me…
I have manage to found the formula for night and day hours but I have problem separate the holiday hours like Sunday (???????)
Is it possible to help me???
On the yellow cell I have try to find out the formula for the holiday hours but because the day is calculated due to a formula it is not working!!!

Example: A doctor Is working from 21:00- 8:00 (next morning Sunday) he should have 1 simple hour (21:00-22:00) 9 night hours (22:00-6:00) and 2 holiday hours (6:00-8:00,)

Thank you in advance…