Labor Costs - what an hour of each agent costs the company (functions/labor_cost.php), * with the date each rate counts from, and the company default for agents with none. Client * Profitability costs the hours on each client's tickets at them. An agent's rates are in their * window (modals/labor_cost/labor_cost_rates.php); the handlers are admin/post/labor_cost.php. * The audit log names the agent, never the amount. */ // Default Column Sortby Filter $sort = "user_name"; $order = "ASC"; require_once "includes/inc_all_admin.php"; if (!laborCostReady()) { ?>
Labor costs need the database update - Maintenance > Update.
['label' => 'Agents', 'icon' => 'fa-user', 'title' => 'Active agents'], 'archived' => ['label' => 'Archived', 'icon' => 'fa-archive', 'title' => 'Archived agents with a rate - their time in earlier periods is still costed'], ]; $show = (string) ($_GET['show'] ?? ''); $show = isset($views[$show]) ? $show : ''; $rates = laborCostRates(); $default = laborCostDefault(); $today = date('Y-m-d'); // Active agents, and archived ones that have a rate - then searched, sorted and paged here $search = mb_strtolower(trim(stripslashes((string) ($q ?? '')))); $rows = []; $view_counts = ['' => 0, 'archived' => 0]; $result = mysqli_query($mysqli, "SELECT user_id, user_name, user_email, user_avatar, user_archived_at FROM users WHERE user_type = 1" . serviceAccountsOutSql() . " AND (user_archived_at IS NULL OR user_id IN (SELECT user_cost_rate_user_id FROM user_cost_rates))"); while ($row = mysqli_fetch_assoc($result)) { if ($search !== '' && mb_strpos(mb_strtolower($row['user_name'] . ' ' . $row['user_email']), $search) === false) { continue; } $view = $row['user_archived_at'] === null ? '' : 'archived'; $view_counts[$view]++; if ($view !== $show) { continue; } $user_id = intval($row['user_id']); $list = $rates[$user_id] ?? []; $row['now'] = laborCostRateOn($rates, $user_id, $today, null); $row['since'] = ''; foreach ($list as [$from]) { if ($from <= $today || $row['since'] === '') { $row['since'] = $from; } } $row['rate_count'] = count($list); $rows[] = $row; } $sortable_columns = [ 'user_name' => function ($row) { return mb_strtolower($row['user_name']); }, 'now' => function ($row) { return $row['now'] ?? -1; }, 'since' => function ($row) { return $row['since']; }, ]; if (!isset($sortable_columns[$sort])) { $sort = 'user_name'; } $key = $sortable_columns[$sort]; usort($rows, function ($a, $b) use ($key, $order) { $cmp = $key($a) <=> $key($b); if ($cmp === 0) { $cmp = strcasecmp($a['user_name'], $b['user_name']); } return $order === 'DESC' ? -$cmp : $cmp; }); $num_rows = [count($rows)]; $rows = array_slice($rows, $record_from, $record_to); $sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { return '' . $label . ($sort === $column ? " $order_icon" : '') . ''; }; $pill_url = function ($view) { return '?' . http_build_query(array_filter(['q' => $_GET['q'] ?? '', 'show' => $view])); }; $money = function ($amount) use ($currency_format, $session_company_currency) { return escapeHtml(numfmt_format_currency($currency_format, $amount, $session_company_currency)); }; ?>

Labor Costs

What an hour of each agent costs the company - their wage, payroll taxes and benefits. Client Profitability costs the hours on each client's tickets at these rates. A new rate counts from its date, so earlier periods keep the rate they had; an agent's first rate also covers the time before it. Agents with no rate take the company default. Only admins see this page.

">
Rates
Default, Not set None' ?>
'agents', 'icon' => 'fa-user-tag', 'filtered' => $q !== '', 'archived' => $show === 'archived', 'views' => ['show'], 'text' => 'Every active agent is listed here, to give a cost per hour.', ]; require_once "../includes/filter_footer.php"; ?>