Skip to content

Instantly share code, notes, and snippets.

@stewones
Forked from anonymous/gist:c09e4a503327433ea87ba87c09302730
Last active May 5, 2016 21:26
Show Gist options
  • Save stewones/9696d983a4e335ce54aee9004bb003a7 to your computer and use it in GitHub Desktop.
Save stewones/9696d983a4e335ce54aee9004bb003a7 to your computer and use it in GitHub Desktop.
function calculo() {
var total1 = 0, total2 = 0, total3 = 0, total4 = 0;
if (document.cel1.Locar1.checked == true) {
total1 = 3999;
if (document.cel1.cel1d == "Dummy") {
total1 = 3799.05;
}
else if (document.cel1.cel1n == "Normal") {
total1 = 3599.1;
}
else if (document.cel1.cel1p == "Power") {
total1 = 3199.2;
}
}
if (document.cel2.Locar2.checked == true) {
total2 = total2 + 1199;
if (document.cel2.cel2d == "Dummy") {
total2 -= total2 * 0.95;
}
if (document.cel2.cel2n == "Normal") {
total2 -= total2 * 0.9;
}
if (document.cel2.cel2p == "Power") {
total2 -= total2 * 0.8;
}
}
if (document.cel3.Locar3.checked == true) {
total3 = total3 + 1649;
if (document.cel3.cel3d == "Dummy") {
total3 -= total3 * 0.95;
}
if (document.cel3.cel3n == "Normal") {
total3 -= total3 * 0.9;
}
if (document.cel3.cel3p == "Power") {
total3 -= total3 * 0.8;
}
}
if (document.cel4.Locar4.checked == true) {
total4 = total4 + 229;
if (document.cel4.cel4d == "Dummy") {
total4 -= total4 * 0.95;
}
if (document.cel4.cel4n == "Normal") {
total4 -= total4 * 0.9;
}
if (document.cel4.cel4p == "Power") {
total4 -= total4 * 0.8;
}
}
//arredonda casas decimais
total1.toFixed(2);
total2.toFixed(2);
total3.toFixed(2);
total4.toFixed(2);
total = total1 + total2 + total3 + total4;
total.toFixed(2);
alert("Total ate agora: " + total);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment