Solved

Job Costing Database with Changing Rates

Posted on 2014-12-17
5
16 Views
Last Modified: 2016-08-22
Hello,

I have created an access database for one of my customers which is used for timesheet entry.

Within the database i have a table called "Timesheets" which contains all of the timesheet entries for all of the employees. Each entry is assigned against a job (I have another table which contains all of the jobs which are available).

In this case all of my employees bill out at the exact same rate no matter what job they work on. However on weekends they bill at a different rate. Saturdays the first two hours the employee works is billed at 1.5x the normal rate and any further work is billed out at 2x rates. All Sunday is billed out at the same rate of 2x.

What i am trying to accomplish is a way for access to automatically find the first two hours that an employee works on a Saturday so that i can bill it against the job at the lower rate and then will all remaining work at 2x.

One of the problems that i see is that i might not have a job or two jobs that will always line up on 2 hours. For example if Joe worked 9-12 on a Saturday, the first 2 hours of that 3 hour job is billed at 1.5x  and the final hour is at 2x.

My second issue is that an employee may work on 5 jobs in a single day or come back and working on a single job multiple times with breaks in between. I need a way to check and see if an employee has already billed out his 2 hours total of 1.5x and if not use the remaining time up before billing at 2x.

At the end of all of this i need to have reports which can show where the 1.5x have been allocated and where the 2x has been allocated.

Any thoughts would be great as im all out of ideas.
0
Comment
Question by:infinnet
  • 2
5 Comments
 
LVL 18

Expert Comment

by:Simon
ID: 40504319
It would be useful if you could post the table structure (fieldname and datatypes) for your timesheet table.
0
 

Author Comment

by:infinnet
ID: 40504337
Timesheet Table:

ID - AutoNumber
Job Number - Number (Used to match Job Name in a table called Jobs)
Date - Date/Time (Date worked, in format d/mm/yyyy)
Employee Name - Number (Used to match Employee Name to a table called Employees)
Time Start - Date/Time (Start time in format Short Time. All in 24hr time)
Time Finish- Date/Time (Finish time in format Short Time. All in 24hr time)
0
 
LVL 18

Accepted Solution

by:
Simon earned 500 total points (awarded by participants)
ID: 40504469
Hi, please try this. I changed your field names slightly, partly because 'DATE' is a reserved word and I wasn't sure if you'd posted exact field names. I can modify it if necessary, but you should get the idea.
The query includes a subquery that sums total time per employee per day per job and then uses the format 'ddd' function to get the day name and use that to identify 'Sat' and 'Sun' and then uses a conditional to calculate the billable hours.

SELECT qryHoursWorked.JobNo, qryHoursWorked.EmployeeName, qryHoursWorked.DateWorked, qryHoursWorked.Hours, Format([dateworked],"ddd") AS Dayname, IIf([dayname]="Sun",[hours]*2,0)+IIf([dayname]="Sat",[hours]*1.5,0)+IIf([dayname]="Sat" And [hours]*24>2,([hours]-2/24)*0.5,0)+IIf(Left([dayname],1)<>"S",[hours],0) AS BillableHours
FROM (SELECT tblTimesheet.JobNo, tblTimesheet.EmployeeName, tblTimesheet.DateWorked, Sum([timeend]-[timestart]) AS Hours
FROM tblTimesheet
GROUP BY tblTimesheet.JobNo, tblTimesheet.EmployeeName, tblTimesheet.DateWorked
ORDER BY tblTimesheet.DateWorked) as qryHoursWorked
;

Open in new window


Using this timesheet data:
ID      JobNo      DateWorked      EmployeeName      timeStart      timeEnd
6      2      Sat 13/12/2014      Sue      09:00      12:00
4      1      Sat 13/12/2014      John      09:00      12:00
3      1      Sat 13/12/2014      John      12:30      15:00
5      1      Sun 14/12/2014      John      09:00      17:00
2      1      Wed 17/12/2014      John      12:30      15:00
1      1      Wed 17/12/2014      John      10:00      12:00

I get these results:
JobNo      EmployeeName      DateWorked      Hours      Dayname      BillableHours
1      John      Sat 13/12/2014      05:30      Sat      10:00
2      Sue      Sat 13/12/2014      03:00      Sat      05:00
1      John      Sun 14/12/2014      08:00      Sun      16:00
1      John      Wed 17/12/2014      04:30      Wed      04:30
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 41754648
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now