2 Replies Latest reply: Mar 15, 2013 9:03 AM by 708631 RSS

    Primavera calendars / computing monthly working hrs

    708631
      Im running some reports out of the p6 database, im trying to computer the monthly hours based on a calendar.
      So the calendar says 8hrs a day, some months have more working days than others as some have 30 days / 31 days / 5 weeks.

      any ideas ?
        • 1. Re: Primavera calendars / computing monthly working hrs
          gCubed
          The Calendar table holds both the global and resource calendars.

          In it you will see the hours by day, week, month and year.

          The issues is that some of the details about a calendar are store in a field called clndr_data which is a coded field. This coded field contains the calendar's DaysOfWeek, View, and Exceptions i.e. non working / holidays.

          If you only need an estimate of the number of working hours for a given month, you could use the day_hr_cnt for a given calendar and multiply it against the number of working days within a given month. Found this at

          http://www.sqlservercentral.com/articles/Advanced+Querying/calculatingworkdays/1660/


          DECLARE @StartDate DATETIME
          DECLARE @EndDate DATETIME
          SET @StartDate = '2013-01-01'
          SET @EndDate = '2013-01-31'

          SELECT
          (DATEDIFF(dd, @StartDate, @EndDate) + 1)
          -(DATEDIFF(wk, @StartDate, @EndDate) * 2)
          -(CASE WHEN DATENAME(dw, @StartDate) = 'Sunday' THEN 1 ELSE 0 END)
          -(CASE WHEN DATENAME(dw, @EndDate) = 'Saturday' THEN 1 ELSE 0 END)

          Gene
          • 2. Re: Primavera calendars / computing monthly working hrs
            708631
            thank you very much