﻿/*------------------------------------------------------------
** generated code: (paste below)
**------------------------------------------------------------*/

// text
function A1() {
    return "Monthly Installment Indicator";
}

// text
function A3() {
    return "Fill in the amount & term blocks below (all amounts shown are R (ZAR - South African Rand)";
}

// text
function A4() {
    return "Place your purchace amount in the indicated block & terms in the 2nd block (use dropdown list)";
}

// number
function M4() {
    return 12;
}

// text
function C5() {
    return "Profit and Loss";
}

// text
function D5() {
    return "Excl";
}

// text
function E5() {
    return "Vat";
}

// number
function M5() {
    return 18;
}

// text
function A6() {
    return "Price Including Vat (amount)";
}

// formula
function D6() {
    //Static cyclePrev
    //Static value
    
    if (cycle != D6.cyclePrev) {
        D6.cyclePrev = cycle;

        D6.value = F6();

        refreshRC("D6", D6.value);
    }

    return D6.value;
}

// inputValue
function F6() {
    //Static cyclePrev
    //Static defaultValue
    //Static value

    if (cycle != F6.cyclePrev) {
        F6.cyclePrev = cycle;

        if (F6.defaultValue == undefined) {
            F6.defaultValue = 15000;
        }

        if (spreadSheetDebug) {
            F6.value = prompt("Amount\n" + "R", F6.defaultValue);
        } else {
            F6.value = $("amountField").value;
        }

        F6.value = iif(F6.value == null, F6.defaultValue, F6.value);

        refreshRC("F6", F6.value);
    }

    return F6.value;
}

// text
function G6() {
    return "<img src='images/arrow-left.png' />";
}

// text
function H6() {
    return "Your purchase amount";
}

// number
function M6() {
    return 24;
}

// text
function A7() {
    return "Vat  (included in above)";
}

// formula
function E7() {
    //Static cyclePrev
    //Static value
    
    if (cycle != E7.cyclePrev) {
        E7.cyclePrev = cycle;

        E7.value = F7();

        refreshRC("E7", E7.value);
    }

    return E7.value;
}

// formula
function F7() {
    //Static cyclePrev
    //Static value
    
    if (cycle != F7.cyclePrev) {
        F7.cyclePrev = cycle;

        F7.value = F6()-(F6()/1.14);

        refreshRC("F7", F7.value);
    }

    return F7.value;
}

// number
function M7() {
    return 30;
}

// number
function U7() {
    return 0.07;
}

// text
function A8() {
    return "Total Price";
}

// formula
function F8() {
    //Static cyclePrev
    //Static value
    
    if (cycle != F8.cyclePrev) {
        F8.cyclePrev = cycle;

        F8.value = F6();

        refreshRC("F8", F8.value);
    }

    return F8.value;
}

// number
function M8() {
    return 36;
}

// number
function U8() {
    return 600;
}

// text
function A9() {
    return "Initiation Fees";
}

// formula
function D9() {
    //Static cyclePrev
    //Static value
    
    if (cycle != D9.cyclePrev) {
        D9.cyclePrev = cycle;

        D9.value = F9();

        refreshRC("D9", D9.value);
    }

    return D9.value;
}

// formula
function F9() {
    //Static cyclePrev
    //Static value
    
    if (cycle != F9.cyclePrev) {
        F9.cyclePrev = cycle;

        F9.value = iif(((F8())>1000),iif(((150+(U7()*(F8()-1000)))>U8()),U8(),(150+(U7()*(F8()-1000)))),150);

        refreshRC("F9", F9.value);
    }

    return F9.value;
}

// text
function A10() {
    return "Vat on Initiation fees";
}

// formula
function E10() {
    //Static cyclePrev
    //Static value
    
    if (cycle != E10.cyclePrev) {
        E10.cyclePrev = cycle;

        E10.value = F10();

        refreshRC("E10", E10.value);
    }

    return E10.value;
}

// formula
function F10() {
    //Static cyclePrev
    //Static value
    
    if (cycle != F10.cyclePrev) {
        F10.cyclePrev = cycle;

        F10.value = F9()*(14/100);

        refreshRC("F10", F10.value);
    }

    return F10.value;
}

// text
function A11() {
    return "Price";
}

// formula
function F11() {
    //Static cyclePrev
    //Static value
    
    if (cycle != F11.cyclePrev) {
        F11.cyclePrev = cycle;

        F11.value = (+F8()+F9())+F10();

        refreshRC("F11", F11.value);
    }

    return F11.value;
}

// text
function A12() {
    return "Deposit %";
}

// number
function F12() {
    return 0.1;
}

// text
function A13() {
    return "Deposit";
}

// formula
function F13() {
    //Static cyclePrev
    //Static value
    
    if (cycle != F13.cyclePrev) {
        F13.cyclePrev = cycle;

        F13.value = F8()*F12();

        refreshRC("F13", F13.value);
    }

    return F13.value;
}

// text
function A14() {
    return "Loan";
}

// formula
function F14() {
    //Static cyclePrev
    //Static value
    
    if (cycle != F14.cyclePrev) {
        F14.cyclePrev = cycle;

        F14.value = F11()-F13();

        refreshRC("F14", F14.value);
    }

    return F14.value;
}

// text
function A15() {
    return "Interest";
}

// number
function F15() {
    return 0.221;
}

// text
function A16() {
    return "Term";
}

// inputValue
function F16() {
    //Static cyclePrev
    //Static defaultValue
    //Static value

    if (cycle != F16.cyclePrev) {
        F16.cyclePrev = cycle;

        if (F16.defaultValue == undefined) {
            F16.defaultValue = 24;
        }

        if (spreadSheetDebug) {
            F16.value = prompt("Term\n" + "12,18,24,30,36", F16.defaultValue);
        } else {
            F16.value = $("termField").value;
        }

        F16.value = iif(F16.value == null, F16.defaultValue, F16.value);

        refreshRC("F16", F16.value);
    }

    return F16.value;
}

// text
function G16() {
    return "<img src='images/arrow-left.png' />";
}

// text
function H16() {
    return "Your term: 12,18,24,30,36";
}

// text
function A17() {
    return "Balloon %";
}

// number
function F17() {
    return 0;
}

// text
function A18() {
    return "Balloon Amount";
}

// formula
function F18() {
    //Static cyclePrev
    //Static value
    
    if (cycle != F18.cyclePrev) {
        F18.cyclePrev = cycle;

        F18.value = F17()*F14();

        refreshRC("F18", F18.value);
    }

    return F18.value;
}

// text
function A19() {
    return "Payment per month";
}

// formula
function F19() {
    //Static cyclePrev
    //Static value
    
    if (cycle != F19.cyclePrev) {
        F19.cyclePrev = cycle;

        F19.value = PMT((F15()/12),F16(),-F14(),F18());

        refreshRC("F19", F19.value);
    }

    return F19.value;
}

// text
function D20() {
    return "Excl";
}

// text
function E20() {
    return "Vat";
}

// text
function F20() {
    return "Incl Vat";
}

// text
function A21() {
    return "Add On's";
}

// text
function A22() {
    return "Service Fee";
}

// number
function D22() {
    return 30;
}

// formula
function E22() {
    //Static cyclePrev
    //Static value
    
    if (cycle != E22.cyclePrev) {
        E22.cyclePrev = cycle;

        E22.value = D22()*(14/100);

        refreshRC("E22", E22.value);
    }

    return E22.value;
}

// formula
function F22() {
    //Static cyclePrev
    //Static value
    
    if (cycle != F22.cyclePrev) {
        F22.cyclePrev = cycle;

        F22.value = D22()+E22();

        refreshRC("F22", F22.value);
    }

    return F22.value;
}

// text
function A23() {
    return "Product Insurance";
}

// number
function B23() {
    return 0.08;
}

// formula
function D23() {
    //Static cyclePrev
    //Static value
    
    if (cycle != D23.cyclePrev) {
        D23.cyclePrev = cycle;

        D23.value = ((+B23()*F8())/12);

        refreshRC("D23", D23.value);
    }

    return D23.value;
}

// formula
function E23() {
    //Static cyclePrev
    //Static value
    
    if (cycle != E23.cyclePrev) {
        E23.cyclePrev = cycle;

        E23.value = ROUND((+D23()*(14/100)),2);

        refreshRC("E23", E23.value);
    }

    return E23.value;
}

// formula
function F23() {
    //Static cyclePrev
    //Static value
    
    if (cycle != F23.cyclePrev) {
        F23.cyclePrev = cycle;

        F23.value = D23()+E23();

        refreshRC("F23", F23.value);
    }

    return F23.value;
}

// text
function A24() {
    return "Credit Life Insurance";
}

// number
function B24() {
    return 0.08;
}

// formula
function D24() {
    //Static cyclePrev
    //Static value
    
    if (cycle != D24.cyclePrev) {
        D24.cyclePrev = cycle;

        D24.value = ((+B24()*F8())/12);

        refreshRC("D24", D24.value);
    }

    return D24.value;
}

// number
function E24() {
    return 0;
}

// formula
function F24() {
    //Static cyclePrev
    //Static value
    
    if (cycle != F24.cyclePrev) {
        F24.cyclePrev = cycle;

        F24.value = D24()+E24();

        refreshRC("F24", F24.value);
    }

    return F24.value;
}

// text
function A26() {
    return "Total Installment to pay by month";
}

// formula
function D26() {
    //Static cyclePrev
    //Static value
    
    if (cycle != D26.cyclePrev) {
        D26.cyclePrev = cycle;

        D26.value = F26()-E26();

        refreshRC("D26", D26.value);
    }

    return D26.value;
}

// formula
function E26() {
    //Static cyclePrev
    //Static value
    
    if (cycle != E26.cyclePrev) {
        E26.cyclePrev = cycle;

        E26.value = ((((+E23()*F16())+(E22()*F16()))+E10())+E7())/F16();

        refreshRC("E26", E26.value);
    }

    return E26.value;
}

// formula
function F26() {
    //Static cyclePrev
    //Static value
    
    if (cycle != F26.cyclePrev) {
        F26.cyclePrev = cycle;

        F26.value = ((+F19()+F22())+F23())+F24();

        refreshRC("F26", F26.value);
    }

    return F26.value;
}

// text
function A27() {
    return "Total Installment paid over loan term";
}

// formula
function D27() {
    //Static cyclePrev
    //Static value
    
    if (cycle != D27.cyclePrev) {
        D27.cyclePrev = cycle;

        D27.value = F27()-E27();

        refreshRC("D27", D27.value);
    }

    return D27.value;
}

// formula
function E27() {
    //Static cyclePrev
    //Static value
    
    if (cycle != E27.cyclePrev) {
        E27.cyclePrev = cycle;

        E27.value = (((+E23()*F16())+(E22()*F16()))+E10())+E7();

        refreshRC("E27", E27.value);
    }

    return E27.value;
}

// formula
function F27() {
    //Static cyclePrev
    //Static value
    
    if (cycle != F27.cyclePrev) {
        F27.cyclePrev = cycle;

        F27.value = F26()*F16();

        refreshRC("F27", F27.value);
    }

    return F27.value;
}

// text
function A30() {
    return "Please Note: This calculator is provided for convenience and is for";
}

// text
function A31() {
    return "illustrative purposes only. Terms and condition apply.";
}

// text
function A33() {
    return "Final monthly installment amount confirmed once Credit application completed";
}

// text
function A35() {
    return "Maravedi (Pty) Ltd t/a Hi-Finance";
}

// text
function A36() {
    return "Maravedi is an authorised financial services and credit provider NCRCP74()";
}

//alert("finCalc.js - loaded");

