document.addEventListener("DOMContentLoaded", function() { // Initialization of variables const manifestiSpecialeFormGroup = document.querySelector('.form-group.manifesti-speciale');document.getElementById('tipologia').addEventListener('change', function() { manifestiSpecialeFormGroup.style.display = (this.value === 'sociale' || this.value === 'mortuaria') ? 'none' : 'block'; }); const dataRichiesta = document.getElementById("data-richiesta"); dataRichiesta.valueAsDate = new Date();const id = Math.floor(Math.random() * (999999 - 100000) + 100000); document.getElementById("id").textContent = id;const dataInizioElement = document.getElementById('data-inizio'); const dataFineElement = document.getElementById('data-fine'); const formatoElement = document.getElementById('formato'); const numeroManifestiElement = document.getElementById('numero-manifesti'); const manifestiSpecialeElement = document.getElementById('manifesti-speciale'); const spaziPrefissatiElement = document.getElementById('spazi-prefissati'); const urgenzaCheckbox = document.getElementById('urgenza-check');const formatMapping = { "70x100": 1, "100x140": 2, "140x200": 2, "200x140": 4, "400x300": 16, "600x300": 24, // Add more if needed };dataInizioElement.addEventListener("change", function() { const richiestaDate = new Date(dataRichiesta.value); const inizioDate = new Date(dataInizioElement.value); const timeDifference = inizioDate.getTime() - richiestaDate.getTime(); const daysDifference = timeDifference / (1000 * 3600 * 24);if (daysDifference <= 1) { urgenzaCheckbox.checked = true; urgenzaCheckbox.disabled = true; } else { urgenzaCheckbox.disabled = false; } });numeroManifestiElement.addEventListener("change", function() { const numeroManifesti = parseFloat(numeroManifestiElement.value) || 0; manifestiSpecialeElement.value = Math.floor(numeroManifesti / 2); });window.calculate = function() { const dataInizio = new Date(dataInizioElement.value); const dataFine = new Date(dataFineElement.value); const formato = formatoElement.value; const numeroManifesti = parseFloat(numeroManifestiElement.value) || 0; const manifestiSpeciale = parseFloat(manifestiSpecialeElement.value) || 0; const spaziPrefissati = parseFloat(spaziPrefissatiElement.value) || 0; // Calculate the number of days const diffTime = Math.abs(dataFine.getTime() - dataInizio.getTime()); let diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)) + 1; if(dataInizio.getTime() === dataFine.getTime()) { diffDays = 1; } document.getElementById("numero-giorni").textContent = diffDays; // Calculate the total sheets const fogliPerManifesto = formatMapping[formato] || 1; const fogliTotali = numeroManifesti * fogliPerManifesto; document.getElementById("fogli-totali").textContent = fogliTotali; const tipologia = document.getElementById('tipologia').value; // Calculate the base amount const importoBase = ((0.13 * (diffDays - 1)) + 0.65) * fogliTotali; document.getElementById("importo-base").textContent = importoBase.toFixed(2); // Calculate the cost for the posters in Special Category const costoManifestiSpeciale = (tipologia === 'sociale' || tipologia === 'mortuaria') ? 0 : manifestiSpeciale * (importoBase / numeroManifesti) * 0.5; // Calculate the cost for the posters in Predetermined Spaces const costoSpaziPrefissati = spaziPrefissati * 2.6;// Calculate the surcharge for urgency const basePrice = importoBase.toFixed(2); const urgCost = urgenzaCheckbox.checked && (tipologia === 'commerciale' || (tipologia !== 'commerciale' && dataRichiesta.value === dataInizioElement.value)) ? Math.max(importoBase * 0.1, 30) : 0; // Surcharge for commissions less than 50 sheets const commissionSurcharge = fogliTotali = 8 && fogliPerManifesto <= 12) { surcharge8to12 = importoBase * 0.5; // 50% of base cost } // Calculate surcharge for posters of 24 sheets let surcharge24Sheets = 0; if (formato === "600x300") { surcharge24Sheets = importoBase; // 100% of base cost for posters of 24 sheets }const total = importoBase + costoManifestiSpeciale + costoSpaziPrefissati + urgCost + commissionSurcharge + surcharge24Sheets; const finalTotal = (tipologia === 'sociale' || tipologia === 'mortuaria') ? total * 0.5 : total;// Display the output document.getElementById("base-output").textContent = importoBase.toFixed(2); document.getElementById("commission-output").textContent = commissionSurcharge.toFixed(2); document.getElementById("special-output").textContent = costoManifestiSpeciale.toFixed(2); document.getElementById("prefixed-output").textContent = costoSpaziPrefissati.toFixed(2); document.getElementById("urgency-output").textContent = urgCost.toFixed(2) + " (10% del prezzo base, minimo 30)"; //document.getElementById("total-output").textContent = total.toFixed(2); document.getElementById("8to12-output").textContent = surcharge8to12.toFixed(2); document.getElementById("24sheets-output").textContent = surcharge24Sheets.toFixed(2); document.getElementById("total-output").textContent // Update the total output document.getElementById("total-output").textContent = finalTotal.toFixed(2); } }); /*body { font-family: Arial, sans-serif; } .card-header { font-size: 1.2em; font-weight: bold; } */ body { font-family: Arial, sans-serif; background-image: url("https://www.dogresrl.it/wp-content/uploads/2023/10/2.png"); background-repeat: no-repeat; background-size: cover, }.container { max-width: 1200px; margin: 0 auto; padding: 15px; }.card { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.473); margin-bottom: 20px; margin-top: 20dvh; }.card-header { font-size: 20px; font-weight: bold; }.card-body { padding: 20px; }.form-group { margin-bottom: 15px; }.form-group label { display: block; margin-bottom: 5px; }.form-group input[type="number"], .form-group input[type="date"], .form-group select { width: 100%; padding: 5px; border: 1px solid #ccc; border-radius: 5px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.10); cursor: pointer; }.form-group input[type="checkbox"] { display: inline-block; width: auto; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.10); cursor: pointer; }.form-group span { color: #333; font-weight: bold; }.button-section { display: flex; flex-direction: column; align-items: center; }.button-section .form-group { text-align: center; }.button-section input[type="button"] { margin-top: 20px; background-color: #007bff; color: white; border: none; padding: 10px 20px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; transition-duration: 0.4s; cursor: pointer; border-radius: 12px; }.button-section input[type="button"]:hover { background-color: #008CBA; color: white; }

Calcolo Costo Affissioni Pubblicitarie


COMMERCIALE Mortuaria Sociale


70x100 100x140 140x200 200x140 400x300 600x300





Risultati

L'importo base dell'affissione è €

L'importo per la maggiorazione per commissioni inferiori a 50 fogli è €

L'importo per i manifesti in Categoria Speciale è €

L'importo per i manifesti in Spazi Prefissati è €

L'importo per la maggiorazione per urgenza è €

L'importo per la maggiorazione del 50% per i manifesti da 8 fino a 12 fogli è €

L'importo per la maggiorazione per commissioni formato a 24 fogli è €

Il costo totale dell' affissione è €