Sales Tax Calculator Wisconsin

Wisconsin Sales Tax Calculator – Calculate WI Sales Tax :root { –primary-color: #004a99; –success-color: #28a745; –background-color: #f8f9fa; –text-color: #333; –border-color: #ddd; –card-background: #fff; –shadow: 0 2px 5px rgba(0,0,0,0.1); } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: var(–background-color); color: var(–text-color); line-height: 1.6; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; min-height: 100vh; } .container { width: 100%; max-width: 960px; margin: 20px auto; padding: 20px; background-color: var(–card-background); border-radius: 8px; box-shadow: var(–shadow); } header { background-color: var(–primary-color); color: white; padding: 20px 0; text-align: center; width: 100%; } header h1 { margin: 0; font-size: 2.5em; } main { width: 100%; padding: 20px 0; } .calculator-section { background-color: var(–card-background); padding: 30px; border-radius: 8px; box-shadow: var(–shadow); margin-bottom: 30px; } .calculator-section h2 { color: var(–primary-color); text-align: center; margin-bottom: 25px; font-size: 2em; } .loan-calc-container { display: flex; flex-direction: column; gap: 20px; } .input-group { display: flex; flex-direction: column; gap: 8px; } .input-group label { font-weight: bold; color: var(–primary-color); } .input-group input[type="number"], .input-group input[type="text"], .input-group select { padding: 12px; border: 1px solid var(–border-color); border-radius: 5px; font-size: 1em; width: 100%; box-sizing: border-box; } .input-group input[type="number"]:focus, .input-group input[type="text"]:focus, .input-group select:focus { outline: none; border-color: var(–primary-color); box-shadow: 0 0 0 3px rgba(0, 74, 153, 0.2); } .input-group .helper-text { font-size: 0.85em; color: #666; } .error-message { color: red; font-size: 0.85em; margin-top: 5px; display: none; /* Hidden by default */ } .button-group { display: flex; gap: 15px; margin-top: 25px; flex-wrap: wrap; /* Allow wrapping on mobile */ } .button-group button { padding: 12px 25px; border: none; border-radius: 5px; cursor: pointer; font-size: 1em; font-weight: bold; transition: background-color 0.3s ease; flex-grow: 1; /* Allow buttons to grow */ min-width: 150px; /* Minimum width for buttons */ } .calculate-btn { background-color: var(–primary-color); color: white; } .calculate-btn:hover { background-color: #003366; } .reset-btn { background-color: #6c757d; color: white; } .reset-btn:hover { background-color: #5a6268; } .copy-btn { background-color: var(–success-color); color: white; } .copy-btn:hover { background-color: #218838; } .results-section { background-color: var(–card-background); padding: 30px; border-radius: 8px; box-shadow: var(–shadow); margin-top: 30px; text-align: center; } .results-section h2 { color: var(–primary-color); margin-bottom: 20px; font-size: 2em; } .main-result { font-size: 2.5em; font-weight: bold; color: var(–success-color); background-color: #e9f7ef; padding: 15px 20px; border-radius: 5px; margin-bottom: 20px; display: inline-block; } .intermediate-results div, .assumptions div { margin-bottom: 10px; font-size: 1.1em; } .intermediate-results span, .assumptions span { font-weight: bold; color: var(–primary-color); } .formula-explanation { font-size: 0.9em; color: #555; margin-top: 15px; border-top: 1px solid var(–border-color); padding-top: 15px; } table { width: 100%; border-collapse: collapse; margin-top: 20px; box-shadow: var(–shadow); border-radius: 5px; overflow-x: auto; /* Make table scrollable */ } th, td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(–border-color); } thead { background-color: var(–primary-color); color: white; } tbody tr:nth-child(even) { background-color: #f2f2f2; } tbody tr:hover { background-color: #e9ecef; } caption { font-size: 1.1em; font-weight: bold; color: var(–primary-color); margin-bottom: 10px; text-align: left; } canvas { max-width: 100%; height: auto; display: block; margin: 20px auto; border: 1px solid var(–border-color); border-radius: 5px; } .article-section { background-color: var(–card-background); padding: 30px; border-radius: 8px; box-shadow: var(–shadow); margin-top: 30px; } .article-section h2, .article-section h3 { color: var(–primary-color); margin-top: 30px; margin-bottom: 15px; } .article-section h2 { font-size: 2em; border-bottom: 2px solid var(–primary-color); padding-bottom: 5px; } .article-section h3 { font-size: 1.6em; } .article-section p { margin-bottom: 15px; } .article-section ul, .article-section ol { margin-left: 20px; margin-bottom: 15px; } .article-section li { margin-bottom: 8px; } .faq-item { margin-bottom: 20px; padding: 15px; background-color: #f8f9fa; border-radius: 5px; border-left: 4px solid var(–primary-color); } .faq-item strong { color: var(–primary-color); display: block; margin-bottom: 5px; } .internal-links { margin-top: 30px; padding: 20px; background-color: var(–card-background); border-radius: 8px; box-shadow: var(–shadow); } .internal-links h3 { color: var(–primary-color); margin-bottom: 15px; font-size: 1.6em; } .internal-links ul { list-style: none; padding: 0; } .internal-links li { margin-bottom: 10px; } .internal-links a { color: var(–primary-color); text-decoration: none; font-weight: bold; } .internal-links a:hover { text-decoration: underline; } .internal-links p { font-size: 0.9em; color: #555; margin-top: 5px; } footer { text-align: center; padding: 20px; margin-top: 30px; width: 100%; background-color: var(–primary-color); color: white; font-size: 0.9em; } @media (max-width: 768px) { .container { margin: 10px; padding: 15px; } header h1 { font-size: 1.8em; } .calculator-section, .results-section, .article-section { padding: 20px; } .calculator-section h2, .results-section h2, .article-section h2 { font-size: 1.8em; } .article-section h3 { font-size: 1.4em; } .main-result { font-size: 2em; } .button-group button { flex-grow: 0; /* Prevent excessive growing on small screens */ min-width: unset; /* Remove min-width */ width: 100%; /* Full width buttons */ } .button-group { flex-direction: column; /* Stack buttons vertically */ gap: 10px; } th, td { padding: 10px 8px; font-size: 0.9em; } caption { font-size: 1em; } }

Wisconsin Sales Tax Calculator

Calculate Wisconsin Sales Tax

Enter the total price of your taxable goods or services.
5.0% (State Rate) 5.1% (State + County Example) 5.5% (State + County + Muni Example) 5.637% (State + County + Muni Example 2) 7.75% (Max Combined Example) Custom Rate Select a standard rate or enter a custom rate if known.

Your Results

State Tax Amount: $0.00
Local Tax Amount: $0.00
Total Cost (Incl. Tax): $0.00
Assumed Tax Rate: 0.00%
Original Purchase Amount: $0.00
Formula Used:
Sales Tax = Purchase Amount × (Tax Rate / 100)
Total Cost = Purchase Amount + Sales Tax
Enter purchase amount and select a tax rate to see results.

Tax Rate Breakdown (Example)

Wisconsin Sales Tax Components
Tax Component Rate (%) Amount ($)
State Tax
County Tax
Municipal Tax
Total Tax

Sales Tax Distribution Chart

What is Wisconsin Sales Tax?

Wisconsin sales tax is a tax imposed by the state of Wisconsin on the sale of tangible personal property and certain services. This tax is collected by retailers at the point of sale and remitted to the Wisconsin Department of Revenue. Understanding the Wisconsin sales tax is crucial for both consumers and businesses operating within the state. The state sales tax rate is a base rate, but it's often combined with county and sometimes municipal taxes, leading to a higher effective rate depending on the specific location of the transaction. This sales tax calculator Wisconsin helps you quickly determine the exact amount of sales tax you'll pay or need to collect.

Who should use this calculator?

  • Consumers: To estimate the final cost of taxable purchases.
  • Businesses: To accurately calculate sales tax on invoices, manage inventory costs, and ensure compliance.
  • Online Shoppers: To understand the tax implications of purchases shipped to Wisconsin addresses.
  • Event Organizers: To calculate sales tax for temporary sales events.

Common Misconceptions:

  • All Services are Taxable: While many services are taxable in Wisconsin, some exemptions exist. This calculator assumes standard taxable items/services.
  • One Rate Fits All: Wisconsin has a state rate, but county and municipal taxes vary significantly, making a single rate inaccurate for many locations. Our calculator allows for custom rates to account for this.
  • Sales Tax is a Business Profit: Sales tax collected is not revenue for the business; it's a pass-through tax that must be remitted to the state.

Wisconsin Sales Tax Formula and Mathematical Explanation

Calculating Wisconsin sales tax involves a straightforward multiplication, but understanding the components is key. The total sales tax is the sum of the state rate, county rate, and any applicable municipal tax rate.

The Core Formula

The fundamental formula to calculate the sales tax amount is:

Sales Tax Amount = Purchase Price × (Sales Tax Rate / 100)

And the total cost including tax is:

Total Cost = Purchase Price + Sales Tax Amount

Step-by-Step Derivation

  1. Identify the Purchase Price: This is the pre-tax cost of the taxable goods or services.
  2. Determine the Applicable Sales Tax Rate: This is the combined rate for the specific location, including state, county, and municipal taxes. Wisconsin's standard state rate is 5.0%, but local rates can add significantly.
  3. Convert Rate to Decimal: Divide the total sales tax rate percentage by 100. For example, a 5.637% rate becomes 0.05637.
  4. Calculate Sales Tax Amount: Multiply the purchase price by the decimal tax rate.
  5. Calculate Total Cost: Add the calculated sales tax amount to the original purchase price.

Variable Explanations

Here's a breakdown of the variables used in the Wisconsin sales tax calculation:

Sales Tax Variables
Variable Meaning Unit Typical Range
Purchase Price The base cost of taxable goods or services before tax. USD ($) $0.01 – $1,000,000+
Sales Tax Rate The combined percentage of state, county, and municipal taxes applicable to the sale. Percent (%) 5.0% (State) up to ~7.75% (Max Combined)
Sales Tax Amount The calculated tax amount to be added to the purchase price. USD ($) Calculated based on rate and price
Total Cost The final price including the purchase price and the sales tax. USD ($) Purchase Price + Sales Tax Amount

Practical Examples (Real-World Use Cases)

Example 1: Purchasing Electronics

Sarah is buying a new laptop in Milwaukee County. The laptop costs $1,200. The combined sales tax rate in her specific location in Milwaukee County is 5.637% (5.0% state + 0.5% county + 0.137% municipal). Using our sales tax calculator Wisconsin:

  • Purchase Amount: $1,200.00
  • Wisconsin Sales Tax Rate: 5.637%

Calculation:

  • Sales Tax Amount = $1,200.00 × (5.637 / 100) = $1,200.00 × 0.05637 = $67.64
  • Total Cost = $1,200.00 + $67.64 = $1,267.64

Interpretation: Sarah will pay $67.64 in sales tax, bringing the total cost of her laptop to $1,267.64.

Example 2: Small Business Service Invoice

A small business provides consulting services in Dane County. The invoice total for services rendered is $5,000. The combined sales tax rate in their service area is 5.5% (5.0% state + 0.5% county). Using the sales tax calculator Wisconsin:

  • Purchase Amount (Service Cost): $5,000.00
  • Wisconsin Sales Tax Rate: 5.5%

Calculation:

  • Sales Tax Amount = $5,000.00 × (5.5 / 100) = $5,000.00 × 0.055 = $275.00
  • Total Invoice Amount = $5,000.00 + $275.00 = $5,275.00

Interpretation: The business must charge $275.00 in sales tax on this invoice, making the total amount due $5,275.00. This amount, including the tax, must be remitted to the state.

How to Use This Wisconsin Sales Tax Calculator

Our free sales tax calculator Wisconsin is designed for simplicity and accuracy. Follow these steps:

  1. Enter Purchase Amount: In the "Purchase Amount ($)" field, input the total price of the taxable goods or services before any tax is applied.
  2. Select Tax Rate: Choose the appropriate Wisconsin sales tax rate from the dropdown menu. Options include the standard state rate and common combined rates. If you know the exact combined rate for your location (state + county + municipal), select "Custom Rate" and enter it in the field that appears.
  3. Calculate: Click the "Calculate Tax" button.

How to Read Results:

  • Total Sales Tax: This is the primary result, showing the exact amount of sales tax you need to pay or collect.
  • State Tax Amount, Local Tax Amount: These break down the total tax into its state and local components (if applicable based on the selected rate).
  • Total Cost (Incl. Tax): This shows the final price you will pay after adding the sales tax to the original purchase amount.
  • Assumed Tax Rate: Confirms the tax rate used in the calculation.
  • Original Purchase Amount: Reconfirms the input purchase price.

Decision-Making Guidance:

  • Budgeting: Use the "Total Cost" to budget accurately for purchases.
  • Pricing: Businesses can use the "Sales Tax Amount" to ensure correct invoicing and remittance.
  • Compliance: Verify that you are using the correct combined tax rate for your specific location to remain compliant with Wisconsin tax laws.

Don't forget to explore our Wisconsin income tax calculator for broader financial planning.

Key Factors That Affect Wisconsin Sales Tax Results

Several factors influence the final sales tax amount in Wisconsin:

  1. Location (County and Municipality): This is the most significant factor beyond the state rate. Wisconsin allows counties to impose a county sales tax, and some municipalities may also impose a separate municipal sales tax. The combination of these rates with the state rate (5.0%) determines the final applicable rate, which can vary widely across the state. For instance, a purchase in Milwaukee County will likely have a different rate than one in Dane County.
  2. Type of Goods or Services: While Wisconsin has a broad sales tax base, certain items and services are exempt. Common exemptions include most groceries, prescription drugs, and certain agricultural products. Conversely, prepared foods, restaurant meals, hotel stays, and many services are taxable. Always verify if an item or service is taxable in Wisconsin.
  3. Purchase Amount: The higher the purchase price of taxable goods or services, the higher the absolute sales tax amount will be, assuming a constant tax rate. This is a direct proportional relationship.
  4. Promotional Sales/Discounts: Sales tax is typically calculated on the final selling price after any discounts are applied. If an item is marked down, the sales tax is calculated on the reduced price, lowering the tax amount.
  5. Interstate Commerce Rules: For online or out-of-state purchases shipped to Wisconsin, the rules can be complex. Generally, if a business has a significant presence (nexus) in Wisconsin, they must collect and remit Wisconsin sales tax, regardless of where they are located. Consumers may also be responsible for use tax on purchases made from out-of-state sellers who do not collect sales tax.
  6. Taxable vs. Non-Taxable Items: The distinction is critical. If you purchase a mix of taxable and non-taxable items, sales tax should only be applied to the taxable items. Misapplying tax to exempt items leads to overpayment, while failing to tax taxable items results in non-compliance.
  7. Changes in Tax Law: Tax rates and regulations can change. County and municipal tax rates are periodically reviewed and adjusted. Staying informed about potential legislative changes is important for accurate calculations.

Understanding these factors ensures accurate calculations and compliance. For more complex business tax needs, consider consulting a Wisconsin business tax guide.

Frequently Asked Questions (FAQ)

Q1: What is the standard sales tax rate in Wisconsin?

A1: The standard state sales tax rate in Wisconsin is 5.0%. However, this is often supplemented by county and municipal taxes, leading to higher combined rates in many locations.

Q2: How do I find the exact sales tax rate for my specific Wisconsin location?

A2: You can typically find the combined rate on the Wisconsin Department of Revenue (DOR) website, or by using local government resources. Our calculator provides common examples, and you can input a custom rate if you know it.

Q3: Are all purchases subject to Wisconsin sales tax?

A3: No. Many essential items like most groceries and prescription medications are exempt. Services are also taxed differently; some are taxable, while others are not. Always check the taxability of specific items or services.

Q4: Does Wisconsin have a use tax?

A4: Yes. Wisconsin has a use tax that applies to the storage, use, or consumption of taxable tangible personal property or taxable services in Wisconsin for which Wisconsin sales tax was not paid at the time of purchase. This often applies to out-of-state purchases.

Q5: How often do sales tax rates change in Wisconsin?

A5: State sales tax rates are generally stable, but county and municipal sales tax rates can be adjusted periodically by local authorities, often effective at the beginning of a calendar year or quarter. It's wise to check for updates annually.

Q6: Can businesses deduct sales tax paid on purchases?

A6: Businesses generally cannot deduct sales tax paid on inventory or supplies they purchase for resale. However, sales tax paid on assets used in the business (like equipment) might be deductible as a business expense, depending on accounting methods and tax regulations. Consult a tax professional for specifics.

Q7: What is the difference between sales tax and income tax in Wisconsin?

A7: Sales tax is a consumption tax levied on the sale of goods and services at the point of purchase. Income tax is a tax levied on the earnings (wages, profits, investments) of individuals and businesses. Our Wisconsin tax brackets page provides details on income tax.

Q8: How does this calculator handle tax exemptions?

A8: This calculator assumes all entered purchase amounts are subject to the selected tax rate. It does not automatically apply exemptions. Users must manually exclude non-taxable items from the "Purchase Amount" before using the calculator.

© 2023 Your Financial Website. All rights reserved. This calculator provides estimates for informational purposes only.

var purchaseAmountInput = document.getElementById('purchaseAmount'); var wiTaxRateSelect = document.getElementById('wiTaxRate'); var customTaxRateInput = document.getElementById('customTaxRate'); var totalSalesTaxDiv = document.getElementById('totalSalesTax'); var stateTaxAmountSpan = document.getElementById('stateTaxAmount'); var localTaxAmountSpan = document.getElementById('localTaxAmount'); var totalCostSpan = document.getElementById('totalCost'); var assumedTaxRateSpan = document.getElementById('assumedTaxRate'); var originalPurchaseAmountSpan = document.getElementById('originalPurchaseAmount'); var resultDiv = document.getElementById('result'); var noResultsDiv = document.getElementById('noResults'); var tableStateRate = document.getElementById('tableStateRate'); var tableStateTaxAmount = document.getElementById('tableStateTaxAmount'); var tableCountyRate = document.getElementById('tableCountyRate'); var tableCountyTaxAmount = document.getElementById('tableCountyTaxAmount'); var tableMunicipalRate = document.getElementById('tableMunicipalRate'); var tableMunicipalTaxAmount = document.getElementById('tableMunicipalTaxAmount'); var tableTotalRate = document.getElementById('tableTotalRate'); var tableTotalTaxAmount = document.getElementById('tableTotalTaxAmount'); var salesTaxChart; var chartContext; // Default values var defaultPurchaseAmount = "; var defaultWiTaxRate = '5.0'; function formatCurrency(amount) { return "$" + amount.toFixed(2); } function formatRate(rate) { return parseFloat(rate).toFixed(3) + "%"; } function validateInput(value, id, errorId, min = 0, max = Infinity) { var errorElement = document.getElementById(errorId); errorElement.style.display = 'none'; var inputElement = document.getElementById(id); if (value === ") { errorElement.textContent = 'This field cannot be empty.'; errorElement.style.display = 'block'; inputElement.style.borderColor = 'red'; return false; } var numValue = parseFloat(value); if (isNaN(numValue)) { errorElement.textContent = 'Please enter a valid number.'; errorElement.style.display = 'block'; inputElement.style.borderColor = 'red'; return false; } if (numValue max) { errorElement.textContent = 'Value is too high.'; errorElement.style.display = 'block'; inputElement.style.borderColor = 'red'; return false; } inputElement.style.borderColor = '#ddd'; // Reset border color return true; } function calculateSalesTax() { var purchaseAmount = purchaseAmountInput.value; var selectedRate = wiTaxRateSelect.value; var customRate = customTaxRateInput.value; var isValidPurchaseAmount = validateInput(purchaseAmount, 'purchaseAmount', 'purchaseAmountError', 0); var isValidRate = true; if (selectedRate === 'custom') { isValidRate = validateInput(customRate, 'customTaxRate', 'wiTaxRateError', 0, 100); // Max rate 100% if (!isValidRate) { wiTaxRateSelect.style.borderColor = 'red'; } else { wiTaxRateSelect.style.borderColor = '#ddd'; } } else { wiTaxRateSelect.style.borderColor = '#ddd'; } if (!isValidPurchaseAmount || !isValidRate) { resultDiv.style.display = 'none'; noResultsDiv.style.display = 'block'; return; } var rateToUse = parseFloat(selectedRate === 'custom' ? customRate : selectedRate); var purchaseAmountNum = parseFloat(purchaseAmount); // Simplified tax breakdown for demonstration purposes // In reality, this would be more complex based on specific county/municipal rates var stateRate = 5.0; var countyRate = 0.0; var municipalRate = 0.0; var calculatedTotalRate = rateToUse; if (rateToUse > stateRate) { // Assume the difference is county + municipal for example purposes var remainingRate = rateToUse – stateRate; // Simple split: 0.5% for county, rest for municipal if available countyRate = Math.min(remainingRate, 0.5); // Cap county at 0.5% for example municipalRate = remainingRate – countyRate; if (municipalRate < 0) municipalRate = 0; // Ensure non-negative } var stateTaxAmount = purchaseAmountNum * (stateRate / 100); var countyTaxAmount = purchaseAmountNum * (countyRate / 100); var municipalTaxAmount = purchaseAmountNum * (municipalRate / 100); var totalTaxAmount = purchaseAmountNum * (calculatedTotalRate / 100); var totalCost = purchaseAmountNum + totalTaxAmount; totalSalesTaxDiv.textContent = formatCurrency(totalTaxAmount); stateTaxAmountSpan.textContent = formatCurrency(stateTaxAmount); localTaxAmountSpan.textContent = formatCurrency(countyTaxAmount + municipalTaxAmount); // Combine county and muni for simplicity totalCostSpan.textContent = formatCurrency(totalCost); assumedTaxRateSpan.textContent = formatRate(calculatedTotalRate); originalPurchaseAmountSpan.textContent = formatCurrency(purchaseAmountNum); resultDiv.style.display = 'block'; noResultsDiv.style.display = 'none'; updateTableAndChart(stateRate, countyRate, municipalRate, calculatedTotalRate, stateTaxAmount, countyTaxAmount, municipalTaxAmount, totalTaxAmount); } function updateTableAndChart(stateRate, countyRate, municipalRate, totalRate, stateTax, countyTax, municipalTax, totalTax) { // Update Table tableStateRate.textContent = formatRate(stateRate); tableStateTaxAmount.textContent = formatCurrency(stateTax); tableCountyRate.textContent = formatRate(countyRate); tableCountyTaxAmount.textContent = formatCurrency(countyTax); tableMunicipalRate.textContent = formatRate(municipalRate); tableMunicipalTaxAmount.textContent = formatCurrency(municipalTax); tableTotalRate.textContent = formatRate(totalRate); tableTotalTaxAmount.textContent = formatCurrency(totalTax); // Update Chart if (salesTaxChart) { salesTaxChart.destroy(); } chartContext = document.getElementById('salesTaxChart').getContext('2d'); salesTaxChart = new Chart(chartContext, { type: 'bar', data: { labels: ['State Tax', 'County Tax', 'Municipal Tax'], datasets: [{ label: 'Tax Amount ($)', data: [stateTax, countyTax, municipalTax], backgroundColor: [ 'rgba(0, 74, 153, 0.6)', // Primary Blue 'rgba(40, 167, 69, 0.6)', // Success Green 'rgba(108, 117, 125, 0.6)' // Secondary Gray ], borderColor: [ 'rgba(0, 74, 153, 1)', 'rgba(40, 167, 69, 1)', 'rgba(108, 117, 125, 1)' ], borderWidth: 1 }] }, options: { responsive: true, maintainAspectRatio: false, scales: { y: { beginAtZero: true, ticks: { callback: function(value) { return formatCurrency(value); } } } }, plugins: { legend: { display: true, position: 'top', }, title: { display: true, text: 'Sales Tax Distribution by Component' } } } }); } function resetCalculator() { purchaseAmountInput.value = defaultPurchaseAmount; wiTaxRateSelect.value = defaultWiTaxRate; customTaxRateInput.style.display = 'none'; customTaxRateInput.value = ''; // Reset error messages and borders document.getElementById('purchaseAmountError').style.display = 'none'; document.getElementById('wiTaxRateError').style.display = 'none'; purchaseAmountInput.style.borderColor = '#ddd'; wiTaxRateSelect.style.borderColor = '#ddd'; resultDiv.style.display = 'none'; noResultsDiv.style.display = 'block'; // Reset table tableStateRate.textContent = ''; tableStateTaxAmount.textContent = ''; tableCountyRate.textContent = ''; tableCountyTaxAmount.textContent = ''; tableMunicipalRate.textContent = ''; tableMunicipalTaxAmount.textContent = ''; tableTotalRate.textContent = ''; tableTotalTaxAmount.textContent = ''; // Clear chart if (salesTaxChart) { salesTaxChart.destroy(); salesTaxChart = null; } } function copyResults() { var purchaseAmount = purchaseAmountInput.value; var selectedRate = wiTaxRateSelect.value; var customRate = customTaxRateInput.value; var rateDisplay = selectedRate === 'custom' ? customRate : selectedRate; var totalTax = totalSalesTaxDiv.textContent; var stateTax = stateTaxAmountSpan.textContent; var localTax = localTaxAmountSpan.textContent; var totalCost = totalCostSpan.textContent; var assumedRate = assumedTaxRateSpan.textContent; var originalPurchase = originalPurchaseAmountSpan.textContent; var textToCopy = "— Wisconsin Sales Tax Calculation Results —\n\n"; textToCopy += "Purchase Amount: " + formatCurrency(parseFloat(purchaseAmount)) + "\n"; textToCopy += "Assumed Tax Rate: " + rateDisplay + "%\n\n"; textToCopy += "Total Sales Tax: " + totalTax + "\n"; textToCopy += "State Tax Component: " + stateTax + "\n"; textToCopy += "Local Tax Component: " + localTax + "\n"; textToCopy += "Total Cost (Including Tax): " + totalCost + "\n\n"; textToCopy += "——————————————–"; navigator.clipboard.writeText(textToCopy).then(function() { // Optional: Show a confirmation message var copyButton = document.querySelector('.copy-btn'); var originalText = copyButton.textContent; copyButton.textContent = 'Copied!'; setTimeout(function() { copyButton.textContent = originalText; }, 2000); }).catch(function(err) { console.error('Failed to copy text: ', err); // Optional: Show an error message }); } // Event listener for custom rate input visibility wiTaxRateSelect.addEventListener('change', function() { if (this.value === 'custom') { customTaxRateInput.style.display = 'block'; customTaxRateInput.focus(); } else { customTaxRateInput.style.display = 'none'; customTaxRateInput.value = ''; // Clear custom rate when not selected } calculateSalesTax(); // Recalculate if rate changes }); // Initial setup document.addEventListener('DOMContentLoaded', function() { // Initialize chart canvas context chartContext = document.getElementById('salesTaxChart').getContext('2d'); // Optionally call calculateSalesTax() if you want initial calculation based on defaults // calculateSalesTax(); if (purchaseAmountInput.value === '' && wiTaxRateSelect.value === defaultWiTaxRate) { noResultsDiv.style.display = 'block'; resultDiv.style.display = 'none'; } });

Leave a Comment