Count Employee Working Days

Hello all
i have a attandance table
create table attn(
EMPNO NUMBER,
ADATE DATE,
ATIME DATE,
ETYPE VARCHAR2(2)); ( IN/OUT )
i want to count a employee working days....i have save all employee in/out attndance table......any body help me

hello all
thanks for replay
but my problem is this........
emp # date time type
4 01-JAN-04 12:15 OUT
4 01-JAN-04 09:50 IN
112 01-JAN-04 10:15 IN
4 01-JAN-04 17:15 OUT
4 01-JAN-04 01:50 IN
112 01-JAN-04 18:57 OUT
10 01-JAN-04 10:50 IN
10 01-JAN-04 19:15 OUT
my problem is one employee in/out more then 1 time a day..same situation end of month.when i have calculate working day end of month....if employee in/out more time a day query only calculate 1........

Similar Messages

  • Count working days

    Hey huys,
    I have a problem with the count of working days in the report I am developing.
    I make the count of days with TIMESTAMPDIFF but this return all days between  Start Date and end date and I Want only working days. I have a column that says if the day is a work day or not.
    I don´t have any idea how I make the comparison day by day.
    Can any suggest how I do it.
    Cumpz

    We can try to create a function in DB which returns the Number of Working Days on passing the Start Date and End Date of Campaign Calendar
    By you saying there is a column "Work Day" with flag "Yes" or "NO", I assume there is a table called Campaign Calendar which may provide this info like if each and every day is working day or not.
    For ex:
    Work_Day                  Flag
    02-SEP-13 00:00:00    YES
    03-SEP-13 00:00:00    YES
    04-SEP-13 00:00:00    YES
    05-SEP-13 00:00:00    YES
    06-SEP-13 00:00:00    YES
    07-SEP-13 00:00:00    NO
    08-SEP-13 00:00:00    NO
    If the above is the case, then try to create a function  as below which return number of working days between two dates
    CREATE
    FUNCTION DATE_DIFF(ST DATE, ED DATE) RETURN NUMBER
    IS NO_OF_WDAYS NUMBER;
    DT1 DATE := ST;  ---VARIABLE TO HOLD START DATE
    CHR1 VARCHAR2(10);   ----VARIABLE TO HOLD FLAG FOR EACH DATE
    HOLIDAY NUMBER := 0;  ----COUNTER WHICH GIVES US NUMBER OF HOLIDAYS BETWEEN TWO DATES INCLUDING SATURDAYS AND SUNDAYS
    BEGIN
      NO_OF_WDAYS := TRUNC(ED - ST);
      LOOP
      SELECT Work_Day /* THE COLUMN WHICH HOLDS THE FLAG*/
      INTO CHR1
      FROM CAMPAIGN_CALENDAR /* THE TABLE WHICH HAS THE INFO */
      WHERE DATE_COLUMN = DT1;
        IF(CHR1 = 'NO') THEN
        HOLIDAY := HOLIDAY + 1;
        END IF;
      DT1 := DT1 + 1;
      EXIT WHEN DT1 > ED;
      END LOOP;
      NO_OF_WDAYS := NO_OF_WDAYS - HOLIDAY;
      RETURN NO_OF_WDAYS;
    END DATE_DIFF;
    Once the above function is written, use Evaluate function in the RPD and pass both the columns as parameters.
    EVALUATE('DATE_DIFF(%1,%2)' ,Campaign Start Date,Campaign End Date)
    Whenever the column gets pulled in the report, the above db function will be fired hence resulting in Number of Working days.
    Hope its helpful
    Srikanth

  • Working day formula that excludes weekends and holidays in WEBI

    Hi Guys,
    Can we calculate a working day formula that excludes weekends and holidays in WEBI OR in Universe?
    The universe I am working on is using stored procedures, so there are no joins or modelling done. Although there is a workday stored proc  that I can bring in the universe.
    I am just thinking if there is no modelling or joins done in the universe how will this help me in webi?
    Your suggestions will be very helpful.
    Thanks,
    Jitan

    One more suggestion I need from you  -
    I have a Work_Calendar_VW that has the following columns -
    Calendar_Date - 5/1/2014
    Calendar_Year - 2014
    Calendar_Month - 5
    Calendar_Day - 1
    Work_Day - 1
    Day_Type - WD (Work Day)  For Weekends this will be displayed as WE
    The columns have all dates for current year in SQL Server.
    I am going to pull this into the universe and create 2 derived tables to calculate MTD Day counts.
    Derived Table 1  - Calculate Yest Work Day... this will remove all the weekends and holidays and give me the last working day. This includes couple of case statments to check each day if it's a working day or weekend.
    For Work Day the above code will be 1 and for weekend 0
    Derived Table 2  - This will give me the count of working days in current month using the above view and Derived table 1 Below is the code  -
    SELECT COUNT(*)
    FROM Work_Calendar_VW
    WHERE [Work_Day] = 1 AND
       (Calendar_Date BETWEEN CAST(CONVERT(VARCHAR(25),MONTH(LastWoringkday()),101) + '/01/'
       + CONVERT(VARCHAR(25),YEAR(LastWoringkday()),101) AS DATE)
      AND LastWoringkday()).
    I cannot do joins because this universe has been built using stored proc and would like to implement this in BO universe.
    let me know if this is the right approach.
    Thanks,
    Jitan

  • Human tasks on working days

    How can I do to make Human task's expiration days count only working days?

    Here's a bit of Java code to generate the string for 8 hour expirations only on days of M-F. It assumes a BPEL variable named strExpirationMinutes of type string has been created. You can pass the variable in to the human task as a parameter and directly assign it via XPath on the task configuration screen.
    String tmp = "PT";
    int iMins = 0;
    int hrs8 = 60*8;
    int hrs23 = 60*23;
    int hrs24 = 60*24;
    java.util.Calendar calNow = java.util.Calendar.getInstance();
    int hours = calNow.get( java.util.Calendar.HOUR_OF_DAY );
    int minutes = calNow.get( java.util.Calendar.MINUTE );
    int dow = calNow.get( java.util.Calendar.DAY_OF_WEEK );
    // if a M-T
    if (dow>=2 && dow<=5) {   
    // if starting before 8 am - add 8 hours plus the interval between now and 8 am
    if (hours<8) {   
    iMins = (60-minutes) + ( (8-hours-1)*60 )+ hrs8;
    // if starting between 8 am and 9 am - just add 8 hours
    } else if (hours==8 || ( hours==9 && minutes==0) ) {   
    iMins = hrs8;
    // if starting between 9 am and 5 pm - just add 23 hours
    } else if (hours>=9 && (hours<17 || (hours==17 && minutes==0)) ) {   
    iMins = hrs23;
    // if starting after 5 pm - add 8 hours plus the interval between now and 8 am
    } else {   
    iMins = (60-minutes) + ( (24-hours-1)*60 ) + hrs8 + hrs8;
    // if Fri
    } else if (dow==6) {   
    // if starting before 8 am - add 8 hours plus the interval between now and 8 am
    if (hours<8) {   
    iMins = (60-minutes) + ( (8-hours-1)*60 )+ hrs8;
    // if starting between 8 am and 9 am - just add 8 hours
    } else if (hours==8 || ( hours==9 && minutes==0) ) {   
    iMins = hrs8;
    // if starting between 9 am and 5 pm - add 23 hours plus the two we days
    } else if (hours>=9 && (hours<17 || (hours==17 && minutes==0)) ) {   
    iMins = hrs23 + hrs24 + hrs24;
    // if starting after 5 pm - add 8 hours duration plus the interval between
    // now and 8 am saturday, plus the 2 we days
    } else {   
    iMins = (60-minutes) + ( (24-hours-1)*60 ) + hrs8 + hrs8 + hrs24 + hrs24;
    // if Sat
    } else if (dow==7) {   
    // add 8 hrs duration, plus the time between now and midnight sat, plus
    // all of sunday, plus 8 hrs for monday before 8 am
    iMins = (60-minutes) + ( (24-hours-1)*60 ) + hrs8 + hrs8 + hrs24;
    // if Sun
    } else {   
    // add 8 hrs duration, plus the time between now and midnight sun, plus
    // 8 hrs for monday before 8 am
    iMins = (60-minutes) + ( (24-hours-1)*60 ) + hrs8 + hrs8;
    // finish build the time string
    tmp = tmp + iMins + "M";
    // save the string to bpel proc and audit
    setVariableData("strExpirationMinutes", tmp);
    addAuditTrailEntry("strExpirationMinutes:",tmp);

  • To see the number of working days and leave of an employee for year

    HI SAP GURUS,
    I want to see the the number of working days and leave of all employees of the organisation for a year. Please tell me is there any report or any transaction code in sap to see the working days and leave for all employees.
    Thanks & Regards
    Surupa

    Hi,
    call transaction PT64.
    Best Regards
    Bernd

  • FM to calculate Number of working days adjusted for an employee -ABAP HR

    I have one requirement in which i have to Calculate "Number of working days adjusted" for an employee for a disability program.
    In this context i wanna know, if just get difference between two dates (i.e the duration for which employee was compensated ) based on Holiday calender...Will this give give me "Number of working days adjusted"  for an employee or i have to consider work schedule for an employee? If yes , Then please let me know sm FM to calculate number of working days between two dates speific to an employee.

    check
    HR_PERSONAL_WORK_SCHEDULE
    HR_GET_QUOTA_DATA

  • How working days is  treated and counted as leave day.

    Q. What is working Days & How working days is  treated and counted as leave day.
    Case 1-suppose Absence is registered on 15.11.2010- 18.112010.but on 17.11.2010 is a public holiday.in as IT2001 it is showing as Absence hrs =24 days,Abs days = 3 days and Cal days = 4 days .Quota used= 4.
    why it is not showing 32 hrs .
    Thanks

    The counting rule for absences takes care if the public holiday or non working days as to be counted when absence is entered or not.
    If you tick on (not  a public holiday) then only days which are not public holidays wll be counted in absence counting. If you dont check saturday sunday in the rule then sat sunday will be counted towards leave...Other options are also there for eg. Holiday classes. You can make appropriate settings  and include or exclude the working/non working days from absence counting.

  • Leave for non working day

    Hi,
    We have a project called as capita for whom our employees are sheeting on their office, and their holiday calendar and our holiday calendar is different some of our employee who are in capita they applied leave on 10th sep which was a holiday in Mastek but it was a working day for capita .
    Neither we can make a new holiday calendar for capita nor can we frame a new absence type, because by doing this there are some possibility of violating our hr policy.
    So kindly suggest us the best possibility.
    We are patch level 58

    Hello sir,
    When entering absences the counts the planned working time which is included between begin and end of the absence. On off-days or public holidays the sum of working hours always is zero. 
    From a business point of view it does not make much sense to record an absence for an employee on a day on which he/she  does not have to work.
    Unfortunately you cannot override this. If you need to record an absence on a day off you will have to create a substitution record so that day is now a working day.
    The following information might be helpful:
    After a change in a holiday calendar the work schedules have to be regenerated. The warning message you described on the first page comes out of a check against the work schedule. In IMG you can find Personal Time Management -> Work Schedules -> Work Schedule Rules and Work Schedules -> Generate Work Schedules Manually Here the work schedules have to be generated after any change in the holiday calendar.

  • Logic to calculate average number of employees per day...

    Hi,
    In an internal table, i have employee number, start date, end date.
    This table shows employee's start and end dates for a cost center.
    Now, the requirement is to calculate the average number of employees available per day for a given period...
    Lets asume that we would like to calculate average number of employees per day for a given period of 30 days (01.01..2009 to 30.01.2009)....
    The above table will have around 20 employees with their start and end date.
    Among these 20, some may be present between 1st to 10th Jan only..
    In such case, How to calculate average number of employees per day in such case?
    Can anyone help me out with a rough sketch of logic for this calculation?
    Thanks in Advance,
    Pavan

    My Logic:
    1) First choose dates from which date to which date you are planning to calculate. [Here i am trying to calculate from Jan 1st 2008 to till date - March 3rd 2009 = So total days = 427 days]
    2) First try to count number of days worked in organization by each employee. [Lets take employee a = 10 days, b = 182 days, c = 427 days].
    3) Then total all the number of days. [abc = 10182427 = 619 days].
    4) Total number days / Total number of days worked = 619 / 427 =  1.44 employees per day.
    Employee     Emp-Start Date     Emp-End Date     No. of days
    a             Jan 1st 2008     Jan 10th 2008     10
    b             Jun 1st 2008     Jun 30th 2008     182
    c            Jan 1st  2008     3rd March 2009     427
              Total No. of days                     619
         From Jan1st 2008 to Till date 3rd March 09          427
              619 / 427 =     1.449648712
    I tried take simple example to recheck the above scenario is correct or not. If 'n' number of employees worked for an organization in a year (365 days) is 730. then per day = 730 / 365 = 2 employees per day worked for organization.
    I am not sure my logic is correct or not ... just tried like above.
    Regards,
    ~Satya

  • Emergency Leave on Non working days

    Hi All,
    Emergency leave : the process at the moment : if the employee avails this from Friday to Monday saturday and sundays are excluded and they are
    not calculated as absence days, (for this scenaro the Saturday and Sunday boxes are unchecked in Table - T556C - Countin rule)
    but now there is another  requirement that if the employees are asked to 
    work on non working days and for some reason if they are not turned up on that day for those employees that day should be considerede
    as Emergency leave and Emergency quota should be deducted accordingly.
    How do i handle this situation?
    your inputs are appriciated.
    Thanks
    Dvnr

    Hi Swapnil,
    It is not cleared to me what you said above please u2018This will not be possible, since you have marked the same as holiday and counting rule is exempted for that. Hence, you can only substitute him for that day using the time entry.
    I am little confused let us forget about the question I asked with the  example of holiday on 25.12.2011.
    Please consider this one: 
    I have maintained DWS in IT2003 on 04.12.2011 for one employee who is supposed work on Saturday (or any non working day in another scenarios) but for some reason he has not turned up , as per the requirement I want to mark EL on 04.12.2011 and EL quota should also deduct accordingly.
    As you said I have unselected the 'Not a public holiday' under public holiday class and with this also quota is not getting deducted
    Thanks and Regards
    Dvnr

  • Holiday as Working day - Marked as leave is not deducting from Quota

    Hi Experts,
    Please help me with below mentioned scenario.
    We have one holiday calendar for two personnel areas however holidays are different in both personnel areas, and as it is middle of year so I can't create a new holiday calendar for other personnel area so we maintain special day as working day in factory calendar to change holiday as working day for one personnel area.
    Holiday Calendar :- HA (haryana) ,                      Personnel Area (A)           Personnel Area (B)
    Holidays :-     25th Till 28th Oct Diwalii,                25th till 28 Holiday             26 & 27 Holiday only (25 & 28 working in special day rule)
    Issue :- personnel area (B) Now if Employee is getting leave for 25th (which is holiday in calendar and maintained as working day in special day rule) it is not deducting leave from quotas.
    Issue :- Half Employee on 25th are marked as Holiday (HH) in system however half have Absent (AA) in report.
    **(Should I try to make a deduction rule and counting rule for 25th & 28th as it is holiday & working togather... if yes thn what needs to be selected in counting rule)**
    Please provide inputs in this regards as it is urgent.
    Thanks you!!
    Anshul

    Hi Swapnil,
    Thanks man, I understood now, Yes you are right as but it is not working when I am trying to solve this issue after maintaining IT 2003. Now I have to go with second solution however I made Counting rule and deduction rule but facing issue assigning counting rule to Absence Type so the question is Do i need to make new absence type then counting rule and deduction rule or I can just make a counting rule and assign it to the existing Absence type?????
    Please help me through the process as I am little confused, just explain a bit like.. I need to make counting rule and assign it from <so & so> place.
    Thank you so much for your precious time,
    Anshul Upadhyay

  • Working days formula and Crystal 7 - is it possible?

    Post Author: Tim F
    CA Forum: Formula
    Hi folks,
    Really hope someone can help, I'm struggling with writing a report that needs to show the difference between two dates in working days. I've found the same formula posted here several times but cannot get it to return a logical value in my report. I'm wondering if that might be because I'm using an older version of Crystal? The formula in question is this one:
    //Main formulaWhileReadingRecords;Local DateVar Start := ({PPV_COMPLAINTSEH.DTRECD});   Local DateVar End := ({PPV_COMPLAINTSEH.ACTCMPLTD}); Local NumberVar Weeks; Local NumberVar Days; Local Numbervar Hol;DateVar Array Holidays;
    Weeks:= (Truncate (End - dayofWeek(End) + 1 - (Start - dayofWeek(Start) + 1)) /7 ) * 5;Days := DayOfWeek(End) - DayOfWeek(Start) + 1 + (if DayOfWeek(Start) = 1 then -1 else 0)  + (if DayOfWeek(End) = 7 then -1 else 0);  
    Local NumberVar i;For i := 1 to Count (Holidays)do (if DayOfWeek ( Holidays&#91;i&#93; ) in 2 to 6 and      Holidays&#91;i&#93; in start to end then Hol:=Hol+1 );
    Has anyone come across an alternative way of doing this, or have any ideas why this formula is not working in my report? Any advice would be much appreciated,
    Regards,
    Tim

    Post Author: Charliy
    CA Forum: Formula
    You set up a Running Total.  Drag the filed you want Summed, Select Sum as the operation if that is not the default.
    Just below that you weill see Radio Buttons that say For Every Record, On Change of Group, On Change of Field, Use a Formula, etc - click the one that says Use a Formula.  The Blue Bos to its right will turn Red, click on it, this is where you put your formula: NOT(DATEPART('w',{table.date}) IN &#91;6,7&#93;)
    Save that, then just decide if you want it reset on a Change of Group, or Never (Grand Total).  Give it a name and put it on your report.

  • Absence Quota to be generated on basis of Working Day

    Hi Experts,
    I have got a scenario in Time management ( negative time management, no time evaluation) where the client wants absence quota to be generated on the basis of working days of employee. I have checked the configuration for creating base entitlement V_t559E but the following options are available:
    Currently i have done the cofiguration on the basis of Accrual period, leave entitlement is 22 days in a year. Wherein entilement each month is coming to 1.83 leaves, but client wants that in case employee is come for only 5 working days in a month the leave generation should accordingly get prorated and in case of 0 working days in a month there should be no entitlement.
    Calendar year
    Accrual period
    Time evalution period
    Payroll period
    Other period
    Please help.
    Regard,
    Jyoti

    Firstly Update the Period Parameters as per ur dates this has to be done manually T549Q
    later generate the Pay Roll Periods useing this Period Paramter
    and Change the evaluation Period parameter  in T559L to the Period paratmeter  which you have generated
    a lot of threads has been raised on the same issue please check

  • Need working days for a particular month and year

    Hi,
    I need the number of working days for a particular month and year.Saturdays and Sundays are holidays.
    Regards,
    Vignesh

    Try this:
    SQL> var yr NUMBER;
    SQL> exec :yr := 2010;
    PL/SQL procedure successfully completed.
    SQL> with t as (select :yr yr from dual)
      2  SELECT TO_CHAR(dat,'MON-RR'),COUNT(*) FROM
      3  (select TO_DATE('01-JAN-'||yr) + lv dat FROM
      4  (select level - 1 lv,yr from t
      5  connect by level <= TO_DATE('31-DEC-'||yr) - TO_DATE('01-JAN-'||yr) + 1))
      6  WHERE TO_CHAR(Dat,'DY') NOT IN ('SAT','SUN')
      7  GROUP BY TO_CHAR(dat,'MON-RR');
    TO_CHAR(DAT,   COUNT(*)
    APR-10               22
    AUG-10               22
    DEC-10               23
    FEB-10               20
    JAN-10               21
    JUL-10               22
    JUN-10               22
    MAR-10               23
    MAY-10               21
    NOV-10               22
    OCT-10               21
    TO_CHAR(DAT,   COUNT(*)
    SEP-10               22
    12 rows selected.
    SQL> Edited by: AP on Jul 27, 2010 7:54 AM

  • How to enter a Absence on a Non- working day?

    Hi All,
    In our company we dont have exact work schedule rules. So we have the need to be able to enter a Absence on a Non- working day for Salaried employees. when i try to enter an absencen on-working day, the number of hours are zeroed out.
    What configuration settings I need to do So that the system will take a Absence on a non working day.
    Thanks in Advance!!!

    Hello,
    I am having the same problem currently.
    When an absence that is less than one day is entered on a non-working day with a given start time and end time (we are using CATS for entering the times) along with some attendance records, there are collisions as the system tries to create the infotype 2001 record as a full day record, and the start time and end time is not taken into account, so we are not able to transfer these hours correctly to SAP HR.
    I checked all the settings regarding the day types, but could not find the trick..
    The days we are trying to create the absences and attendances for are not public holidays, just ordinary weekends with no working hours, so I don't think Holiday Class is relevant here at all.. 
    If anyone has a solution, please update the thread..
    Best regards,
    Nihan

Maybe you are looking for

  • Back up iPhone to iCloud and Macbook Pro?

    I recently had to restore my iPhone, and it was from my MacBook Pro cause I don't know how to restore it from iCloud. Is there a way to back it up on both devices?

  • How do i import outlook email addresses to iphone and send as a SMS text messages

    How do i import outlook email addresses to iphone and send as a SMS text messages?

  • Disappearing footnote numbers in InDesign CS4

    Hi all, This is my very first post here, and hope that this is the right place to expose my problem. Forgive me if this is not so. The thing is, some footnotes numbers (both in the text body and in the footnote) are nowhere to be seen in the pdf vers

  • Corrup twice!!

    so the first time, my ipod was corrupt, i reseted it and connected it to my computer, it started to update all of my songs all over again, it was fine. then when it got up to like the 60th song, it stopped and froze again. now its been like this for

  • Export: Maintain Folder Hierarchy -

    it would be very useful if lightroom could export a group of images maintaining the existing folder hierarchy, instead of dumping them all into one folder - as in, i import my images into lightroom, sort the images into subfolders, put them through d