Basic Example;-
select
projectid,
taskuniqueid,
[Task Code],
[Transaction Date],
staff_id,
Service,
[Activity Code],
Activity,
[Resource Group],
[Home Group],
[Overtime Type],
[Charge Method],
Hours,
[Timesheet Minutes],
Cost,
Recharge,
[Currency Charge],
[Curreny ID],
[Currency Conversion],
status,
costed_yn,
Invoiced,
projecttaskid
from
[vw_timecharges]
where
[Transaction Date] >= '20230101' and [Transaction Date] <= '20230331'
This lists all columns in the view. Columns can be removed as necessary. The last column name should not have a comma separator at the end of it.
Due to the number of timesheet records in your database, it is recommended that this view is used with a 'where' clause as shown in the example above which limits the transaction date between 01/01/2023 and 31/03/2023. You should change these dates to suit your needs.
Other Examples;-
The following are some examples how the data can be manipulated;-
Totals by Project
select
projectid,
sum(Hours) as total_hours,
sum([Timesheet Minutes]) as [total_Timesheet Minutes],
sum(Cost) as total_Cost,
sum(Recharge) as total_Recharge,
sum([Currency Charge]) as [total_Currency Charge]
from
[vw_timecharges]
where
[Transaction Date] >= '20230101' and [Transaction Date] <= '20230331'
group by
projectid
Totals by Project and Task
select
projectid,
[Task Code],
taskuniqueid,
sum(Hours) as total_hours,
sum([Timesheet Minutes]) as [total_Timesheet Minutes],
sum(Cost) as total_Cost,
sum(Recharge) as total_Recharge,
sum([Currency Charge]) as [total_Currency Charge]
from
[vw_timecharges]
where
[Transaction Date] >= '20230101' and [Transaction Date] <= '20230331'
group by
projectid,
[Task Code],
taskuniqueid
Totals by Staff Member
select
staff_id,
sum(Hours) as total_hours,
sum([Timesheet Minutes]) as [total_Timesheet Minutes],
sum(Cost) as total_Cost,
sum(Recharge) as total_Recharge,
sum([Currency Charge]) as [total_Currency Charge]
from
[vw_timecharges]
where
[Transaction Date] >= '20230101' and [Transaction Date] <= '20230331'
group by
staff_id
Totals by Staff Member (join to vw_staff)
select
vw_staff.[Staff Name],
vw_staff.[Linemanager Name],
sum(Hours) as total_hours,
sum([Timesheet Minutes]) as [total_Timesheet Minutes],
sum(Cost) as total_Cost,
sum(Recharge) as total_Recharge,
sum([Currency Charge]) as [total_Currency Charge]
from
[vw_timecharges]
join
vw_staff on vw_staff.staff_id = [vw_timecharges].staff_id
where
[Transaction Date] >= '20230101' and [Transaction Date] <= '20230331'
group by
vw_staff.[Staff Name],
vw_staff.[Linemanager Name]
|