{"id":3818,"date":"2025-02-14T15:52:11","date_gmt":"2025-02-14T15:52:11","guid":{"rendered":"https:\/\/srilankaexport.com\/?page_id=3818"},"modified":"2025-02-14T17:21:15","modified_gmt":"2025-02-14T17:21:15","slug":"trade-calculator","status":"publish","type":"page","link":"https:\/\/srilankaexport.com\/si\/trade-calculator\/","title":{"rendered":"Trade Calculators"},"content":{"rendered":"<!DOCTYPE html>\n<html>\n<head>\n    <title>Sri Lanka Export Shipping Calculator<\/title>\n    <style>\n        \/* Basic Styling for better appearance *\/\n        body {\n            font-family: sans-serif;\n            margin: 20px;\n        }\n        label {\n            display: block;\n            margin-bottom: 5px;\n        }\n        input[type=\"number\"],\n        select {\n            width: 250px;\n            padding: 8px;\n            margin-bottom: 15px;\n            border: 1px solid #ccc;\n            border-radius: 4px;\n            box-sizing: border-box; \/* Ensures padding doesn't affect width *\/\n        }\n\n        #shippingResult {\n          margin-top: 15px;\n          font-weight: bold;\n        }\n        #otherCountryLabel, #otherCountry {\n            display: none;\n        }\n        .disclaimer {\n            font-size: smaller;\n            color: #888;\n            margin-top: 10px;\n        }\n    <\/style>\n<\/head>\n<body>\n\n    <h2>Sri Lanka Export Shipping Calculator<\/h2>\n\n    <label for=\"destinationCountry\">\ud83c\udf0e Destination Country:<\/label>\n    <select id=\"destinationCountry\">\n        <option value=\"\">Select a Country<\/option>\n        <option value=\"US\">United States<\/option>\n        <option value=\"GB\">United Kingdom<\/option>\n        <option value=\"IN\">India<\/option>\n        <option value=\"DE\">Germany<\/option>\n        <option value=\"IT\">Italy<\/option>\n        <option value=\"BE\">Belgium<\/option>\n        <option value=\"CA\">Canada<\/option>\n        <option value=\"CN\">China<\/option>\n        <option value=\"NL\">Netherlands<\/option>\n        <option value=\"JP\">Japan<\/option>\n        <option value=\"FR\">France<\/option>\n        <option value=\"AE\">United Arab Emirates (UAE)<\/option>\n        <option value=\"OTHER\">Other (Please Specify)<\/option>\n    <\/select>\n\n    <label for=\"otherCountry\" id=\"otherCountryLabel\">Other Country:<\/label>\n    <input type=\"text\" id=\"otherCountry\" placeholder=\"Enter country name\">\n\n        <label for=\"destinationRegion\">\ud83c\udf0d General Region:<\/label>\n    <select id=\"destinationRegion\">\n        <option value=\"\">Select a Region<\/option>\n        <option value=\"southAsia\">South Asia (e.g., India, Pakistan, Bangladesh)<\/option>\n        <option value=\"eastAsia\">East Asia (e.g., China, Japan, South Korea)<\/option>\n        <option value=\"europe\">Europe<\/option>\n        <option value=\"northAmerica\">North America<\/option>\n        <option value=\"latinAmerica\">Latin America<\/option>\n        <option value=\"africa\">Africa<\/option>\n        <option value=\"australiaOceania\">Australia\/Oceania<\/option>\n    <\/select>\n\n    <label for=\"weight\">\ud83d\udce6 Weight (kg):<\/label>\n    <input type=\"number\" id=\"weight\" placeholder=\"Enter weight\">\n\n    <label for=\"distance\">\ud83d\udccd Distance (km):<\/label>\n    <input type=\"number\" id=\"distance\" placeholder=\"Enter distance (Optional)\">\n\n    <label for=\"method\">\ud83d\ude9b Shipping Method:<\/label>\n    <select id=\"method\">\n        <option value=\"sea\">\ud83d\udea2 Sea (Estimated $3-8\/kg)<\/option>\n        <option value=\"air\">\u2708 Air (Estimated $10+\/kg)<\/option>\n        <option value=\"ground\">\ud83d\ude9a Ground (If Applicable &#8211; See Disclaimer)<\/option>\n\n    <\/select>\n\n    <button id=\"calculateButton\">\ud83d\udcca Calculate Shipping<\/button>\n\n    <p id=\"selectedCountry\"><\/p>\n    <p id=\"shippingResult\"><\/p>\n\n    <p class=\"disclaimer\">\n        <strong>Disclaimer:<\/strong> This calculator provides ESTIMATES only. Actual shipping costs vary significantly.\n        Please contact shipping carriers or a freight forwarder for precise quotes. The &#8220;Ground&#8221; option&#8217;s price range can change depending on your Geographical region, Please Choose A general Region. All weights are calculate by assumptions that can affect prices. This result is to used as example and does not apply.\n    <\/p>\n\n    <script>\n        const destinationCountrySelect = document.getElementById(\"destinationCountry\");\n        const otherCountryLabel = document.getElementById(\"otherCountryLabel\");\n        const otherCountryInput = document.getElementById(\"otherCountry\");\n        const selectedCountryParagraph = document.getElementById(\"selectedCountry\");\n          const destinationRegionSelect = document.getElementById(\"destinationRegion\");\n\n        const weightInput = document.getElementById(\"weight\");\n        const distanceInput = document.getElementById(\"distance\");\n        const methodSelect = document.getElementById(\"method\");\n        const calculateButton = document.getElementById(\"calculateButton\");\n        const shippingResultParagraph = document.getElementById(\"shippingResult\");\n\n        \/\/Initially hide Other country input and label\n        otherCountryLabel.style.display = 'none';\n        otherCountryInput.style.display = 'none';\n\n          let regionFactor = 1.0; \/\/ Default (no regional adjustment)\n\n\n\n        destinationCountrySelect.addEventListener(\"change\", function() {\n            const selectedValue = destinationCountrySelect.value;\n\n            if (selectedValue === \"OTHER\") {\n                otherCountryLabel.style.display = \"block\";\n                otherCountryInput.style.display = \"block\";\n                otherCountryInput.focus(); \/\/ Put the focus on the input\n                selectedCountryParagraph.textContent = \"\"; \/\/ Clear previous selection\n            } else {\n                otherCountryLabel.style.display = \"none\";\n                otherCountryInput.style.display = \"none\";\n                selectedCountryParagraph.textContent = `You selected: ${destinationCountrySelect.options[destinationCountrySelect.selectedIndex].text} (${selectedValue})`;\n            }\n        });\n\n        otherCountryInput.addEventListener(\"input\", function() {\n           if (otherCountryInput.value.trim() !== \"\") {\n             selectedCountryParagraph.textContent = `You selected: ${otherCountryInput.value.trim()} (OTHER)`;\n           } else {\n             selectedCountryParagraph.textContent = \"\"; \/\/ Clear if the \"Other\" input is empty\n           }\n        });\n\n\n       destinationRegionSelect.addEventListener(\"change\", function() {\n           const selectedRegion = destinationRegionSelect.value;\n\n           switch (selectedRegion) {\n               case \"southAsia\":\n                   regionFactor = 1.0;  \/\/ Base price\n                   break;\n               case \"eastAsia\":\n                   regionFactor = 1.2;\n                   break;\n               case \"europe\":\n                   regionFactor = 1.5;\n                   break;\n               case \"northAmerica\":\n                   regionFactor = 1.6;\n                   break;\n               case \"latinAmerica\":\n                   regionFactor = 1.7;\n                   break;\n               case \"africa\":\n                   regionFactor = 1.8;\n                   break;\n               case \"australiaOceania\":\n                   regionFactor = 1.7;\n                   break;\n               default:\n                   regionFactor = 1.0;  \/\/ Default or unspecified region\n                   break;\n           }\n       });\n\n\n\n        calculateButton.addEventListener(\"click\", calculateShipping);\n\n        function calculateShipping() {\n            const weight = parseFloat(weightInput.value);\n            const distance = parseFloat(distanceInput.value) || 0;\n            const method = methodSelect.value;\n\n            \/\/ Input Validation\n            if (!weight) {\n                shippingResultParagraph.innerHTML = \"<p style='color:red;'>\u274c Please enter the weight.<\/p>\";\n                return;\n            }\n\n            if (isNaN(weight)) {\n                shippingResultParagraph.innerHTML = \"<p style='color:red;'>\u274c Weight must be a number.<\/p>\";\n                return;\n            }\n\n            if (weight <= 0) {\n                shippingResultParagraph.innerHTML = \"<p style='color:red;'>\u274c Weight must be a positive value.<\/p>\";\n                return;\n            }\n\n           if (distance && isNaN(distance)) {\n                shippingResultParagraph.innerHTML = \"<p style='color:red;'>\u274c Distance must be a number.<\/p>\";\n                return;\n            }\n           if (distance && distance < 0) {\n                shippingResultParagraph.innerHTML = \"<p style='color:red;'>\u274c Distance must be a positive value.<\/p>\";\n                return;\n            }\n           if (method === \"ground\" && !destinationRegionSelect.value){\n                 shippingResultParagraph.innerHTML = \"<p style='color:red;'>\u274cPlease select a Geographical region for an example with road transport<\/p>\";\n                return;\n           }\n\n\n\n            let cost = 0;\n\n               if (method === \"sea\") {\n                 cost = weight * (3 + (5 * Math.random())); \/\/ Random value with range between $3 - $8\n\n            } else if (method === \"air\") {\n                cost = weight * (10 + (5 * Math.random())); \/\/ $10+  Estimations\n            } else if (method === \"ground\") {\n\n                  let groundRate = 1.5 + (3.5 * Math.random());\n                    cost = weight * groundRate * regionFactor;\n\n             }\n\n\n            const formattedCost = cost.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 });\n            shippingResultParagraph.innerHTML = `\ud83d\udcb0 Estimated Shipping Cost: $${formattedCost}`;\n\n        }\n\n    <\/script>\n\n<\/body>\n<\/html>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<section class=\"currency-converter\">\n    <h2>\ud83d\udcb1 Currency Converter<\/h2>\n\n    <form id=\"currencyForm\" action=\"\">\n        <div class=\"input-group\">\n            <label for=\"amount\" title=\"Enter the amount in Sri Lankan Rupees (LKR)\">\ud83d\udcb5 Amount in LKR:<\/label>\n            <input type=\"number\" id=\"amount\" placeholder=\"Enter amount in LKR\" aria-describedby=\"amountHelp\" min=\"0\">\n            <div id=\"amountHelp\" class=\"form-text\">Enter a positive number.<\/div>\n        <\/div>\n\n        <div class=\"input-group\">\n            <label for=\"currency\" title=\"Select the currency to convert to\">\ud83c\udf0d Convert to:<\/label>\n            <select id=\"currency\">\n                <option value=\"USD\">\ud83c\uddfa\ud83c\uddf8 USD<\/option>\n                <option value=\"EUR\">\ud83c\uddea\ud83c\uddfa EUR<\/option>\n                <option value=\"INR\">\ud83c\uddee\ud83c\uddf3 INR<\/option>\n                <option value=\"GBP\">\ud83c\uddec\ud83c\udde7 GBP<\/option>\n            <\/select>\n        <\/div>\n\n        <button type=\"submit\" id=\"convertButton\">\ud83d\udd04 Convert<\/button>\n    <input type=\"hidden\" name=\"trp-form-language\" value=\"si\"\/><\/form>\n\n    <div id=\"currencyResult\" class=\"result-message\" role=\"alert\" aria-live=\"polite\"><\/div>\n\n    <p class=\"disclaimer\">Exchange rates are indicative and may vary.<\/p>\n<\/section>\n\n<script>\n  const amountInput = document.getElementById(\"amount\");\n  const currencySelect = document.getElementById(\"currency\");\n  const convertButton = document.getElementById(\"convertButton\");\n  const currencyResult = document.getElementById(\"currencyResult\");\n  const currencyForm = document.getElementById(\"currencyForm\");\n\n  let timeoutId; \/\/ For debouncing\n\n  currencyForm.addEventListener(\"submit\", async (event) => {\n    event.preventDefault(); \/\/ Prevent form submission\n    await convertCurrency();\n  });\n    amountInput.addEventListener(\"input\", function() {\n        clearTimeout(timeoutId); \/\/ Clear any previous timeout\n        timeoutId = setTimeout(convertCurrency, 500); \/\/ Convert after 500ms delay\n    });\n\n\n  async function convertCurrency() {\n      let amount = amountInput.value;\n      let currency = currencySelect.value;\n\n      if (!amount) {\n          displayErrorMessage(\"\u274c Enter an amount.\");\n          return;\n      }\n\n      if (isNaN(amount) || parseFloat(amount) <= 0) {\n          displayErrorMessage(\"\u274c Please enter a valid positive number.\");\n          return;\n      }\n\n      try {\n          const apiUrl = `https:\/\/api.exchangerate-api.com\/v4\/latest\/LKR`;\n          const response = await fetch(apiUrl);\n\n          if (!response.ok) {\n              throw new Error(`HTTP error! Status: ${response.status}`);\n          }\n\n          const data = await response.json();\n          if (!data || !data.rates || !data.rates[currency]) {\n              throw new Error(\"Invalid exchange rate data received.\");\n          }\n\n          const rate = data.rates[currency];\n          const converted = amount * rate;\n          displaySuccessMessage(`\ud83d\udcb0 ${amount} LKR = ${converted.toFixed(2)} ${currency}`);\n      } catch (error) {\n          console.error(\"Error fetching exchange rates:\", error);\n          displayErrorMessage(\"\u274c Error fetching exchange rates. Please try again later.\");\n      }\n  }\n\n  function displayErrorMessage(message) {\n    currencyResult.textContent = message;\n    currencyResult.className = \"result-message error\"; \/\/ Set class for error styling\n  }\n\n  function displaySuccessMessage(message) {\n    currencyResult.textContent = message;\n    currencyResult.className = \"result-message success\"; \/\/ Set class for success styling\n  }\n<\/script>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<section class=\"profit-calculator\">\n    <h2>\ud83d\udcca Profit Margin & Duties Calculator<\/h2>\n\n    <form id=\"profitForm\" action=\"\">\n        <div class=\"input-group\">\n            <label for=\"cost\" title=\"Enter the cost of the product in US dollars\">\ud83d\udcb0 Product Cost ($):<\/label>\n            <input type=\"number\" id=\"cost\" placeholder=\"Enter product cost\" aria-describedby=\"costHelp\" min=\"0\">\n            <div id=\"costHelp\" class=\"form-text\">Enter a positive number.<\/div>\n        <\/div>\n\n        <div class=\"input-group\">\n            <label for=\"shipping\" title=\"Enter the shipping cost in US dollars\">\ud83d\udce6 Shipping Cost ($):<\/label>\n            <input type=\"number\" id=\"shipping\" placeholder=\"Enter shipping cost\" aria-describedby=\"shippingHelp\" min=\"0\">\n            <div id=\"shippingHelp\" class=\"form-text\">Enter a positive number.<\/div>\n        <\/div>\n\n        <div class=\"input-group\">\n            <label for=\"tariff\" title=\"Enter the tariff rate as a percentage\">\ud83d\udcb8 Tariff Rate (%):<\/label>\n            <input type=\"number\" id=\"tariff\" placeholder=\"Enter tariff rate\" aria-describedby=\"tariffHelp\" min=\"0\" max=\"100\">\n            <div id=\"tariffHelp\" class=\"form-text\">Enter a value between 0 and 100.<\/div>\n        <\/div>\n\n        <div class=\"input-group\">\n            <label for=\"profit\" title=\"Enter the desired profit margin as a percentage\">\ud83d\udcc8 Profit Margin (%):<\/label>\n            <input type=\"number\" id=\"profit\" placeholder=\"Enter profit margin\" aria-describedby=\"profitHelp\" min=\"0\">\n            <div id=\"profitHelp\" class=\"form-text\">Enter a positive number.<\/div>\n        <\/div>\n\n        <button type=\"submit\" id=\"calculateButton\">\ud83d\udca1 Calculate<\/button>\n    <input type=\"hidden\" name=\"trp-form-language\" value=\"si\"\/><\/form>\n\n    <div id=\"profitResult\" class=\"result-message\" role=\"alert\" aria-live=\"polite\"><\/div>\n    <p class=\"disclaimer\">Calculations are estimates. Actual profit may vary.<\/p>\n<\/section>\n\n<script>\nconst profitForm = document.getElementById(\"profitForm\");\nconst costInput = document.getElementById(\"cost\");\nconst shippingInput = document.getElementById(\"shipping\");\nconst tariffInput = document.getElementById(\"tariff\");\nconst profitInput = document.getElementById(\"profit\");\nconst calculateButton = document.getElementById(\"calculateButton\");\nconst profitResultDiv = document.getElementById(\"profitResult\");\n\nprofitForm.addEventListener(\"submit\", function (event) {\n    event.preventDefault(); \/\/ Prevent form submission\n    calculateProfit();\n});\n\nfunction calculateProfit() {\n    let cost = parseFloat(costInput.value);\n    let shipping = parseFloat(shippingInput.value);\n    let tariff = parseFloat(tariffInput.value) \/ 100;\n    let profit = parseFloat(profitInput.value) \/ 100;\n\n    if (isNaN(cost) || cost < 0) {\n        displayErrorMessage(\"\u274c Enter a valid, positive product cost.\");\n        return;\n    }\n\n    if (isNaN(shipping) || shipping < 0) {\n        displayErrorMessage(\"\u274c Enter a valid, positive shipping cost.\");\n        return;\n    }\n\n    if (isNaN(tariff) || tariff < 0 || tariff > 1) {\n        displayErrorMessage(\"\u274c Enter a valid tariff rate between 0 and 100.\");\n        return;\n    }\n\n    if (isNaN(profit) || profit < 0) {\n        displayErrorMessage(\"\u274c Enter a valid, positive profit margin.\");\n        return;\n    }\n\n    let tariffAmount = cost * tariff;\n    let totalCost = cost + shipping + tariffAmount;\n    let sellingPrice = totalCost * (1 + profit);\n\n    displaySuccessMessage(`\n        \ud83d\udd39 Total Cost: $${totalCost.toFixed(2)} <br>\n        \ud83d\udcb5 Selling Price: $${sellingPrice.toFixed(2)}\n    `);\n}\n\nfunction displayErrorMessage(message) {\n    profitResultDiv.innerHTML = message;\n    profitResultDiv.className = \"result-message error\";\n}\n\nfunction displaySuccessMessage(message) {\n    profitResultDiv.innerHTML = message;\n    profitResultDiv.className = \"result-message success\";\n}\n<\/script>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<section class=\"container-calculator\">\n    <h2>\ud83d\udea2 Container Load Calculator<\/h2>\n\n    <form id=\"containerForm\" action=\"\">\n        <div class=\"input-group\">\n            <label for=\"prodLength\" title=\"Enter the length of the product in centimeters\">\ud83d\udce6 Product Length (cm):<\/label>\n            <input type=\"number\" id=\"prodLength\" placeholder=\"Enter length\" aria-describedby=\"lengthHelp\" min=\"0\">\n            <div id=\"lengthHelp\" class=\"form-text\">Enter a positive number in centimeters.<\/div>\n        <\/div>\n\n        <div class=\"input-group\">\n            <label for=\"prodWidth\" title=\"Enter the width of the product in centimeters\">\ud83d\udce6 Product Width (cm):<\/label>\n            <input type=\"number\" id=\"prodWidth\" placeholder=\"Enter width\" aria-describedby=\"widthHelp\" min=\"0\">\n            <div id=\"widthHelp\" class=\"form-text\">Enter a positive number in centimeters.<\/div>\n        <\/div>\n\n        <div class=\"input-group\">\n            <label for=\"prodHeight\" title=\"Enter the height of the product in centimeters\">\ud83d\udce6 Product Height (cm):<\/label>\n            <input type=\"number\" id=\"prodHeight\" placeholder=\"Enter height\" aria-describedby=\"heightHelp\" min=\"0\">\n            <div id=\"heightHelp\" class=\"form-text\">Enter a positive number in centimeters.<\/div>\n        <\/div>\n\n        <div class=\"input-group\">\n            <label for=\"containerSize\" title=\"Select the size of the shipping container\">\ud83d\udef3 Select Container Size:<\/label>\n            <select id=\"containerSize\">\n                <option value=\"20\">20ft Container (33.2 m\u00b3)<\/option>\n                <option value=\"40\">40ft Container (67.7 m\u00b3)<\/option>\n                <option value=\"HC40\">40ft High Cube (76.3 m\u00b3)<\/option>\n            <\/select>\n        <\/div>\n\n        <div class=\"input-group\">\n            <label for=\"fillRate\" title=\"Estimate container fill efficiency (%)\">Fill Rate (%)<\/label>\n            <input type=\"number\" id=\"fillRate\" value=\"80\" min=\"1\" max=\"100\" step=\"1\">\n        <\/div>\n\n        <div class=\"input-group\">\n            <label for=\"stackingLimit\" title=\"Maximum number of products that can be stacked\">Stacking Limit<\/label>\n            <input type=\"number\" id=\"stackingLimit\" value=\"10\" min=\"1\">\n        <\/div>\n\n        <button type=\"submit\" id=\"calculateButton\">\ud83d\udcca Calculate<\/button>\n    <input type=\"hidden\" name=\"trp-form-language\" value=\"si\"\/><\/form>\n\n    <div id=\"containerResult\" class=\"result-message\" role=\"alert\" aria-live=\"polite\"><\/div>\n    <p class=\"disclaimer\">Calculations are estimates. Actual loading may vary.<\/p>\n<\/section>\n\n<script>\nconst containerForm = document.getElementById(\"containerForm\");\nconst prodLengthInput = document.getElementById(\"prodLength\");\nconst prodWidthInput = document.getElementById(\"prodWidth\");\nconst prodHeightInput = document.getElementById(\"prodHeight\");\nconst containerSizeSelect = document.getElementById(\"containerSize\");\nconst calculateButton = document.getElementById(\"calculateButton\");\nconst containerResultDiv = document.getElementById(\"containerResult\");\nconst fillRateInput = document.getElementById(\"fillRate\");\nconst stackingLimitInput = document.getElementById(\"stackingLimit\");\n\ncontainerForm.addEventListener(\"submit\", function (event) {\n    event.preventDefault(); \/\/ Prevent form submission\n    calculateContainer();\n});\n\nfunction calculateContainer() {\n    const lengthCm = parseFloat(prodLengthInput.value);\n    const widthCm = parseFloat(prodWidthInput.value);\n    const heightCm = parseFloat(prodHeightInput.value);\n    const containerSizeValue = containerSizeSelect.value;\n    const fillRate = parseFloat(fillRateInput.value) \/ 100;\n    const stackingLimit = parseInt(stackingLimitInput.value);\n\n    if (isNaN(lengthCm) || isNaN(widthCm) || isNaN(heightCm) || lengthCm <= 0 || widthCm <= 0 || heightCm <= 0) {\n        displayErrorMessage(\"\u274c Please enter valid, positive dimensions for all product sizes in centimeters.\");\n        return;\n    }\n\n    const lengthM = lengthCm \/ 100; \/\/ Convert cm to meters\n    const widthM = widthCm \/ 100;   \/\/ Convert cm to meters\n    const heightM = heightCm \/ 100;  \/\/ Convert cm to meters\n\n    const productVolume = lengthM * widthM * heightM;\n\n    let containerVolume;\n    switch (containerSizeValue) {\n        case \"20\":\n            containerVolume = 33.2;\n            break;\n        case \"40\":\n            containerVolume = 67.7;\n            break;\n        case \"HC40\":\n            containerVolume = 76.3;\n            break;\n        default:\n            displayErrorMessage(\"\u274c Invalid container size selected.\");\n            return;\n    }\n\n    const usableContainerVolume = containerVolume * fillRate;\n    const maxUnitsTheoretical = usableContainerVolume \/ productVolume;\n    const maxUnits = Math.floor(maxUnitsTheoretical);\n\n    if (maxUnits <= 0) {\n        displayErrorMessage(\"\ud83d\udce6 Product is too large for the selected container, or Fill Rate is too low.\");\n        return;\n    }\n\n    const maxUnitsWithStacking = Math.min(maxUnits, stackingLimit * Math.floor(usableContainerVolume \/ (lengthM * widthM * (stackingLimit > 0 ? heightM : 0))));\n\n    displaySuccessMessage(`\ud83d\udce6 Maximum products: <strong>${maxUnits}<\/strong> (Theoretical)<br>\n                            Assuming a Fill Rate of <strong>${fillRate*100}%<\/strong> and Stacking Limit of <strong>${stackingLimit}<\/strong>`);\n}\n\nfunction displayErrorMessage(message) {\n    containerResultDiv.innerHTML = message;\n    containerResultDiv.className = \"result-message error\";\n}\n\nfunction displaySuccessMessage(message) {\n    containerResultDiv.innerHTML = message;\n    containerResultDiv.className = \"result-message success\";\n}\n<\/script>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<section class=\"export-tax-calculator\">\n    <h2>\ud83d\udcb0 Export Tax & VAT Calculator<\/h2>\n\n    <form id=\"exportTaxForm\" action=\"\">\n        <div class=\"input-group\">\n            <label for=\"exportValue\" title=\"Enter the value of the product in US dollars\">\ud83d\udce6 Product Value ($):<\/label>\n            <input type=\"number\" id=\"exportValue\" placeholder=\"Enter value\" aria-describedby=\"valueHelp\" min=\"0\">\n            <div id=\"valueHelp\" class=\"form-text\">Enter a positive number.<\/div>\n        <\/div>\n\n        <div class=\"input-group\">\n            <label for=\"exportCategory\" title=\"Select the product category to determine the default tax rate\">\ud83d\udcb8 Select Product Category:<\/label>\n            <select id=\"exportCategory\">\n                <option value=\"0.05\">Agriculture (5% Tax)<\/option>\n                <option value=\"0.10\">Manufactured Goods (10% Tax)<\/option>\n                <option value=\"0.15\">Luxury Goods (15% Tax)<\/option>\n                <!-- You could dynamically load these from a server -->\n            <\/select>\n        <\/div>\n\n        <div class=\"input-group\">\n            <label for=\"exportTaxRate\" title=\"Enter export tax rate. Leave blank to use default from category\">Export Tax Rate (%):<\/label>\n            <input type=\"number\" id=\"exportTaxRate\" placeholder=\"Leave blank for default\">\n        <\/div>\n\n        <div class=\"input-group\">\n            <label for=\"vatRate\" title=\"Enter the VAT rate as a percentage\">\ud83d\udcca VAT Rate (%):<\/label>\n            <input type=\"number\" id=\"vatRate\" value=\"15\" min=\"0\" max=\"100\">\n        <\/div>\n\n        <button type=\"submit\" id=\"calculateButton\">\ud83d\udcca Calculate<\/button>\n    <input type=\"hidden\" name=\"trp-form-language\" value=\"si\"\/><\/form>\n\n    <div id=\"exportTaxResult\" class=\"result-message\" role=\"alert\" aria-live=\"polite\"><\/div>\n    <p class=\"disclaimer\">Calculations are estimates and may not include all applicable taxes or fees.<\/p>\n<\/section>\n\n<script>\nconst exportTaxForm = document.getElementById(\"exportTaxForm\");\nconst exportValueInput = document.getElementById(\"exportValue\");\nconst exportCategorySelect = document.getElementById(\"exportCategory\");\nconst exportTaxRateInput = document.getElementById(\"exportTaxRate\");\nconst vatRateInput = document.getElementById(\"vatRate\");\nconst calculateButton = document.getElementById(\"calculateButton\");\nconst exportTaxResultDiv = document.getElementById(\"exportTaxResult\");\n\nexportTaxForm.addEventListener(\"submit\", function (event) {\n    event.preventDefault(); \/\/ Prevent form submission\n    calculateExportTax();\n});\n\nfunction calculateExportTax() {\n    let value = parseFloat(exportValueInput.value);\n    let categoryTaxRate = parseFloat(exportCategorySelect.value);\n    let vatRate = parseFloat(vatRateInput.value) \/ 100;\n\n    \/\/ Check for a user-specified export tax rate\n    let taxRate = exportTaxRateInput.value ? parseFloat(exportTaxRateInput.value) \/ 100 : categoryTaxRate;\n\n    if (isNaN(value) || value <= 0) {\n        displayErrorMessage(\"\u274c Enter a valid, positive product value.\");\n        return;\n    }\n      if (isNaN(taxRate)) {\n        displayErrorMessage(\"\u274c Enter a valid tax rate or select a product category.\");\n        return;\n    }\n\n    if (isNaN(vatRate) || vatRate < 0 || vatRate > 1) {\n        displayErrorMessage(\"\u274c Enter a valid VAT rate between 0 and 100.\");\n        return;\n    }\n\n    let tax = value * taxRate;\n    let vat = value * vatRate;\n    let totalCost = value + tax + vat;\n\n    displaySuccessMessage(`\n        \ud83d\udce6 Export Tax: $${tax.toFixed(2)} <br>\n        \ud83d\udcb0 VAT: $${vat.toFixed(2)} <br>\n        \ud83d\udd39 Total Cost: $${totalCost.toFixed(2)}\n    `);\n}\n\nfunction displayErrorMessage(message) {\n    exportTaxResultDiv.innerHTML = message;\n    exportTaxResultDiv.className = \"result-message error\";\n}\n\nfunction displaySuccessMessage(message) {\n    exportTaxResultDiv.innerHTML = message;\n    exportTaxResultDiv.className = \"result-message success\";\n}\n<\/script>\n\n\n\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>Sri Lanka Export Shipping Calculator Sri Lanka Export Shipping Calculator \ud83c\udf0e Destination Country: Select a CountryUnited StatesUnited KingdomIndiaGermanyItalyBelgiumCanadaChinaNetherlandsJapanFranceUnited Arab Emirates (UAE)Other (Please Specify) Other Country: \ud83c\udf0d General Region: Select a RegionSouth Asia (e.g., India, Pakistan, Bangladesh)East Asia (e.g., China, Japan, South Korea)EuropeNorth AmericaLatin AmericaAfricaAustralia\/Oceania \ud83d\udce6 Weight (kg): \ud83d\udccd Distance (km): \ud83d\ude9b Shipping Method: \ud83d\udea2 Sea [&hellip;]<\/p>","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"disabled","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"class_list":["post-3818","page","type-page","status-publish","hentry"],"aioseo_notices":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"trp-custom-language-flag":false,"woocommerce_thumbnail":false,"woocommerce_single":false,"woocommerce_gallery_thumbnail":false},"uagb_author_info":{"display_name":"Sri Lanka Export Hub","author_link":"https:\/\/srilankaexport.com\/si\/author\/sheny-ktgmail-com\/"},"uagb_comment_info":0,"uagb_excerpt":"Sri Lanka Export Shipping Calculator Sri Lanka Export Shipping Calculator \ud83c\udf0e Destination Country: Select a CountryUnited StatesUnited KingdomIndiaGermanyItalyBelgiumCanadaChinaNetherlandsJapanFranceUnited Arab Emirates (UAE)Other (Please Specify) Other Country: \ud83c\udf0d General Region: Select a RegionSouth Asia (e.g., India, Pakistan, Bangladesh)East Asia (e.g., China, Japan, South Korea)EuropeNorth AmericaLatin AmericaAfricaAustralia\/Oceania \ud83d\udce6 Weight (kg): \ud83d\udccd Distance (km): \ud83d\ude9b Shipping Method: \ud83d\udea2 Sea&hellip;","_links":{"self":[{"href":"https:\/\/srilankaexport.com\/si\/wp-json\/wp\/v2\/pages\/3818","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/srilankaexport.com\/si\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/srilankaexport.com\/si\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/srilankaexport.com\/si\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/srilankaexport.com\/si\/wp-json\/wp\/v2\/comments?post=3818"}],"version-history":[{"count":35,"href":"https:\/\/srilankaexport.com\/si\/wp-json\/wp\/v2\/pages\/3818\/revisions"}],"predecessor-version":[{"id":3861,"href":"https:\/\/srilankaexport.com\/si\/wp-json\/wp\/v2\/pages\/3818\/revisions\/3861"}],"wp:attachment":[{"href":"https:\/\/srilankaexport.com\/si\/wp-json\/wp\/v2\/media?parent=3818"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}