intval($_GET['product_id'] ?? 0), 'client_id' => intval($_GET['client_id'] ?? 0), 'kind' => isset(productRepriceKinds()[$_GET['kind'] ?? '']) ? $_GET['kind'] : '', 'doc_id' => intval($_GET['doc_id'] ?? 0), ]; $groups = productRepriceLines($filters); $kinds = productRepriceKinds(); $can_edit = lookupUserPermission('module_sales') >= 2; $line_count = array_sum(array_map(function ($group) { return count($group['lines']); }, $groups)); $period_words = ['month' => 'a month', 'quarter' => 'a quarter', 'year' => 'a year']; $doc_pages = ['recurring' => 'recurring_invoice.php?recurring_invoice_id=', 'invoice' => 'invoice.php?invoice_id=', 'quote' => 'quote.php?quote_id=']; // What it is narrowed to, each with a link that takes it off $narrowed = []; $clear_url = function ($keys) use ($filters) { $params = array_filter(array_diff_key($filters, array_flip($keys))); return 'products_reprice.php' . ($params ? '?' . http_build_query($params) : ''); }; if ($filters['product_id']) { $narrowed[] = ['Product', getFieldById('products', $filters['product_id'], 'product_name') ?: 'a product', $clear_url(['product_id'])]; } if ($filters['client_id']) { $narrowed[] = ['Client', getFieldById('clients', $filters['client_id'], 'client_name') ?: 'a client', $clear_url(['client_id'])]; } if ($filters['kind']) { $doc = $filters['doc_id'] ? billingRow($filters['kind'], $filters['doc_id']) : null; $narrowed[] = [$kinds[$filters['kind']]['one'], $doc ? billingNumber($filters['kind'], $doc) : $kinds[$filters['kind']]['label'], $clear_url(['kind', 'doc_id'])]; } $page_title = 'Update Prices'; ?>

Update Prices

Catalog lines on recurring invoices, draft invoices and draft quotes whose price isn't the product's price now. Lines still at one of its old prices are picked. A price it never had looks agreed with the client, so it is left alone unless you pick it. Invoices already sent, and quotes out with clients, keep their prices.

: Clear
0 ? floatval($last['price_new']) / floatval($last['price_old']) : 0; $percent = $ratio ? round(($ratio - 1) * 100, 1) : 0; ?>
Now · was until ( 0 ? '+' : '' ?>%)
1 / 12, 'quarter' => 1 / 3][$frequency] ?? 1 : 0; ?>
On Client Line Qty Now New price Change
data-reprice-pick>
Own price
= 1000) { ?>
The first 1000 lines - update these, or narrow it to a product, and the rest show.