Vice Admiral
Vice Admiral
111 views

Calculating WorkDays

I am creating a procedure that needs to determine the number of workdays for a resource (both named and unnamed).  I have tried using krsc_assignment_utils.calc_working_days but the results are not accurate.  Here are a few months results if I use a userID of 0 to use the Regional Calendar: 

 

Start      End       # Calc Days  # Act Days
____________________________________________
01-MAY-15  31-MAY-15      20         20
01-JUN-15  30-JUN-15      21         22
01-JUL-15  31-JUL-15      21         20
01-AUG-15  31-AUG-15      20         21

 

The only Holidays during this period are May 25 and July 3.  I have checked the regional calendar to verify the number of working days.

 

Interestingly, I changed the user ID to null so it would count all days as working days (per the comments in the package) and PPM is calculating one less day each month.  So according to PPM May has 30, June has 29, July has 30 and August has 30 days.  But just adding 1 to the result above does not produce the correct answer.

 

Here is the code to replicate the above.  Am I using this incorrectly or is there a bug in this procedure?

 

SET serveroutput ON
CLEAR screen
DECLARE
v_workdays NUMBER;
o_start_day_fraction NUMBER;
o_end_day_fraction NUMBER;
sday VARCHAR2(200);
eday VARCHAR2(200);
adays NUMBER;

BEGIN
dbms_output.put_line('Start      End       # Calc Days  # Act Days');
dbms_output.put_line('____________________________________________');
sday := '01-MAY-15';
eday := '31-MAY-15';
adays := 20;
ppm.krsc_assignment_utils.calc_working_days(sday, eday, 0, 0, 0,  v_workdays, o_start_day_fraction, o_end_day_fraction);
dbms_output.put_line(sday || '  ' || eday || '      ' || v_workdays || '         ' || adays);
sday := '01-JUN-15';
eday := '30-JUN-15';
adays := 22;
ppm.krsc_assignment_utils.calc_working_days(sday, eday, 0, 0, 0,  v_workdays, o_start_day_fraction, o_end_day_fraction);
dbms_output.put_line(sday || '  ' || eday || '      ' || v_workdays || '         ' || adays);
sday := '01-JUL-15';
eday := '31-JUL-15';
adays := 20;
ppm.krsc_assignment_utils.calc_working_days(sday, eday, 0, 0, 0,  v_workdays, o_start_day_fraction, o_end_day_fraction);
dbms_output.put_line(sday || '  ' || eday || '      ' || v_workdays || '         ' || adays);
sday := '01-AUG-15';
eday := '31-AUG-15';
adays := 21;
ppm.krsc_assignment_utils.calc_working_days(sday, eday, 0, 0, 0,  v_workdays, o_start_day_fraction, o_end_day_fraction);
dbms_output.put_line(sday || '  ' || eday || '      ' || v_workdays || '         ' || adays);

end;

 

-- Remember to give Kudos to answers! (click the KUDOS star)
0 Likes
2 Replies
Absent Member.
Absent Member.

Hi Derek ,

 

You can use this table: TM_TIME_SHEETS

 

This table stores the definition of each time sheet including the copied policy

information from the resource's time sheet policy.

 


PERIOD_HOURS_CALC_TYPE_ CODE
Indicates the setting for calculating the number of hours in a period. This is controlled by the time sheet policy. Valid values are WORKDAY and FIXED.


WORKDAY_HOURS If PERIOD_HOURS_CALC_TYPE_CODE is set to WORKDAY, this column indicates the number of hours in a working day.

 

I am attaching the data model guide for references, in case you need help to build a Query, you can contact PSO team thorugh your sales representative.

 

Also you can post your doubts in the HP Public Forums where  customers share their experiences: http://h30499.www3.hp.com/t5/Project-and-Portfolio-Management/bd-p/itrc-935#.VXdUYnlFDIU

 

 

Best Regards,

Carolina.


“HP Support
If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.”
0 Likes
Vice Admiral
Vice Admiral

This has nothing to do with Time Sheets.  We do not use TimeSheets so this table is empty. I am working on a procedure to report on Resource Forecasts and Assignments and need to use the number of workdays in a period.

-- Remember to give Kudos to answers! (click the KUDOS star)
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.