Find date range for sick leaves
Hi,
Ive been trying to get readable output from HR system.
I have added the source data into Data Model, since i had to read the data with power query. Now i have pivot table like this:
date workdaY? user
6.3.2014 Sickleave user1
1.2.2014 Sickleave user2
2.2.2014 Sickleave user2
5.3.2014 Sickleave user4
5.3.2014 Sickleave user1
5.5.2014 Sickleave user1
16.9.2014 Sickleave user3
7.3.2014 Sickleave user1
6.5.2014 Sickleave user1
6.3.2014 Sickleave user4
Is there any possible way to get some kind of find function to sort and combine the data like this:
user1 Sickleave 5.3-7.3.2014
user1 Sickleave 5.5-6.5.2014
user2 Sickleave 1.2-2.2.2014
user3 Sickleave 16.9-16.9.2014
user4 Sickleave 5.3-6.3.2014
One way to do this is with a VBA macro. The following should get you started.
As you can see looking at the macro, the original data is assumed to be on a worksheet named HRData and starts in A1.
The results are placed on the same worksheet but starting at cell G1. You could easily write the results to another worksheet.
The original data is copied to a temporary worksheet for sorting (and the temporary sheet is subsequently deleted).
A Class Module is added so we can use a User Defined Object which has the properties of the user name, start date and end date of the vacation period.
We then cycle through the sorted data, and create a Sickleave object and add it to a collection. If the "previous" row has the same user, and the date is one more than the previous End Date, we add one to the previous end date; if not, we
create a new object and start another sickleave period.
This is the data input:
and here are the results:
To enter this Macro (Sub), <alt-F11> opens the Visual Basic Editor.
Ensure your project is highlighted in the Project Explorer window.
First, from the top menu, select Insert/Class Module. Highlight the new class module in the Project Explorer; click F4, and rename it to cSickLeave
Then paste the code below into that class module:
=======================================
Option Explicit
Private pUser As String
Private pStartDt As Date
Private pEndDt As Date
Public Property Get User() As String
User = pUser
End Property
Public Property Let User(Value As String)
pUser = Value
End Property
Public Property Get StartDt() As Date
StartDt = pStartDt
End Property
Public Property Let StartDt(Value As Date)
pStartDt = Value
End Property
Public Property Get EndDt() As Date
EndDt = pEndDt
End Property
Public Property Let EndDt(Value As Date)
pEndDt = Value
End Property
Then, from the top menu, select Insert/Module and
paste the code below into the regular module window that opens.
To use this Macro (Sub), <alt-F8> opens the macro dialog box. Select the macro by name, and <RUN>.
====================================
Option Explicit
Option Compare Text
Sub SickLeave()
Dim cSL As cSickLeave, colSL As Collection
Dim wsSrc As Worksheet, wsRes As Worksheet
Dim wsTemp As Worksheet, rTemp As Range
Dim vSrc As Variant, rSrc As Range
Dim vRes() As Variant, rRes As Range
Dim I As Long
'set Worksheets
Set wsSrc = Worksheets("HRData")
With wsSrc
Set rSrc = .Range("A1", .Cells(.Rows.Count, "C").End(xlUp))
End With
Set wsRes = Worksheets("HRData")
Set rRes = wsRes.Range("G1") 'upper left cell of results
'Sort the HRdata on a Temp sheet
Worksheets.Add
Set wsTemp = ActiveSheet
Set rTemp = wsTemp.Range("A1")
rSrc.Copy rTemp
Set rTemp = rTemp.CurrentRegion
With rTemp
.Sort key1:=.Columns(3), order1:=xlAscending, _
key2:=.Columns(1), order2:=xlAscending, _
Header:=xlYes, MatchCase:=False
End With
vSrc = rTemp.Value
With Application
.ScreenUpdating = False
.DisplayAlerts = False
wsTemp.Delete
.DisplayAlerts = True
End With
'create collection for results
Set colSL = New Collection
For I = 2 To UBound(vSrc)
If vSrc(I, 2) = "Sickleave" Then
If I = 2 Then
Set cSL = New cSickLeave
With cSL
.User = vSrc(I, 3)
.StartDt = vSrc(I, 1)
.EndDt = vSrc(I, 1)
colSL.Add cSL
End With
ElseIf vSrc(I, 3) = colSL(colSL.Count).User And _
(vSrc(I, 1) - 1) = colSL(colSL.Count).EndDt Then
With colSL(colSL.Count)
.EndDt = .EndDt + 1
End With
Else
Set cSL = New cSickLeave
With cSL
.User = vSrc(I, 3)
.StartDt = vSrc(I, 1)
.EndDt = vSrc(I, 1)
colSL.Add cSL
End With
End If
End If
Next I
ReDim vRes(0 To colSL.Count, 1 To 3)
vRes(0, 1) = "User"
vRes(0, 2) = "workdaY?"
vRes(0, 3) = "Date Range"
For I = 1 To colSL.Count
With colSL(I)
vRes(I, 1) = .User
vRes(I, 2) = "Sickleave"
vRes(I, 3) = Format(.StartDt, "d.m\-") & _
Format(.EndDt, "d.m.yyyy")
End With
Next I
Set rRes = rRes.Resize(UBound(vRes) + 1, UBound(vRes, 2))
With rRes
.EntireColumn.Clear
.Value = vRes
.EntireColumn.AutoFit
.Rows(1).HorizontalAlignment = xlCenter
End With
Application.ScreenUpdating = True
End Sub
Ron
Similar Messages
-
Public Holiday calendar not to be taken into account for Sick Leave
Dear All,
I need help.
Public Holiday calendar not to be taken into account for Sick Leave.
Eg -When I employee applies for sick leave, the public holiday in between the dates shouldnt be considered. How can I configure this requirement.
Please help.
Regards,
PoornimaFor that group, you need 2 counting rules:
- one for Holiday Class 0 (not a public holiday) and Day Work Schedule Class 0 (not a working day)
- one for Holiday Class 0 (not a public holiday) and Day Work Schedule Class 1 to 9 (a working day)
If you want, you can add an other one or two for Holiday Class 1 to 9 (public holiday)
extract from our T556C
2 1 10 Q 10 Sick leave deduct from quotas (incl personal/spec) XXXXX X X XXXXXXXXXX XXXXXXXXX X X XX XX 100.00 100.00 1 1 10
2 1 10 Q 11 Sick leave deduct from quotas (incl personal/spec) XXXXX X X XXXXXXXXXX X X X XX XX 0.00 0.00 1 1 10
2 1 30 Q 10 Special leave with pay (with quotas deduction) XXXXX X X XXXXXXXXXX XXXXXXXXX X X XX XX 100.00 100.00 1 1 30
2 1 30 Q 11 Special leave with pay (with quotas deduction) XXXXX X X XXXXXXXXXX X X X XX XX 0.00 0.00 1 1 30 -
EasyDMS - search by date range for characteristics of type date
Hi Folks,
I have a characteristic of type date in the additional data of a DMS document. If I enter the date (for example validity date) as 08/31/2009 and search using cv04n and give a date range for the characteristic (i.e. 01/01/2009 - 12/31/2009), the search result will bring up the document.
However, I cannot do this from the EasyDMS find function. I need to specify an exact date. This is not very helpful for user who need to find documents with a validity date between 01/01/2009 - 12/31/2009 for example. Is there a way users can search for date range in EasyDMS find function?
Thanks,
LashanTo search a date range with EasyDMS Client you have to set the registry key
\HKEY_CURRENT_USER\Software\SAP\EasyDms\Generel\DateSearchPick to Value 0
Then you can use the input field like in SAP-Gui. (01.01.2009-31.01.2009)
If you set the value to 1 or the key is not defined you can only search for one specified date.
If you don't find this key on your PC create it as dword.
Maybe you must restart you PC for takeing effect.
Hope this will help you.
Regards Wolfgang -
How to find the Ranges for a field ?
Hello All,
Can anyone tell me how to find the ranges for a field.
<b>1</b>, i.e say I want the Ranges Structure for the field LIFNR.
The ranges structure for this is "<b>RANGE_LIFNR</b>".
This I used in my Program since I know it previously.
But now I want the ranges structure for the field <b>VBELN (Delivery Document).</b>
I don't know what is it !!!!!
<b>2</b>, Is there any procedure to know the ranges structure for a particular field ?
Regards,
Deepu.KHi Deepu,
Using 'Where used list' you can able to find out RANGES tables.
For VEBLN range table is --> CRM_AC_ASSIGN_VBELN
If you using a program defined as shown below.
DATA: r_vbeln type ranges of vbeln.
The above statement also creates ranges structure in Runtime.
Procedure finding range table structures
go to SE37 -> Enter domain or dataelement value
Go to where used list --> search for 'Structures'
After getting all structure --> Click 'SEARCH' butoon in tool bar --> Search for 'RANGES' word
You can get all ranges tables in the search window
If helps plz reward points.
Regards
Bhupal Reddy -
Date Range for a fixed fiscal year
Dear All,
How to write a code to fix the date range for 12months only. Example like mine selection should be between one fiscal year only.
I have check that the date is of one year range like 1.05.2008 to 30.04.2009
month bt 05 & 04 for one particular year. how to write the code.hi,
check for the year like this.
if v_date1(4) EQ v_date2(4).
endif.
this will check for the first 4 characters of the date string which is the year.
regards,
Peter -
How to set a date range for date field ?
Dear Experts,
Scenario:
I have a query in validating the date field in my BSP application. My application is for maintain infotype 0023 Other/Previous Employers online by employees in the company.
As per our design we are maintaining the all employment details of the employee both ( with in the current company / previous employment outside the company) in the same infotype.
Every employee will have a hiring date within the SAP HR system. We consider this date as the cutoff date between current and previous employment in our application. When the employee updating the details wia BSP page I need to check the following.
Record inside current company: Validation that, the user should only able to enter BEGIN DATE (BEGDA) greater than or equal HIRING DATE and END DATE(ENDDA) should be greater than FROM DATE (BEGDA).
Record outside current Company: Validation that, the user should only able to enter BEGIN DATE (BEGDA) less than or equal HIRING DATE and END DATE (ENDDA) should be greater than FROM DATE (BEGDA) and less than HIRING DATE.
Technical Requirement:
How to set a date range for date field, i.e. how we can limit the date range in a HTMLB date field? Can this it be achieved via standard functionality of HTMLB?
Following is the code to describe date field in my application.
<htmlb:inputField id= "ENDDA_NEW_IN"
type= "date"
doValidate= "TRUE"
showHelp= "TRUE"
disabled= "FALSE"
width= "183"
style= "cssTextAreadate"
value= "<%='99991231'%>"/>
Thanks a lot in advance for your assistance and help.
Cibinu2026
Edited by: cibin kuruvilla on Nov 12, 2008 11:13 AMHi,
This functionality is known to be very important and is a key part of the next major release of the JRC planned for the first half of 2008.
Regards,
<p>Blair Wheadon</p>
<p>Product Manager, Crystal Reports</p> -
In 4.1 BO Client Tools not able to find data source for BVM
Hi All,
In 4.1 BO Client Tools not able to find data source for BVM
Its creating issue .
So if any body have any solution please let me know.
Regards,
Abhishekjava.lang.NoSuchMethodError: org.w3c.dom.Node.getTextContent()Ljava/lang/String;
at customertree.XmlLoader.readData(XmlLoader.java:127)
at customertree.XmlLoader.<init>(XmlLoader.java:69)
at customertree.CustomerTreeFinal.jbInit(CustomerTreeFinal.java:240)
at customertree.CustomerTreeFinal.init(CustomerTreeFinal.java:858)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source
at java.lang.Thread.run(Unknown Source)and then inside the code... this is where i get my first error
clients.setRowId(list2.item(i).getTextContent()); -
Date range for key date in hierarchy
Dear Friends,
Is there a work around for single key date restriction for time dependent hierarchy.Bcos i can only select one key date in teh report for my hierarchy so that it will take that hierarchy which falls in this date and display the result accordingly.
But is there a way to select the date range for key date so that more than one hierarchy can be used to display my report accrding to the time range.
Say,i have 4 hierarchies (time dependent) like v1,v2,v3,v4 and v5 for jan 08,feb 08,mar 08,apr 08 & may 08 respectively.
In my report,i want to display the result for the time interval say mar to May.
So my report should diplay the result according to the 3 different hierarchies for the time period i.e.v3,v4&v5.
How do i acheive this.
Thanks.
raguHi
I think we may do with the Char with text with replecement path.
take time char as Calmonth and set the offet value as -1 and -2 and design the report and use the hierarchies in that query.
Am not surt it willwork but better to try with this. -
How can I set a date range for a Date/Time Field in LiveCycle ES2?
I need to set a specific date range for a form set up in LiveCycle ES2. Cannot see where i allows me to do that without a code entered.
Hi,
You can't set a start and end date for the date/time field, the best you can do is validate the range after the user has selected it.
An alternate is to make your own date / time field, like this sample http://adobelivecycledesignercookbookbybr001.blogspot.com.au/2013/05/an-alternative-date-p icker-for.html
Regards
Bruce -
Function module find date Range input for scheduling a job
hi i have created a program for scheduling a back ground job for purchase order extract in that i have to get the last 7 days records when i schedule it on every sunday can any one tell me the function module which satisfies the requirment
Date Range input in my program to be calculated for past 7 days from current date (ie from Sunday to Saturday of the week.)Hi,
You can do it simply by
v_cdate TYPE sy-datum, " current system date
v_cdate = sy-datum - 7. " take date 7 days before current date
Pass this v_cdate in your logic
Hope it will help you.
Thanks
Arun Kayal -
XL Reporter - Selection of date range for report templates
Dear All,
I want to create a report using XL reporter and attach it to the main SAP B1 reports module . For this I have created the template using report composer .
Issue:
I have only one sub-period (ie,year wise in the posting periods)
how i can select the date range in the Composer and attach it to the main menu.
Regards,
Suresh Kannan.P.Suresh,
1. Goto Report Designer
2. there u can find "Advanced Report Builder" on left side of the window
3. At the below u can find three buttons like "Parameters", "Properties","Apply"
4. Click on "Parameters"
5. then Parameters window will populate
6. Click the new Button
7. Name: give as u like
Category: Literal
Type: Date
Attribute: Leave blank
Default Vale: Leave Blank
Prompt: From Date
This is the process to create the parameters.
create two parameters. one is fdate and ldate. -
HR-ABAP-want user exit for pa30 for creation 2001 infotype for sick leave
Hi ALL,
My requirement like, whenever I try to create a sick leave through PA30 Tcode for infotype 2001 then the has to be trigger like, if the personnel joing date will be from Feb-Dec any date of the year then, the SL will be valid for next year Jan.
Ex; Todya I am creating SL on 2001 infotype. then the condition will
If joining date not Jan 2007 then,
Leave will be valid for next year Jan 2008.
So, let me know is there any user exit for this.
Thanks In advance.
J.PFind myself
-
Exporting incoming email address by date range for all mailboxes
I run a Small Business 2011 Standard server using Exchange 2010 for a small municipality. A public records request was made for all email address that emailed any employee of that city between 1-1-2013 and 3-6-2014 . There are about 160,000 emails
for that date range but how can I just export a log of the senders email address with a time stamp? Thank you in advanced for any help you can give.
I should add that All logging is at defaults values
I found a "work around", I have a Barracuda Message Archiver, I did a search of the date range and exported it to CSV, then imported it in to Excel and just deleted the extra data.
Thanks for the fast repliesGood point, Belinda. If you have that time period within your log retention, then you should be able to do something with the Exchange Shell. This is a bit rough but could serve your purpose:
#--- This finds the email addresses of the users whose city is set to Sydney.
$Sydmbx = Get-ADUser -Filter {City -eq "Sydney"} -Properties homemdb, proxyaddresses | ?{$_.homemdb -ne $null}
$Sydmbx | %{$Sydaddresses += $_.Proxyaddresses}
$Sydaddresses = $Sydaddresses.TrimStart("SMTP:")
$Sydaddresses = $Sydaddresses.TrimStart("smtp:")
#--- Enter your HT servers here
$ExchServ = @("exch01", "exch02")
#--- This creates an object which lists senders who have sent to our recipient addresses, the timestamp and messageid.
$Report =@()
foreach ($server in $ExchServ){
foreach ($addy in $Sydaddresses){
$sentmail = Get-MessageTrackingLog -Server $server -Recipients $addy -Start "01/01/2013 12:00:00 AM" -End "06/03/2014 2:00:00 PM" -EventID Deliver -ResultSize Unlimited
$sentmail | foreach{
$Trackobj = New-Object PSObject
$Trackobj | Add-Member -MemberType NoteProperty -Name "Recipient" -Value $addy
$Trackobj | Add-Member -MemberType NoteProperty -Name "Timestamp" -Value $_.Timestamp
$Trackobj | Add-Member -MemberType NoteProperty -Name "Sender" -Value $_.Sender
$Trackobj | Add-Member -MemberType NoteProperty -Name "MessageID" -Value $_.MessageID
$Report += $Trackobj
$Report
You can change the location to suit yourself as long as you populate "City" in AD and the server names with your own servers. -
To implement new value for sick leave
hi
i need to change sick leave(SICK_LEAVE_FULL_PAY_DAYS ) for employees from 6 to 15 ie from 1-march-2010 every employee has to get 15 days sick leave
for example an employee A has to get sick leaves based on 6 days sick leave for the month of JAN and FEB as well as from march onwards sick leave based on 15 days
ie say an employee joined on 2nd jan 2010
his sick leave would be ------sick leave based on 6 days for jan ,feb+sick leave based on 15 days from march onwards
GLOBAL VALUES DEFINED IN ERP IN UK HRMS-TOTAL COMPENSATION-GLOBAL VALUES ie opening GLOBALS window
NAME DESCRIPTION TYPE VALUE (EFFECTIVE DATES )from DATE to date
SICK_LEAVE_25_PERCENT_PAY_DAYS 25% Paid Sick Leave Days Slab Number 24 01-JAN-1990
SICK_LEAVE_50_PERCENT_PAY_DAYS 50% Paid Sick Leave Days Slab Number 18 01-JAN-1990
SICK_LEAVE_75_PERCENT_PAY_DAYS 75% Paid Sick Leave Days Slab Number 12 01-JAN-1990
SICK_LEAVE_DEDUCTIBLE_SLAB1 Sick Leave Deductible Percentage For The First 6 Days Number 0 01-JAN-1990
SICK_LEAVE_DEDUCTIBLE_SLAB2 Sick Leave Deductible Percentage For The Next 6 Days Number 25 01-JAN-1990
SICK_LEAVE_DEDUCTIBLE_SLAB3 Sick Leave Deductible Percentage For The Third 6 Days Number 50 01-JAN-1990
SICK_LEAVE_DEDUCTIBLE_SLAB4 Sick Leave Deductible Percentage For The Fourth 6 Days Number 75 01-JAN-1990
SICK_LEAVE_DEDUCTIBLE_SLAB5 Sick Leave Deductible Percentage Beyond 24 Days Number 100 01-JAN-1990
SICK_LEAVE_FULL_PAY_DAYS Fully Paid Sick Leave Days Slab Number 6 01-JAN-1990
SICK_LEAVE_NO_PAY_DAYS 0% Paid Sick Leave Days Slab Number 30 01-JAN-1990could someone pls guide me ,can i change manually in the globals window the value 6 to 15 (needed value)
thanking in advance
Edited by: makdutakdu on Sep 15, 2010 2:01 PM
Edited by: makdutakdu on Sep 15, 2010 2:02 PM
Edited by: makdutakdu on Sep 15, 2010 2:03 PM
Edited by: makdutakdu on Sep 15, 2010 2:04 PM
Edited by: makdutakdu on Sep 15, 2010 2:06 PM
Edited by: makdutakdu on Sep 15, 2010 2:06 PM
Edited by: makdutakdu on Sep 15, 2010 2:07 PM
Edited by: makdutakdu on Sep 15, 2010 2:07 PM
Edited by: makdutakdu on Sep 15, 2010 2:08 PM
Edited by: makdutakdu on Sep 15, 2010 2:16 PMThe jar command's -u option is about as easy as I know.
See the jar command documentation for the details. -
Can not set data range for a numerical control
I want to set the maximum of data range to 5000, but it always went back to default value of 127.
WHy I can not change the data range? Thanka for explanations.
Message Edited by Dejun on 11-14-2007 11:47 PM
Attachments:
datarange.jpg 74 KBSo hit the 'Representation' button.
Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas
LabVIEW, programming like it should be!
Maybe you are looking for
-
How to remove plug in ._v1_.swf from safari
How to remove plug in ._v1_.swf from safari. Can't do it the usual ways.
-
Can't download drivers and software from website
I've seen this problem posted a few other times so it looks like it's recurring.I reinstalled Win7 on my machine. I am looking to reinstall the driver and software for my All in One. I get "HP is compiling your results. This could take up to 3 minu
-
Report CSS not working after upgrade
I have been researching this issue for days with no luck. I recently upgraded a project from VS2008 to VS1013. During this process, I downloaded and installed the 13.0.10 installer. Everything seems to work great except for the CSS functionality o
-
TS1702 my viber app do not work in iphone(ios 6.1.3)
I install vibre app. when I start it, say to me, "your internet don't connect, please connect to internet". Whereas I connected to internet and I didn;t have any problem with internet on my iphone. I think with upgarde to ios 6.1.3, this problem is a
-
Received my Sprout 2 days ago and it looks great! I'm having a Marketplace connectivity issue, getting an error: "Sorry, no one is distributing apps in your selected location yet. Change your location to see apps available elsewhere." and then I have