How to create a function to calculate the calendar

Oracle Forms 6i

Hai

I'm generating a daily presence that is stored in the database with the fields

Empcode, attend_date, intimate, outtime, extratime, deptcode, unitid and some other things

I need to create a function by taking these fields of the table unitid, empcode, intimate, outtime, attend_date, deptcode and return total hours he worked, and more than 8 means it will add in extra time.

If it is possible to give the run of the date value to which to this day, you must calculate.

Thanks in advance

Srikkanth.Ml

Srikkanth,
Depending on how you stated your RESPONDENT and OUTTIME, columns this should quite simply be a calculation. For example, if you have declared these columns as DATE columns, the following calculation should work:

SELECT NVL(OUTTIME,SYSDATE) - INTIME AS hours_worked
FROM DAILY_ATTENDANCE
WHERE EMPCODE = "Emp Code of the employee you are evaluating";

Once you have the HOURS_WORKED, you can check if the amount is greater than 8 (or whatever is the approved duration of working hours of the employee's) to determine if he or she worked longer than their approved shift back the extra time, and the user has worked or NULL or zero if they have not exceeded their shift.

If you have set up the columns of time as something other than the DATE or DATETIME, you will need to convert the values in input/OUTPUT at a DATE so that you can use the functionality of calculation date default Oracle or you need to build your own process of calculation of the WORK_HOURS based on how you store the RESPONDENT and OUTTIME values.

I hope this helps.
Craig...

Tags: Oracle Development

Similar Questions

  • Function to calculate the days of work

    Hi all

    I accidentally develop an application in which I had to follow the thread below and it works perfectly for the weekend (Saturday and Sunday)

    PL/SQL function to calculate the non-working days

    Now, my specific question is: how to implement the same function , but weekends (Fri & sat).

    I tried to recognize the logic behind the calendar to change the days of the weekend, but I suspect.

    I need your recommendation around this function specifically.

    !-[CodeBlockStart:3cad70b5 - 81 a 0-4f6b-909 a-cacb29e25953]--> BOX WHEN IN l_case (-"Mon6", "Tue5", "Wed4", "Thu3", "Fri2" - exclude Saturday & Sunday, workday begins from Monday 'Sun6', 'Mon5', 'Tue4', 'Wed3', 'Thu2' - remove begins day 2 business days (Fri & sat) on Sunday and maintaining the order of the sequences,-"Sat1", "Sun1", "Sun2', 'Sun3', 'Sun4' - Include weekend can be for the rest of the week) , "Sat1", "Sat2", 'Fri1', "Sat3", "Sat4" - includes my week ends replace (with FRI Sat) & (Sun to SAT) & law enforcement-sequence, "Sun5', 'Sun6',"Sat5","Sat6"- replace (Sun with Sam).                                                                   ) 1 THEN WHEN IN l_case (-'Tue6', 'Wed5', 'Wed6', 'Thu4', "Thu5" - Old (Saturday and Sunday) end over the next week - I guess - sequence of days - since the week days sequence Changed (number 1 or 1 step backward) when numbers also changed accordingly "Tue5", "Wed4", "Wed5", "Thu3", "Thu4" - ok-, 'Thu6', 'Fri3', "Fri4", "Fri5", "Fri6", "Thu5", "Sun1", "Sun2", 'Sun3', 'Sun4' - contiue to Thu sequence number & then replace my current (Friday) holiday with start of work dat (Sun) "Fri1") (, 'Fri2', 'Fri3', 'Fri4', "Fri5") THEN 2 0 OTHERWISE END;

    Thanks in advance.

    Amatu Allah

    with

    calendar as

    (select dat_val,

    cases where to_char(dat_val,'mm-dd') in (12-25', 12-26', ' 01-01')-in fact select the host table to_char(holiday_date,'mm-dd')

    then "vacation."

    When to_char (dat_val, 'Dy') in ('Friday', 'Saturday')

    then 'weekend '.

    else 'work '.

    end dat_type

    sum (case when to_char(dat_val,'mm-dd') in (12-25', 12-26', ' 01-01'))

    then 0

    When to_char (dat_val, 'Dy') in ('Friday', 'Saturday')

    then 0

    1 other

    end

    ) on working_count (dat_val control)

    from (select date "' 2015-12-01 + level - 1 dat_val)

    of the double

    connect by level<=>

    )

    )

    Select dat_val,

    dat_type,

    working_count

    calendar

    where dat_val between to_date(:lo_date,'yyyymmdd') and to_date(:hi_date,'yyyymmdd')

    and dat_type! = work «»

    DAT_VAL DAT_TYPE WORKING_COUNT
    11/12/2015 end of week 8
    12/12/2015 end of week 8
    18/12/2015 end of week 13
    19/12/2015 end of week 13
    25/12/2015 holiday 18
    26/12/2015 holiday 18
    01/01/2016 holiday 23
    02/01/2016 end of week 23
    08/01/2016 end of week 28
    09/01/2016 end of week 28

    Select to_date(:lo_date,'yyyymmdd') lo_date,

    to_date(:hi_date,'yyyymmdd') hi_date,

    dat_val,

    dat_type,

    working_count,

    Lead (working_count) more (order of dat_val) - working_count + 1 working_days,

    to_date(:hi_date,'yyyymmdd') - to_date(:lo_date,'yyyymmdd') - lead (working_count) (order dat_val) + working_count non_working_days

    calendar

    where dat_val in (to_date (:hi_date,'yyyymmdd'),to_date(:lo_date,'yyyymmdd'))

    LO_DATE HI_DATE DAT_VAL DAT_TYPE WORKING_COUNT WORKING_DAYS NON_WORKING_DAYS
    10/12/2015 10/01/2016 10/12/2015 work 8 22 10
    10/12/2015 10/01/2016 10/01/2016 work 29 - -

    Concerning

    Etbin

  • How to write a function to estimate the number of rows returned SQL?

    How to write a function to estimate the number of rows returned SQL through SQL Execution Plan?
    My idea is
    Call dbms_sql.parse to create the SQL PLAN, then ask the PLAN for the number of estimated return lines.
    But how to get SQL plan through "id cursor?
    Thank you.

    You can use EXECUTE IMMEDIATE to explain plan statement. About the STATEMENT_ID generation, it could be anything. Even a SYSTIMESTAMP cast as TANK would work.

  • How to create a shortcut to toggle the sound device?

    Anyone have any suggestions on how to create a shortcut to toggle the USB audio device in Device Manager?

    A shortcut is to enable this device, and the other shortcut is disable this device.

    Thanks for all the suggestions

    Hi oem7110,

    · Why you want to create a shortcut to enable or disable an audio device from Device Manager?

    You will be able to create the shortcut to Device Manager but no shortcut to enable/disable a device in Device Manager:

    a. right-click on the space empty where you want to create a shortcut

    b. click the shortcut

    c. in the type of space empty in devmgmt.msc

    d. click Next and follow the instructions in the wizard.

    With regard to:

    Samhrutha G S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How to create a document and insert the words and/or art on both sides of the page

    How to create a document and insert the words and/or art on both sides of the page

    How to create a document and insert the words and/or art on both sides of the page

    You create a document by using an application of word processor like Microsoft Word or Corel WordPerfect or OpenOffice Writer.  Think of it as a broad a page roll.

    When you print the document, you can print all pages of the document on one sheet of paper (the normal default value), or you can print on both sides of a sheet of paper.

    Some printers are capable of automatic double-sided printing.  With others, you print all the odd pages and then take the stack of paper, turn upside down and put it back into the printer to print all pages.  You need either to read your printer manual, or experiment a bit to determine if you need to re - organize the first last pages before printing the second side.

  • How to create a new folder in the voice tab 7 hp slate

    How to create a new folder in the voice tab 7 hp slate?

    I wish to cretae a folder in my home page.

    Please help me...

    Hello and welcome to the HP support community!

    You want to organize your icons in folders, or put a shortcut of data on your home page folder?

    The first is easy, this last not so much.

    Just hold your finger on an icon, and then drag it on another similar icon.  A "folder" will be done with the name "unnamed file".  Press and hold the words to change the name of the folder.

    I'm not aware of a way to file a record of data on the homepage...

    WyreNut

  • How to create a restore point in the protection of the system in safe mode?

    As topic the question, how to create a restore point in the protection of the system in safe mode?

    Hello

    read a tutorial on the below link for everything you need to know about the system restore

    http://www.bleepingcomputer.com/tutorials/tutorial143.html

    and read this too

    System Restore: frequently asked questions

    http://Windows.Microsoft.com/en-us/Windows-Vista/system-restore-frequently-asked-questions

  • Smartphones blackBerry how to create a new folder in the video folder in the media

    Hi, I'm trying to figure out how to create a new folder in the video folder in the media. I can easily create new folders in the pictures folder, but not in the videos... Why? Thanks in advance for your help.

    well I'm sorry, I think that I have not read your emails correctly.

    The media application doesn't care about records at all. It will read the files, the tags when they are available, playlists, but it will not show the files. with the exception of the pictures.

  • How to create a Viewer without buying the image? I want to be able to save the images I'm looking a subject without purchase or download.

    How to create a Viewer without buying the image? I want to be able to save the images I'm looking a subject without purchase or download.

    After talking to the Customer Service, I now get it. Thank you.

    That is to say: down arrow recorded a watermark image in the gallery without you buy. You can download an overview lores on your desktop for motorhomes with this same arrow, but it is unfortunately a watermark (unlike the DPC). You can also copy and send a link to the Gallery clients to review before you buy.

  • How to create my electronic signature for the first time

    How to create my electronic signature for the first time

    Hi debbieh62171891,

    You can fill feature & signature to create a Signature in Adobe Reader. If you want to create a Digital Signature using Adobe Reader you must then a PDF form with signature inside and drive field expanded licence fees. In this case, when you click the signature field it will take you with the process of creating a Digital Signature.

    Thank you

    Abhishek

  • Please how to create an e-commerce using the muse of adobe

    Please how to create an e-commerce using the muse of adobe

    ECWID is certainly the easiest to customize muse and it's very easy for customers to add/manage products. Another thing that many people love in Ecwid, it's that you can host several stores account. If you know css/javascript then you can do this on your own, but if you want a widget that does, make these widgets.

    If you are looking for some great Ecwid widgets, you can enter these ones that are free. And if you are wanting to customize even more (including the ability to host multiple account stores), you can get these even more impressive widgets for $14.99 with promo code: 1MUSESTORE #.

  • I need to update the screenshots for a new version of an app existing Itune application to download a new version. Since I did not create the original version, can you guide me how to create a new version with the new version number?

    I need to update the screenshots for a new version of an existing iTunes Connect App asks me to download a new version. Since I did not create the original version, can you guide me how to create a new version with the new version number?

    You must call the assistance of the company and ask them to help you with this. You can find contact information by logging on http://digitalpublishing.acrobat.com/ and looking at the Middle at the bottom of the page.

    Neil

  • How to create a report based on the item selected from the list of selection?

    Hello

    I created a tables_LOV based on:

    Select table_name table_name user_tab_cols r, d

    where column_name like '% _type % '.

    Then I created a ListOfTables page element, display in a selection list and pointing to tables_LOV.

    I run the page, and I can choose the table I want in the drop-down list.

    How to create a report based on the selected element? (ex: select * from selected_table)

    Thanks in advance

    Salah

    Hi Salah,

    Allright, take a look at this page: http://apex.oracle.com/pls/apex/f?p=vincentdeelen:collection_report

    I think that simulates what you are trying to accomplish. I've implemented the simplest method I could think of.

    The report is based on a collection of apex. If you are not familiar with this, you should study the documentation: APEX_COLLECTION

    To recreate my example, you should:

    (1) create a report (interactive) on your collection

    SELECT *
       FROM APEX_collections
     WHERE collection_name = 'MY_COLLECTION'
    

    (2) create a selection list page_item for the tables that you want to display (in my case, this is called "P38_TABLES")

    (3) create a dynamic action that triggers on the evolution of your selection list page_item. Dynamic action must be a parade of PL/SQL procedure the following code:

    declare
      l_query varchar2(4000);
    begin
      l_query := 'select * from '||:P38_TABLES;
      if apex_collection.collection_exists
            ( p_collection_name => 'MY_COLLECTION' )
      then
        apex_collection.delete_collection
          ( p_collection_name => 'MY_COLLECTION' );
      end if;
    
      apex_collection.create_collection_from_query
        ( p_collection_name => 'MY_COLLECTION'
        , p_query           => l_query
        );
    end;
    

    Make sure that you add your page_item 'Page to send items' section.

    (4) add a real extra action that makes an update of the report area.

    Here are two photos describing the da:

    http://www.vincentdeelen.com/images/OTN/OTN_COLLECTION_REPORT_DA1.PNG

    http://www.vincentdeelen.com/images/OTN/OTN_COLLECTION_REPORT_DA2.PNG

    Good luck and greetings,

    Vincent

    http://vincentdeelen.blogspot.com

  • How to create images that react to the size of the browser (and not to the device)?

    How to create images that react to the size of the browser (and not to the device)?

    Hello

    Please try this widget.

    http://widgets-musethemes.BusinessCatalyst.com/tb032.html

    Concerning

    Vivek

  • How to create drop down menus in the main menu?

    How to create drop down menus in the main menu?

    such as:

    1 menu 2 menu 3 menu 4

    menu one

    menu b

    menu menu menu x c y menuz

    menu d

    I have the top menu, but don't know how to get the submenus

    Help you to appreciate in advance

    You must set the 'Pages' menu preferences:

Maybe you are looking for

  • Satellite L20-183 broken BIOS - Linux

    I have a problem with may Satellite L20-183. When I try to install the operating system Linux (Mandriva Linux 2006 official) after checking the HDD, cd... I see a broken 'BIOS' massage and only what I can do is to restart the computer.Why is this hap

  • Unable to connect satellite Pro 6000 network

    I would appreciate help on this. We have a Toshiba Satellite Pro 6000, which we assumed is active wireless. But when you turn on the wireless switch, there is no answer and the laptop will not come to look for me or any other network. I was able to c

  • Sort by date does not account for the year

    When I sort the files by modification date he considers only the month and date. The year is ignored, causing very old files appear on the top, for example 2007-12-14 02/10/2010 2008-09-30 01/05/2009

  • TextInput restrictions as spark/mx. TextInput

    The QNX TextInput class doesn't have a property limit as the mx/spark. TextInput class.  Very practical.  will we have to roll our own will be the next version of the SDK support this?  I have no need for the change in keyboards for things like email

  • Problem with black ink

    Hello there, I have a HP C6380 printer. I ran out of black ink small 564. I have a larger 564 black ink there how can I get the printer to use the largest cartiage of ink instead of replace ink 564 more small. Thank you Scott