Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/11/2015, 21:21
canoj
 
Fecha de Ingreso: diciembre-2011
Ubicación: México
Mensajes: 26
Antigüedad: 12 años, 4 meses
Puntos: 0
Problema con funcion javascript

Muy buenas tardes,

Espero que puedan ayudarme ya que tengo bastantes dias tratando de resolver este problema, tengo una funcion en javascript que se ejecuta al momento de dar clic un botón, funciona correctamente cuando se trata de una linea de captura, pero si agrego otra linea de captura no realiza la funcion.

Acá dejo el código:

Código:
<script type="text/javascript">
		   
		   
		function generarcalculo() {
		   var i=1;
		   var valoravaluo=0;
		   var valorcatastral=0;
		   var valoroperacion=0;
		   var creditoinstituto=0;
		   var valor;
		   var cantidad2 = parseInt(document.getElementById("cantidad2").value)+parseInt(1);
		   var operacion = document.getElementById("operaciones1").value;
		   while(i<cantidad2)
		   	 {
		   	 	
		   	 	valoravaluo = parseFloat(valoravaluo)+parseFloat(document.getElementById("valoravaluo"+i).value);
		   	 	valorcatastral = parseFloat(valorcatastral)+parseFloat(document.getElementById("valorcatastral"+i).value);
		   	 	valoroperacion = parseFloat(valoroperacion)+parseFloat(document.getElementById("valoroperacion"+i).value);
		   	 	creditoinstituto = parseFloat(creditoinstituto)+parseFloat(document.getElementById("creditoinstituto"+i).value);
		   	 	i++;
		   	 }
		   	var mayor = -1;
		   	var porcetaje = 0;
		   	var acumulado = 0;
		   	var honorarios = 0;
		   	var iva;
		   	var totalh;
		   	var t;
		   	var va;
		   	valor = valoravaluo+" - "+valorcatastral+" - "+valoroperacion+" - "+creditoinstituto;
		   	if(mayor<valoravaluo) {mayor=valoravaluo;}
		   	if(mayor<valorcatastral) {mayor=valorcatastral;}
		   	if(mayor<valoroperacion) {mayor=valoroperacion;}
		   	if(mayor<creditoinstituto) {mayor=creditoinstituto;}

		   	if(mayor>=1.00 && mayor<28040.00) {linferior = 1.00; porcentaje = 0.00; acumulado=630.90;}
		   	if(mayor>=28040.00 && mayor<112160.00) {linferior = 28040.00; porcentaje = 0.0275; acumulado=1261.80;}
		   	if(mayor>=112160.00 && mayor<280400.00) {linferior = 112160.00; porcentaje = 0.0200; acumulado=3575.10;}
		   	if(mayor>=280400.00 && mayor<560800.00) {linferior = 280400.00; porcentaje = 0.0150; acumulado=6939.90;}
		   	if(mayor>=560800.00 && mayor<2804000.00) {linferior = 560800.00; porcentaje = 0.0095; acumulado=11145.90;}
		   	if(mayor>=2804000.00 && mayor<5608000.00) {linferior = 2804000.00; porcentaje = 0.0055; acumulado=32456.30;}
		   	if(mayor>=5608000.00 && mayor<=999999999.00) {linferior = 5608000.00; porcentaje = 0.0035; acumulado=47878.30;}

		   	honorarios = (mayor - linferior) * (porcentaje) + acumulado; 
		   	iva = honorarios * 0.16;
		   	totalh = honorarios + iva;
		   	totalh = parseFloat(totalh);
		   	totalh = Math.round(totalh*100)/100;

		   	document.getElementById("monto1").value=honorarios;
		   	document.getElementById("subtotal").value=honorarios;
		   	document.getElementById("iva").value=iva;
		   	document.getElementById("total").value=totalh;

		   

		}
		// -->
	</script>
Gracias de antemano