Every company aims for a long term existence. To achieve this, at some point, it has to have a positive cash-flow. What does that mean? It’s simple; the income has to be at least equivalent or more than the expense. Of course, there can always be some unexpected events which can turn the table, but you can prepare for that by saving some budget that can be used these times. Needless to say, you have to have positive revenue in some years to be able to do that.
To achieve profitability, you should have a way to determine which tasks and projects should be kept, which should be stopped or which even terminated. Sometimes it is not easy to make a smart decision, especially when you have to turn down or to change a running project. One of the key metrics, in this case, is the costs of your activity you can track.
In many sectors, the calculation of costs can be difficult. There can be hundreds of different expenses, thousands of transactions. In the IT sector (especially in the software development business) it is a little bit easier. Typically you don’t have to worry about manufacturing, shipping, etc., so most of the expenses are coming from the salaries. And yes you will have some other cost items (rental of the office, cost of the IT infrastructure, etc.) as well, but you can split and build in these amounts as a general overhead into your internal daily cost rate. So the end of the day you will have only logged work and cost rates to calculate with. So let’s take a look at how can we store, record and track all these information with ease to archive a simple and powerful cost control approach beyond the regular issue/task management.
We live and breathe Jira, so it is evident that we want to implement such a reporting system inside this cool software.
If you are using Jira (Core or Software) as well, here is the guide on how you can do it for yourself with the help of a few handy Apps!
If you are not familiar with any of the required apps, don’t worry, we will explain everything.
First of all you need the Timetracker – Time Tracking & Reporting app. It is really useful not just because of the simple time tracking and the powerful reporting features but also it has a cost rate feature. That means, you can add a default cost rate and user cost rates to your employees. The default cost rate will be used with users who do not have an hourly rate defined in the user cost rates table and with the user cost rate you will be able to define the hourly cost rates for each Jira user.
Hourly cost rates will be used in reporting to calculate the costs of work logged by the users.
When you don’t have a lot of projects this can also be enough already. On the other hand, if you have several projects it could be useful to see them in a table at once and not just one by one.
For that, we are using the Mirrorlake Pivot Charts app. It is really useful because you can create different pivot tables and charts to analyze, report and manage your issues. Another great feature is that you can add any custom fields to your tables so there are no limitations what you want to see. If you want to learn more, please check the plugin documentation.
After installing the application, you will be able to add the Mirrorlake Pivot Charts app gadget to your dashboard. In the gadget edit you can choose the project or projects (if you predefined a filter) then in the Field Selector you can select the fields you require. In the table options check the “show total” for rows and columns and press save.
In the settings, you can choose the pivot type, the fields you would like to see and the aggregator value. For the X axis, choose Project (and optionally Issue) fields. You can keep the Y axis empty.
Last, but not least you have to connect the Timetracker costs to this Pivot table. This is where Scriptrunner will come to your help. All you have to do is create a new scripted field, let’s call it “Issue Cost” and use this script:
import com.onresolve.scriptrunner.runner.customisers.PluginModule; import com.onresolve.scriptrunner.runner.customisers.WithPlugin; import org.everit.jira.timetracker.service.WorklogService; import java.util.ArrayList; import java.time.Instant; import java.time.Period; import java.time.ZonedDateTime; import com.atlassian.jira.timezone.TimeZoneServiceImpl; import com.atlassian.jira.bc.JiraServiceContext; import com.atlassian.jira.security.JiraAuthenticationContext; import com.atlassian.jira.user.ApplicationUser; import com.atlassian.jira.bc.JiraServiceContextImpl; import com.atlassian.jira.component.ComponentAccessor; import java.util.TimeZone; @WithPlugin("org.everit.jira.timetracker.plugin") @PluginModule WorklogService worklogService; TimeZoneServiceImpl timeZoneService = new TimeZoneServiceImpl(ComponentAccessor.getApplicationProperties(), ComponentAccessor.getPermissionManager(), ComponentAccessor.getUserPreferencesManager()); JiraAuthenticationContext authenticationContext = ComponentAccessor .getJiraAuthenticationContext(); ApplicationUser user = authenticationContext.getLoggedInUser(); JiraServiceContextImpl jiraServiceContext = new JiraServiceContextImpl(user); TimeZone timeZone = timeZoneService.getUserTimeZone(jiraServiceContext); Instant startDate = ZonedDateTime.now(timeZone.toZoneId()) .withMonth(1) .withDayOfMonth(1) .withHour(0) .withMinute(0) .withSecond(0) .withNano(0) .toInstant(); Instant endDate = Instant.now(); List<String> users = new ArrayList<String>(); List<String> groups = new ArrayList<String>(); return worklogService.costSummary(issue.getKey(), startDate ,endDate, users, groups);
By the way, you can check other usefil script for Timetracker at the Adaptavist Script Library.
When you are finished with this scripted field and navigate back to the Pivot gadget, you will be able to add this to the Field Selector. After that, you can choose the Issue Cost field as an aggregator.
Don’t forget that you have to sum the issue cost value instead of counting it.
We hope this will help you to calculate your expenses and make better financial decisions.
+36 20 568 6583
Copyright © 2022 Everit Kft. – All rights reserved.