Calculate Scheduled End Times
In todo4teams every ticket has a target time, which is the time within a ticket must be finished, because the customer expects a least at the end of the time period a definite answer. Effective target times take into consideration that a service-center has working hours.
The helper-objects required for the parameterization differ according to whether the target time is in the hour/minute range below one day or the target time comprises more than one day. The documentation for the parameters to be defined for the helper objects can be found in our API documentation (under manuals in the start menu of todo4teams).
If a service-center has i.e. working hours from 7:00 - 20:00 and a new ticket with a promised processing duration of four hours is generated at 19:00, then this todo can be finished at the earliest at 10:00 Uhr on the next working day, because on the first day there is only one hour left and on the next day another three hours are necessary to process this todo. There are different methods within the todo4teams-API to calculate the target time within the scipts to email-, sms- and webservice.
1. target times within the hour/minute range
working hours | from | to |
---|---|---|
Monday-Friday | 7:00 | 22:00 |
Saturday | 8:00 | 16:30 |
Sunday | 9:00 | 13:00 |
For this service-center the following method will calculate the effective target times, needed is the helper-objekt "helper.getScheduledEndDateByServiceTimes". The Parameters:
getScheduledEndDateByServiceTimes
public java.util.Date getScheduledEndDateByServiceTimes(int minutes,
int startHourWeekdays,
int startMinuteWeekdays,
int endHourWeekdays,
int endMinuteWeekdays,
int startHourSaturdays,
int startMinuteSaturdays,
int endHourSaturdays,
int endMinuteSaturdays,
int startHourSundays,
int startMinuteSundays,
int endHourSundays,
int endMinuteSundays)
Calculates the scheduled end time of a ticket taking into account the current timestamp and the effective service times given by the parameters. This method helps to avoid to create tickets with scheduled end times that can not be satisfied due to night break, weekend etc.
Parameters:
startHourWeekdays - start of service time hour from Mo-Fr
startMinuteWeekdays - start of service time minute from Mo-Fr
endHourWeekdays - end of service time hour from Mo-Fr
endMinuteWeekdays - end of service time minute from Mo-Fr
startHourSaturdays - start of service time hour on Sa
startMinuteSaturdays - start of service time minute on Sa
endHourSaturdays - end of service time hour on Sa
endMinuteSaturdays - end of service time minute on Sa
startHourSundays - start of service time hour on Su
startMinuteSundays - start of service time minute on Su
endHourSundays - end of service time hour on Su
endMinuteSundays - end of service time minute on Su
Returns:
the effective scheduled end time
For the concrete example:
var effektiveZielzeit = helper.getScheduledEndDateByServiceTimes(
15, // minute count
7, 0, 22, 0, // Mo-Fr from 7:00 til 22:00
8, 0, 16, 30, // Sa from 8:00 til 16:30
9, 0, 13, 0); // So from 9:00 til 13.00
// Setting the effective target time
task.setScheduledEndDate(effektiveZielzeit);
For the case that the service times differ on Friday from the other working days the effective target times can be calculated with the following method, the helper object "helper.getScheduledEndDateByServiceTimes4" is needed. The parameters:
getScheduledEndDateByServiceTimes4
public java.util.Date getScheduledEndDateByServiceTimes4(int minutes,
int startHourWeekdays,
int startMinuteWeekdays,
int endHourWeekdays,
int endMinuteWeekdays,
int startHourFridays,
int startMinuteFridays,
int endHourFridays,
int endMinuteFridays,
int startHourSaturdays,
int startMinuteSaturdays,
int endHourSaturdays,
int endMinuteSaturdays,
int startHourSundays,
int startMinuteSundays,
int endHourSundays,
int endMinuteSundays)
Calculates the scheduled end time of a ticket taking into account the current timestamp and the effective service times given by the parameters. This method helps to avoid to create tickets with scheduled end times that can not be satisfied due to night break, weekend etc.
Parameters:
startHourWeekdays - start of service time hour from Mo-Do
startMinuteWeekdays - start of service time minute from Mo-Do
endHourWeekdays - end of service time hour from Mo-Do
endMinuteWeekdays - end of service time minute from Mo-Do
startHourFridays - start of service time hour on Fri
startMinuteFridays - start of service time minute on Fri
endHourFridays - end of service time hour on Fri
endMinuteFridays - end of service time minute on Fri
startHourSaturdays - start of service time hour on Sa
startMinuteSaturdays - start of service time minute on Sa
endHourSaturdays - end of service time hour on Sa
endMinuteSaturdays - end of service time minute on Sa
startHourSundays - start of service time hour on Su
startMinuteSundays - start of service time minute on Su
endHourSundays - end of service time hour on Su
endMinuteSundays - end of service time minute on Su
Returns:
the effective scheduled end time
For the concrete example, here however the Friday has the same service times as Mo-Do:
var effektiveZielzeit = helper.getScheduledEndDateByServiceTimes4(
15, // minute count
7, 0, 22, 0, // Mo-Do from 7:00 til 22:00
7, 0, 22, 0, // Friday from 7:00 til 22:00
8, 0, 16, 30, // Sa from 8:00 til 16:30
9, 0, 13, 0); // So from 9:00 til 13.00
// Setting the effective target time
task.setScheduledEndDate(effektiveZielzeit);
2. target times more than one day, some days
In our second example we will caculate the effective target times for todos, which have a promised processing duration of two days. The service-center has the following working hours:
working hours | from | to |
---|---|---|
Monday-Thursday | 8:00 | 16:00 |
Friday | 8:00 | 12:30 |
Saturday | closed | |
Sunday | closed |
Here you can map the scenario via the helper object "getScheduledEndDay", the parameters:
getScheduledEndDay
public java.util.Date getScheduledEndDay(int workingdays,
boolean weekday,
boolean friday,
boolean saturday,
boolean sunday,
int endHourWeekdays,
int endMinuteWeekdays,
int endHourFridays,
int endMinuteFridays,
int endHourSaturdays,
int endMinuteSaturdays,
int endHourSundays,
int endMinuteSundays)
Calculates the scheduled end time of a ticket taking into account the current timestamp and the effective service times given by the parameters. This method helps to avoid to create tickets with scheduled end times that can not be satisfied due to night break, weekend etc. This method is to be used for service times for more than one working day
Parameters:
workingdays - number of working days to be taken into account
weekday - Mon-Do to be taken into account
friday - Friday to be taken into account
saturday - Saturday to be taken into account
sunday - Sunday to be taken into account
endHourWeekdays - end of service time hour from Mon-Do
endMinuteWeekdays - end of service time minute from Mon-Do
endHourFridays - end of service time hour on Fri
endMinuteFridays - end of service time minute on Fri
endHourSaturdays - end of service time hour on Sat
endMinuteSaturdays - end of service time minute on Sat
endHourSundays - end of service time hour on Sun.
endMinuteSundays - end of service time minute on Su
Returns:
the effective scheduled end time
For the concrete example:
var effektiveZielzeit = task.setScheduledEndDate(helper.getScheduledEndDay(
2, // two days target time
true, // Mo-Do is closed
true, // Friday is open
false, // Saturday is closed
false, // Sunday is closed
16, 0, // Mo-Do the service center closes at 16:00
12, 30, // Friday the service center closes at 12:30
0, 0, // Saturday is closed
0, 0)); // Sunday is closed
// Setting the effective target time
task.setScheduledEndDate(effektiveZielzeit);
There are more methods to set an absolute target time plus variants of the examples mentioned above. More details are listed in the documentation of the todo4teams-API.