Skip navigation
pomixprod
Currently Being Moderated

Calculation javascript in dropdown list

Apr 26, 2012 9:02 AM

In Acrobat Pro X, I can execute javascript calcultion with a variable in drop down list, but it does'nt work in LC

 

 

In Drop down list calculation

 

function TaxeRang1(suffixe) {
    rang = 1 * getField("Total_km" + suffixe).value + 1 * getField("Transport" + suffixe).value + 1 * getField("Logement" + suffixe).value + 1 * getField("Repas_FF" + suffixe).value + 1 * getField("Autres" + suffixe).value;
    rangFD = 1 * getField("Logement" + suffixe).value + 1 * getField("Autres" + suffixe).value


    if (event.value == "QC") {
        rang1QC = rang;
        rang1ON = rang1CB = rang1NE = rang1NB = rang1TN = 0;
        rang1FDQC = rangFD;
        rang1FDON = rang1FDCB = rang1FDNE = rang1FDNB = rang1FDTN = 0;

    }
    if (event.value == "ON") {
        rang1ON = rang;
        rang1QC = rang1CB = rang1NE = rang1NB = rang1TN = 0;
        rang1FDON = rangFD;
        rang1FDQC = rang1FDCB = rang1FDNE = rang1FDNB = rang1FDTN = 0;

    }
    if (event.value == "CB") {
        rang1CB = rang;
        rang1ON = rang1QC = rang1NE = rang1NB = rang1TN = 0;
        rang1FDCB = rangFD;
        rang1FDON = rang1FDQC = rang1FDNE = rang1FDNB = rang1FDTN = 0;
    }

    if (event.value == "NE") {
        rang1NE = rang;
        rang1ON = rang1QC = rang1CB = rang1NB = rang1TN = 0;
        rang1FDNE = rangFD;
        rang1FDON = rang1FDCB = rang1FDQC = rang1FDNB = rang1FDTN = 0;
    }

    if (event.value == "NB") {
        rang1NB = rang;
        rang1ON = rang1QC = rang1CB = rang1NE = rang1TN = 0;
        rang1FDNB = rangFD;
        rang1FDON = rang1FDCB = rang1FDNE = rang1FDQC = rang1FDTN = 0;
    }

    if (event.value == "TN") {
        rang1TN = rang;
        rang1ON = rang1QC = rang1CB = rang1NE = rang1NB = 0;
        rang1FDTN = rangFD;
        rang1FDON = rang1FDCB = rang1FDNE = rang1FDNB = rang1FDQC = 0;
    }

    if (event.value == "EX") {

        rang1QC = rang1ON = rang1CB = rang1NE = rang1NB = rang1TN = 0;
        rang1FDQC = rang1FDON = rang1FDCB = rang1FDNE = rang1FDNB = rang1FDTN = 0;
    }
}
TaxeRang1("_01");

 

result field : DepQC

 

event.value = 1 * rang1QC + 1 * rang2QC + 1 * rang3QC + 1 * rang4QC + 1 * rang5QC + 1 * rang6QC + 1 * rang7QC + 1 * rang8QC + 1 * rang9QC + 1 * rang10QC + 1 * rang11QC + 1 * rang12QC + 1 * rang13QC + 1 * rang14QC + 1 * rang15QC + 1 * rang16QC + 1 * rang17QC + 1 * rang18QC + 1 * rang19QC + 1 * rang20QC + 1 * rang21QC + 1 * rang22QC + 1 * rang23QC + 1 * rang24QC + 1 * rang25QC + 1 * rang26QC

TotalTaxables = 1 * event.value + getField("DepON").value + getField("DepCB").value + getField("DepNE").value + getField("DepNBTN").value

getField("TotalDepTPS").value=getField("TotalDepTPSA").value=1*event.v alue

getField("TotalDepTVH").value = TotalTaxables - event.value

getField("Grand_Total_Taxables").value = TotalTaxables

getField("Total_SansTaxes").value = getField("Grand_Total").value - TotalTaxables


if (TotalTaxables == 0) {
PourcentageNUM=0
    getField("TxRatio").value = 0

} else {
PourcentageNUM=100*event.value / TotalTaxables
    getField("TxRatio").value = event.value / TotalTaxables
    getField("TxRatioTVH").value =  (1 - (event.value / TotalTaxables))

}


result field : DepON

event.value=1*rang1ON+1*rang2ON+1*rang3ON+1*rang4ON+1*rang5ON+1*rang6O N+1*rang7ON+1*rang8ON+1*rang9ON+1*rang10ON+1*rang11ON+1*rang12ON+1*ran g13ON+1*rang14ON+1*rang15ON+1*rang16ON+1*rang17ON+1*rang18ON+1*rang19O N+1*rang20ON+1*rang21ON+1*rang22ON+1*rang23ON+1*rang24ON+1*rang25ON+1* rang26ON

getField("TotalDepON").value=event.value

 

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points