RE: calculating Payroll
From: yapster (yapster_at_discussions.microsoft.com)
Date: 12/28/04
- Next message: tarheels4025: "RE: Pulling data from 2 columns"
- Previous message: Brandon Lilly: "RE: Pulling data from 2 columns"
- In reply to: Paul: "RE: calculating Payroll"
- Messages sorted by: [ date ] [ thread ]
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
> >
- Next message: tarheels4025: "RE: Pulling data from 2 columns"
- Previous message: Brandon Lilly: "RE: Pulling data from 2 columns"
- In reply to: Paul: "RE: calculating Payroll"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|