Hi I am calling on the community help once again. I explain as best as i can
I am trying to build a service app with automated invoicing. The bit I am stuck on is out of hours.
(IN HOURS 08:00 - 18:00) so On-Site Time (09/01/2021 - 13:00:00) Off-Site Time (09/01/2021 -14:00:00) gives me 1-hour duration on site – This is fine this bit works
(Out of hours before 08:00 On-site or after 18:00 Offsite) On-site time(09/01/20201 - 07:00) Off- Time (09/01/2021 - 09:00) gives me 1 hour out of hours + 1 hour in hours – This Works Too
Now The problem
On-Site Time 09/01/2021 - 01:00 Off-Site - 09/01/2021 02:00)
Gives me 7 hours Out of hours as 01:00:00 is 7 hours before 8 am
and -16 hours for 02:00:00 after 18:00.
Now I know the problem is giving me the answer I have asked which is how many hours before 8 am and how many hours after 18:00.
What I was trying to do and can’t seem to think of a workaround is
between 8 am - 6 pm is in hours
Before 8 am and after 6 pm is out of hours
So if we were called out at 7 am and finished at 9 am it would be 1 hour out of hours because it’s 1 hour before 8 am and 1 hour in hours because it’s after 8 am. Now I need to know how many hours before 8 am for invoicing purposes I.e invoice 1 hour at out of hours rate and 1 hour at in hours rate.
I hope I have explained this well enough for help.