Comunidad de diseño web y desarrollo en internet online

PORFA UNA AYUDADITA EN JAVA ES SUPER SIMPLE (para uds.)

Citar            
MensajeEscrito el 06 Dic 2006 08:37 pm
hola de nuevo maestros

RESULTA QUE PEDI AYUDA AQUI Y ME RESULTO PERO QUEDE ESTANCADO PARA SACAR EL IVA ES UN SCRIPT DE JAVA SI ALGUIEN ME PUDIESE AGREGAR EL IVA PORFA

SERIA EL NETO X 0.19


ESTA TODO BIEN SOLO QUE AL FINAL INTENTE SACARLO MULTIPLICANDO TODA LA SUMA POR 0,19 Y EL NUMERO ME APARECE ROJO. TAMBIEN LO INTENTE PONIENDO EL 0,19 COMO VARIABLE Y TAMPOCO ME SALIO. IGUAL DEBE SER SIMPLE. DIGO ESTO PQ NO SOY DE LOS QUE HACE TODO FACIL PRIMERO ME LA JUEGO.
Y NO SE MUCHO DE JAVA POR NO DECIR NADA :lol:
AHI VA EL SCRIPT

Código :

<script language="javascript">   
  function suma()   
  
{      
     var num1 = eval(document.getElementById("x_Cantidad_1").value);      
     if(num1==undefined) num1 = 0;
     var num2 = eval(document.getElementById("x_Unitario_1").value); 
     if(num2==undefined) num2 = 0;            
     document.getElementById("x_Total_1").value = num1 * num2;   
      var num3 = eval(document.getElementById("x_Cantidad_2").value);      
     if(num3==undefined) num3 = 0;
      var num4 = eval(document.getElementById("x_Unitario_2").value);      
     if(num4==undefined) num4 = 0;
      document.getElementById("x_Total_2").value = num3 * num4;
      var num5 = eval(document.getElementById("x_Cantidad_3").value);      
     if(num5==undefined) num5 = 0;
     var num6 = eval(document.getElementById("x_Unitario_3").value); 
     if(num6==undefined) num6 = 0;            
     document.getElementById("x_Total_3").value = num5 * num6;   
      var num7 = eval(document.getElementById("x_Cantidad_4").value);      
     if(num7==undefined) num7 = 0;
      var num8 = eval(document.getElementById("x_Unitario_4").value);      
     if(num8==undefined) num8 = 0;
      document.getElementById("x_Total_4").value = num7 * num8;
      var num9 = eval(document.getElementById("x_Cantidad_5").value);      
     if(num9==undefined) num9 = 0;
     var num10 = eval(document.getElementById("x_Unitario_5").value); 
     if(num10==undefined) num10 = 0;            
     document.getElementById("x_Total_5").value = num9 * num10;   
      var num11 = eval(document.getElementById("x_Cantidad_6").value);      
     if(num11==undefined) num11 = 0;
      var num12 = eval(document.getElementById("x_Unitario_6").value);      
     if(num12==undefined) num12 = 0;
      document.getElementById("x_Total_6").value = num11 * num12;
      var num13 = eval(document.getElementById("x_Cantidad_7").value);      
     if(num13==undefined) num13 = 0;
     var num14 = eval(document.getElementById("x_Unitario_7").value); 
     if(num14==undefined) num14 = 0;            
     document.getElementById("x_Total_7").value = num13 * num14;   
      var num15 = eval(document.getElementById("x_Cantidad_8").value);      
     if(num15==undefined) num15 = 0;
      var num16 = eval(document.getElementById("x_Unitario_8").value);      
     if(num16==undefined) num16 = 0;
      document.getElementById("x_Total_8").value = num15 * num16;
      var num17 = eval(document.getElementById("x_Cantidad_9").value);      
     if(num17==undefined) num17 = 0;
     var num18 = eval(document.getElementById("x_Unitario_9").value); 
     if(num18==undefined) num18 = 0;            
     document.getElementById("x_Total_9").value = num17 * num18;   
      var num19 = eval(document.getElementById("x_Cantidad_10").value);      
     if(num19==undefined) num19 = 0;
      var num20 = eval(document.getElementById("x_Unitario_10").value);      
     if(num20==undefined) num20 = 0;
      document.getElementById("x_Total_10").value = num19 * num20;
      var num21 = eval(document.getElementById("x_Neto").value);      
     if(num21==undefined) num21 = 0;
      document.getElementById("x_Neto").value = num1 * num2 + num3 * num4 + num5 * num6 + num7 * num8 + num9 * num10 + num11 * num12 + num13 * num14 + num15 * num16 + num17 * num18 + num19 * num20 ;
   
   }
   
   </script>


EL IVA ES 19% Y EL ID ES id="x_Iva"



GRACIAS !!!!!!

Por defabxla

8 de clabLevel



 

msie
Citar            
MensajeEscrito el 07 Dic 2006 02:40 am
Hola

Fijate si esto te sirve

Código :

neto = 0;
formu = document.forms[0] /*o bien aca, envez de poner forms[0](q hace referencia al 1er form
 q tengas, podes poner el name o el id del formulario q utilizas, si en el html hay 1 solo, 
lo podes dejar asi*/

for (i = 1; i < 11; i++)
{
    elem = formu.elements["x_Cantidad_"+i)];
    cant = (elem == null)? 0: parseFloat(elem.value);
    elem = formu.elements["x_Unitario_"+i];
    unitario = (elem == null)? 0: parseFloat(elem.value);
    neto += cant*unitario;
}
formu.elements["X_Neto"].value = neto;
formu.elements["X_Iva"].value = neto*0.19


Espero q te sirva :wink:

Por alfathenus

833 de clabLevel

5 tutoriales

 

buenos aires || Argentina

firefox
Citar            
MensajeEscrito el 07 Dic 2006 03:39 am
no escribas todo en mayúsculas, muestra un poco de netiquette!

Por fael

BOFH

2443 de clabLevel

3 tutoriales
2 articulos

 

firefox
Citar            
MensajeEscrito el 07 Dic 2006 01:40 pm
Por todo lo que rosa!!!!!! defabxla en un post anterior te había dicho que no escribieras en mayúsculas, y que colocarás un título descriptivo a tus post y de nuevo, no todo en mayúsculas. Vé y leete las reglas del foro porque sino a la siguiente no seré tan condescendiente, usa la etiqueta code para colocar código, en este forma:

[ code ] (Omite los espacio en blanco)
Pon aquí tu código
[ / code ] (Omite los espacio en blanco)

Por Aoyama

BOFH

6224 de clabLevel

6 tutoriales
12 articulos

Genero:Masculino   Anime Bloggers Bastard Operators From Hell

Webdesigner & Developer, en mis ratos libres bebo café por litros.

firefox
Citar            
MensajeEscrito el 10 Dic 2006 01:36 am
muchas gracias por las respuestas ahora a trabajar !!!!! :wink:

Por defabxla

8 de clabLevel



 

msie

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.