0

# Time PCR to get number of days from Monday to Friday till the end of the year

Mar 09, 2017 at 09:21 PM

57

Former Member

HI there!

I have the following requirement,

We maintain date type 01 "Technical date for holidays" in IT0041 "Date specifications" to calculate the number of holiday days the employee is entitle to, which are granted at the beginning of the year or as soon as the employee is hired.

If date type 01 is ≥ 01.07, a proportional holiday calculation will be made, assigning a day of holiday every 20 worked days, considering as worked days the days from Monday to Friday from the date type 01 until the 31st of December of the same year.

Since we don´t evaluate in the future, how can I get from the date type 01 the number of days from Monday to Friday till the end of the year?

Thank you so much for your help!

Cheers!

Former Member Mar 10, 2017 at 04:40 PM
0

Hi,

If I understand your question correctly you could use the following solution. This is assuming that you are evaluating the same date that is held in date type 01 in IT0041.

• Create a PCR and query the how many days are left in the current time evaluation period (month) by using operation HRS=YXED, add this value into a new time type.
• Now query the month by using operation HRS=BCURMO, depending on the month being evaluated you can add the number of days left in the year from the next month into the same time type. You can do this by creating 3 constants (T511K) which hold the number of months that contain either 28, 30 or 31 days. Note that my constant for 28 days takes leap years into account.pcr-page-001.jpgpcr-page-002.jpgpcr-page-003.jpgt511k.jpg
• Divide the value by 7 and then multiply by 5 to give you the amount of M-F left in the year. If you don't want to include the current week then apply a rounding rule to the value held in your time type. Create or use a rule that rounds down to the nearest whole number.

I have included the configuration required as attachments in this reply.

pcr-page-001.jpg (160.7 kB)
pcr-page-002.jpg (156.0 kB)
pcr-page-003.jpg (83.0 kB)
t511k.jpg (30.8 kB)
Share