mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2026-11-18 02:20:37 -05:00
Math in the amount box
Arithmetic typed into a line's amount (e.g. 300*1.1) is rounded to the nearest penny and sets the rate from the quantity, as a typed amount already did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
2 files changed
+3
-2
No files matched your search
@@ -103,7 +103,7 @@ Estimates and invoices keep their number, date, customer, total and **man-hours*
|
|||||||
|
|
||||||
* **New estimate** from the customer page: Create Estimate opens the Redmine editor. The customer page no longer links to QuickBooks' estimate or payment screens; the customer's name still opens their QuickBooks account page as a fallback.
|
* **New estimate** from the customer page: Create Estimate opens the Redmine editor. The customer page no longer links to QuickBooks' estimate or payment screens; the customer's name still opens their QuickBooks account page as a fallback.
|
||||||
* **Edit** any estimate from the Edit link next to it on the customer page or the issue page.
|
* **Edit** any estimate from the Edit link next to it on the customer page or the issue page.
|
||||||
* **Keyboard entry**: in a line's product box, Tab picks the product the text points to (an exact name, the only match, or the only name starting with it, e.g. "lab" → Labor) and fills the line. Tabbing into the description, quantity or rate selects it, so typing replaces it. The quantity and rate boxes take simple math (e.g. `33*1.3`, `(120+15)/2`; `+ - * /`, `x` for times, parentheses), worked out when you leave the box; math in the rate is rounded to the nearest penny.
|
* **Keyboard entry**: in a line's product box, Tab picks the product the text points to (an exact name, the only match, or the only name starting with it, e.g. "lab" → Labor) and fills the line. Tabbing into the description, quantity or rate selects it, so typing replaces it. The quantity, rate and amount boxes take simple math (e.g. `33*1.3`, `(120+15)/2`; `+ - * /`, `x` for times, parentheses), worked out when you leave the box; math in the rate or amount is rounded to the nearest penny, and an amount sets the rate from the quantity.
|
||||||
* **Duplicate** an estimate to start a similar one: same customer, lines, subtotals, custom fields and messages, dated today, with the current user as sales person.
|
* **Duplicate** an estimate to start a similar one: same customer, lines, subtotals, custom fields and messages, dated today, with the current user as sales person.
|
||||||
* **Read-only once linked to an issue**: an estimate that an issue is linked to can be viewed, emailed and duplicated, but not changed, so the work doesn't drift from what was quoted. The list shows a View link for these instead of Edit.
|
* **Read-only once linked to an issue**: an estimate that an issue is linked to can be viewed, emailed and duplicated, but not changed, so the work doesn't drift from what was quoted. The list shows a View link for these instead of Edit.
|
||||||
* **Read-only once billed**: an estimate that's Converted or Closed in QuickBooks, or linked to an invoice, can't be changed here either (including redmine_qbo_lineitems' estimates once they're invoiced). Its page lists the invoices it's on; it can still be viewed, emailed and duplicated, and it shows View instead of Edit in lists.
|
* **Read-only once billed**: an estimate that's Converted or Closed in QuickBooks, or linked to an invoice, can't be changed here either (including redmine_qbo_lineitems' estimates once they're invoiced). Its page lists the invoices it's on; it can still be viewed, emailed and duplicated, and it shows View instead of Edit in lists.
|
||||||
|
|||||||
@@ -310,11 +310,12 @@ $(function () {
|
|||||||
$tbody.on('change', '.qbo-line-taxable', changed);
|
$tbody.on('change', '.qbo-line-taxable', changed);
|
||||||
$tbody.on('input', '.qbo-line-description-input', function () { autoGrow(this); });
|
$tbody.on('input', '.qbo-line-description-input', function () { autoGrow(this); });
|
||||||
|
|
||||||
// Typing an amount works out the rate from the quantity
|
// Typing an amount (or math, e.g. 300*1.1, rounded to the penny) works out the rate from the quantity
|
||||||
$tbody.on('input', '.qbo-line-amount-input', function () {
|
$tbody.on('input', '.qbo-line-amount-input', function () {
|
||||||
var $row = $(this).closest('tr');
|
var $row = $(this).closest('tr');
|
||||||
var amount = parseNumber($(this).val());
|
var amount = parseNumber($(this).val());
|
||||||
if (amount === null || isNaN(amount)) return;
|
if (amount === null || isNaN(amount)) return;
|
||||||
|
if (isMath($(this).val().replace(/[$,\s]/g, ''))) amount = round(amount, 2);
|
||||||
var qty = parseNumber($row.find('.qbo-line-qty-input').val());
|
var qty = parseNumber($row.find('.qbo-line-qty-input').val());
|
||||||
if (qty === null || isNaN(qty) || qty === 0) qty = 1;
|
if (qty === null || isNaN(qty) || qty === 0) qty = 1;
|
||||||
$row.find('.qbo-line-rate-input').val(plain(amount / qty, 5));
|
$row.find('.qbo-line-rate-input').val(plain(amount / qty, 5));
|
||||||
|
|||||||
Reference in new issue
Block a user