RE: calculating Payroll

From: yapster (yapster_at_discussions.microsoft.com)
Date: 12/28/04


Date: Tue, 28 Dec 2004 12:41:04 -0800

Thanks Paul

"Paul" wrote:

>
> If I understand your post correctly you want to pay them for half of an hour
> if they work between 1 and 30 minutes and a full hour if they work between 31
> and 59 minutes. If so then the following should work for you. You'll need
> to turn this into a query to match your db structure...
>
>
> DECLARE
> @BeginDate AS SMALLDATETIME,
> @EndDate AS SMALLDATETIME,
> @HourlyRate AS DECIMAL(5, 2)
>
> SET @BeginDate = '01/15/2005 10:24 AM'
> SET @EndDate = '01/15/2005 03:38 PM'
>
> SET @HourlyRate = '12.5'
>
> PRINT
> (
> DATEDIFF(hh, @BeginDate, @EndDate) +
> CASE
> WHEN (DATEDIFF(mi, @BeginDate, @EndDate) % 60) = 0 THEN 0.0
> WHEN (DATEDIFF(mi, @BeginDate, @EndDate) % 60) <= 30 THEN .5
> WHEN (DATEDIFF(mi, @BeginDate, @EndDate) % 60) > 30 THEN 1.0
> ELSE 0.0
> END
> )
> * @HourlyRate
>
> Hope this helps.
>
> Paul
>
> "yapster" wrote:
>
> > I am stuck in how to calculate a person's salary based on hours worked and
> > rate. To calculate the salary on an hourly basis per day, I need to
> > calculate the hours worked based on start time and end time rounded to the
> > bottom hour. Then the hours worked is multiplied by the hourly rate. I am
> > stuck on how to write the SQL to calculate the salary earned for that day.
> > The values are as follows:
> >
> > Begin Time: 10:24
> > End Time: 15:38
> > Rate: 12.50 per hour
> >
> > The result should be 5.5 hours (5:14 actual time rounded) * 12.50 per hour.
> > Total pay = $68.75 dollars
> >



Relevant Pages

  • Re: source code for a program
    ... "Paul O'Donnell" wrote in message ... >> police people who post to more than one newsgroup. ... > the group can help him if he gets stuck. ... > daunting to someone who has been programming Java for 7 weeks. ...
    (comp.lang.java.help)
  • Re: chris bliss on letterman tonight
    ... Little Paul wrote: ... Not even if you're joking. ... It's occasionally "passable" but if you're stuck in a position where you're ... to drink Heineken any time, day or night, and don't mind that it costs ...
    (rec.juggling)
  • Re: Help with download please
    ... Thanks Paul and Chas for your prompt replies. ... software installation stage,god knows what will happen when I start to ... >> I am starting to learn Java, but I am stuck on the software. ... For some reason SUN renamed it from JDK to SDK. ...
    (comp.lang.java.help)
  • Re: Hello
    ... Vicky got ice-cream ... stuck in her hair, Paul C got sick, The Antipodeans enjoyed ...
    (uk.sport.football)
  • Re: Pauls 1 sided story
    ... interviews and a few open letters, while Paul just stuck to business: ... writing, recording and touring for a good "Many Years"... ...
    (rec.music.beatles)