Plugin Directory

Changeset 3448629


Ignore:
Timestamp:
01/28/2026 11:11:48 AM (3 weeks ago)
Author:
dbee78
Message:

Bump version to 1.1.4

Location:
keiste-solar-report/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • keiste-solar-report/trunk/assets/js/chart-initialization.js

    r3448482 r3448629  
    77
    88    // Configuration variables - will be set from PHP config
    9     let CURRENCY_SYMBOL = '';
     9    let CURRENCY_SYMBOL = '$';
    1010    let solarConfigurations = [];
    1111
     
    245245    function init() {
    246246        if (window.KSRAD_ChartConfig) {
    247             CURRENCY_SYMBOL = window.KSRAD_ChartConfig.currencySymbol || '';
     247            CURRENCY_SYMBOL = window.KSRAD_ChartConfig.currencySymbol || '$';
    248248            solarConfigurations = window.KSRAD_ChartConfig.solarConfigurations || [];
    249249        }
  • keiste-solar-report/trunk/assets/js/charts.js

    r3447073 r3448629  
    2424    // ===== BREAK-EVEN CHART =====
    2525    function calculateBreakEvenDataSimple(config) {
    26         console.log('[CHART] calculateBreakEvenDataSimple called with config:', config);
    27        
    2826        const yearlyEnergy = config.yearlyEnergyDcKwh;
    2927        const panelCount = config.panelsCount;
     
    3129        // Get values from config or inputs
    3230        const cfg = window.KSRAD_CalcConfig || {};
    33         const electricityRate = parseFloat(document.getElementById('electricityRate')?.value) || 0.36;
    34         const feedInTariff = 0.21; // Standard FIT rate
     31        const electricityRate = parseFloat(document.getElementById('electricityRate')?.value) || 0;
     32        const feedInTariff = parseFloat(cfg.defaultFeedInTariff || 0);
    3533        const billMonthly = parseFloat(document.getElementById('electricityBill')?.value) || 0;
    3634
    37         const exportRatePercent = cfg.defaultExportRate || 0.05;
     35        const exportRatePercent = parseFloat(cfg.defaultExportRate || 0) / 100;
    3836
    3937        const inclGrant = document.getElementById('inclGrant')?.checked;
    4038        const inclLoan = document.getElementById('inclLoan')?.checked;
    41         const degradation = 0.005;
    42         const annualIncrease = 0.05; // 5% bill increase per year
     39        const degradation = SOLAR_PANEL_DEGRADATION;
     40        const annualIncrease = parseFloat(cfg.annualPriceIncrease || 0) / 100;
    4341
    4442        // Get actual net install cost from the calculator
    4543        // We need to recalculate it here to match what keyFigures does
    4644        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);
    5245       
    5346        // Get grant settings based on building type
     
    5952                const isResidential = (selected === 'Residential');
    6053                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                };
    6258                return inclGrant ? Math.min(baseCost * grantSettings.rate, grantSettings.cap) : 0;
    6359            } 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;
    6564            }
    6665        };
     
    6968        const principal = Math.max(0, baseCost - seaiGrant);
    7069       
    71         console.log('[CHART] seaiGrant:', seaiGrant);
    72         console.log('[CHART] principal:', principal);
    73        
    7470        // Calculate loan payments if applicable
    75         const loanAPR = 0.07; // 7% APR
    76         const loanYears = 7;
     71        const loanAPR = parseFloat(cfg.defaultLoanApr || 0) / 100;
     72        const loanYears = parseInt(cfg.loanTerm || 7);
    7773        let yearlyLoanCost = 0;
    7874        let totalCost = principal;
     
    8783        }
    8884       
    89         console.log('[CHART] yearlyLoanCost:', yearlyLoanCost);
    90         console.log('[CHART] totalCost (investment):', totalCost);
    91 
    9285        // Calculate annual usage from bill
    9386        const annualUsageKwh = (billMonthly * 12) / electricityRate;
    94        
    95         console.log('[CHART] annualUsageKwh:', annualUsageKwh);
    9687
    9788        const years = Array.from({ length: 25 }, (_, i) => i);
     
    136127       
    137128        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));
    140129
    141130        return {
     
    308297            window.energyChart.update();
    309298        } catch (e) {
    310             console.error('updateEnergyChart error', e);
     299            // Error in energy chart update
    311300        }
    312301    };
     
    314303    // ===== UPDATE BREAK-EVEN CHART =====
    315304    window.updateBreakEvenChart = function (state, figs) {
    316         console.log('updateBreakEvenChart in charts.js called', { state, figs, hasChart: !!window.breakEvenChart });
    317        
    318305        if (!window.breakEvenChart) {
    319             console.warn('No breakEvenChart available');
    320306            return;
    321307        }
     
    324310            // On page load with no bill, show zero baseline
    325311            if (!state.billMonthly || state.billMonthly === 0) {
    326                 console.log('Setting chart to zero (no bill)');
    327 
    328312                if (window.breakEvenChart.data && window.breakEvenChart.data.datasets && window.breakEvenChart.data.datasets[0]) {
    329313                    window.breakEvenChart.data.datasets[0].data = Array(25).fill(0);
     
    352336            }
    353337        } catch (e) {
    354             console.error('updateBreakEvenChart error', e);
     338            // Error in break-even chart update
    355339        }
    356340    };
  • keiste-solar-report/trunk/assets/js/maps-integration.js

    r3448482 r3448629  
    156156           
    157157            // 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] || '$';
    159159           
    160160            // Also update in KSRAD_CalcConfig if it exists
     
    328328                    };
    329329                    if (window.COUNTRY_SETTING) {
    330                         window.CURRENCY_SYMBOL = currencyMap[window.COUNTRY_SETTING] || '';
     330                        window.CURRENCY_SYMBOL = currencyMap[window.COUNTRY_SETTING] || '$';
    331331                        if (window.KSRAD_CalcConfig) {
    332332                            window.KSRAD_CalcConfig.currencySymbol = window.CURRENCY_SYMBOL;
     
    417417   
    418418    if (window.COUNTRY_SETTING) {
    419         window.CURRENCY_SYMBOL = currencyMap[window.COUNTRY_SETTING] || '';
     419        window.CURRENCY_SYMBOL = currencyMap[window.COUNTRY_SETTING] || '$';
    420420        if (window.KSRAD_CalcConfig) {
    421421            window.KSRAD_CalcConfig.currencySymbol = window.CURRENCY_SYMBOL;
  • keiste-solar-report/trunk/assets/js/solar-calculator-main.js

    r3448482 r3448629  
    1818    // Financial - will be set from PHP config
    1919    const CORPORATION_TAX = 0.125;        // 12.5%
    20     let CURRENCY_SYMBOL = '';  // Default, will be overridden by config
     20    let CURRENCY_SYMBOL = '$';  // Default, will be overridden by config
    2121    // Grant settings are now building-type-specific, resolved dynamically
    2222    const LOAN_APR_DEFAULT = 0.07;        // 7% APR
    23     const FEED_IN_TARIFF_DEFAULT = 0.21;  // /kWh
     23    const FEED_IN_TARIFF_DEFAULT = 0.21;  // $/kWh
    2424    const COMPOUND_7_YRS = 1.07;          // coefficient @5% over 7years
    25     const ANNUAL_INCREASE = 0.05;         // 5% bill increase
     25    let ANNUAL_INCREASE = 0.05;           // 5% bill increase - will be set from config
    2626    const SOLAR_PANEL_DEGRADATION = 0.005;// 0.5%/yr
    2727    const LENGTH_OF_PAYBACK = 7;          // loan length, years (used when needed)
     
    3838    const DEFAULT_PANELS = 0;
    3939    const DEFAULT_EXPORT_PERCENT = 0.10;   // 10% of production exported
    40     const DEFAULT_RETAIL_RATE = 0.17;     // /kWh – sensible default if blank
     40    const DEFAULT_RETAIL_RATE = 0.17;     // $/kWh – sensible default if blank
    4141    const DEFAULT_FEED_IN_TARIFF = FEED_IN_TARIFF_DEFAULT;
    4242    const DEFAULT_APR = LOAN_APR_DEFAULT;
     
    110110     * @param {number} panels - number of solar panels (each assumed 400 W)
    111111     * @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 ($)
    114114     */
    115115    function estimateSolarCost(panels, batteryKWh = 0, includeDiverter = true) {
     
    137137        const costPerKwP = getCostPerKwP();
    138138        const systemKwP = (panels * panelWatt) / 1000;
    139         const batteryCostPerKWh = 500;      // /kWh installed
     139        const batteryCostPerKWh = 500;      // $/kWh installed
    140140        const diverterCost = 550;           // one-off
    141141        const panelCost = systemKwP * costPerKwP;
    142142        const batteryCost = batteryKWh * batteryCostPerKWh;
    143143        // 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.
    145145        const diverter = includeDiverter && panels > 0 ? diverterCost : 0;
    146146        return panelCost + batteryCost + diverter;
     
    260260        // Derived system constants
    261261        const kWp = (panels * PANEL_POWER_W) / 1000;
    262         const baseCost = Math.round(estimateSolarCost(state.panels)); //
     262        const baseCost = Math.round(estimateSolarCost(state.panels)); // $
    263263
    264264        // Resolve grant settings based on building type (Residential vs Non-Residential)
     
    273273                const category = isResidential ? 'Residential' : 'Non-Residential';
    274274                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 };
    276276                }
    277                 return { rate: 0.30, cap: 162000 }; // fallback
     277                return { rate: 0, cap: 0 }; // fallback
    278278            } catch (e) {
    279                 return { rate: 0.30, cap: 162000 };
     279                return { rate: 0, cap: 0 };
    280280            }
    281281        };
     
    391391            console.log('  CORPORATION_TAX: ' + (CORPORATION_TAX * 100) + '%');
    392392            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');
    394394            console.log('  ANNUAL_INCREASE: ' + (ANNUAL_INCREASE * 100) + '%');
    395395            console.log('  SOLAR_PANEL_DEGRADATION: ' + (SOLAR_PANEL_DEGRADATION * 100) + '%/yr');
     
    404404            console.log('\n[2] INPUT VARIABLES:');
    405405            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');
    409409            console.log('  exportRate: ' + (exportRate * 100) + '%');
    410410            console.log('  APR: ' + (APR * 100) + '%');
     
    414414            console.log('  yearlyEnergy (from config): ' + yearlyEnergy + ' kWh');
    415415            console.log('  grantSettings.rate: ' + (grantSettings.rate * 100) + '%');
    416             console.log('  grantSettings.cap: €' + grantSettings.cap);
     416            console.log('  grantSettings.cap: ' + CURRENCY_SYMBOL + grantSettings.cap);
    417417           
    418418            // 3. DERIVED SYSTEM VALUES
     
    425425            console.log('\n[4] COST CALCULATIONS:');
    426426            console.log('  baseCost = estimateSolarCost(panels)');
    427             console.log('           = €' + baseCost);
     427            console.log('           = ' + CURRENCY_SYMBOL + baseCost);
    428428            console.log('  ');
    429429            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);
    432432            console.log('  ');
    433433            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);
    438438           
    439439            // 5. LOAN CALCULATIONS
     
    442442            console.log('  n (total months) = LENGTH_OF_PAYBACK × m = ' + LENGTH_OF_PAYBACK + ' × ' + m + ' = ' + n);
    443443            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);
    446446            console.log('  r (monthly rate) = APR ÷ m = ' + APR + ' ÷ ' + m + ' = ' + r.toFixed(6));
    447447            console.log('  ');
    448448            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);
    451451            console.log('  ');
    452452            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);
    455455            console.log('  ');
    456456            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);
    459459           
    460460            // 6. ENERGY PRODUCTION CALCULATIONS
     
    467467            console.log('  ');
    468468            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);
    470470            console.log('                    = ' + current_usage_kwh.toFixed(2) + ' kWh');
    471471           
     
    487487            console.log('\n[8] YEAR 0 FINANCIAL SAVINGS:');
    488488            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));
    491491            console.log('  ');
    492492            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));
    495495            console.log('  ');
    496496            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));
    499499           
    500500            // 9. 25-YEAR PROJECTIONS
     
    505505            console.log('  ');
    506506            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));
    511511            console.log('  ');
    512512            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));
    515515           
    516516            // 10. KEY INTERFACE FIGURES
    517517            console.log('\n[10] KEY INTERFACE FIGURES:');
    518518            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));
    521521            console.log('  ');
    522522            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);
    525525            console.log('  ');
    526526            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');
    528528            console.log('                 = ' + payback_period.toFixed(2) + ' years');
    529529            console.log('  ');
    530530            const roi_cost = inclLoan ? (monthlyRepay * 12 * loanYearsCount) : principal;
    531531            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');
    533533            console.log('          = ' + ROI_25Y.toFixed(2) + '%');
    534534            console.log('  ');
     
    542542            // 11. SUMMARY
    543543            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);
    548548            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));
    551551            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));
    553553            console.log('  25-Year ROI: ' + ROI_25Y.toFixed(2) + '%');
    554554            console.log('  CO2 Reduction (25 years): ' + co2_reduction.toFixed(2) + ' tonnes');
     
    579579            const category = isResidential ? 'Residential' : 'Non-Residential';
    580580           
    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;
    583583           
    584584            // Find and update grant description elements
     
    888888            CURRENCY_SYMBOL = window.KSRAD_CalcConfig.currencySymbol || CURRENCY_SYMBOL;
    889889            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;
    890892        }
    891893       
  • keiste-solar-report/trunk/includes/admin-settings.php

    r3447073 r3448629  
    459459        if (isset($input['default_electricity_rate'])) {
    460460            $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;
    462462        }
    463463       
    464464        if (isset($input['default_export_rate'])) {
    465465            $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;
    467467        }
    468468       
    469469        if (isset($input['default_feed_in_tariff'])) {
    470470            $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;
    472472        }
    473473       
    474474        if (isset($input['default_loan_apr'])) {
    475475            $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;
    477477        }
    478478       
    479479        if (isset($input['loan_term'])) {
    480480            $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;
    482482        }
    483483       
    484484        if (isset($input['annual_price_increase'])) {
    485485            $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;
    487487        }
    488488       
     
    503503        if (isset($input['grant_rate_domestic'])) {
    504504            $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;
    506506        }
    507507       
    508508        if (isset($input['grant_cap_domestic'])) {
    509509            $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;
    511511        }
    512512       
    513513        if (isset($input['grant_rate_non_domestic'])) {
    514514            $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;
    516516        }
    517517       
    518518        if (isset($input['grant_cap_non_domestic'])) {
    519519            $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;
    521521        }
    522522       
     
    578578        if (isset($input['cost_domestic'])) {
    579579            $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;
    581581        }
    582582       
    583583        if (isset($input['cost_small'])) {
    584584            $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;
    586586        }
    587587       
    588588        if (isset($input['cost_medium'])) {
    589589            $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;
    591591        }
    592592       
    593593        if (isset($input['cost_large'])) {
    594594            $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;
    596596        }
    597597       
     
    711711        printf(
    712712            '<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'
    714714        );
    715715        echo ' <span class="description">per kWh (e.g., 0.17 for 0.17/kWh)</span>';
     
    719719        printf(
    720720            '<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'
    722722        );
    723723        echo ' <span class="description">% (percentage of energy exported to grid)</span>';
     
    727727        printf(
    728728            '<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'
    730730        );
    731731        echo ' <span class="description">per kWh</span>';
     
    735735        printf(
    736736            '<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'
    738738        );
    739739        echo ' <span class="description">% (annual percentage rate)</span>';
     
    743743        printf(
    744744            '<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'
    746746        );
    747747        echo ' <span class="description">Years (length of payback period)</span>';
     
    751751        printf(
    752752            '<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'
    754754        );
    755755        echo ' <span class="description">% (expected electricity price inflation)</span>';
     
    781781        printf(
    782782            '<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'
    784784        );
    785785        echo ' <span class="description">% (grant percentage for residential/domestic installations)</span>';
     
    790790        printf(
    791791            '<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'
    793793        );
    794794        echo ' <span class="description">' . $currency . ' (maximum grant for residential/domestic)</span>';
     
    798798        printf(
    799799            '<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'
    801801        );
    802802        echo ' <span class="description">% (grant percentage for commercial/non-domestic installations)</span>';
     
    807807        printf(
    808808            '<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'
    810810        );
    811811        echo ' <span class="description">' . $currency . ' (maximum grant for commercial/non-domestic)</span>';
     
    935935        if (empty($grants)) {
    936936            $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),
    939939                array('country' => 'Rep. of Ireland', 'building_type' => 'Residential', 'grant_percentage' => 47, 'grant_max' => 1800),
    940940                array('country' => 'Rep. of Ireland', 'building_type' => 'Non-Residential', 'grant_percentage' => 30, 'grant_max' => 162000),
     
    11281128        printf(
    11291129            '<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'
    11311131        );
    11321132        echo ' <span class="description">Cost per kWp for residential/domestic installations</span>';
     
    11381138        printf(
    11391139            '<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'
    11411141        );
    11421142        echo ' <span class="description">Cost per kWp for small commercial (<50kW)</span>';
     
    11481148        printf(
    11491149            '<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'
    11511151        );
    11521152        echo ' <span class="description">Cost per kWp for medium commercial (50-250kW)</span>';
     
    11581158        printf(
    11591159            '<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'
    11611161        );
    11621162        echo ' <span class="description">Cost per kWp for large commercial (>250kW)</span>';
     
    11691169        if (empty($system_sizes)) {
    11701170            $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' => 2200),
    1173                 array('country' => 'United States', 'building_type' => 'Commercial Medium', 'cost_ratio' => 1800),
    1174                 array('country' => 'United States', 'building_type' => 'Commercial Large', 'cost_ratio' => 1500),
    1175                 array('country' => 'Rep. of Ireland', 'building_type' => 'Residential', 'cost_ratio' => 1500),
    1176                 array('country' => 'Rep. of Ireland', 'building_type' => 'Commercial Small', 'cost_ratio' => 1400),
    1177                 array('country' => 'Rep. of Ireland', 'building_type' => 'Commercial Medium', 'cost_ratio' => 1300),
    1178                 array('country' => 'Rep. of Ireland', 'building_type' => 'Commercial Large', 'cost_ratio' => 1100),
    1179                 array('country' => 'United Kingdom', 'building_type' => 'Residential', 'cost_ratio' => 2000),
    1180                 array('country' => 'United Kingdom', 'building_type' => 'Commercial Small', 'cost_ratio' => 1800),
    1181                 array('country' => 'United Kingdom', 'building_type' => 'Commercial Medium', 'cost_ratio' => 1600),
    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' => 1700),
     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),
    11861186                array('country' => 'Canada', 'building_type' => 'Commercial Large', 'cost_ratio' => 1400),
    11871187            );
     
    12361236                        foreach ($building_types as $type):
    12371237                            // Find existing value or use default
    1238                             $cost_ratio = 1500;
     1238                            $cost_ratio = 0;
    12391239                            foreach ($system_sizes as $size) {
    12401240                                if ($size['country'] === $country && $size['building_type'] === $type) {
  • keiste-solar-report/trunk/includes/plugin-init.php

    r3448482 r3448629  
    217217            'googleSolarApiKey' => ksrad_get_option('google_solar_api_key', ''),
    218218            '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'),
    225225            'currency' => ksrad_get_option('currency', '$'),
    226226            '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'),
    228228            'grantRateDomestic' => ksrad_get_option('grant_rate_domestic', '0'),
    229229            'grantCapDomestic' => ksrad_get_option('grant_cap_domestic', '0'),
     
    311311            'report_key' => '',
    312312            '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',
    319319            'currency' => '$',
    320320            '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',
    326326            'grant_rate_domestic' => '0',
    327327            'grant_cap_domestic' => '0',
  • keiste-solar-report/trunk/keiste-solar-report.php

    r3448482 r3448629  
    55 * Plugin URI: https://keiste.com/keiste-solar-report
    66 * Description: Comprehensive solar panel analysis tool with ROI calculations, Google Solar API integration, interactive charts, and PDF report generation.
    7  * Version: 1.1.3
     7 * Version: 1.1.4
    88 * Author: Dara Burke, Keiste
    99 * Author URI: https://keiste.com
     
    3434// Define plugin constants (only once) with ksrad_ namespace
    3535if (!defined('KSRAD_VERSION')) {
    36     define('KSRAD_VERSION', '1.1.3');
     36    define('KSRAD_VERSION', '1.1.4');
    3737}
    3838if (!defined('KSRAD_PLUGIN_DIR')) {
     
    657657                                                    <label for="electricityBill" class="form-label"
    658658                                                        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>
    660660                                                </div>
    661661                                                <input type="number" min="0" class="form-control"
     
    732732                                                    <i class="fas fa-euro-sign"></i>
    733733                                                    <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>
    735735                                                        <div class="ms-2 underWrite">NET INSTALL <br>COST</div>
    736736                                                    </div>
     
    747747                                                    <i class="fas fa-piggy-bank"></i>
    748748                                                    <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>
    750750                                                        <div class="ms-2 underWrite">ANNUAL SAVINGS <br>(YEAR 1)</div>
    751751                                                    </div>
     
    758758                                                    <i class="fas fa-chart-line"></i>
    759759                                                    <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>
    761761                                                        <div class="ms-2 underWrite">25-YEAR <br>SAVINGS</div>
    762762                                                    </div>
     
    835835                                        <div class="install-details-cell">
    836836                                            <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>
    838838                                            <?php
    839839                                            // Default to 0 panels - user will adjust slider to calculate cost
     
    846846                                        </div>
    847847                                        <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>
    849849                                            <div class="energy-display-right"><span id="grant"
    850850                                                    class="highlighted-value">0</span></div>
    851851                                            <?php
    852852                                                // 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', '$');
    854854                                                $ksrad_grant_rate = floatval(ksrad_get_option('grant_rate_domestic', '0')); // default 30%
    855855                                                $ksrad_grant_cap = floatval(ksrad_get_option('grant_cap_domestic', '0')); // sensible numeric default
     
    868868                                        </div>
    869869                                        <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>
    871871                                            <input type="number" class="form-control" id="electricityRate" value="<?php echo esc_attr(ksrad_get_option('default_electricity_rate', '0.17')); ?>" step="0.01"
    872872                                                min="0" required>
     
    884884                                        </div>
    885885                                        <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>
    887887                                            <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"
    888888                                                min="0" required>
     
    895895                                            <div class="energy-display-left"><span id="monthlyBill"
    896896                                                    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>
    898898                                        </div>
    899899                                        <div class="install-details-cell install-details-border">
    900900                                            <label for="annualIncrease" class="form-label-right">Annual Price Increase</label>
    901901                                            <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>
    903903                                            <div class="input-help-right">Electricity inflation (estimate)</div>
    904904                                        </div>
     
    910910                                window.KSRAD_UtilityConfig = {
    911911                                    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', '$')); ?>',
    913913                                    grantsTable: <?php
    914914                                                    $grants_table = ksrad_get_option('grants_table', array());
     
    916916                                                        // Default grants if not configured
    917917                                                        $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),
    922922                                                            array('country' => 'UK', 'building_type' => 'Residential', 'grant_percentage' => 0, 'grant_max' => 0),
    923923                                                            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),
    926926                                                        );
    927927                                                    }
     
    934934                            <script>
    935935                                // 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', '$')); ?>';
    937937                                // if it's the UK, the remove include grant setting
    938938                                if (window.CURRENCY_SYMBOL == '£') {
     
    949949                                // Configuration for event-handlers.js
    950950                                window.KSRAD_EventConfig = {
    951                                     currencySymbol: '<?php echo esc_js(ksrad_get_option('currency', '')); ?>',
     951                                    currencySymbol: '<?php echo esc_js(ksrad_get_option('currency', '$')); ?>',
    952952                                    acaRate: <?php $aca = ksrad_get_option('aca_rate', ''); echo esc_js($aca === '' ? '0' : (floatval($aca) / 100)); ?>
    953953                                };
     
    11531153            // Configuration for chart-initialization.js
    11541154            window.KSRAD_ChartConfig = {
    1155                 currencySymbol: '<?php echo esc_js(ksrad_get_option('currency', '')); ?>',
     1155                currencySymbol: '<?php echo esc_js(ksrad_get_option('currency', '$')); ?>',
    11561156                solarConfigurations: <?php echo wp_json_encode($ksrad_solarData['solarPotential']['solarPanelConfigs']); ?>
    11571157            };
     
    11631163        // Configuration for solar-calculator-main.js (consolidated with system costs)
    11641164        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); ?>,
    11671167            // Grant settings by building type
    11681168            grantSettings: {
    11691169                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'))); ?>
    11721172                },
    11731173                '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'))); ?>
    11761176                }
    11771177            },
    11781178            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'))); ?>
    11841184            }
    11851185        });
  • keiste-solar-report/trunk/readme.txt

    r3448482 r3448629  
    55Tested up to: 6.9
    66Requires PHP: 7.4
    7 Stable tag: 1.1.3
     7Stable tag: 1.1.4
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    199199
    200200== Changelog ==
     201
     202= 1.1.4 =
     203* Version bump for WordPress.org release
     204* Minor updates and improvements
    201205
    202206= 1.1.3 =
Note: See TracChangeset for help on using the changeset viewer.