Changeset 3448629
- Timestamp:
- 01/28/2026 11:11:48 AM (3 weeks ago)
- Location:
- keiste-solar-report/trunk
- Files:
-
- 8 edited
-
assets/js/chart-initialization.js (modified) (2 diffs)
-
assets/js/charts.js (modified) (10 diffs)
-
assets/js/maps-integration.js (modified) (3 diffs)
-
assets/js/solar-calculator-main.js (modified) (17 diffs)
-
includes/admin-settings.php (modified) (20 diffs)
-
includes/plugin-init.php (modified) (2 diffs)
-
keiste-solar-report.php (modified) (17 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
keiste-solar-report/trunk/assets/js/chart-initialization.js
r3448482 r3448629 7 7 8 8 // Configuration variables - will be set from PHP config 9 let CURRENCY_SYMBOL = ' €';9 let CURRENCY_SYMBOL = '$'; 10 10 let solarConfigurations = []; 11 11 … … 245 245 function init() { 246 246 if (window.KSRAD_ChartConfig) { 247 CURRENCY_SYMBOL = window.KSRAD_ChartConfig.currencySymbol || ' €';247 CURRENCY_SYMBOL = window.KSRAD_ChartConfig.currencySymbol || '$'; 248 248 solarConfigurations = window.KSRAD_ChartConfig.solarConfigurations || []; 249 249 } -
keiste-solar-report/trunk/assets/js/charts.js
r3447073 r3448629 24 24 // ===== BREAK-EVEN CHART ===== 25 25 function calculateBreakEvenDataSimple(config) { 26 console.log('[CHART] calculateBreakEvenDataSimple called with config:', config);27 28 26 const yearlyEnergy = config.yearlyEnergyDcKwh; 29 27 const panelCount = config.panelsCount; … … 31 29 // Get values from config or inputs 32 30 const cfg = window.KSRAD_CalcConfig || {}; 33 const electricityRate = parseFloat(document.getElementById('electricityRate')?.value) || 0 .36;34 const feedInTariff = 0.21; // Standard FIT rate31 const electricityRate = parseFloat(document.getElementById('electricityRate')?.value) || 0; 32 const feedInTariff = parseFloat(cfg.defaultFeedInTariff || 0); 35 33 const billMonthly = parseFloat(document.getElementById('electricityBill')?.value) || 0; 36 34 37 const exportRatePercent = cfg.defaultExportRate || 0.05;35 const exportRatePercent = parseFloat(cfg.defaultExportRate || 0) / 100; 38 36 39 37 const inclGrant = document.getElementById('inclGrant')?.checked; 40 38 const inclLoan = document.getElementById('inclLoan')?.checked; 41 const degradation = 0.005;42 const annualIncrease = 0.05; // 5% bill increase per year39 const degradation = SOLAR_PANEL_DEGRADATION; 40 const annualIncrease = parseFloat(cfg.annualPriceIncrease || 0) / 100; 43 41 44 42 // Get actual net install cost from the calculator 45 43 // We need to recalculate it here to match what keyFigures does 46 44 const baseCost = config.installCost || 0; 47 48 console.log('[CHART] baseCost:', baseCost);49 console.log('[CHART] billMonthly:', billMonthly);50 console.log('[CHART] inclGrant:', inclGrant);51 console.log('[CHART] inclLoan:', inclLoan);52 45 53 46 // Get grant settings based on building type … … 59 52 const isResidential = (selected === 'Residential'); 60 53 const category = isResidential ? 'Residential' : 'Non-Residential'; 61 const grantSettings = grants[category] || { rate: 0.30, cap: 162000 }; 54 const grantSettings = grants[category] || { 55 rate: isResidential ? parseFloat(cfg.grantRateDomestic || 0) / 100 : parseFloat(cfg.grantRateNonDomestic || 0) / 100, 56 cap: isResidential ? parseFloat(cfg.grantCapDomestic || 0) : parseFloat(cfg.grantCapNonDomestic || 0) 57 }; 62 58 return inclGrant ? Math.min(baseCost * grantSettings.rate, grantSettings.cap) : 0; 63 59 } catch (e) { 64 return inclGrant ? Math.min(baseCost * 0.30, 162000) : 0; 60 const isRes = true; 61 const rate = parseFloat(cfg.grantRateDomestic || 0) / 100; 62 const cap = parseFloat(cfg.grantCapDomestic || 0); 63 return inclGrant ? Math.min(baseCost * rate, cap) : 0; 65 64 } 66 65 }; … … 69 68 const principal = Math.max(0, baseCost - seaiGrant); 70 69 71 console.log('[CHART] seaiGrant:', seaiGrant);72 console.log('[CHART] principal:', principal);73 74 70 // Calculate loan payments if applicable 75 const loanAPR = 0.07; // 7% APR76 const loanYears = 7;71 const loanAPR = parseFloat(cfg.defaultLoanApr || 0) / 100; 72 const loanYears = parseInt(cfg.loanTerm || 7); 77 73 let yearlyLoanCost = 0; 78 74 let totalCost = principal; … … 87 83 } 88 84 89 console.log('[CHART] yearlyLoanCost:', yearlyLoanCost);90 console.log('[CHART] totalCost (investment):', totalCost);91 92 85 // Calculate annual usage from bill 93 86 const annualUsageKwh = (billMonthly * 12) / electricityRate; 94 95 console.log('[CHART] annualUsageKwh:', annualUsageKwh);96 87 97 88 const years = Array.from({ length: 25 }, (_, i) => i); … … 136 127 137 128 const breakEvenYear = savings.findIndex(saving => saving >= 0); 138 console.log('[CHART] Break-even year:', breakEvenYear);139 console.log('[CHART] First 5 years cumulative savings:', savings.slice(0, 5));140 129 141 130 return { … … 308 297 window.energyChart.update(); 309 298 } catch (e) { 310 console.error('updateEnergyChart error', e);299 // Error in energy chart update 311 300 } 312 301 }; … … 314 303 // ===== UPDATE BREAK-EVEN CHART ===== 315 304 window.updateBreakEvenChart = function (state, figs) { 316 console.log('updateBreakEvenChart in charts.js called', { state, figs, hasChart: !!window.breakEvenChart });317 318 305 if (!window.breakEvenChart) { 319 console.warn('No breakEvenChart available');320 306 return; 321 307 } … … 324 310 // On page load with no bill, show zero baseline 325 311 if (!state.billMonthly || state.billMonthly === 0) { 326 console.log('Setting chart to zero (no bill)');327 328 312 if (window.breakEvenChart.data && window.breakEvenChart.data.datasets && window.breakEvenChart.data.datasets[0]) { 329 313 window.breakEvenChart.data.datasets[0].data = Array(25).fill(0); … … 352 336 } 353 337 } catch (e) { 354 console.error('updateBreakEvenChart error', e);338 // Error in break-even chart update 355 339 } 356 340 }; -
keiste-solar-report/trunk/assets/js/maps-integration.js
r3448482 r3448629 156 156 157 157 // Update all instances of CURRENCY_SYMBOL across different script contexts 158 window.CURRENCY_SYMBOL = currencyMap[window.COUNTRY_SETTING] || ' €';158 window.CURRENCY_SYMBOL = currencyMap[window.COUNTRY_SETTING] || '$'; 159 159 160 160 // Also update in KSRAD_CalcConfig if it exists … … 328 328 }; 329 329 if (window.COUNTRY_SETTING) { 330 window.CURRENCY_SYMBOL = currencyMap[window.COUNTRY_SETTING] || ' €';330 window.CURRENCY_SYMBOL = currencyMap[window.COUNTRY_SETTING] || '$'; 331 331 if (window.KSRAD_CalcConfig) { 332 332 window.KSRAD_CalcConfig.currencySymbol = window.CURRENCY_SYMBOL; … … 417 417 418 418 if (window.COUNTRY_SETTING) { 419 window.CURRENCY_SYMBOL = currencyMap[window.COUNTRY_SETTING] || ' €';419 window.CURRENCY_SYMBOL = currencyMap[window.COUNTRY_SETTING] || '$'; 420 420 if (window.KSRAD_CalcConfig) { 421 421 window.KSRAD_CalcConfig.currencySymbol = window.CURRENCY_SYMBOL; -
keiste-solar-report/trunk/assets/js/solar-calculator-main.js
r3448482 r3448629 18 18 // Financial - will be set from PHP config 19 19 const CORPORATION_TAX = 0.125; // 12.5% 20 let CURRENCY_SYMBOL = ' €'; // Default, will be overridden by config20 let CURRENCY_SYMBOL = '$'; // Default, will be overridden by config 21 21 // Grant settings are now building-type-specific, resolved dynamically 22 22 const LOAN_APR_DEFAULT = 0.07; // 7% APR 23 const FEED_IN_TARIFF_DEFAULT = 0.21; // €/kWh23 const FEED_IN_TARIFF_DEFAULT = 0.21; // $/kWh 24 24 const COMPOUND_7_YRS = 1.07; // coefficient @5% over 7years 25 const ANNUAL_INCREASE = 0.05; // 5% bill increase25 let ANNUAL_INCREASE = 0.05; // 5% bill increase - will be set from config 26 26 const SOLAR_PANEL_DEGRADATION = 0.005;// 0.5%/yr 27 27 const LENGTH_OF_PAYBACK = 7; // loan length, years (used when needed) … … 38 38 const DEFAULT_PANELS = 0; 39 39 const DEFAULT_EXPORT_PERCENT = 0.10; // 10% of production exported 40 const DEFAULT_RETAIL_RATE = 0.17; // €/kWh – sensible default if blank40 const DEFAULT_RETAIL_RATE = 0.17; // $/kWh – sensible default if blank 41 41 const DEFAULT_FEED_IN_TARIFF = FEED_IN_TARIFF_DEFAULT; 42 42 const DEFAULT_APR = LOAN_APR_DEFAULT; … … 110 110 * @param {number} panels - number of solar panels (each assumed 400 W) 111 111 * @param {number} batteryKWh - optional battery size in kWh 112 * @param {boolean} includeDiverter - whether to include a diverter ( €550)113 * @returns {number} total cost ( €)112 * @param {boolean} includeDiverter - whether to include a diverter ($550) 113 * @returns {number} total cost ($) 114 114 */ 115 115 function estimateSolarCost(panels, batteryKWh = 0, includeDiverter = true) { … … 137 137 const costPerKwP = getCostPerKwP(); 138 138 const systemKwP = (panels * panelWatt) / 1000; 139 const batteryCostPerKWh = 500; // €/kWh installed139 const batteryCostPerKWh = 500; // $/kWh installed 140 140 const diverterCost = 550; // one-off 141 141 const panelCost = systemKwP * costPerKwP; 142 142 const batteryCost = batteryKWh * batteryCostPerKWh; 143 143 // Only include diverter cost when at least one panel is selected. 144 // This prevents a default €550 cost appearing when panels = 0.144 // This prevents a default $550 cost appearing when panels = 0. 145 145 const diverter = includeDiverter && panels > 0 ? diverterCost : 0; 146 146 return panelCost + batteryCost + diverter; … … 260 260 // Derived system constants 261 261 const kWp = (panels * PANEL_POWER_W) / 1000; 262 const baseCost = Math.round(estimateSolarCost(state.panels)); // €262 const baseCost = Math.round(estimateSolarCost(state.panels)); // $ 263 263 264 264 // Resolve grant settings based on building type (Residential vs Non-Residential) … … 273 273 const category = isResidential ? 'Residential' : 'Non-Residential'; 274 274 if (grants[category]) { 275 return { rate: grants[category].rate || 0 .30, cap: grants[category].cap || 162000 };275 return { rate: grants[category].rate || 0, cap: grants[category].cap || 0 }; 276 276 } 277 return { rate: 0 .30, cap: 162000 }; // fallback277 return { rate: 0, cap: 0 }; // fallback 278 278 } catch (e) { 279 return { rate: 0 .30, cap: 162000 };279 return { rate: 0, cap: 0 }; 280 280 } 281 281 }; … … 391 391 console.log(' CORPORATION_TAX: ' + (CORPORATION_TAX * 100) + '%'); 392 392 console.log(' LOAN_APR_DEFAULT: ' + (LOAN_APR_DEFAULT * 100) + '%'); 393 console.log(' FEED_IN_TARIFF_DEFAULT: €'+ FEED_IN_TARIFF_DEFAULT + '/kWh');393 console.log(' FEED_IN_TARIFF_DEFAULT: ' + CURRENCY_SYMBOL + FEED_IN_TARIFF_DEFAULT + '/kWh'); 394 394 console.log(' ANNUAL_INCREASE: ' + (ANNUAL_INCREASE * 100) + '%'); 395 395 console.log(' SOLAR_PANEL_DEGRADATION: ' + (SOLAR_PANEL_DEGRADATION * 100) + '%/yr'); … … 404 404 console.log('\n[2] INPUT VARIABLES:'); 405 405 console.log(' panels: ' + panels); 406 console.log(' billMonthly: €'+ billMonthly);407 console.log(' electricityRate (RETAIL): €'+ RETAIL + '/kWh');408 console.log(' feedInTariff (FIT): €'+ FIT + '/kWh');406 console.log(' billMonthly: ' + CURRENCY_SYMBOL + billMonthly); 407 console.log(' electricityRate (RETAIL): ' + CURRENCY_SYMBOL + RETAIL + '/kWh'); 408 console.log(' feedInTariff (FIT): ' + CURRENCY_SYMBOL + FIT + '/kWh'); 409 409 console.log(' exportRate: ' + (exportRate * 100) + '%'); 410 410 console.log(' APR: ' + (APR * 100) + '%'); … … 414 414 console.log(' yearlyEnergy (from config): ' + yearlyEnergy + ' kWh'); 415 415 console.log(' grantSettings.rate: ' + (grantSettings.rate * 100) + '%'); 416 console.log(' grantSettings.cap: €'+ grantSettings.cap);416 console.log(' grantSettings.cap: ' + CURRENCY_SYMBOL + grantSettings.cap); 417 417 418 418 // 3. DERIVED SYSTEM VALUES … … 425 425 console.log('\n[4] COST CALCULATIONS:'); 426 426 console.log(' baseCost = estimateSolarCost(panels)'); 427 console.log(' = €'+ baseCost);427 console.log(' = ' + CURRENCY_SYMBOL + baseCost); 428 428 console.log(' '); 429 429 console.log(' seaiGrant = inclGrant ? min(baseCost × grantRate, grantCap) : 0'); 430 console.log(' = ' + inclGrant + ' ? min( €' + baseCost + ' × ' + grantSettings.rate + ', €'+ grantSettings.cap + ') : 0');431 console.log(' = €'+ seaiGrant);430 console.log(' = ' + inclGrant + ' ? min(' + CURRENCY_SYMBOL + baseCost + ' × ' + grantSettings.rate + ', ' + CURRENCY_SYMBOL + grantSettings.cap + ') : 0'); 431 console.log(' = ' + CURRENCY_SYMBOL + seaiGrant); 432 432 console.log(' '); 433 433 console.log(' acaAllowance = inclACA ? min(baseCost - seaiGrant, baseCost × CORPORATION_TAX) : 0'); 434 console.log(' = ' + inclACA + ' ? min( €' + baseCost + ' - €' + seaiGrant + ', €'+ baseCost + ' × ' + CORPORATION_TAX + ') : 0');435 console.log(' = €'+ acaAllowance);436 console.log(' '); 437 console.log(' install_cost = €'+ install_cost);434 console.log(' = ' + inclACA + ' ? min(' + CURRENCY_SYMBOL + baseCost + ' - ' + CURRENCY_SYMBOL + seaiGrant + ', ' + CURRENCY_SYMBOL + baseCost + ' × ' + CORPORATION_TAX + ') : 0'); 435 console.log(' = ' + CURRENCY_SYMBOL + acaAllowance); 436 console.log(' '); 437 console.log(' install_cost = ' + CURRENCY_SYMBOL + install_cost); 438 438 439 439 // 5. LOAN CALCULATIONS … … 442 442 console.log(' n (total months) = LENGTH_OF_PAYBACK × m = ' + LENGTH_OF_PAYBACK + ' × ' + m + ' = ' + n); 443 443 console.log(' principal = max(0, baseCost - seaiGrant)'); 444 console.log(' = max(0, €' + baseCost + ' - €'+ seaiGrant + ')');445 console.log(' = €'+ principal);444 console.log(' = max(0, ' + CURRENCY_SYMBOL + baseCost + ' - ' + CURRENCY_SYMBOL + seaiGrant + ')'); 445 console.log(' = ' + CURRENCY_SYMBOL + principal); 446 446 console.log(' r (monthly rate) = APR ÷ m = ' + APR + ' ÷ ' + m + ' = ' + r.toFixed(6)); 447 447 console.log(' '); 448 448 console.log(' monthlyRepay = inclLoan ? principal × (r ÷ (1 - (1 + r)^-n)) : 0'); 449 console.log(' = ' + inclLoan + ' ? €'+ principal + ' × (' + r.toFixed(6) + ' ÷ (1 - (1 + ' + r.toFixed(6) + ')^-' + n + ')) : 0');450 console.log(' = €'+ monthlyRepay);449 console.log(' = ' + inclLoan + ' ? ' + CURRENCY_SYMBOL + principal + ' × (' + r.toFixed(6) + ' ÷ (1 - (1 + ' + r.toFixed(6) + ')^-' + n + ')) : 0'); 450 console.log(' = ' + CURRENCY_SYMBOL + monthlyRepay); 451 451 console.log(' '); 452 452 console.log(' yearlyLoanCost = inclLoan ? monthlyRepay × 12 : 0'); 453 console.log(' = ' + inclLoan + ' ? €'+ monthlyRepay + ' × 12 : 0');454 console.log(' = €'+ yearlyLoanCost);453 console.log(' = ' + inclLoan + ' ? ' + CURRENCY_SYMBOL + monthlyRepay + ' × 12 : 0'); 454 console.log(' = ' + CURRENCY_SYMBOL + yearlyLoanCost); 455 455 console.log(' '); 456 456 console.log(' net_install_cost = inclLoan ? yearlyLoanCost × LENGTH_OF_PAYBACK : baseCost - seaiGrant'); 457 console.log(' = ' + inclLoan + ' ? €' + yearlyLoanCost + ' × ' + LENGTH_OF_PAYBACK + ' : €' + baseCost + ' - €'+ seaiGrant);458 console.log(' = €'+ net_install_cost);457 console.log(' = ' + inclLoan + ' ? ' + CURRENCY_SYMBOL + yearlyLoanCost + ' × ' + LENGTH_OF_PAYBACK + ' : ' + CURRENCY_SYMBOL + baseCost + ' - ' + CURRENCY_SYMBOL + seaiGrant); 458 console.log(' = ' + CURRENCY_SYMBOL + net_install_cost); 459 459 460 460 // 6. ENERGY PRODUCTION CALCULATIONS … … 467 467 console.log(' '); 468 468 console.log(' current_usage_kwh = (billMonthly × MONTHS_IN_YR) ÷ RETAIL'); 469 console.log(' = ( €' + billMonthly + ' × ' + MONTHS_IN_YR + ') ÷ €'+ RETAIL);469 console.log(' = (' + CURRENCY_SYMBOL + billMonthly + ' × ' + MONTHS_IN_YR + ') ÷ ' + CURRENCY_SYMBOL + RETAIL); 470 470 console.log(' = ' + current_usage_kwh.toFixed(2) + ' kWh'); 471 471 … … 487 487 console.log('\n[8] YEAR 0 FINANCIAL SAVINGS:'); 488 488 console.log(' bill_savings = actual_self_consumption_kwh × RETAIL'); 489 console.log(' = ' + actual_self_consumption_kwh.toFixed(2) + ' × €'+ RETAIL);490 console.log(' = €'+ bill_savings.toFixed(2));489 console.log(' = ' + actual_self_consumption_kwh.toFixed(2) + ' × ' + CURRENCY_SYMBOL + RETAIL); 490 console.log(' = ' + CURRENCY_SYMBOL + bill_savings.toFixed(2)); 491 491 console.log(' '); 492 492 console.log(' export_income = export_kwh × FIT'); 493 console.log(' = ' + export_kwh.toFixed(2) + ' × €'+ FIT);494 console.log(' = €'+ export_income.toFixed(2));493 console.log(' = ' + export_kwh.toFixed(2) + ' × ' + CURRENCY_SYMBOL + FIT); 494 console.log(' = ' + CURRENCY_SYMBOL + export_income.toFixed(2)); 495 495 console.log(' '); 496 496 console.log(' savings_year0 = bill_savings + export_income - yearlyLoanCost'); 497 console.log(' = €' + bill_savings.toFixed(2) + ' + €' + export_income.toFixed(2) + ' - €'+ yearlyLoanCost);498 console.log(' = €'+ savings_year0.toFixed(2));497 console.log(' = ' + CURRENCY_SYMBOL + bill_savings.toFixed(2) + ' + ' + CURRENCY_SYMBOL + export_income.toFixed(2) + ' - ' + CURRENCY_SYMBOL + yearlyLoanCost); 498 console.log(' = ' + CURRENCY_SYMBOL + savings_year0.toFixed(2)); 499 499 500 500 // 9. 25-YEAR PROJECTIONS … … 505 505 console.log(' '); 506 506 console.log(' loanCost25 = inclLoan ? (monthlyRepay × 12 × loanYearsCount) : principal'); 507 console.log(' = ' + inclLoan + ' ? ( €' + monthlyRepay + ' × 12 × ' + loanYearsCount + ') : €'+ principal);508 console.log(' = €'+ loanCost25);509 console.log(' '); 510 console.log(' benefits25 (sum of 25 years with degradation & escalation) = €'+ benefits25.toFixed(2));507 console.log(' = ' + inclLoan + ' ? (' + CURRENCY_SYMBOL + monthlyRepay + ' × 12 × ' + loanYearsCount + ') : ' + CURRENCY_SYMBOL + principal); 508 console.log(' = ' + CURRENCY_SYMBOL + loanCost25); 509 console.log(' '); 510 console.log(' benefits25 (sum of 25 years with degradation & escalation) = ' + CURRENCY_SYMBOL + benefits25.toFixed(2)); 511 511 console.log(' '); 512 512 console.log(' total_yr_savings = benefits25 - loanCost25 + (inclACA ? acaAllowance : 0)'); 513 console.log(' = €' + benefits25.toFixed(2) + ' - €' + loanCost25 + ' + (' + inclACA + ' ? €'+ acaAllowance + ' : 0)');514 console.log(' = €'+ total_yr_savings.toFixed(2));513 console.log(' = ' + CURRENCY_SYMBOL + benefits25.toFixed(2) + ' - ' + CURRENCY_SYMBOL + loanCost25 + ' + (' + inclACA + ' ? ' + CURRENCY_SYMBOL + acaAllowance + ' : 0)'); 514 console.log(' = ' + CURRENCY_SYMBOL + total_yr_savings.toFixed(2)); 515 515 516 516 // 10. KEY INTERFACE FIGURES 517 517 console.log('\n[10] KEY INTERFACE FIGURES:'); 518 518 console.log(' monthly_charge = billMonthly > 0 ? (savings_year0 ÷ 12) - billMonthly : 0'); 519 console.log(' = ' + billMonthly + ' > 0 ? ( €' + savings_year0.toFixed(2) + ' ÷ 12) - €'+ billMonthly + ' : 0');520 console.log(' = €'+ monthly_charge.toFixed(2));519 console.log(' = ' + billMonthly + ' > 0 ? (' + CURRENCY_SYMBOL + savings_year0.toFixed(2) + ' ÷ 12) - ' + CURRENCY_SYMBOL + billMonthly + ' : 0'); 520 console.log(' = ' + CURRENCY_SYMBOL + monthly_charge.toFixed(2)); 521 521 console.log(' '); 522 522 console.log(' investment = inclLoan ? loanCost25 : net_install_cost'); 523 console.log(' = ' + inclLoan + ' ? €' + loanCost25 + ' : €'+ net_install_cost);524 console.log(' = €'+ investment);523 console.log(' = ' + inclLoan + ' ? ' + CURRENCY_SYMBOL + loanCost25 + ' : ' + CURRENCY_SYMBOL + net_install_cost); 524 console.log(' = ' + CURRENCY_SYMBOL + investment); 525 525 console.log(' '); 526 526 console.log(' payback_period = savings_year0 > 0 ? investment ÷ savings_year0 : 0'); 527 console.log(' = ' + savings_year0.toFixed(2) + ' > 0 ? €' + investment + ' ÷ €'+ savings_year0.toFixed(2) + ' : 0');527 console.log(' = ' + savings_year0.toFixed(2) + ' > 0 ? ' + CURRENCY_SYMBOL + investment + ' ÷ ' + CURRENCY_SYMBOL + savings_year0.toFixed(2) + ' : 0'); 528 528 console.log(' = ' + payback_period.toFixed(2) + ' years'); 529 529 console.log(' '); 530 530 const roi_cost = inclLoan ? (monthlyRepay * 12 * loanYearsCount) : principal; 531 531 console.log(' ROI_25Y = cost > 0 ? ((benefits25 - cost) ÷ cost) × 100 : 0'); 532 console.log(' = €' + roi_cost + ' > 0 ? ((€' + benefits25.toFixed(2) + ' - €' + roi_cost + ') ÷ €'+ roi_cost + ') × 100 : 0');532 console.log(' = ' + CURRENCY_SYMBOL + roi_cost + ' > 0 ? ((' + CURRENCY_SYMBOL + benefits25.toFixed(2) + ' - ' + CURRENCY_SYMBOL + roi_cost + ') ÷ ' + CURRENCY_SYMBOL + roi_cost + ') × 100 : 0'); 533 533 console.log(' = ' + ROI_25Y.toFixed(2) + '%'); 534 534 console.log(' '); … … 542 542 // 11. SUMMARY 543 543 console.log('\n[11] CALCULATION SUMMARY:'); 544 console.log(' Installation Cost: €'+ install_cost);545 console.log(' Grant: €'+ seaiGrant);546 console.log(' ACA Allowance: €'+ acaAllowance);547 console.log(' Net Install Cost: €'+ net_install_cost);544 console.log(' Installation Cost: ' + CURRENCY_SYMBOL + install_cost); 545 console.log(' Grant: ' + CURRENCY_SYMBOL + seaiGrant); 546 console.log(' ACA Allowance: ' + CURRENCY_SYMBOL + acaAllowance); 547 console.log(' Net Install Cost: ' + CURRENCY_SYMBOL + net_install_cost); 548 548 console.log(' Annual Energy (Year 0): ' + yearlyEnergyKWh + ' kWh'); 549 console.log(' Annual Savings (Year 0): €'+ savings_year0.toFixed(2));550 console.log(' Monthly Net Income: €'+ monthly_charge.toFixed(2));549 console.log(' Annual Savings (Year 0): ' + CURRENCY_SYMBOL + savings_year0.toFixed(2)); 550 console.log(' Monthly Net Income: ' + CURRENCY_SYMBOL + monthly_charge.toFixed(2)); 551 551 console.log(' Payback Period: ' + payback_period.toFixed(2) + ' years'); 552 console.log(' 25-Year Total Savings: €'+ total_yr_savings.toFixed(2));552 console.log(' 25-Year Total Savings: ' + CURRENCY_SYMBOL + total_yr_savings.toFixed(2)); 553 553 console.log(' 25-Year ROI: ' + ROI_25Y.toFixed(2) + '%'); 554 554 console.log(' CO2 Reduction (25 years): ' + co2_reduction.toFixed(2) + ' tonnes'); … … 579 579 const category = isResidential ? 'Residential' : 'Non-Residential'; 580 580 581 const grantRate = grants[category] ? (grants[category].rate || 0 .30) : 0.30;582 const grantCap = grants[category] ? (grants[category].cap || 162000) : 162000;581 const grantRate = grants[category] ? (grants[category].rate || 0) : 0; 582 const grantCap = grants[category] ? (grants[category].cap || 0) : 0; 583 583 584 584 // Find and update grant description elements … … 888 888 CURRENCY_SYMBOL = window.KSRAD_CalcConfig.currencySymbol || CURRENCY_SYMBOL; 889 889 window.CURRENCY_SYMBOL = CURRENCY_SYMBOL; 890 // Set annual price increase from config (convert from percentage to decimal) 891 ANNUAL_INCREASE = parseFloat(window.KSRAD_CalcConfig.annualPriceIncrease || 0) / 100; 890 892 } 891 893 -
keiste-solar-report/trunk/includes/admin-settings.php
r3447073 r3448629 459 459 if (isset($input['default_electricity_rate'])) { 460 460 $rate = floatval($input['default_electricity_rate']); 461 $new_input['default_electricity_rate'] = ($rate >= 0 && $rate <= 10) ? $rate : 0 .17;461 $new_input['default_electricity_rate'] = ($rate >= 0 && $rate <= 10) ? $rate : 0; 462 462 } 463 463 464 464 if (isset($input['default_export_rate'])) { 465 465 $rate = floatval($input['default_export_rate']); 466 $new_input['default_export_rate'] = ($rate >= 0 && $rate <= 100) ? $rate : 10;466 $new_input['default_export_rate'] = ($rate >= 0 && $rate <= 100) ? $rate : 0; 467 467 } 468 468 469 469 if (isset($input['default_feed_in_tariff'])) { 470 470 $tariff = floatval($input['default_feed_in_tariff']); 471 $new_input['default_feed_in_tariff'] = ($tariff >= 0 && $tariff <= 10) ? $tariff : 0 .15;471 $new_input['default_feed_in_tariff'] = ($tariff >= 0 && $tariff <= 10) ? $tariff : 0; 472 472 } 473 473 474 474 if (isset($input['default_loan_apr'])) { 475 475 $apr = floatval($input['default_loan_apr']); 476 $new_input['default_loan_apr'] = ($apr >= 0 && $apr <= 100) ? $apr : 5;476 $new_input['default_loan_apr'] = ($apr >= 0 && $apr <= 100) ? $apr : 0; 477 477 } 478 478 479 479 if (isset($input['loan_term'])) { 480 480 $term = intval($input['loan_term']); 481 $new_input['loan_term'] = ($term >= 1 && $term <= 30) ? $term : 7;481 $new_input['loan_term'] = ($term >= 1 && $term <= 30) ? $term : 0; 482 482 } 483 483 484 484 if (isset($input['annual_price_increase'])) { 485 485 $increase = floatval($input['annual_price_increase']); 486 $new_input['annual_price_increase'] = ($increase >= 0 && $increase <= 50) ? $increase : 5;486 $new_input['annual_price_increase'] = ($increase >= 0 && $increase <= 50) ? $increase : 0; 487 487 } 488 488 … … 503 503 if (isset($input['grant_rate_domestic'])) { 504 504 $rate = floatval($input['grant_rate_domestic']); 505 $new_input['grant_rate_domestic'] = ($rate >= 0 && $rate <= 100) ? $rate : 30;505 $new_input['grant_rate_domestic'] = ($rate >= 0 && $rate <= 100) ? $rate : 0; 506 506 } 507 507 508 508 if (isset($input['grant_cap_domestic'])) { 509 509 $cap = floatval($input['grant_cap_domestic']); 510 $new_input['grant_cap_domestic'] = ($cap >= 0 && $cap <= 1000000) ? $cap : 7500;510 $new_input['grant_cap_domestic'] = ($cap >= 0 && $cap <= 1000000) ? $cap : 0; 511 511 } 512 512 513 513 if (isset($input['grant_rate_non_domestic'])) { 514 514 $rate = floatval($input['grant_rate_non_domestic']); 515 $new_input['grant_rate_non_domestic'] = ($rate >= 0 && $rate <= 100) ? $rate : 30;515 $new_input['grant_rate_non_domestic'] = ($rate >= 0 && $rate <= 100) ? $rate : 0; 516 516 } 517 517 518 518 if (isset($input['grant_cap_non_domestic'])) { 519 519 $cap = floatval($input['grant_cap_non_domestic']); 520 $new_input['grant_cap_non_domestic'] = ($cap >= 0 && $cap <= 1000000) ? $cap : 50000;520 $new_input['grant_cap_non_domestic'] = ($cap >= 0 && $cap <= 1000000) ? $cap : 0; 521 521 } 522 522 … … 578 578 if (isset($input['cost_domestic'])) { 579 579 $cost = floatval($input['cost_domestic']); 580 $new_input['cost_domestic'] = ($cost >= 0 && $cost <= 10000) ? $cost : 650;580 $new_input['cost_domestic'] = ($cost >= 0 && $cost <= 10000) ? $cost : 0; 581 581 } 582 582 583 583 if (isset($input['cost_small'])) { 584 584 $cost = floatval($input['cost_small']); 585 $new_input['cost_small'] = ($cost >= 0 && $cost <= 10000) ? $cost : 600;585 $new_input['cost_small'] = ($cost >= 0 && $cost <= 10000) ? $cost : 0; 586 586 } 587 587 588 588 if (isset($input['cost_medium'])) { 589 589 $cost = floatval($input['cost_medium']); 590 $new_input['cost_medium'] = ($cost >= 0 && $cost <= 10000) ? $cost : 500;590 $new_input['cost_medium'] = ($cost >= 0 && $cost <= 10000) ? $cost : 0; 591 591 } 592 592 593 593 if (isset($input['cost_large'])) { 594 594 $cost = floatval($input['cost_large']); 595 $new_input['cost_large'] = ($cost >= 0 && $cost <= 10000) ? $cost : 425;595 $new_input['cost_large'] = ($cost >= 0 && $cost <= 10000) ? $cost : 0; 596 596 } 597 597 … … 711 711 printf( 712 712 '<input type="number" step="0.01" id="default_electricity_rate" name="ksrad_options[default_electricity_rate]" value="%s" />', 713 isset($this->options['default_electricity_rate']) ? esc_attr($this->options['default_electricity_rate']) : '0 .17'713 isset($this->options['default_electricity_rate']) ? esc_attr($this->options['default_electricity_rate']) : '0' 714 714 ); 715 715 echo ' <span class="description">per kWh (e.g., 0.17 for 0.17/kWh)</span>'; … … 719 719 printf( 720 720 '<input type="number" step="1" id="default_export_rate" name="ksrad_options[default_export_rate]" value="%s" />', 721 isset($this->options['default_export_rate']) ? esc_attr($this->options['default_export_rate']) : ' 10'721 isset($this->options['default_export_rate']) ? esc_attr($this->options['default_export_rate']) : '0' 722 722 ); 723 723 echo ' <span class="description">% (percentage of energy exported to grid)</span>'; … … 727 727 printf( 728 728 '<input type="number" step="0.01" id="default_feed_in_tariff" name="ksrad_options[default_feed_in_tariff]" value="%s" />', 729 isset($this->options['default_feed_in_tariff']) ? esc_attr($this->options['default_feed_in_tariff']) : '0 .15'729 isset($this->options['default_feed_in_tariff']) ? esc_attr($this->options['default_feed_in_tariff']) : '0' 730 730 ); 731 731 echo ' <span class="description">per kWh</span>'; … … 735 735 printf( 736 736 '<input type="number" step="0.1" id="default_loan_apr" name="ksrad_options[default_loan_apr]" value="%s" />', 737 isset($this->options['default_loan_apr']) ? esc_attr($this->options['default_loan_apr']) : ' 5'737 isset($this->options['default_loan_apr']) ? esc_attr($this->options['default_loan_apr']) : '0' 738 738 ); 739 739 echo ' <span class="description">% (annual percentage rate)</span>'; … … 743 743 printf( 744 744 '<input type="number" step="1" id="loan_term" name="ksrad_options[loan_term]" value="%s" />', 745 isset($this->options['loan_term']) ? esc_attr($this->options['loan_term']) : ' 7'745 isset($this->options['loan_term']) ? esc_attr($this->options['loan_term']) : '0' 746 746 ); 747 747 echo ' <span class="description">Years (length of payback period)</span>'; … … 751 751 printf( 752 752 '<input type="number" step="0.1" id="annual_price_increase" name="ksrad_options[annual_price_increase]" value="%s" />', 753 isset($this->options['annual_price_increase']) ? esc_attr($this->options['annual_price_increase']) : ' 5'753 isset($this->options['annual_price_increase']) ? esc_attr($this->options['annual_price_increase']) : '0' 754 754 ); 755 755 echo ' <span class="description">% (expected electricity price inflation)</span>'; … … 781 781 printf( 782 782 '<input type="number" step="0.1" id="grant_rate_domestic" name="ksrad_options[grant_rate_domestic]" value="%s" />', 783 isset($this->options['grant_rate_domestic']) ? esc_attr($this->options['grant_rate_domestic']) : ' 30'783 isset($this->options['grant_rate_domestic']) ? esc_attr($this->options['grant_rate_domestic']) : '0' 784 784 ); 785 785 echo ' <span class="description">% (grant percentage for residential/domestic installations)</span>'; … … 790 790 printf( 791 791 '<input type="number" step="1" id="grant_cap_domestic" name="ksrad_options[grant_cap_domestic]" value="%s" />', 792 isset($this->options['grant_cap_domestic']) ? esc_attr($this->options['grant_cap_domestic']) : ' 7500'792 isset($this->options['grant_cap_domestic']) ? esc_attr($this->options['grant_cap_domestic']) : '0' 793 793 ); 794 794 echo ' <span class="description">' . $currency . ' (maximum grant for residential/domestic)</span>'; … … 798 798 printf( 799 799 '<input type="number" step="0.1" id="grant_rate_non_domestic" name="ksrad_options[grant_rate_non_domestic]" value="%s" />', 800 isset($this->options['grant_rate_non_domestic']) ? esc_attr($this->options['grant_rate_non_domestic']) : ' 30'800 isset($this->options['grant_rate_non_domestic']) ? esc_attr($this->options['grant_rate_non_domestic']) : '0' 801 801 ); 802 802 echo ' <span class="description">% (grant percentage for commercial/non-domestic installations)</span>'; … … 807 807 printf( 808 808 '<input type="number" step="1" id="grant_cap_non_domestic" name="ksrad_options[grant_cap_non_domestic]" value="%s" />', 809 isset($this->options['grant_cap_non_domestic']) ? esc_attr($this->options['grant_cap_non_domestic']) : ' 50000'809 isset($this->options['grant_cap_non_domestic']) ? esc_attr($this->options['grant_cap_non_domestic']) : '0' 810 810 ); 811 811 echo ' <span class="description">' . $currency . ' (maximum grant for commercial/non-domestic)</span>'; … … 935 935 if (empty($grants)) { 936 936 $grants = array( 937 array('country' => 'United States', 'building_type' => 'Residential', 'grant_percentage' => 30, 'grant_max' => 7500),938 array('country' => 'United States', 'building_type' => 'Non-Residential', 'grant_percentage' => 30, 'grant_max' => 50000),937 array('country' => 'United States', 'building_type' => 'Residential', 'grant_percentage' => 0, 'grant_max' => 0), 938 array('country' => 'United States', 'building_type' => 'Non-Residential', 'grant_percentage' => 0, 'grant_max' => 0), 939 939 array('country' => 'Rep. of Ireland', 'building_type' => 'Residential', 'grant_percentage' => 47, 'grant_max' => 1800), 940 940 array('country' => 'Rep. of Ireland', 'building_type' => 'Non-Residential', 'grant_percentage' => 30, 'grant_max' => 162000), … … 1128 1128 printf( 1129 1129 '<input type="number" step="1" id="cost_domestic" name="ksrad_options[cost_domestic]" value="%s" />', 1130 isset($this->options['cost_domestic']) ? esc_attr($this->options['cost_domestic']) : ' 650'1130 isset($this->options['cost_domestic']) ? esc_attr($this->options['cost_domestic']) : '0' 1131 1131 ); 1132 1132 echo ' <span class="description">Cost per kWp for residential/domestic installations</span>'; … … 1138 1138 printf( 1139 1139 '<input type="number" step="1" id="cost_small" name="ksrad_options[cost_small]" value="%s" />', 1140 isset($this->options['cost_small']) ? esc_attr($this->options['cost_small']) : ' 600'1140 isset($this->options['cost_small']) ? esc_attr($this->options['cost_small']) : '0' 1141 1141 ); 1142 1142 echo ' <span class="description">Cost per kWp for small commercial (<50kW)</span>'; … … 1148 1148 printf( 1149 1149 '<input type="number" step="1" id="cost_medium" name="ksrad_options[cost_medium]" value="%s" />', 1150 isset($this->options['cost_medium']) ? esc_attr($this->options['cost_medium']) : ' 500'1150 isset($this->options['cost_medium']) ? esc_attr($this->options['cost_medium']) : '0' 1151 1151 ); 1152 1152 echo ' <span class="description">Cost per kWp for medium commercial (50-250kW)</span>'; … … 1158 1158 printf( 1159 1159 '<input type="number" step="1" id="cost_large" name="ksrad_options[cost_large]" value="%s" />', 1160 isset($this->options['cost_large']) ? esc_attr($this->options['cost_large']) : ' 425'1160 isset($this->options['cost_large']) ? esc_attr($this->options['cost_large']) : '0' 1161 1161 ); 1162 1162 echo ' <span class="description">Cost per kWp for large commercial (>250kW)</span>'; … … 1169 1169 if (empty($system_sizes)) { 1170 1170 $system_sizes = array( 1171 array('country' => 'United States', 'building_type' => 'Residential', 'cost_ratio' => 2500),1172 array('country' => 'United States', 'building_type' => 'Commercial Small', 'cost_ratio' => 2 200),1173 array('country' => 'United States', 'building_type' => 'Commercial Medium', 'cost_ratio' => 1800),1174 array('country' => 'United States', 'building_type' => 'Commercial Large', 'cost_ratio' => 1 500),1175 array('country' => 'Rep. of Ireland', 'building_type' => 'Residential', 'cost_ratio' => 1500),1176 array('country' => 'Rep. of Ireland', 'building_type' => 'Commercial Small', 'cost_ratio' => 1 400),1177 array('country' => 'Rep. of Ireland', 'building_type' => 'Commercial Medium', 'cost_ratio' => 1 300),1178 array('country' => 'Rep. of Ireland', 'building_type' => 'Commercial Large', 'cost_ratio' => 1 100),1179 array('country' => 'United Kingdom', 'building_type' => 'Residential', 'cost_ratio' => 2000),1180 array('country' => 'United Kingdom', 'building_type' => 'Commercial Small', 'cost_ratio' => 1 800),1181 array('country' => 'United Kingdom', 'building_type' => 'Commercial Medium', 'cost_ratio' => 1 600),1182 array('country' => 'United Kingdom', 'building_type' => 'Commercial Large', 'cost_ratio' => 1300),1183 array('country' => 'Canada', 'building_type' => 'Residential', 'cost_ratio' => 2300),1184 array('country' => 'Canada', 'building_type' => 'Commercial Small', 'cost_ratio' => 2000),1185 array('country' => 'Canada', 'building_type' => 'Commercial Medium', 'cost_ratio' => 17 00),1171 array('country' => 'United States', 'building_type' => 'Residential', 'cost_ratio' => 3500), 1172 array('country' => 'United States', 'building_type' => 'Commercial Small', 'cost_ratio' => 2450), 1173 array('country' => 'United States', 'building_type' => 'Commercial Medium', 'cost_ratio' => 2200), 1174 array('country' => 'United States', 'building_type' => 'Commercial Large', 'cost_ratio' => 1800), 1175 array('country' => 'Rep. of Ireland', 'building_type' => 'Residential', 'cost_ratio' => 2500), 1176 array('country' => 'Rep. of Ireland', 'building_type' => 'Commercial Small', 'cost_ratio' => 1800), 1177 array('country' => 'Rep. of Ireland', 'building_type' => 'Commercial Medium', 'cost_ratio' => 1500), 1178 array('country' => 'Rep. of Ireland', 'building_type' => 'Commercial Large', 'cost_ratio' => 1250), 1179 array('country' => 'United Kingdom', 'building_type' => 'Residential', 'cost_ratio' => 1800), 1180 array('country' => 'United Kingdom', 'building_type' => 'Commercial Small', 'cost_ratio' => 1300), 1181 array('country' => 'United Kingdom', 'building_type' => 'Commercial Medium', 'cost_ratio' => 1000), 1182 array('country' => 'United Kingdom', 'building_type' => 'Commercial Large', 'cost_ratio' => 800), 1183 array('country' => 'Canada', 'building_type' => 'Residential', 'cost_ratio' => 3200), 1184 array('country' => 'Canada', 'building_type' => 'Commercial Small', 'cost_ratio' => 1850), 1185 array('country' => 'Canada', 'building_type' => 'Commercial Medium', 'cost_ratio' => 1750), 1186 1186 array('country' => 'Canada', 'building_type' => 'Commercial Large', 'cost_ratio' => 1400), 1187 1187 ); … … 1236 1236 foreach ($building_types as $type): 1237 1237 // Find existing value or use default 1238 $cost_ratio = 1500;1238 $cost_ratio = 0; 1239 1239 foreach ($system_sizes as $size) { 1240 1240 if ($size['country'] === $country && $size['building_type'] === $type) { -
keiste-solar-report/trunk/includes/plugin-init.php
r3448482 r3448629 217 217 'googleSolarApiKey' => ksrad_get_option('google_solar_api_key', ''), 218 218 'reportKey' => ksrad_get_option('report_key', ''), 219 'defaultElectricityRate' => ksrad_get_option('default_electricity_rate', '0 .18'),220 'defaultExportRate' => ksrad_get_option('default_export_rate', ' 5'),221 'defaultFeedInTariff' => ksrad_get_option('default_feed_in_tariff', '0 .25'),222 'defaultLoanApr' => ksrad_get_option('default_loan_apr', ' 5'),223 'loanTerm' => ksrad_get_option('loan_term', ' 7'),224 'annualPriceIncrease' => ksrad_get_option('annual_price_increase', ' 5'),219 'defaultElectricityRate' => ksrad_get_option('default_electricity_rate', '0'), 220 'defaultExportRate' => ksrad_get_option('default_export_rate', '0'), 221 'defaultFeedInTariff' => ksrad_get_option('default_feed_in_tariff', '0'), 222 'defaultLoanApr' => ksrad_get_option('default_loan_apr', '0'), 223 'loanTerm' => ksrad_get_option('loan_term', '0'), 224 'annualPriceIncrease' => ksrad_get_option('annual_price_increase', '0'), 225 225 'currency' => ksrad_get_option('currency', '$'), 226 226 'country' => ksrad_get_option('country', 'United States'), 227 'systemCostRatio' => ksrad_get_option('system_cost_ratio', ' 3500'),227 'systemCostRatio' => ksrad_get_option('system_cost_ratio', '0'), 228 228 'grantRateDomestic' => ksrad_get_option('grant_rate_domestic', '0'), 229 229 'grantCapDomestic' => ksrad_get_option('grant_cap_domestic', '0'), … … 311 311 'report_key' => '', 312 312 'logo_url' => '', 313 'default_electricity_rate' => '0 .34',314 'default_export_rate' => ' 5',315 'default_feed_in_tariff' => '0 .21',316 'default_loan_apr' => ' 5',317 'loan_term' => ' 7',318 'annual_price_increase' => ' 5',313 'default_electricity_rate' => '0', 314 'default_export_rate' => '0', 315 'default_feed_in_tariff' => '0', 316 'default_loan_apr' => '0', 317 'loan_term' => '0', 318 'annual_price_increase' => '0', 319 319 'currency' => '$', 320 320 'country' => 'United States', 321 'system_cost_ratio' => ' 3500',322 'cost_domestic' => ' 3500',323 'cost_small' => ' 2450',324 'cost_medium' => ' 2200',325 'cost_large' => ' 1800',321 'system_cost_ratio' => '0', 322 'cost_domestic' => '0', 323 'cost_small' => '0', 324 'cost_medium' => '0', 325 'cost_large' => '0', 326 326 'grant_rate_domestic' => '0', 327 327 'grant_cap_domestic' => '0', -
keiste-solar-report/trunk/keiste-solar-report.php
r3448482 r3448629 5 5 * Plugin URI: https://keiste.com/keiste-solar-report 6 6 * Description: Comprehensive solar panel analysis tool with ROI calculations, Google Solar API integration, interactive charts, and PDF report generation. 7 * Version: 1.1. 37 * Version: 1.1.4 8 8 * Author: Dara Burke, Keiste 9 9 * Author URI: https://keiste.com … … 34 34 // Define plugin constants (only once) with ksrad_ namespace 35 35 if (!defined('KSRAD_VERSION')) { 36 define('KSRAD_VERSION', '1.1. 3');36 define('KSRAD_VERSION', '1.1.4'); 37 37 } 38 38 if (!defined('KSRAD_PLUGIN_DIR')) { … … 657 657 <label for="electricityBill" class="form-label" 658 658 style="color: var(--primary-green);">Monthly Elec. Bill 659 (<span class="currency-symbol" id="elecBillCurrency"><?php echo esc_html(ksrad_get_option('currency', ' €')); ?></span>)</label>659 (<span class="currency-symbol" id="elecBillCurrency"><?php echo esc_html(ksrad_get_option('currency', '$')); ?></span>)</label> 660 660 </div> 661 661 <input type="number" min="0" class="form-control" … … 732 732 <i class="fas fa-euro-sign"></i> 733 733 <div class="resultsCol"> 734 <span class="highlight" id="netCost"><span class="currency-symbol"><?php echo esc_html(ksrad_get_option('currency', ' €')); ?></span>0</span>734 <span class="highlight" id="netCost"><span class="currency-symbol"><?php echo esc_html(ksrad_get_option('currency', '$')); ?></span>0</span> 735 735 <div class="ms-2 underWrite">NET INSTALL <br>COST</div> 736 736 </div> … … 747 747 <i class="fas fa-piggy-bank"></i> 748 748 <div class="resultsCol"> 749 <span class="highlight" id="annualSavings"><span class="currency-symbol"><?php echo esc_html(ksrad_get_option('currency', ' €')); ?></span>0</span>749 <span class="highlight" id="annualSavings"><span class="currency-symbol"><?php echo esc_html(ksrad_get_option('currency', '$')); ?></span>0</span> 750 750 <div class="ms-2 underWrite">ANNUAL SAVINGS <br>(YEAR 1)</div> 751 751 </div> … … 758 758 <i class="fas fa-chart-line"></i> 759 759 <div class="resultsCol"> 760 <span class="highlight" id="totalSavings"><span class="currency-symbol"><?php echo esc_html(ksrad_get_option('currency', ' €')); ?></span>0</span>760 <span class="highlight" id="totalSavings"><span class="currency-symbol"><?php echo esc_html(ksrad_get_option('currency', '$')); ?></span>0</span> 761 761 <div class="ms-2 underWrite">25-YEAR <br>SAVINGS</div> 762 762 </div> … … 835 835 <div class="install-details-cell"> 836 836 <label for="installationCost" class="form-label-left">Upfront Installation Cost 837 (<span class="currency-symbol"><?php echo esc_html(ksrad_get_option('currency', ' €')); ?></span>)</label>837 (<span class="currency-symbol"><?php echo esc_html(ksrad_get_option('currency', '$')); ?></span>)</label> 838 838 <?php 839 839 // Default to 0 panels - user will adjust slider to calculate cost … … 846 846 </div> 847 847 <div class="install-details-cell install-details-border"> 848 <label for="grant" class="form-label-right">Available Grant (<span class="currency-symbol"><?php echo esc_html(ksrad_get_option('currency', ' €')); ?></span>)</label>848 <label for="grant" class="form-label-right">Available Grant (<span class="currency-symbol"><?php echo esc_html(ksrad_get_option('currency', '$')); ?></span>)</label> 849 849 <div class="energy-display-right"><span id="grant" 850 850 class="highlighted-value">0</span></div> 851 851 <?php 852 852 // Display grant help with correct percent and currency formatting 853 $ksrad_currency_symbol = ksrad_get_option('currency', ' €');853 $ksrad_currency_symbol = ksrad_get_option('currency', '$'); 854 854 $ksrad_grant_rate = floatval(ksrad_get_option('grant_rate_domestic', '0')); // default 30% 855 855 $ksrad_grant_cap = floatval(ksrad_get_option('grant_cap_domestic', '0')); // sensible numeric default … … 868 868 </div> 869 869 <div class="install-details-cell install-details-border"> 870 <label for="electricityRate" class="form-label-right">Electricity Rate (<span class="currency-symbol"><?php echo esc_html(ksrad_get_option('currency', ' €')); ?></span>/kWh)</label>870 <label for="electricityRate" class="form-label-right">Electricity Rate (<span class="currency-symbol"><?php echo esc_html(ksrad_get_option('currency', '$')); ?></span>/kWh)</label> 871 871 <input type="number" class="form-control" id="electricityRate" value="<?php echo esc_attr(ksrad_get_option('default_electricity_rate', '0.17')); ?>" step="0.01" 872 872 min="0" required> … … 884 884 </div> 885 885 <div class="install-details-cell install-details-border"> 886 <label for="exportRate" class="form-label-right">Feed-in Tariff (<span class="currency-symbol"><?php echo esc_html(ksrad_get_option('currency', ' €')); ?></span>/kWh)</label>886 <label for="exportRate" class="form-label-right">Feed-in Tariff (<span class="currency-symbol"><?php echo esc_html(ksrad_get_option('currency', '$')); ?></span>/kWh)</label> 887 887 <input type="number" class="form-control" id="exportRate" value="<?php echo esc_attr(ksrad_get_option('default_feed_in_tariff', '0.15')); ?>" step="0.01" 888 888 min="0" required> … … 895 895 <div class="energy-display-left"><span id="monthlyBill" 896 896 class="highlighted-value">0</span></div> 897 <div class="input-help-left">Current monthly electricity expense (<span class="currency-symbol"><?php echo esc_html(ksrad_get_option('currency', ' €')); ?></span>)</div>897 <div class="input-help-left">Current monthly electricity expense (<span class="currency-symbol"><?php echo esc_html(ksrad_get_option('currency', '$')); ?></span>)</div> 898 898 </div> 899 899 <div class="install-details-cell install-details-border"> 900 900 <label for="annualIncrease" class="form-label-right">Annual Price Increase</label> 901 901 <div class="energy-display-right"><span id="annualIncrease" 902 class="highlighted-value"><?php echo esc_html(ksrad_get_option('annual_price_increase', ' 5')); ?></span></div>902 class="highlighted-value"><?php echo esc_html(ksrad_get_option('annual_price_increase', '0')); ?></span></div> 903 903 <div class="input-help-right">Electricity inflation (estimate)</div> 904 904 </div> … … 910 910 window.KSRAD_UtilityConfig = { 911 911 solarConfigs: <?php echo wp_json_encode(!empty($ksrad_solarData['solarPotential']['solarPanelConfigs']) ? $ksrad_solarData['solarPotential']['solarPanelConfigs'] : []); ?>, 912 currencySymbol: '<?php echo esc_js(ksrad_get_option('currency', ' €')); ?>',912 currencySymbol: '<?php echo esc_js(ksrad_get_option('currency', '$')); ?>', 913 913 grantsTable: <?php 914 914 $grants_table = ksrad_get_option('grants_table', array()); … … 916 916 // Default grants if not configured 917 917 $grants_table = array( 918 array('country' => 'United States', 'building_type' => 'Residential', 'grant_percentage' => 30, 'grant_max' => 7500),919 array('country' => 'United States', 'building_type' => 'Non-Residential', 'grant_percentage' => 30, 'grant_max' => 50000),920 array('country' => 'Rep. of Ireland', 'building_type' => 'Residential', 'grant_percentage' => 47, 'grant_max' => 1800),921 array('country' => 'Rep. of Ireland', 'building_type' => 'Non-Residential', 'grant_percentage' => 30, 'grant_max' => 162000),918 array('country' => 'United States', 'building_type' => 'Residential', 'grant_percentage' => 0, 'grant_max' => 0), 919 array('country' => 'United States', 'building_type' => 'Non-Residential', 'grant_percentage' => 0, 'grant_max' => 0), 920 array('country' => 'Rep. of Ireland', 'building_type' => 'Residential', 'grant_percentage' => 0, 'grant_max' => 0), 921 array('country' => 'Rep. of Ireland', 'building_type' => 'Non-Residential', 'grant_percentage' => 0, 'grant_max' => 0), 922 922 array('country' => 'UK', 'building_type' => 'Residential', 'grant_percentage' => 0, 'grant_max' => 0), 923 923 array('country' => 'UK', 'building_type' => 'Non-Residential', 'grant_percentage' => 0, 'grant_max' => 0), 924 array('country' => 'Canada', 'building_type' => 'Residential', 'grant_percentage' => 25, 'grant_max' => 5000),925 array('country' => 'Canada', 'building_type' => 'Non-Residential', 'grant_percentage' => 20, 'grant_max' => 40000),924 array('country' => 'Canada', 'building_type' => 'Residential', 'grant_percentage' => 0, 'grant_max' => 0), 925 array('country' => 'Canada', 'building_type' => 'Non-Residential', 'grant_percentage' => 0, 'grant_max' => 0), 926 926 ); 927 927 } … … 934 934 <script> 935 935 // Currency symbol and getPanelCount - expose globally for external scripts 936 window.CURRENCY_SYMBOL = '<?php echo esc_js(ksrad_get_option('currency', ' €')); ?>';936 window.CURRENCY_SYMBOL = '<?php echo esc_js(ksrad_get_option('currency', '$')); ?>'; 937 937 // if it's the UK, the remove include grant setting 938 938 if (window.CURRENCY_SYMBOL == '£') { … … 949 949 // Configuration for event-handlers.js 950 950 window.KSRAD_EventConfig = { 951 currencySymbol: '<?php echo esc_js(ksrad_get_option('currency', ' €')); ?>',951 currencySymbol: '<?php echo esc_js(ksrad_get_option('currency', '$')); ?>', 952 952 acaRate: <?php $aca = ksrad_get_option('aca_rate', ''); echo esc_js($aca === '' ? '0' : (floatval($aca) / 100)); ?> 953 953 }; … … 1153 1153 // Configuration for chart-initialization.js 1154 1154 window.KSRAD_ChartConfig = { 1155 currencySymbol: '<?php echo esc_js(ksrad_get_option('currency', ' €')); ?>',1155 currencySymbol: '<?php echo esc_js(ksrad_get_option('currency', '$')); ?>', 1156 1156 solarConfigurations: <?php echo wp_json_encode($ksrad_solarData['solarPotential']['solarPanelConfigs']); ?> 1157 1157 }; … … 1163 1163 // Configuration for solar-calculator-main.js (consolidated with system costs) 1164 1164 window.KSRAD_CalcConfig = Object.assign({}, window.KSRAD_CalcConfig || {}, { 1165 currencySymbol: '<?php echo esc_js(ksrad_get_option('currency', ' €')); ?>',1166 defaultExportRate: <?php echo esc_js(floatval(ksrad_get_option('default_export_rate', ' 5')) / 100); ?>,1165 currencySymbol: '<?php echo esc_js(ksrad_get_option('currency', '$')); ?>', 1166 defaultExportRate: <?php echo esc_js(floatval(ksrad_get_option('default_export_rate', '0')) / 100); ?>, 1167 1167 // Grant settings by building type 1168 1168 grantSettings: { 1169 1169 Residential: { 1170 rate: <?php echo esc_js(floatval(ksrad_get_option('grant_rate_domestic', ' 30')) / 100); ?>,1171 cap: <?php echo esc_js(floatval(ksrad_get_option('grant_cap_domestic', ' 1800'))); ?>1170 rate: <?php echo esc_js(floatval(ksrad_get_option('grant_rate_domestic', '0')) / 100); ?>, 1171 cap: <?php echo esc_js(floatval(ksrad_get_option('grant_cap_domestic', '0'))); ?> 1172 1172 }, 1173 1173 'Non-Residential': { 1174 rate: <?php echo esc_js(floatval(ksrad_get_option('grant_rate_non_domestic', ' 30')) / 100); ?>,1175 cap: <?php echo esc_js(floatval(ksrad_get_option('grant_cap_non_domestic', ' 162000'))); ?>1174 rate: <?php echo esc_js(floatval(ksrad_get_option('grant_rate_non_domestic', '0')) / 100); ?>, 1175 cap: <?php echo esc_js(floatval(ksrad_get_option('grant_cap_non_domestic', '0'))); ?> 1176 1176 } 1177 1177 }, 1178 1178 systemCosts: { 1179 Residential: <?php echo esc_js(floatval(ksrad_get_option('cost_domestic', ' 2500'))); ?>,1180 Commercial: <?php echo esc_js(floatval(ksrad_get_option('cost_small', ' 2000'))); ?>,1181 Farm: <?php echo esc_js(floatval(ksrad_get_option('cost_medium', ' 1700'))); ?>,1182 Community: <?php echo esc_js(floatval(ksrad_get_option('cost_large', ' 1500'))); ?>,1183 Business: <?php echo esc_js(floatval(ksrad_get_option('cost_small', ' 2000'))); ?>1179 Residential: <?php echo esc_js(floatval(ksrad_get_option('cost_domestic', '0'))); ?>, 1180 Commercial: <?php echo esc_js(floatval(ksrad_get_option('cost_small', '0'))); ?>, 1181 Farm: <?php echo esc_js(floatval(ksrad_get_option('cost_medium', '0'))); ?>, 1182 Community: <?php echo esc_js(floatval(ksrad_get_option('cost_large', '0'))); ?>, 1183 Business: <?php echo esc_js(floatval(ksrad_get_option('cost_small', '0'))); ?> 1184 1184 } 1185 1185 }); -
keiste-solar-report/trunk/readme.txt
r3448482 r3448629 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 1.1. 37 Stable tag: 1.1.4 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 199 199 200 200 == Changelog == 201 202 = 1.1.4 = 203 * Version bump for WordPress.org release 204 * Minor updates and improvements 201 205 202 206 = 1.1.3 =
Note: See TracChangeset
for help on using the changeset viewer.