/* This source is shared under the terms of LGPL 3 www.gnu.org/licenses/lgpl.html You are free to use the code in Commercial or non-commercial projects */ //Set up an associative array //The keys represent the size of the cake //The values represent the cost of the cake i.e A 10" cake cost's $35 var cake_prices = new Array(); cake_prices["Round01"]=0.95; cake_prices["Round02"]=1.05; cake_prices["Round03"]=1.05; cake_prices["Round04"]=1.05; cake_prices["Round05"]=1.05; cake_prices["Round06"]=1.05; cake_prices["Round07"]=1.05; cake_prices["Round08"]=0.95; cake_prices["Round09"]=0.95; cake_prices["Round10"]=1.05; cake_prices["Round11"]=0.95; cake_prices["Round12"]=0.95; cake_prices["Round13"]=0.95; cake_prices["Round14"]=1.1; cake_prices["Round15"]=0.95; cake_prices["Round16"]=0.95; cake_prices["Round17"]=0.95; cake_prices["Round18"]=0.95; cake_prices["Round19"]=0.95; cake_prices["Round20"]=0.95; cake_prices["Round21"]=0.95; cake_prices["Round22"]=0.95; cake_prices["Round23"]=0.95; cake_prices["Round24"]=0.95; cake_prices["Round25"]=0.95; cake_prices["Round26"]=0.95; cake_prices["Round27"]=0.95; cake_prices["Round28"]=0.95; cake_prices["Round29"]=0.95; cake_prices["Round30"]=1; cake_prices["Round31"]=0.95; cake_prices["Round32"]=0.95; cake_prices["Round33"]=1; cake_prices["Round34"]=1.05; cake_prices["Round35"]=0.95; cake_prices["Round36"]=0.95; cake_prices["Round37"]=0.95; cake_prices["Round38"]=0.95; cake_prices["Round39"]=1.05; cake_prices["Round40"]=0.95; cake_prices["Round41"]=0.95; cake_prices["Round42"]=0.95; cake_prices["Round43"]=0.95; cake_prices["Round44"]=0.95; cake_prices["Round45"]=0.95; cake_prices["Round46"]=0.95; cake_prices["Round47"]=0.95; cake_prices["Round48"]=0.95; cake_prices["Round49"]=0.95; cake_prices["Round50"]=0.95; cake_prices["Round51"]=0.95; cake_prices["Round52"]=0.95; cake_prices["Round53"]=0.95; cake_prices["Round54"]=1.05; cake_prices["Round55"]=1; cake_prices["Round56"]=1.05; cake_prices["Round57"]=1; cake_prices["Round58"]=1.05; cake_prices["Round59"]=1.05; cake_prices["Round60"]=1; cake_prices["Round61"]=0.95; cake_prices["Round62"]=1.05; cake_prices["Round63"]=1.05; cake_prices["Round64"]=1.05; cake_prices["Round65"]=1.05; cake_prices["Round66"]=1; cake_prices["Round67"]=0.95; cake_prices["Round68"]=0.95; cake_prices["Round69"]=0.95; cake_prices["Round70"]=0.95; cake_prices["Round71"]=0.95; cake_prices["Round72"]=0.95; cake_prices["Round73"]=0.95; //Set up an associative array //The keys represent the filling type //The value represents the cost of the filling i.e. Lemon filling is $5,Dobash filling is $9 //We use this this array when the user selects a filling from the form var filling_prices= new Array(); filling_prices["A001"]=1.39; filling_prices["A002"]=1.06; filling_prices["A003"]=1.55; filling_prices["A004"]=1.24; filling_prices["A005"]=1.2; filling_prices["A006"]=1.16; filling_prices["B100"]=1.45; filling_prices["B110"]=1.04; filling_prices["B111"]=1.69; filling_prices["B112"]=1.66; filling_prices["B113"]=1.94; filling_prices["B114"]=2.07; filling_prices["B115"]=1.37; filling_prices["B116"]=0.62; filling_prices["B200"]=1.04; filling_prices["B300"]=2.12; filling_prices["B400"]=1.86; filling_prices["B500"]=1.79; filling_prices["B600"]=1.89; filling_prices["B700"]=1.89; filling_prices["B800"]=2.07; filling_prices["B900"]=1.89; filling_prices["C100"]=1.45; filling_prices["C110"]=1.24; filling_prices["C111"]=1.59; filling_prices["C200"]=1.55; filling_prices["C300"]=1.14; filling_prices["C400"]=1.24; filling_prices["C500"]=1.24; filling_prices["C600"]=2.28; filling_prices["C700"]=1.97; filling_prices["C800"]=2.17; filling_prices["C900"]=1.14; filling_prices["D110"]=2.07; filling_prices["D120"]=1.27; filling_prices["D130"]=2.69; filling_prices["D140"]=0.31; filling_prices["D200"]=1.24; filling_prices["D300"]=1.35; filling_prices["D400"]=1.35; filling_prices["D500"]=1.76; filling_prices["D600"]=1.76; filling_prices["D700"]=1.35; filling_prices["D800"]=0.58; filling_prices["D900"]=1.04; filling_prices["E100"]=1.35; filling_prices["E110"]=2.17; filling_prices["E111"]=1.24; filling_prices["E112"]=2.07; filling_prices["E200"]=1.45; filling_prices["E300"]=1.24; filling_prices["E400"]=1.24; filling_prices["E500"]=1.35; filling_prices["E600"]=1.24; filling_prices["E700"]=2.48; filling_prices["E800"]=1.55; filling_prices["E900"]=2.07; filling_prices["F100"]=3.01; filling_prices["F200"]=1.45; filling_prices["F300"]=0.21; filling_prices["F400"]=1.24; filling_prices["F500"]=0.83; filling_prices["F610"]=1.24; filling_prices["F620"]=0.04; filling_prices["F710"]=1.24; filling_prices["F720"]=0.04; filling_prices["F800"]=1.04; filling_prices["G100"]=1.08; filling_prices["G110"]=1.45; filling_prices["G111"]=1.45; filling_prices["G120"]=1.24; filling_prices["G130"]=1.45; filling_prices["G140"]=1.45; filling_prices["G150"]=1.39; filling_prices["G200"]=1.45; filling_prices["G300"]=1.35; filling_prices["G400"]=1.15; filling_prices["G500"]=1.15; filling_prices["G600"]=1.15; filling_prices["G700"]=1.39; filling_prices["G800"]=1.39; filling_prices["G900"]=1.39; filling_prices["H100"]=1.2; filling_prices["H200"]=1.28; filling_prices["H300"]=1.28; filling_prices["H400"]=1.22; filling_prices["H500"]=1.2; filling_prices["I100"]=1.14; filling_prices["I210"]=1.35; filling_prices["I220"]=0.06; filling_prices["I300"]=1.2; filling_prices["I400"]=1.38; filling_prices["I500"]=1.38; filling_prices["I600"]=1.05; filling_prices["I700"]=1.64; filling_prices["I800"]=1.59; filling_prices["I900"]=1.59; filling_prices["J100"]=1.04; filling_prices["J200"]=1.34; filling_prices["J300"]=1.57; filling_prices["J400"]=1.49; filling_prices["J500"]=0.84; filling_prices["J600"]=1; filling_prices["J700"]=1.14; filling_prices["J800"]=1.28; filling_prices["J900"]=1.89; filling_prices["K100"]=0.06; filling_prices["K200"]=0.55; filling_prices["K300"]=1.22; filling_prices["K400"]=0.86; filling_prices["K500"]=1.18; filling_prices["K600"]=1.14; filling_prices["K700"]=0.57; filling_prices["l-610"]=1.18; filling_prices["L100"]=1.14; filling_prices["L210"]=1.18; filling_prices["L220"]=0.06; filling_prices["L310"]=1.18; filling_prices["L320"]=0.06; filling_prices["L400"]=1.2; filling_prices["L510"]=1.18; filling_prices["L520"]=0.06; filling_prices["L620"]=0.06; filling_prices["L700"]=1.22; filling_prices["L800"]=1.3; filling_prices["M100"]=1.3; filling_prices["M110"]=1.3; filling_prices["M120"]=0.04; filling_prices["M121"]=1.86; filling_prices["M130"]=0.05; filling_prices["M140"]=1.41; filling_prices["M151"]=1.55; filling_prices["M152"]=0.06; filling_prices["M200"]=1.86; filling_prices["M300"]=1.04; filling_prices["M400"]=1.3; filling_prices["M500"]=1.76; filling_prices["M600"]=1.32; filling_prices["M700"]=1.86; filling_prices["M800"]=0.04; filling_prices["M900"]=1.45; filling_prices["N100"]=1.86; filling_prices["N200"]=1.97; filling_prices["N300"]=1.3; filling_prices["N400"]=1.2; filling_prices["N500"]=1.76; filling_prices["N600"]=1.55; filling_prices["O100"]=1.14; filling_prices["O110"]=1.04; filling_prices["O111"]=1.04; filling_prices["O200"]=1.08; filling_prices["O300"]=1.07; filling_prices["O400"]=1.08; filling_prices["O500"]=1.04; filling_prices["O600"]=1.24; filling_prices["O700"]=1.24; filling_prices["O800"]=1.92; filling_prices["O900"]=1.22; filling_prices["P100"]=1.14; filling_prices["P110"]=1.45; filling_prices["P111"]=0.06; filling_prices["P112"]=2.07; filling_prices["P210"]=1.14; filling_prices["P220"]=0.06; filling_prices["P300"]=0.05; filling_prices["P400"]=2.01; filling_prices["P500"]=3.39; filling_prices["P600"]=0.06; filling_prices["P700"]=2.82; filling_prices["P800"]=1.94; filling_prices["P900"]=1.55; filling_prices["Q100"]=1.86; filling_prices["Q200"]=1.45; filling_prices["Q300"]=1.24; filling_prices["Q400"]=1.18; filling_prices["Q500"]=1.76; filling_prices["R100"]=1.33; filling_prices["R200"]=1; filling_prices["R300"]=1.16; filling_prices["R400"]=1.33; // getCakeSizePrice() finds the price based on the size of the cake. // Here, we need to take user's the selection from radio button selection function getCakeSizePrice() { var cakeSizePrice=0; //Get a reference to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the select id="selectedCake" var selectedCake = theForm.elements["edos"]; //set cakeFilling Price equal to value user chose //For example cake_prices["Lemon".value] would be equal to 5 cakeSizePrice = cake_prices[selectedCake.value]; //finally we return cakeSizePrice return cakeSizePrice; } //This function finds the filling price based on the //drop down selection function getFillingPrice() { var cakeFillingPrice=0; //Get a reference to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the select id="filling" var selectedFilling = theForm.elements["filling"]; //set cakeFilling Price equal to value user chose //For example filling_prices["Lemon".value] would be equal to 5 cakeFillingPrice = filling_prices[selectedFilling.value]; //finally we return cakeFillingPrice return cakeFillingPrice; } //candlesPrice() finds the candles price based on a check box selection function candlesPrice() { var candlePrice=0; //Get a reference to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the checkbox id="includecandles" var includeCandles = theForm.elements["includecandles"]; //If they checked the box set candlePrice to 5 if(includeCandles.checked==true) { candlePrice=0.10; } //finally we return the candlePrice return candlePrice; } function conceptualPrice() { var conceptualPrice=0; //Get a reference to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the checkbox id="includecandles" var includeCandles = theForm.elements["conceptual"]; //If they checked the box set candlePrice to 5 if(includeCandles.checked==true) { conceptualPrice=0.06; } //finally we return the candlePrice return conceptualPrice; } function anteproyectoPrice() { var anteproyectoPrice=0; //Get a reference to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the checkbox id="includecandles" var includeCandles = theForm.elements["anteproyecto"]; //If they checked the box set candlePrice to 5 if(includeCandles.checked==true) { anteproyectoPrice=0.06; } //finally we return the candlePrice return anteproyectoPrice; } function ejecutivoPrice() { var ejecutivoPrice=0; //Get a reference to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the checkbox id="includecandles" var includeCandles = theForm.elements["ejecutivo"]; //If they checked the box set candlePrice to 5 if(includeCandles.checked==true) { ejecutivoPrice=0.06; } //finally we return the candlePrice return ejecutivoPrice; } function estrucutralPrice() { var estrucutralPrice=0; //Get a reference to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the checkbox id="includecandles" var includeCandles = theForm.elements["estrucutral"]; //If they checked the box set candlePrice to 5 if(includeCandles.checked==true) { estrucutralPrice=0.06; } //finally we return the candlePrice return estrucutralPrice; } function electricaPrice() { var electricaPrice=0; //Get a reference to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the checkbox id="includecandles" var includeCandles = theForm.elements["electrica"]; //If they checked the box set candlePrice to 5 if(includeCandles.checked==true) { electricaPrice=0.06; } //finally we return the candlePrice return electricaPrice; } function hidrosanitariaPrice() { var hidrosanitariaPrice=0; //Get a reference to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the checkbox id="includecandles" var includeCandles = theForm.elements["hidrosanitaria"]; //If they checked the box set candlePrice to 5 if(includeCandles.checked==true) { hidrosanitariaPrice=0.06; } //finally we return the candlePrice return hidrosanitariaPrice; } function gasPrice() { var gasPrice=0; //Get a reference to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the checkbox id="includecandles" var includeCandles = theForm.elements["gas"]; //If they checked the box set candlePrice to 5 if(includeCandles.checked==true) { gasPrice=0.06; } //finally we return the candlePrice return gasPrice; } function insciptionPrice() { //This local variable will be used to decide whether or not to charge for the inscription //If the user checked the box this value will be 20 //otherwise it will remain at 0 var inscriptionPrice=0; //Get a refernce to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the checkbox id="includeinscription" var includeInscription = theForm.elements["includeinscription"]; //If they checked the box set inscriptionPrice to 20 if(includeInscription.checked==true){ inscriptionPrice=0.01; } //finally we return the inscriptionPrice return inscriptionPrice; } function getQuantity() { //Assume form with id="theform" var theForm = document.forms["cakeform"]; //Get a reference to the TextBox var quantity = theForm.elements["quantity"]; var howmany =0; //If the textbox is not blank if(quantity.value!="") { howmany = parseInt(quantity.value); } return howmany; } function calculateTotal() { //Here we get the total price by calling our function //Each function returns a number so by calling them we add the values they return together var cakePrice = (getQuantity() * 12259 * getFillingPrice()) * (15-(2.5 * Math.log10(getQuantity()))) * getCakeSizePrice() * (conceptualPrice() + anteproyectoPrice() + ejecutivoPrice() + estrucutralPrice() + electricaPrice() + hidrosanitariaPrice() + gasPrice() ) / 100; var costodirecto = (getQuantity() * 12259 * getFillingPrice()) //display the result var divobj = document.getElementById('totalPrice'); divobj.style.display='block'; divobj.innerHTML = "El precio minimo recomendado por el diseño arquitectónico con los alcances seleccionados es de "+accounting.formatMoney(cakePrice)+" pesos mexicanos asumiendo que el costo directo de construcción será de "+accounting.formatMoney(costodirecto)+" pesos mexicanos (con valores de 1 de Marzo del 2025). "; } function hideTotal() { var divobj = document.getElementById('totalPrice'); divobj.style.display='none'; }