Retroactively update member labor cost on time records

When you save a time entry, ConnectWise calculates the labor cost for that time using the member's hourly rate multiplied by the work type's cost multiplier. This cost is then used in various reports, by the Company Finance Recap tab and extensively throughout the new Financial Dashboard.

This all works great, except for when you have missing or inaccurate member hourly costs or cost multipliers on your work types. Here's a script that retroactive updates the hourly cost for time records.

1
2
3
4
5
6
7
8
9
10
11
12
13
UPDATE time_entry
SET    hourly_cost = dbo.udf_EncrDecr(CONVERT(DECIMAL(18, 2),
                                      CONVERT(DECIMAL(18, 2),
       dbo.udf_EncrDecr(m.hourly_cost,
       'd'
       )) *
       ISNULL(at.cost_multiplier, 1)), 'e')
FROM   member m
       JOIN time_entry
         ON time_entry.member_recid = m.member_recid
       JOIN activity_type at
         ON at.activity_type_recid = time_entry.activity_type_recid
WHERE  ( time_entry.date_start >= '2011-01-01' )

The start date in line 13 controls which times records are updated. In this example, only time records beginning on or after 01 January 2011 are affected. Be sure to update this based on your actual needs or remove line 13 if you want to run this against all time records in ConnectWise.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>