Calendars Primavera / calculation of monthly working hours

IM in some ways out of the database of the p6, im trying the monthly hours based on a calendar computer.
If the timetable says 8 hours a day, some months have more working days others like some have 31 days/30 days/5 weeks.

any ideas?

The Schedule table contains both global schedules and resources.

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

The questions, is that some of the details on a calendar are stored in a field called clndr_data which is a coded field. This code field contains DaysOfWeek, view and Exceptions that is, not the calendar of work / vacation.

If you need only 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 in 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)
-(BOX WHEN DATENAME (dw, @StartDate) = 'Sunday' THEN 1 ELSE END 0)
-(BOX WHEN DATENAME (dw, @EndDate) = 'Saturday' THEN 1 ELSE END 0)

Gene

Tags: Oracle Applications

Similar Questions

  • [8i] help with function with parameters (for the calculation of the work)

    Let me start by saying, I've never written a function before, and I do not have access to create a feature in my database (that is, I can't test this feature). I am trying to achieve a function I can ask my IT Department to add for me. I hope that someone can take a look at what I wrote and tell me if this should work or not, and if it's the right way to go to solve my problem.

    I'm creating a function to make a very simple calculation of work (add/subtract a number of days to a date in the calendar).

    The database, I work with has a table with the schedule of work. Here is a sample table and sample data, representative of what is in my work table calendar:
    CREATE TABLE caln
    (     clndr_dt     DATE,
         shop_days     NUMBER(5)
         CONSTRAINT caln_pk PRIMARY KEY (clndr_dt)
    );
    
    INSERT INTO     caln
    VALUES (To_Date('01/01/1980','mm/dd/yyyy'),0);
    INSERT INTO     caln
    VALUES (To_Date('01/02/1980','mm/dd/yyyy'),1);
    INSERT INTO     caln
    VALUES (To_Date('01/03/1980','mm/dd/yyyy'),2);
    INSERT INTO     caln
    VALUES (To_Date('01/04/1980','mm/dd/yyyy'),3);
    INSERT INTO     caln
    VALUES (To_Date('01/05/1980','mm/dd/yyyy'),3);
    INSERT INTO     caln
    VALUES (To_Date('01/06/1980','mm/dd/yyyy'),3);
    INSERT INTO     caln
    VALUES (To_Date('01/07/1980','mm/dd/yyyy'),4);
    INSERT INTO     caln
    VALUES (To_Date('01/08/1980','mm/dd/yyyy'),5);
    INSERT INTO     caln
    VALUES (To_Date('01/09/1980','mm/dd/yyyy'),6);
    INSERT INTO     caln
    VALUES (To_Date('01/10/1980','mm/dd/yyyy'),7);
    INSERT INTO     caln
    VALUES (To_Date('01/11/1980','mm/dd/yyyy'),8);
    INSERT INTO     caln
    VALUES (To_Date('01/12/1980','mm/dd/yyyy'),8);
    INSERT INTO     caln
    VALUES (To_Date('01/13/1980','mm/dd/yyyy'),8);
    INSERT INTO     caln
    VALUES (To_Date('01/14/1980','mm/dd/yyyy'),9);
    The table includes since 01/01/1980 but 31/12/2015.

    I have written (and validated) this parameter query that performs the calculation of my working day (mday):
    SELECT     cal.clndr_dt
    FROM     CALN cal
    ,     (
         SELECT     cal.shop_days+:mdays     AS new_shop_days
         FROM     CALN cal
         WHERE     cal.clndr_dt     =:start_date
         ) a
    WHERE     cal.shop_days     = a.new_shop_days
    AND     ROWNUM          =1
    ORDER BY     cal.clndr_dt;
    Based on this request, I created the following function (and I have no idea if it works or if the syntax is right, etc..):
    CREATE OR REPLACE FUNCTION add_mdays 
         (start_date     IN DATE,
         mdays          IN NUMBER(5))
    RETURN     DATE 
    IS
         new_date DATE;
    BEGIN
    
         SELECT     cal.clndr_dt
         FROM     CALN cal
         ,     (
              SELECT     cal.shop_days+mdays     AS new_shop_days
              FROM     CALN cal
              WHERE     cal.clndr_dt     =start_date
              ) a
         WHERE     cal.shop_days     = a.new_shop_days
         AND     ROWNUM          =1
         ORDER BY     cal.clndr_dt;
    
         RETURN     new_date;
    
    END add_mdays;  //edit 9:31 AM - noticed I left off this bit
    I'm also not sure how to do to have the function handle results that would return a date outside the range of dates that appear in the table (prior to 01/01/1980 or after until 31/12/2015 - or, another way to look at what was, before the caln.clndr_dt or the caln.clndr_dt MAX value MIN value).

    My goal is to be able to use the function in a situation similar to the following:

    First of all, here is a sample table and data:
    CREATE TABLE orders
    (     ord_no          NUMBER(5),
         plan_start_dt     DATE,
         CONSTRAINT orders_pk PRIMARY KEY (ord_no)
    );
    
    INSERT INTO orders
    VALUES (1,To_Date('01/08/1980','mm/dd/yyyy'));
    INSERT INTO orders
    VALUES (2,To_Date('01/09/1980','mm/dd/yyyy'));
    INSERT INTO orders
    VALUES (3,To_Date('01/10/1980','mm/dd/yyyy'));
    And here's how I would use my function:
    SELECT     orders.ord_no
    ,     orders.plan_start_dt
    ,     add_mdays(orders.plan_start_dt, -3) AS prep_date
    FROM     orders
    Thus, the function would allow me to come back, for each command in my table of orders, the date is 3 days working (mdays) before the start of the plan of each order.

    I go about it the right way? I have to create a function to do this, or is there a way for me to integrate my request (which makes my mday calculation) in the example query above (eliminating the need to create a function)?

    Thank you very much in advance!

    Published by: user11033437 on February 2, 2010 08:55
    Fixed some typos in the last insert statements

    Published by: user11033437 on February 2, 2010 09:31 (fixed some syntax in the function)

    Hello

    Ah, referring to Oracle 8 and is not not able to test your own code makes me nostalgic for the good old days, when you have entered your cards and led to a window to the computer center and waited an hour for the work to be performed and then seen printing to find that you had made a typo.

    If you write functions, you should really test yourself. Like all codes, functions forge be written small not: write a line or two (or sometimes just a part of what would later become a single line), test, make sure it is running properly and repeat.
    Ideally, your employer must create a pattern of development in a development database that you can use.
    You can legally download your own instance of Oracle Express Edition free; just be careful not to use features that are not available in the database where the code will be deployed.

    You need a function to get the desired results:

    SELECT       o.ord_no
    ,       o.plan_start_dt
    ,       MIN (e.clndr_dt)     AS prep_date
    FROM       orders     o
    ,       caln          l
    ,       caln          e
    WHERE       l.clndr_dt     = o.plan_start_dt
    AND       e.shop_days     = l.shop_days - 3
    GROUP BY  o.ord_no
    ,            o.plan_start_dt
    ;
    

    It would be more effective (and somewhat simpler) If you've added a column (let's call it work_day) identified whether each line represents a work_day or not.
    For each value of shop_days, exactly 1 row will be considered as a working day.
    Then, the query may be something like:

    SELECT       o.ord_no
    ,       o.plan_start_dt
    ,       e.clndr_dt          AS prep_date
    FROM       orders     o
    ,       caln          l
    ,       caln          e
    WHERE       l.clndr_dt     = o.plan_start_dt
    AND       e.shop_days     = l.shop_days - 3
    AND       e.work_day     = 1
    ;
    

    You can use the analytic LAG function to populate the work_day column.

    A function would certainly be useful, although perhaps slower.

    The function you have posted has some errors:
    an argument can be stated under NUMBER (5); Just NUMBER.
    (b) when you SELECT in PL/SQL, as you do, you must SELECT a variable to store the results.
    (c) ROWNUM is arbitrary (making it useless in this problem) unless you draw a neat subquery. I don't think you can use ORDER BY in subqueries in Oracle 8. Use the ROW_NUMBER analytic function.
    (d) the service must end with an END statement.

    Given your current caln table, here's how I would write the function:

    CREATE OR REPLACE FUNCTION add_mdays
         ( start_date     IN           DATE          DEFAULT     SYSDATE,
           mdays          IN           NUMBER          DEFAULT     1
         )
    RETURN     DATE
    DETERMINISTIC
    IS
         --     add_mdays returns the DATE that is mdays working days
         --     after start_date.  (If mdays < 0, the DATE returned
         --     will be before start_date).
         --     Work days do not include Saturdays, Sundays or holidays
         --     as indicated in the caln table.
    
         new_date     DATE;          -- to be returned
    BEGIN
    
         SELECT     MIN (t.clndr_dt)
         INTO     new_date
         FROM     caln     f     -- f stands for "from"
         ,     caln     t     -- t stands for "to"
         WHERE     f.clndr_dt     = TRUNC (start_date)
         AND     t.shop_days     = f.shop_days + TRUNC (mdays)
         ;
    
         RETURN     new_date;
    END     add_mdays;
    /
    SHOW ERRORS
    

    Production code forge be robust (which includes "fool-proofing").
    Try to anticipate what people errors might appeal to your function and correct for them where possible.
    For example, if it only makes sense for start_date at midnight, mdays to be an integer, use TRUNC in the function where soembody passes a good value.
    Allow default arguments.
    Comment of your function. Put all comments within the service (i.e. after CREATION and before the END) so that they will remain in the data dictionary.
    If, given the same arguments, the function always returns the same value, mark it as DETERMINISTIC, for efficiency. This means that the system will remember the values transmitted rather than to call the function whenever it is said to.

    I wish I could score questions such as 'Correct' or 'useful '; you get 10 points for sure.
    You posted CREATE TABLE and INSERT statements (without even be begged).
    You gave a clear description of the problem, including the expected results.
    The code is well formatted and easy to read.
    All around, one of the more thoughtful and well written questions I've seen.
    Play well! Keep up the good work!

    Published by: Frank Kulash, February 2, 2010 13:10
    Added to my own version of the function.

  • calculator does not work

    It is deplorable that a vibrant and visually stimulating USER once interface has been reduced to a dull, lifeless card-bored cut out, but El Capitan, with its Microsoft Mindset, has since taken the wheel, now even the calculator does not work!

    If you use the mouse or the keyboard, at any time, I try to enter a function such as +, -, *, /, =, all I get is a "ding". I don't mind the "ding" as it is followed by an action.

    I mean really?

    Can't get even a calculator to work after how the OS updates to El Capitan?

    Maybe no one else has this problem, and even more like Microsoft, it's a bad update of Yosemite for me?
    I mean, come on!

    When Jobs was alive, I do not remember Apple with Mickey$ oft problems like that.

    It just worked.

    Now, I can't even another user connected along the mine aside without the fan turns up and system preferences get hooked!

    And I'm not skinny on either system resources! Addition of RAM and an SSD.

    And, no, the fan does not permanently due to the SSD more. At least one thing slipped.

    Geez, maybe I should start thinking Ubuntu?

    They made a lot of progress!

    My calculator as planned and without sound effects work. In fact, it's the first time I heard about this issue.

    Please stop calculator. Then, bring up your library to the user. In Finder command + shift + H to go home. Then, command + J > check mark display library at the bottom of the context menu folder. Now, go to ~/Library/Containers/com.apple.calculator and drag this file to your desktop.

    Restart the calculator and test.

  • BlackBerry Smartphones how can I synchronize Blackberry 2 calendars with Outlook for example work &amp; facebook calendars

    I downloaded the new facebook application for Blackberry. He created a FACEBOOK CALENDAR on my blackberry.  So now, I have a calendar under my work email, facebook and my personal hotmail.

    Facebook events have been added to the FACEBOOK calendar but when I sync my blackberry with Outlook only items under the work email address are syncronised with Outlook. I would like to synchronize the calendar entries facebook and my work with my Outlook calendar calendar entries.

    I tried to search similar questions others maybe, but did not find this particular problem.

    I have a Blackberry "BOLD".

    Thank you

    Big thank you.

    Yes I saw the part on the implementation of the facebook calendar. It doesn't give me an option to choose my default calendar, just went ahead and created his own little calendar of Facebook. Very confusing. I don't think he can do what I need it to do and will just have to keep an eye on the next update and see if it solves the problem. I read all the articles refered you too so thank you for that.

    Thank you again for your answers you have been very helpful and I don't think I'll make the thing "synchronize each calendar separately. That is why too much messy as you say.

    Thanks again

  • How to contact Adobe technical support outside of my working hours?

    I'm trying to contact Adobe about a billing issue.  Basically they'll more than the agreed amount and the current price on the UK for Adobe CC site.  I had no warning of a rise in prices, and there is no explanation why.

    Unfortunately, it seems that the only way to contact Adobe support in the United Kingdom today is by phone or live chat, between 09:00 and 17:00 (that is, while I'm at work).  As the subscription of the CC has nothing to do with the work, it would be very difficult to expect from live chat (not sure about our firewall would allow anyway), or for the phone for a response (I can't make calls not working at my office), during working hours.

    How do I just send them a message, or make contact outside working hours?  If the answer is "you can't" then I'm sorry, but it is quite unreasonable and unacceptable service level

    No email address I knew

    Find an answer by a member of staff in a message... hover over their name... you can then click the Message option in the pop-up window to send a message private via the Forum software

    As the person in response #2 in message American trying to subscribe to Thailand

  • Hi, I'm in total panic. I have daughter an Acrpobat PDF reader for 8 hours - suddenly when I closed the pdf it didn't close properly by asking to save what was written and I've lost 8 working hours. find the pdf on my pc somwhere

    Hi, I'm in total panic. I have daughter an Acrpobat PDF reader for 8 hours - suddenly when I closed the pdf it didn't close properly by asking to save what was written and I've lost 8 working hours. find the pdf on my pc somwhere

    Hi klaush21776048,

    I'm sorry, but if the file is not saved correctly, then it is not possible to find the PDF file.

    Kind regards

    Ana Maria

  • Can I View Manager 3.0 to 3.1.1 during work hours?

    Hi all

    is it possible to improve my manager view of 3.0 to 3.1.1 during the working hours (08:00-17:00)? The upgrade process breaks the connection between client and server?

    See, View client agent and server connection to view, that we should I update first?

    Thanks in advance.

    hihiy

    I recommend you to upgrade:

    (1) login server

    (2) view composer

    (3) view Agent

    (4) customer view

    There will be some downtime due to the upgrade of services. Also, you will need some downtime to redial when you update the view in the picture Agent parent.

    I hope this helps.

    Jason Silva

    blog: http://silvaecs.com

  • Annual calendar (display of 12 months)

    Hello

    I want to create a view of calendar in the apex is it possible? Maybe it uses Sql calendar.


    The weekly, monthly, and daily of Calenders account wizard.


    I'm under the Apex Version 2.0.0.00.49


    Thanks in advance,

    Huw.

    Hi Huw,

    You create a page template "Page Snippet" and apply it to the second page of schedule?

    On the main section of the calendar page, I have a HTML area for each 'drawn' calendars The Source of the region to that of my second calendar is:

    <div id="CALENDAR2"> </div>
    

    I then an another region HTML in the display point "Before the Footer" that has a parameter of area Source of:

    <script type="text/javascript">
    function getCalendar(calPage, calDIV){
      var get = new htmldb_Get(null,$x('pFlowId').value,null,calPage);
      var gReturn = get.get(null,'<htmldb:BOX_BODY>','</htmldb:BOX_BODY>');
      get = null;
      document.getElementById(calDIV).innerHTML = gReturn;
      document.getElementById(calDIV).innerHTML += "";
      gReturn = null;
    }
    getCalendar(3, 'CALENDAR2');
    getCalendar(4, 'CALENDAR3');
    </script>
    

    It's the Ajax call that goes and gets all that overrides the setting #BOX_BODY # on the page template and pushes in the div tag

    The calendar page 2 with no style sheet, the style of the calendar is dependent on the schedule of the first page - this should be ok if both use the same calendar model.

    If you have nothing else on the page for the 2nd page of calendar template, this can interfere with the output

    The parameter 'calPage' in the getCalendar() function is the number of page Apex which is the second calendar-in my example above, the 2nd calendar is on page 3. If you use the number of page bad here, nothing would be returned (or, depending on your application, you get the content from another page!).

    Otherwise, the steps are related, the only other possibility would be a typing error in the javascript code

    Andy

  • Passport blackBerry calendar times are 4 to 5 hours off on my passport

    Hello community,

    I recently got the Passport. Great phone.

    Had a single problem, however. I'm synced to my BES works and whenever someone sends me an invitation from calendar, the time they died in 4 or 5 hours when it hits my calendar of passports.  My calendar looks good on Outlook on my desktop, but on my passport, the times are all off.

    Example: sent an invitation for 16:00 to 18:00 - my passport shows that he is 21:00 - 23:00... difference of 5 hours.

    The problem is, it is not constant. Another recurring invitation is from 1230 am in my calendar, but my passport shows 430 pm - 4 hours difference.

    This may be synonymous with doom very quickly.  No idea what is happening and how I can fix this problem?

    David

    Passport to a time zone change schedule diff and put your again and it should be better after

  • Calculator is not working

    Calculator hot key turns off automatically

    Hello

    (1) have you made changes before the start of this issue?

    (2) what is the brand and model of the keyboard?

    (3) is the specific question of the keys of the calculator?

    If you use the Microsoft keyboard, then click on the link below:

    Fix shortcuts or Volume control keys not working not not on Microsoft keyboards

    http://support.Microsoft.com/kb/932875

    Let us know if that helps.

  • Appeal of calendar on the scope of work

    I use the following code to call a container application work, calendar, but the call what follows is invoking the calendar House, not the perimeter of work schedule. When I used a similar code to call the mail client, he called customer of e-mail in the scope of work. Can someone check the code and see what I'm doing wrong?

    Participants QVariantList = QVariantList();
    participants. Append ("[email protected]");
    Data QVariantMap = QVariantMap();
    Data.Insert (QString ("participants"), QVariant (participants));

    Application of InvokeRequest;
    request.setTarget (tr ("sys.pim.calendar.viewer.eventcreate"));
    request.setAction (tr ("bb.action.CREATE"));
    request.setMimeType (tr("text/calendar"));
    QByteArray encData = bb:psObject::encode (data);
    request.setData (encData);
    BB::System:InvokeManager * m_invokeManager = new InvokeManager (this);
    m_invokeManager-> invoke (request);

    We will examine this question. But for now, at least you can specify the ID of the calendar account to use to create the event. Who should call the event create map with the preset specified account.

    Shadid

  • BlackBerry Smartphones sync wants to delete each event calendar more old 3 months from Outlook

    When I sync my curve with Outlook using Desktop Manager (4.5) he wants to delete all of my calendar on Outlook events that are older than 90 days. I don't want to lose this story so I hit always refuse, but then of course you can not updated to the device. I pointed out that when suspends occur WINS Outlook but that doesn't seem to work.

    Nope it is set to never. I checked that before after reading some of the more early semi-connexes sons.

  • Leak filter twelve months work not as expected

    Guys,

    All OOB reports come with trailing four quarters but if the quarter just started then the future months will have no data.

    If it's Q4 and a July, August and September - in August and September are in the future there is no data. so we see only 10 months.

    My req is if we're 15 - I want to see every month from 14

    I've implemented as the logic below but it is not work - these are filters

    Business period is superior to @{ENTERPRISE_PERIOD_YEAR_AGO}

    AND the company period is less than or equal to @{CURRENT_ENTERPRISE_PERIOD }

    I see the result is that a month, which is July 15 - can you guys please tell me where I am doing wrong - please check the attachment for the result

    Thank you

    1.JPG

    I got the 12 months I'm looking for but the sorting does not work properly - you guys can help pls

    I use this formula - 'Time Enterprise'. "" Date of the company "BETWEEN TIMESTAMPADD (SQL_TSI_MONTH-12, CURRENT_DATE) AND CURRENT_DATE

  • 1.2 calendar highlighting the current month

    I went to Nov 2009 & dec. 2009/2010 and calendar do not alleviate the current monthly view, as it does in other months.  What is happening to someone else?

    Mine display it correctly. Have you tried a reboot of the phone?

  • Calculation No. Longer Works if a value in a field is deleted

    I have a question where a FormCalc calculation stops working if I delete a value in a field that is part of the formula.

    Here is a link to the test form: https://www.dropbox.com/s/3w6weyd3bp5dfss/Test_Totals.pdf?dl=0

    When I enter values in the table below, the calculation in the field of the CASH DUE EMPLOYEE works very well.

    Total_B.jpg

    If I delete the value in the field of the ADVANCE of FUNDS, the calculation in the field of the CASH DUE EMPLOYEE is not recalculated.  In the example below, I've removed the cash advance, so the EMPLOYEE DUE CASH should be $ 100, but yet the field is empty.

    Total_A.jpg

    This is the FormCalc script in the field of the CASH DUE EMPLOYEE:

    If (Table1.Row1.Total_E_Exp.rawValue > Table1.Row2.Cash_Adv.rawValue) then

    Cash_Due_Employee.RawValue = Table1.Row1.Total_E_Exp.rawValue - Table1.Row2.Cash_Adv.rawValue

    on the other

    Cash_Due_Employee.RawValue = 0

    endif

    I just can't understand why the field isn't recalculate after that I deleted the value in the field of the CASH ADVANCE.

    Any help would be appreciated.

    Thank you

    Not sure why FornCalc does not work, but the same logic works fine JavaScript.

    Check the form at the following link:

    Dropbox - Test_Totals2.pdf

Maybe you are looking for