This commit is contained in:
Andreas Knuth 2026-01-21 21:30:23 -06:00
parent d29a00ff63
commit 9b827b2170
1 changed files with 18 additions and 1 deletions

View File

@ -507,6 +507,23 @@ function generateQuoteHTML(quote) {
return parseFloat(amount).toFixed(2); return parseFloat(amount).toFixed(2);
}; };
const formatRate = (rate) => {
// Check if rate contains /hr or other text
const match = rate.match(/^([\d.]+)(.*)$/);
if (match) {
const number = parseFloat(match[1]);
const suffix = match[2]; // e.g., "/hr", ""
return number.toFixed(2) + suffix;
}
// If it's just a number
const number = parseFloat(rate);
if (!isNaN(number)) {
return number.toFixed(2);
}
// Return as-is if can't parse
return rate;
};
const formatDate = (dateString) => { const formatDate = (dateString) => {
const date = new Date(dateString); const date = new Date(dateString);
return `${date.getMonth() + 1}/${date.getDate()}/${date.getFullYear()}`; return `${date.getMonth() + 1}/${date.getDate()}/${date.getFullYear()}`;
@ -539,7 +556,7 @@ function generateQuoteHTML(quote) {
<tr> <tr>
<td class="qty">${item.quantity}</td> <td class="qty">${item.quantity}</td>
<td class="description">${item.description}</td> <td class="description">${item.description}</td>
<td class="rate">${item.rate}</td> <td class="rate">${formatRate(item.rate)}</td>
<td class="amount">${item.amount}</td> <td class="amount">${item.amount}</td>
</tr> </tr>
`; `;