Error codigo JScript

20/01/2005 - 01:52 por L. A. M. | Informe spam
Buenos dias

No soy experimentado en el uso de lenguajes, pero diseñé el código que aquí
presento porque la parte en JavaScript me genera error y no se detectarlo.

Al abrir la pagina se conecta a una BD Access y extrae unos porcentajes que
los coloca en los campos de texto. Eso lo hago con VBScript y va bien.

Luego, el usuario ingresa en otros dos campos dos valores y al darle al
boton Calcular, debiera darle resultados que trato de obtener con la funcion
en JScript, pero alli sale el error.

Este es el código en total:

-
<html>
<head>
<!--
This file retrieved from the JS-Examples archives
http://www.js-x.com
1000s of free ready to use scripts, tutorials, forums.
Author: Tim Wallace - 0

<SCRIPT>
<!-- Activate Cloaking Device

// Called by computeIt() function - creates $xx.xx format.
function fmtPrice(value)
{
result="$"+Math.floor(value)+".";
var cents0*(value-Math.floor(value))+0.5;
result += Math.floor(cents / 10);
result += Math.floor(cents % 10);
return result;
}

// Called by COMPUTE button - gathers selected values, computes tax & total
cost, displays values.
function computeIt(form)
{
// Sets myindex1 to selected value from unit menu.
var misueldo = form.sueldo.value;
// Sets myindex2 to selected value from cost menu.
var minum = form.numempl.value;
var miminimo = form.minimo.value;

// Checks that an item is selected from each menu.
if (misueldo>=1 && minum>=1)
{
// Variables used for computations.
var VSueldo = misueldo * minum;
var VSubsidio = form.subsidio.value;
var PCesantias = form.cesantias.value;
var PInts = form.intereses.value;
var PPrima = form.prima.value;
var PVacaciones = form.vacaciones.value;
var PPension = form.pension.value;
var PSalud = form.salud.value;
var PAtep = form.atep.value;
var PCaja = form.caja.value;
var PIcbf = form.icbf.value;
var PSena = form.sena.value;
var PAdmin = form.admin.value;
var PIva = form.iva.value;

// Computations
if misueldo <= miminimo * 2 then
{
var TSubsidio = VSubsidio * minum;
else
var TSubsidio = 0;
}
var TCesantias = PCesantias * misueldo * minum / 100;
var TInts = PInts * misueldo * minum / 100;
var TPrima = PPrima * misueldo * minum / 100;
var TVacaciones = PVacaciones * misueldo * minum / 100;
var TPension = PPension * misueldo * minum / 100;
var TSalud = PSalud * misueldo * minum / 100;
var TAtep = PAtep * misueldo * minum / 100;
var TCaja = PCaja * misueldo * minum / 100;
var TIcbf = PIcbf * misueldo * minum / 100;
var TSena = PSena * misueldo * minum / 100;
var TAdmin = PAdmin * misueldo * minum / 100;
var TIva = PIva * TAdmin / 100;

// Display formatted values.

form.RSubsidio.value = fmtPrice(TSubsidio);
form.RCesantas.value = fmtPrice(TCesantias);
form.RInts.value = fmtPrice(TInts);
form.RPrima.value = fmtPrice(TPrima);
form.RVacaciones.value = fmtPrice(TVacaciones);
form.RTotPrestac.value = fmtPrice(TCesantias + TInts + TPrima);
form.RPension.value = fmtPrice(TPension);
form.RSalud.value = fmtPrice(TSalud);
form.RAtep.value = fmtPrice(TAtep);
form.RTotSeg.value = fmtPrice(TPension + TSalud + TAtep);
form.RCaja.value = fmtPrice(TCaja);
form.RIcbf.value = fmtPrice(TIcbf);
form.RSena.value = fmtPrice(TSena);
form.RTotParaf.value = fmtPrice(TCaja + TIcbf + TSena);
form.RTotfprest.value = fmtPrice(TCesantias + TInts + TPrima + TPension +
TSalud + TAtep + TCaja + TIcbf + TSena);
form.RAdmin.value = fmtPrice(TAdmin);
form.RIva.value = fmtPrice(TIva);
form.VrSueldo.value = fmtPrice(VSueldo);
form.TotNomina.value = fmtPrice(VSueldo + TSubsidio + TCesantias + TInts +
TPrima + TPension + TSalud + TAtep + TCaja + TIcbf + TSena);

}
// Displays an Alert message if a selection is not made from both menus.
else
alert("Debe ingresar el sueldo - the number of
TS - a COST per unit - the applicable TAX before clicking
the COMPUTE button.");
}

// Deactivate Cloaking -->
</SCRIPT>

</head>
<body>

<p><br>
<FORM NAME="myform">

<table border="1" cellspacing="1" style="border-collapse: collapse"
bordercolor="#111111" width="67%" id="AutoNumber1">
<tr>
<td width="61%">Sueldo base de cálculo
<input type="text" name="Sueldo" size="12"></td>
<td width="37%">Valor sueldos<br>
<input type="text" name="VrSueldo" size="12"></td>
<td width="39%">Valor Total Esta Nómina</td>
</tr>
<tr>
<td width="61%">Numero de empleados
<input type="text" name="NumEmpl" size="12"></td>
<td width="37%">
<p align="center"><INPUT TYPE="button" VALUE="CALCULAR"
onClick="computeIt(this.form)"></td>
<td width="39%">
<input type="text" name="TotNomina" size="14"></td>
</tr>
<tr>
<td width="61%">&nbsp;</td>
<td width="37%">
<p align="center"><INPUT TYPE="Reset" VALUE=" Reiniciar "
size="20"></td>
<td width="39%">&nbsp;</td>
</tr>
</table>

<p>En el cuadro de abajo se muestran los porcentajes </p>

<%
dim cn, rs, sql
' Name of the Accessdb being read

' Connect to the db with a DSN-less connection
cn="DRIVER={Microsoft Access Driver (*.mdb)};"
cn=cn & "DBQ=" & server.mappath("fpdbegistro.mdb")

' Create a server recordset object
Set rs = Server.CreateObject("ADODB.Recordset")

' Select all data from the table the_bird
sql = "select * from datos "

' Execute the sql
rs.Open sql, cn
%>

<TABLE BORDER=3 WIDTHE0 height="100">
<TR>
<TD align="center" height="22" colspan="12">
<p align="left">Conceptos de Ley que se liquidan mensualmente sobre la
nómina<TR>
<TD align="center" height="36"><font size="2">Concepto</font><TD
align="center" height="36"><font size="1">Subsidio<br>
transporte</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
size="1">%<br>
cesantias</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
size="1">% ints<br>
cesantias</font><TD align="center" height="36" colspan="2"
bgcolor="#CCFFFF"><font size="1">%<br>
prima</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
size="1">%<br>
vacaciones</font><TD align="center" height="36" bgcolor="#CCCCFF"><font
size="1">Total %<br>
prestaciones soc</font><TD align="center" height="80" colspan="4"
rowspan="3">&nbsp;
<%
' Move to the first record
rs.movefirst

' Start a loop that will end with the last record
do while not rs.eof
%> &nbsp;
<tr>
<td height="22">
<font size="2">Porcentaje</font><td height="22">
<input type="text" name="Subsidio" value="<%= rs("subtransp") %>"
size="7"><TD align="center" height="22">
<input type="text" name="cesantias" value="<%= rs("cesantias") %>"
size="7"><TD align="center" height="22">
<input type="text" name="Intereses" value="<%= rs("intereses") %>"
size="7"><TD align="center" height="22" colspan="2">
<input type="text" name="prima" value="<%= rs("prima")%>" size="7"><TD
align="center" height="22">
<input type="text" name="vacaciones" value="<%= rs("vacaciones") %>"
size="7"><TD align="center" height="22" bgcolor="#CCCCFF">
<input type="text" name="TotPrestS" value="<%= rs("tprestacsoc") %>"
size="7"><tr>
<TD align="center" height="22">
<font size="2">RESULTADOS</font><TD align="center" height="22">
<input type="text" name="RSubsidio" size="7"><TD align="center"
height="22">
<input type="text" name="RCesantias" size="7"><TD align="center"
height="22">
<input type="text" name="RInts" size="7"><TD align="center" height="22">
<input type="text" name="RPrima" size="7"><TD align="center" height="22">
&nbsp;<TD align="center" height="22">
<input type="text" name="RVacaciones" size="7"><TD align="center"
height="22">
<input type="text" name="RTotPrestac" size="7"></tr>
<tr>
<TD align="center" colspan="12" height="22">

&nbsp;</TR>
<tr>
<TD align="center" height="36" bgcolor="#CCFFFF"><font
size="2">Concepto</font><TD align="center" height="36"
bgcolor="#CCFFFF"><font size="1">%<br>
Pension</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
size="1">%<br>
Salud</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
size="1">%<br>
ATEP</font><TD align="center" height="36" bgcolor="#CCCCFF"><font
size="1">Total %<br>
Seg.Social</font><TD align="center" height="36">&nbsp;<TD align="center"
height="36" bgcolor="#CCFFFF"><font size="1">%<br>
Caja Comp.</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
size="1">%<br>
I.C.B.F.</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
size="1">%<br>
Sena</font><TD align="center" height="36" bgcolor="#CCCCFF"><font
size="1">Total<br>
Ap. Parafiscales</font></TR>
<TD align="center" height="36">&nbsp;</TR>
<TD align="center" height="36" bgcolor="#CCCCFF"><font size="1">TOTAL
FACTOR<br>
PRESTACIONAL</font></TR>
<tr>
<TD align="center" height="22">
<font size="2">Porcentaje</font><TD align="center" height="22">
<input type="text" name="pension" value="<%= rs("pension") %>" size="7"><TD
align="center" height="22">
<input type="text" name="salud" value="<%= rs("salud") %>" size="7"><TD
align="center" height="22">
<input type="text" name="atep" value="<%= rs("atep") %>" size="7"><TD
align="center" height="22" bgcolor="#CCCCFF">
<input type="text" name="segsoc" value="<%= rs("tsegsoc") %>" size="7"><TD
align="center" height="22">
&nbsp;<TD align="center" height="22">
<input type="text" name="caja" value="<%= rs("caja") %>" size="7"><TD
align="center" height="22">
<input type="text" name="icbf" value="<%= rs("icbf") %>" size="7"><TD
align="center" height="22">
<input type="text" name="sena" value="<%= rs("sena") %>" size="7"><TD
align="center" height="22" bgcolor="#CCCCFF">
<input type="text" name="TotParaf" value="<%= rs("tparafisc") %>"
size="7"></TR>
<TD align="center" height="22">
&nbsp;</TR>

<TD align="center" height="22" bgcolor="#CCCCFF">
<input type="text" name="TotFPrestac" value="<%= rs("tfactprestac") %>"
size="7"></TR>

<tr>
<TD align="center" height="22">
<font size="2">RESULTADOS</font><TD align="center" height="22">
<input type="text" name="RPension" size="7"><TD align="center" height="22">
<input type="text" name="RSalud" size="7"><TD align="center" height="22">
<input type="text" name="RATEP" size="7"><TD align="center" height="22"
bgcolor="#CCCCFF">
<input type="text" name="RTotSeg" size="7"><TD align="center" height="22">
&nbsp;<TD align="center" height="22">
<input type="text" name="RCaja" size="7"><TD align="center" height="22">
<input type="text" name="RICBF" size="7"><TD align="center" height="22">
<input type="text" name="RSena" size="7"><TD align="center" height="22"
bgcolor="#CCCCFF">
<input type="text" name="RTotParaf" size="7"></TR>
<TD align="center" height="22">
&nbsp;</TR>

<TD align="center" height="22" bgcolor="#CCCCFF">
<input type="text" name="RTotFPrest" size="7"></TR>

<tr>
<TD align="center" height="22" colspan="12">
&nbsp;<tr>
<TD align="center" height="22">
<font size="2">Concepto</font><TD align="center" height="22">
<font size="1">% Costo<br>
Administrativo</font><TD align="center" height="22">
<font size="1">% de<br>
I.V.A.</font><TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;</TR>
<TD align="center" height="22">
&nbsp;</TR>

<TD align="center" height="22">
&nbsp;</TR>

<tr>
<TD align="center" height="22">
<font size="2">Porcentaje</font><TD align="center" height="22">
<input type="text" name="admin" value="<%= rs("admin") %>" size="7"><TD
align="center" height="22">
<input type="text" name="iva" value="<%= rs("iva") %>" size="7"><TD
align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;</TR>
<TD align="center" height="22">
&nbsp;</TR>

<TD align="center" height="22">
&nbsp;</TR>

<tr>
<TD align="center" height="22">
<font size="2">RESULTADOS</font><TD align="center" height="22">
<input type="text" name="RAdmin" size="7"><TD align="center" height="22">
<input type="text" name="RIva" size="7"><TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;</TR>
<TD align="center" height="22">
&nbsp;</TR>

<TD align="center" height="22">
&nbsp;</TR>

<tr>
<TD align="center" height="22" colspan="12" bgcolor="#CCCCFF">
TOTAL COSTO DE ESTA NOMINA: $
<input type="text" name="TotNomina1" size="8"><tr>
<TD align="left" height="10">
<TD align="left" height="10" colspan="11">
Salario Minimo: $
<input type="text" name="Minimo" value="<%= rs("salminimo") %>"
size="10"><br>
Datos actualizados para el año <%= rs("periodo") %><tr>

<%
' Move to the next record
rs.movenext
' Loop back to the do statement
loop %>




</p>
</table>
<p>&nbsp;</p>

&nbsp;</FORM>

<BR><center><a href='http://www.js-x.com'>JS-X.com</a></center>
</body>
</html>



Gracias, Luis



Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.802 / Virus Database: 545 - Release Date: 11/26/2004

Preguntas similare

Leer las respuestas

#1 Matias Iacono
20/01/2005 - 13:57 | Informe spam
Depurarlo a vista es un poco complicado, asi que, que error te sale?

Saludos,

Matias Iacono
Microsoft MVP



"L. A. M." <luism0(arroba)yahoo.es> wrote in message
news:uQeZLpo$
Buenos dias

No soy experimentado en el uso de lenguajes, pero diseñé el código que


aquí
presento porque la parte en JavaScript me genera error y no se detectarlo.

Al abrir la pagina se conecta a una BD Access y extrae unos porcentajes


que
los coloca en los campos de texto. Eso lo hago con VBScript y va bien.

Luego, el usuario ingresa en otros dos campos dos valores y al darle al
boton Calcular, debiera darle resultados que trato de obtener con la


funcion
en JScript, pero alli sale el error.

Este es el código en total:

-
<html>
<head>
<!--
This file retrieved from the JS-Examples archives
http://www.js-x.com
1000s of free ready to use scripts, tutorials, forums.
Author: Tim Wallace - 0

<SCRIPT>
<!-- Activate Cloaking Device

// Called by computeIt() function - creates $xx.xx format.
function fmtPrice(value)
{
result="$"+Math.floor(value)+".";
var cents0*(value-Math.floor(value))+0.5;
result += Math.floor(cents / 10);
result += Math.floor(cents % 10);
return result;
}

// Called by COMPUTE button - gathers selected values, computes tax &


total
cost, displays values.
function computeIt(form)
{
// Sets myindex1 to selected value from unit menu.
var misueldo = form.sueldo.value;
// Sets myindex2 to selected value from cost menu.
var minum = form.numempl.value;
var miminimo = form.minimo.value;

// Checks that an item is selected from each menu.
if (misueldo>=1 && minum>=1)
{
// Variables used for computations.
var VSueldo = misueldo * minum;
var VSubsidio = form.subsidio.value;
var PCesantias = form.cesantias.value;
var PInts = form.intereses.value;
var PPrima = form.prima.value;
var PVacaciones = form.vacaciones.value;
var PPension = form.pension.value;
var PSalud = form.salud.value;
var PAtep = form.atep.value;
var PCaja = form.caja.value;
var PIcbf = form.icbf.value;
var PSena = form.sena.value;
var PAdmin = form.admin.value;
var PIva = form.iva.value;

// Computations
if misueldo <= miminimo * 2 then
{
var TSubsidio = VSubsidio * minum;
else
var TSubsidio = 0;
}
var TCesantias = PCesantias * misueldo * minum / 100;
var TInts = PInts * misueldo * minum / 100;
var TPrima = PPrima * misueldo * minum / 100;
var TVacaciones = PVacaciones * misueldo * minum / 100;
var TPension = PPension * misueldo * minum / 100;
var TSalud = PSalud * misueldo * minum / 100;
var TAtep = PAtep * misueldo * minum / 100;
var TCaja = PCaja * misueldo * minum / 100;
var TIcbf = PIcbf * misueldo * minum / 100;
var TSena = PSena * misueldo * minum / 100;
var TAdmin = PAdmin * misueldo * minum / 100;
var TIva = PIva * TAdmin / 100;

// Display formatted values.

form.RSubsidio.value = fmtPrice(TSubsidio);
form.RCesantas.value = fmtPrice(TCesantias);
form.RInts.value = fmtPrice(TInts);
form.RPrima.value = fmtPrice(TPrima);
form.RVacaciones.value = fmtPrice(TVacaciones);
form.RTotPrestac.value = fmtPrice(TCesantias + TInts + TPrima);
form.RPension.value = fmtPrice(TPension);
form.RSalud.value = fmtPrice(TSalud);
form.RAtep.value = fmtPrice(TAtep);
form.RTotSeg.value = fmtPrice(TPension + TSalud + TAtep);
form.RCaja.value = fmtPrice(TCaja);
form.RIcbf.value = fmtPrice(TIcbf);
form.RSena.value = fmtPrice(TSena);
form.RTotParaf.value = fmtPrice(TCaja + TIcbf + TSena);
form.RTotfprest.value = fmtPrice(TCesantias + TInts + TPrima + TPension +
TSalud + TAtep + TCaja + TIcbf + TSena);
form.RAdmin.value = fmtPrice(TAdmin);
form.RIva.value = fmtPrice(TIva);
form.VrSueldo.value = fmtPrice(VSueldo);
form.TotNomina.value = fmtPrice(VSueldo + TSubsidio + TCesantias + TInts


+
TPrima + TPension + TSalud + TAtep + TCaja + TIcbf + TSena);

}
// Displays an Alert message if a selection is not made from both


menus.
else
alert("Debe ingresar el sueldo - the number of
TS - a COST per unit - the applicable TAX before


clicking
the COMPUTE button.");
}

// Deactivate Cloaking -->
</SCRIPT>

</head>
<body>

<p><br>
<FORM NAME="myform">

<table border="1" cellspacing="1" style="border-collapse: collapse"
bordercolor="#111111" width="67%" id="AutoNumber1">
<tr>
<td width="61%">Sueldo base de cálculo
<input type="text" name="Sueldo" size="12"></td>
<td width="37%">Valor sueldos<br>
<input type="text" name="VrSueldo" size="12"></td>
<td width="39%">Valor Total Esta Nómina</td>
</tr>
<tr>
<td width="61%">Numero de empleados
<input type="text" name="NumEmpl" size="12"></td>
<td width="37%">
<p align="center"><INPUT TYPE="button" VALUE="CALCULAR"
onClick="computeIt(this.form)"></td>
<td width="39%">
<input type="text" name="TotNomina" size="14"></td>
</tr>
<tr>
<td width="61%">&nbsp;</td>
<td width="37%">
<p align="center"><INPUT TYPE="Reset" VALUE=" Reiniciar "
size="20"></td>
<td width="39%">&nbsp;</td>
</tr>
</table>

<p>En el cuadro de abajo se muestran los porcentajes </p>

<%
dim cn, rs, sql
' Name of the Accessdb being read

' Connect to the db with a DSN-less connection
cn="DRIVER={Microsoft Access Driver (*.mdb)};"
cn=cn & "DBQ=" & server.mappath("fpdbegistro.mdb")

' Create a server recordset object
Set rs = Server.CreateObject("ADODB.Recordset")

' Select all data from the table the_bird
sql = "select * from datos "

' Execute the sql
rs.Open sql, cn
%>

<TABLE BORDER=3 WIDTHE0 height="100">
<TR>
<TD align="center" height="22" colspan="12">
<p align="left">Conceptos de Ley que se liquidan mensualmente sobre la
nómina<TR>
<TD align="center" height="36"><font size="2">Concepto</font><TD
align="center" height="36"><font size="1">Subsidio<br>
transporte</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
size="1">%<br>
cesantias</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
size="1">% ints<br>
cesantias</font><TD align="center" height="36" colspan="2"
bgcolor="#CCFFFF"><font size="1">%<br>
prima</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
size="1">%<br>
vacaciones</font><TD align="center" height="36" bgcolor="#CCCCFF"><font
size="1">Total %<br>
prestaciones soc</font><TD align="center" height="80" colspan="4"
rowspan="3">&nbsp;
<%
' Move to the first record
rs.movefirst

' Start a loop that will end with the last record
do while not rs.eof
%> &nbsp;
<tr>
<td height="22">
<font size="2">Porcentaje</font><td height="22">
<input type="text" name="Subsidio" value="<%= rs("subtransp") %>"
size="7"><TD align="center" height="22">
<input type="text" name="cesantias" value="<%= rs("cesantias") %>"
size="7"><TD align="center" height="22">
<input type="text" name="Intereses" value="<%= rs("intereses") %>"
size="7"><TD align="center" height="22" colspan="2">
<input type="text" name="prima" value="<%= rs("prima")%>" size="7"><TD
align="center" height="22">
<input type="text" name="vacaciones" value="<%= rs("vacaciones") %>"
size="7"><TD align="center" height="22" bgcolor="#CCCCFF">
<input type="text" name="TotPrestS" value="<%= rs("tprestacsoc") %>"
size="7"><tr>
<TD align="center" height="22">
<font size="2">RESULTADOS</font><TD align="center" height="22">
<input type="text" name="RSubsidio" size="7"><TD align="center"
height="22">
<input type="text" name="RCesantias" size="7"><TD align="center"
height="22">
<input type="text" name="RInts" size="7"><TD align="center" height="22">
<input type="text" name="RPrima" size="7"><TD align="center" height="22">
&nbsp;<TD align="center" height="22">
<input type="text" name="RVacaciones" size="7"><TD align="center"
height="22">
<input type="text" name="RTotPrestac" size="7"></tr>
<tr>
<TD align="center" colspan="12" height="22">

&nbsp;</TR>
<tr>
<TD align="center" height="36" bgcolor="#CCFFFF"><font
size="2">Concepto</font><TD align="center" height="36"
bgcolor="#CCFFFF"><font size="1">%<br>
Pension</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
size="1">%<br>
Salud</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
size="1">%<br>
ATEP</font><TD align="center" height="36" bgcolor="#CCCCFF"><font
size="1">Total %<br>
Seg.Social</font><TD align="center" height="36">&nbsp;<TD align="center"
height="36" bgcolor="#CCFFFF"><font size="1">%<br>
Caja Comp.</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
size="1">%<br>
I.C.B.F.</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
size="1">%<br>
Sena</font><TD align="center" height="36" bgcolor="#CCCCFF"><font
size="1">Total<br>
Ap. Parafiscales</font></TR>
<TD align="center" height="36">&nbsp;</TR>
<TD align="center" height="36" bgcolor="#CCCCFF"><font size="1">TOTAL
FACTOR<br>
PRESTACIONAL</font></TR>
<tr>
<TD align="center" height="22">
<font size="2">Porcentaje</font><TD align="center" height="22">
<input type="text" name="pension" value="<%= rs("pension") %>"


size="7"><TD
align="center" height="22">
<input type="text" name="salud" value="<%= rs("salud") %>" size="7"><TD
align="center" height="22">
<input type="text" name="atep" value="<%= rs("atep") %>" size="7"><TD
align="center" height="22" bgcolor="#CCCCFF">
<input type="text" name="segsoc" value="<%= rs("tsegsoc") %>"


size="7"><TD
align="center" height="22">
&nbsp;<TD align="center" height="22">
<input type="text" name="caja" value="<%= rs("caja") %>" size="7"><TD
align="center" height="22">
<input type="text" name="icbf" value="<%= rs("icbf") %>" size="7"><TD
align="center" height="22">
<input type="text" name="sena" value="<%= rs("sena") %>" size="7"><TD
align="center" height="22" bgcolor="#CCCCFF">
<input type="text" name="TotParaf" value="<%= rs("tparafisc") %>"
size="7"></TR>
<TD align="center" height="22">
&nbsp;</TR>

<TD align="center" height="22" bgcolor="#CCCCFF">
<input type="text" name="TotFPrestac" value="<%= rs("tfactprestac") %>"
size="7"></TR>

<tr>
<TD align="center" height="22">
<font size="2">RESULTADOS</font><TD align="center" height="22">
<input type="text" name="RPension" size="7"><TD align="center"


height="22">
<input type="text" name="RSalud" size="7"><TD align="center" height="22">
<input type="text" name="RATEP" size="7"><TD align="center" height="22"
bgcolor="#CCCCFF">
<input type="text" name="RTotSeg" size="7"><TD align="center"


height="22">
&nbsp;<TD align="center" height="22">
<input type="text" name="RCaja" size="7"><TD align="center" height="22">
<input type="text" name="RICBF" size="7"><TD align="center" height="22">
<input type="text" name="RSena" size="7"><TD align="center" height="22"
bgcolor="#CCCCFF">
<input type="text" name="RTotParaf" size="7"></TR>
<TD align="center" height="22">
&nbsp;</TR>

<TD align="center" height="22" bgcolor="#CCCCFF">
<input type="text" name="RTotFPrest" size="7"></TR>

<tr>
<TD align="center" height="22" colspan="12">
&nbsp;<tr>
<TD align="center" height="22">
<font size="2">Concepto</font><TD align="center" height="22">
<font size="1">% Costo<br>
Administrativo</font><TD align="center" height="22">
<font size="1">% de<br>
I.V.A.</font><TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;</TR>
<TD align="center" height="22">
&nbsp;</TR>

<TD align="center" height="22">
&nbsp;</TR>

<tr>
<TD align="center" height="22">
<font size="2">Porcentaje</font><TD align="center" height="22">
<input type="text" name="admin" value="<%= rs("admin") %>" size="7"><TD
align="center" height="22">
<input type="text" name="iva" value="<%= rs("iva") %>" size="7"><TD
align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;</TR>
<TD align="center" height="22">
&nbsp;</TR>

<TD align="center" height="22">
&nbsp;</TR>

<tr>
<TD align="center" height="22">
<font size="2">RESULTADOS</font><TD align="center" height="22">
<input type="text" name="RAdmin" size="7"><TD align="center" height="22">
<input type="text" name="RIva" size="7"><TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;</TR>
<TD align="center" height="22">
&nbsp;</TR>

<TD align="center" height="22">
&nbsp;</TR>

<tr>
<TD align="center" height="22" colspan="12" bgcolor="#CCCCFF">
TOTAL COSTO DE ESTA NOMINA: $
<input type="text" name="TotNomina1" size="8"><tr>
<TD align="left" height="10">
<TD align="left" height="10" colspan="11">
Salario Minimo: $
<input type="text" name="Minimo" value="<%= rs("salminimo") %>"
size="10"><br>
Datos actualizados para el año <%= rs("periodo") %><tr>

<%
' Move to the next record
rs.movenext
' Loop back to the do statement
loop %>




</p>
</table>
<p>&nbsp;</p>

&nbsp;</FORM>

<BR><center><a href='http://www.js-x.com'>JS-X.com</a></center>
</body>
</html>



Gracias, Luis



Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.802 / Virus Database: 545 - Release Date: 11/26/2004


Respuesta Responder a este mensaje
#2 L. A. M.
20/01/2005 - 14:37 | Informe spam
Matias, gracias por responder. Pues lo ejecuté en otro PC y me mostró los
mensajes de error de JScript, como llamar a los cuadros de textos en
minusculas cuando tienen alguna mayuscula, etc.

Pero ahora me puedes ayudar indicándome cómo hago para que en este PC me
muestre los mensajes de error al ejecutar la página.

También, tengo problema al multiplicar por el valor que sube, desde una BD,
al cuadro de texto separando decimales con coma (ej.: 43,27). Al efectuar el
calculo con JScript usando la funcion parseFloat, parece que no toma sino la
parte entera (Debo convertirlo a decimales separado por punto?)

esta es una muestra

var PCesantias = parseFloat(form.cesantias.value);


Gracias

Luis

"Matias Iacono" escribió en el mensaje
news:Ouyg$3u$
Depurarlo a vista es un poco complicado, asi que, que error te sale?

Saludos,

Matias Iacono
Microsoft MVP



"L. A. M." <luism0(arroba)yahoo.es> wrote in message
news:uQeZLpo$
Buenos dias

No soy experimentado en el uso de lenguajes, pero diseñé el código que


aquí
presento porque la parte en JavaScript me genera error y no se
detectarlo.

Al abrir la pagina se conecta a una BD Access y extrae unos porcentajes


que
los coloca en los campos de texto. Eso lo hago con VBScript y va bien.

Luego, el usuario ingresa en otros dos campos dos valores y al darle al
boton Calcular, debiera darle resultados que trato de obtener con la


funcion
en JScript, pero alli sale el error.

Este es el código en total:

-
<html>
<head>
<!--
This file retrieved from the JS-Examples archives
http://www.js-x.com
1000s of free ready to use scripts, tutorials, forums.
Author: Tim Wallace - 0

<SCRIPT>
<!-- Activate Cloaking Device

// Called by computeIt() function - creates $xx.xx format.
function fmtPrice(value)
{
result="$"+Math.floor(value)+".";
var cents0*(value-Math.floor(value))+0.5;
result += Math.floor(cents / 10);
result += Math.floor(cents % 10);
return result;
}

// Called by COMPUTE button - gathers selected values, computes tax &


total
cost, displays values.
function computeIt(form)
{
// Sets myindex1 to selected value from unit menu.
var misueldo = form.sueldo.value;
// Sets myindex2 to selected value from cost menu.
var minum = form.numempl.value;
var miminimo = form.minimo.value;

// Checks that an item is selected from each menu.
if (misueldo>=1 && minum>=1)
{
// Variables used for computations.
var VSueldo = misueldo * minum;
var VSubsidio = form.subsidio.value;
var PCesantias = form.cesantias.value;
var PInts = form.intereses.value;
var PPrima = form.prima.value;
var PVacaciones = form.vacaciones.value;
var PPension = form.pension.value;
var PSalud = form.salud.value;
var PAtep = form.atep.value;
var PCaja = form.caja.value;
var PIcbf = form.icbf.value;
var PSena = form.sena.value;
var PAdmin = form.admin.value;
var PIva = form.iva.value;

// Computations
if misueldo <= miminimo * 2 then
{
var TSubsidio = VSubsidio * minum;
else
var TSubsidio = 0;
}
var TCesantias = PCesantias * misueldo * minum / 100;
var TInts = PInts * misueldo * minum / 100;
var TPrima = PPrima * misueldo * minum / 100;
var TVacaciones = PVacaciones * misueldo * minum / 100;
var TPension = PPension * misueldo * minum / 100;
var TSalud = PSalud * misueldo * minum / 100;
var TAtep = PAtep * misueldo * minum / 100;
var TCaja = PCaja * misueldo * minum / 100;
var TIcbf = PIcbf * misueldo * minum / 100;
var TSena = PSena * misueldo * minum / 100;
var TAdmin = PAdmin * misueldo * minum / 100;
var TIva = PIva * TAdmin / 100;

// Display formatted values.

form.RSubsidio.value = fmtPrice(TSubsidio);
form.RCesantas.value = fmtPrice(TCesantias);
form.RInts.value = fmtPrice(TInts);
form.RPrima.value = fmtPrice(TPrima);
form.RVacaciones.value = fmtPrice(TVacaciones);
form.RTotPrestac.value = fmtPrice(TCesantias + TInts + TPrima);
form.RPension.value = fmtPrice(TPension);
form.RSalud.value = fmtPrice(TSalud);
form.RAtep.value = fmtPrice(TAtep);
form.RTotSeg.value = fmtPrice(TPension + TSalud + TAtep);
form.RCaja.value = fmtPrice(TCaja);
form.RIcbf.value = fmtPrice(TIcbf);
form.RSena.value = fmtPrice(TSena);
form.RTotParaf.value = fmtPrice(TCaja + TIcbf + TSena);
form.RTotfprest.value = fmtPrice(TCesantias + TInts + TPrima + TPension
+
TSalud + TAtep + TCaja + TIcbf + TSena);
form.RAdmin.value = fmtPrice(TAdmin);
form.RIva.value = fmtPrice(TIva);
form.VrSueldo.value = fmtPrice(VSueldo);
form.TotNomina.value = fmtPrice(VSueldo + TSubsidio + TCesantias + TInts


+
TPrima + TPension + TSalud + TAtep + TCaja + TIcbf + TSena);

}
// Displays an Alert message if a selection is not made from both


menus.
else
alert("Debe ingresar el sueldo - the number of
TS - a COST per unit - the applicable TAX before


clicking
the COMPUTE button.");
}

// Deactivate Cloaking -->
</SCRIPT>

</head>
<body>

<p><br>
<FORM NAME="myform">

<table border="1" cellspacing="1" style="border-collapse: collapse"
bordercolor="#111111" width="67%" id="AutoNumber1">
<tr>
<td width="61%">Sueldo base de cálculo
<input type="text" name="Sueldo" size="12"></td>
<td width="37%">Valor sueldos<br>
<input type="text" name="VrSueldo" size="12"></td>
<td width="39%">Valor Total Esta Nómina</td>
</tr>
<tr>
<td width="61%">Numero de empleados
<input type="text" name="NumEmpl" size="12"></td>
<td width="37%">
<p align="center"><INPUT TYPE="button" VALUE="CALCULAR"
onClick="computeIt(this.form)"></td>
<td width="39%">
<input type="text" name="TotNomina" size="14"></td>
</tr>
<tr>
<td width="61%">&nbsp;</td>
<td width="37%">
<p align="center"><INPUT TYPE="Reset" VALUE=" Reiniciar "
size="20"></td>
<td width="39%">&nbsp;</td>
</tr>
</table>

<p>En el cuadro de abajo se muestran los porcentajes </p>

<%
dim cn, rs, sql
' Name of the Accessdb being read

' Connect to the db with a DSN-less connection
cn="DRIVER={Microsoft Access Driver (*.mdb)};"
cn=cn & "DBQ=" & server.mappath("fpdbegistro.mdb")

' Create a server recordset object
Set rs = Server.CreateObject("ADODB.Recordset")

' Select all data from the table the_bird
sql = "select * from datos "

' Execute the sql
rs.Open sql, cn
%>

<TABLE BORDER=3 WIDTHE0 height="100">
<TR>
<TD align="center" height="22" colspan="12">
<p align="left">Conceptos de Ley que se liquidan mensualmente sobre la
nómina<TR>
<TD align="center" height="36"><font size="2">Concepto</font><TD
align="center" height="36"><font size="1">Subsidio<br>
transporte</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
size="1">%<br>
cesantias</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
size="1">% ints<br>
cesantias</font><TD align="center" height="36" colspan="2"
bgcolor="#CCFFFF"><font size="1">%<br>
prima</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
size="1">%<br>
vacaciones</font><TD align="center" height="36" bgcolor="#CCCCFF"><font
size="1">Total %<br>
prestaciones soc</font><TD align="center" height="80" colspan="4"
rowspan="3">&nbsp;
<%
' Move to the first record
rs.movefirst

' Start a loop that will end with the last record
do while not rs.eof
%> &nbsp;
<tr>
<td height="22">
<font size="2">Porcentaje</font><td height="22">
<input type="text" name="Subsidio" value="<%= rs("subtransp") %>"
size="7"><TD align="center" height="22">
<input type="text" name="cesantias" value="<%= rs("cesantias") %>"
size="7"><TD align="center" height="22">
<input type="text" name="Intereses" value="<%= rs("intereses") %>"
size="7"><TD align="center" height="22" colspan="2">
<input type="text" name="prima" value="<%= rs("prima")%>" size="7"><TD
align="center" height="22">
<input type="text" name="vacaciones" value="<%= rs("vacaciones") %>"
size="7"><TD align="center" height="22" bgcolor="#CCCCFF">
<input type="text" name="TotPrestS" value="<%= rs("tprestacsoc") %>"
size="7"><tr>
<TD align="center" height="22">
<font size="2">RESULTADOS</font><TD align="center" height="22">
<input type="text" name="RSubsidio" size="7"><TD align="center"
height="22">
<input type="text" name="RCesantias" size="7"><TD align="center"
height="22">
<input type="text" name="RInts" size="7"><TD align="center" height="22">
<input type="text" name="RPrima" size="7"><TD align="center"
height="22">
&nbsp;<TD align="center" height="22">
<input type="text" name="RVacaciones" size="7"><TD align="center"
height="22">
<input type="text" name="RTotPrestac" size="7"></tr>
<tr>
<TD align="center" colspan="12" height="22">

&nbsp;</TR>
<tr>
<TD align="center" height="36" bgcolor="#CCFFFF"><font
size="2">Concepto</font><TD align="center" height="36"
bgcolor="#CCFFFF"><font size="1">%<br>
Pension</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
size="1">%<br>
Salud</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
size="1">%<br>
ATEP</font><TD align="center" height="36" bgcolor="#CCCCFF"><font
size="1">Total %<br>
Seg.Social</font><TD align="center" height="36">&nbsp;<TD align="center"
height="36" bgcolor="#CCFFFF"><font size="1">%<br>
Caja Comp.</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
size="1">%<br>
I.C.B.F.</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
size="1">%<br>
Sena</font><TD align="center" height="36" bgcolor="#CCCCFF"><font
size="1">Total<br>
Ap. Parafiscales</font></TR>
<TD align="center" height="36">&nbsp;</TR>
<TD align="center" height="36" bgcolor="#CCCCFF"><font size="1">TOTAL
FACTOR<br>
PRESTACIONAL</font></TR>
<tr>
<TD align="center" height="22">
<font size="2">Porcentaje</font><TD align="center" height="22">
<input type="text" name="pension" value="<%= rs("pension") %>"


size="7"><TD
align="center" height="22">
<input type="text" name="salud" value="<%= rs("salud") %>" size="7"><TD
align="center" height="22">
<input type="text" name="atep" value="<%= rs("atep") %>" size="7"><TD
align="center" height="22" bgcolor="#CCCCFF">
<input type="text" name="segsoc" value="<%= rs("tsegsoc") %>"


size="7"><TD
align="center" height="22">
&nbsp;<TD align="center" height="22">
<input type="text" name="caja" value="<%= rs("caja") %>" size="7"><TD
align="center" height="22">
<input type="text" name="icbf" value="<%= rs("icbf") %>" size="7"><TD
align="center" height="22">
<input type="text" name="sena" value="<%= rs("sena") %>" size="7"><TD
align="center" height="22" bgcolor="#CCCCFF">
<input type="text" name="TotParaf" value="<%= rs("tparafisc") %>"
size="7"></TR>
<TD align="center" height="22">
&nbsp;</TR>

<TD align="center" height="22" bgcolor="#CCCCFF">
<input type="text" name="TotFPrestac" value="<%= rs("tfactprestac") %>"
size="7"></TR>

<tr>
<TD align="center" height="22">
<font size="2">RESULTADOS</font><TD align="center" height="22">
<input type="text" name="RPension" size="7"><TD align="center"


height="22">
<input type="text" name="RSalud" size="7"><TD align="center"
height="22">
<input type="text" name="RATEP" size="7"><TD align="center" height="22"
bgcolor="#CCCCFF">
<input type="text" name="RTotSeg" size="7"><TD align="center"


height="22">
&nbsp;<TD align="center" height="22">
<input type="text" name="RCaja" size="7"><TD align="center" height="22">
<input type="text" name="RICBF" size="7"><TD align="center" height="22">
<input type="text" name="RSena" size="7"><TD align="center" height="22"
bgcolor="#CCCCFF">
<input type="text" name="RTotParaf" size="7"></TR>
<TD align="center" height="22">
&nbsp;</TR>

<TD align="center" height="22" bgcolor="#CCCCFF">
<input type="text" name="RTotFPrest" size="7"></TR>

<tr>
<TD align="center" height="22" colspan="12">
&nbsp;<tr>
<TD align="center" height="22">
<font size="2">Concepto</font><TD align="center" height="22">
<font size="1">% Costo<br>
Administrativo</font><TD align="center" height="22">
<font size="1">% de<br>
I.V.A.</font><TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;</TR>
<TD align="center" height="22">
&nbsp;</TR>

<TD align="center" height="22">
&nbsp;</TR>

<tr>
<TD align="center" height="22">
<font size="2">Porcentaje</font><TD align="center" height="22">
<input type="text" name="admin" value="<%= rs("admin") %>" size="7"><TD
align="center" height="22">
<input type="text" name="iva" value="<%= rs("iva") %>" size="7"><TD
align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;</TR>
<TD align="center" height="22">
&nbsp;</TR>

<TD align="center" height="22">
&nbsp;</TR>

<tr>
<TD align="center" height="22">
<font size="2">RESULTADOS</font><TD align="center" height="22">
<input type="text" name="RAdmin" size="7"><TD align="center"
height="22">
<input type="text" name="RIva" size="7"><TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;<TD align="center" height="22">
&nbsp;</TR>
<TD align="center" height="22">
&nbsp;</TR>

<TD align="center" height="22">
&nbsp;</TR>

<tr>
<TD align="center" height="22" colspan="12" bgcolor="#CCCCFF">
TOTAL COSTO DE ESTA NOMINA: $
<input type="text" name="TotNomina1" size="8"><tr>
<TD align="left" height="10">
<TD align="left" height="10" colspan="11">
Salario Minimo: $
<input type="text" name="Minimo" value="<%= rs("salminimo") %>"
size="10"><br>
Datos actualizados para el año <%= rs("periodo") %><tr>

<%
' Move to the next record
rs.movenext
' Loop back to the do statement
loop %>




</p>
</table>
<p>&nbsp;</p>

&nbsp;</FORM>

<BR><center><a href='http://www.js-x.com'>JS-X.com</a></center>
</body>
</html>



Gracias, Luis



Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.802 / Virus Database: 545 - Release Date: 11/26/2004











Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.802 / Virus Database: 545 - Release Date: 11/26/2004
Respuesta Responder a este mensaje
#3 Matias Iacono
20/01/2005 - 15:04 | Informe spam
Si... generalmente el separador comun es el del . (punto)

Con respecto a ver el error, si es un error de javascript, dependiendo la
version del navegador, te salta una ventana o te aparece en la parte
inferior izquierda un simbolo de alerta. Haciendo doble click sobre el
aparece la descripcion.

Matias Iacono
Microsoft MVP



"L. A. M." <luism0(arroba)yahoo.es> wrote in message
news:%23POq2Uv$
Matias, gracias por responder. Pues lo ejecuté en otro PC y me mostró los
mensajes de error de JScript, como llamar a los cuadros de textos en
minusculas cuando tienen alguna mayuscula, etc.

Pero ahora me puedes ayudar indicándome cómo hago para que en este PC me
muestre los mensajes de error al ejecutar la página.

También, tengo problema al multiplicar por el valor que sube, desde una


BD,
al cuadro de texto separando decimales con coma (ej.: 43,27). Al efectuar


el
calculo con JScript usando la funcion parseFloat, parece que no toma sino


la
parte entera (Debo convertirlo a decimales separado por punto?)

esta es una muestra

var PCesantias = parseFloat(form.cesantias.value);


Gracias

Luis

"Matias Iacono" escribió en el mensaje
news:Ouyg$3u$
> Depurarlo a vista es un poco complicado, asi que, que error te sale?
>
> Saludos,
>
> Matias Iacono
> Microsoft MVP
>
>
>
> "L. A. M." <luism0(arroba)yahoo.es> wrote in message
> news:uQeZLpo$
>> Buenos dias
>>
>> No soy experimentado en el uso de lenguajes, pero diseñé el código que
> aquí
>> presento porque la parte en JavaScript me genera error y no se
>> detectarlo.
>>
>> Al abrir la pagina se conecta a una BD Access y extrae unos porcentajes
> que
>> los coloca en los campos de texto. Eso lo hago con VBScript y va bien.
>>
>> Luego, el usuario ingresa en otros dos campos dos valores y al darle al
>> boton Calcular, debiera darle resultados que trato de obtener con la
> funcion
>> en JScript, pero alli sale el error.
>>
>> Este es el código en total:
>>
>> -
>> <html>
>> <head>
>> <!--
>> This file retrieved from the JS-Examples archives
>> http://www.js-x.com
>> 1000s of free ready to use scripts, tutorials, forums.
>> Author: Tim Wallace - 0
>>
>> <SCRIPT>
>> <!-- Activate Cloaking Device
>>
>> // Called by computeIt() function - creates $xx.xx format.
>> function fmtPrice(value)
>> {
>> result="$"+Math.floor(value)+".";
>> var cents0*(value-Math.floor(value))+0.5;
>> result += Math.floor(cents / 10);
>> result += Math.floor(cents % 10);
>> return result;
>> }
>>
>> // Called by COMPUTE button - gathers selected values, computes tax &
> total
>> cost, displays values.
>> function computeIt(form)
>> {
>> // Sets myindex1 to selected value from unit menu.
>> var misueldo = form.sueldo.value;
>> // Sets myindex2 to selected value from cost menu.
>> var minum = form.numempl.value;
>> var miminimo = form.minimo.value;
>>
>> // Checks that an item is selected from each menu.
>> if (misueldo>=1 && minum>=1)
>> {
>> // Variables used for computations.
>> var VSueldo = misueldo * minum;
>> var VSubsidio = form.subsidio.value;
>> var PCesantias = form.cesantias.value;
>> var PInts = form.intereses.value;
>> var PPrima = form.prima.value;
>> var PVacaciones = form.vacaciones.value;
>> var PPension = form.pension.value;
>> var PSalud = form.salud.value;
>> var PAtep = form.atep.value;
>> var PCaja = form.caja.value;
>> var PIcbf = form.icbf.value;
>> var PSena = form.sena.value;
>> var PAdmin = form.admin.value;
>> var PIva = form.iva.value;
>>
>> // Computations
>> if misueldo <= miminimo * 2 then
>> {
>> var TSubsidio = VSubsidio * minum;
>> else
>> var TSubsidio = 0;
>> }
>> var TCesantias = PCesantias * misueldo * minum / 100;
>> var TInts = PInts * misueldo * minum / 100;
>> var TPrima = PPrima * misueldo * minum / 100;
>> var TVacaciones = PVacaciones * misueldo * minum / 100;
>> var TPension = PPension * misueldo * minum / 100;
>> var TSalud = PSalud * misueldo * minum / 100;
>> var TAtep = PAtep * misueldo * minum / 100;
>> var TCaja = PCaja * misueldo * minum / 100;
>> var TIcbf = PIcbf * misueldo * minum / 100;
>> var TSena = PSena * misueldo * minum / 100;
>> var TAdmin = PAdmin * misueldo * minum / 100;
>> var TIva = PIva * TAdmin / 100;
>>
>> // Display formatted values.
>>
>> form.RSubsidio.value = fmtPrice(TSubsidio);
>> form.RCesantas.value = fmtPrice(TCesantias);
>> form.RInts.value = fmtPrice(TInts);
>> form.RPrima.value = fmtPrice(TPrima);
>> form.RVacaciones.value = fmtPrice(TVacaciones);
>> form.RTotPrestac.value = fmtPrice(TCesantias + TInts + TPrima);
>> form.RPension.value = fmtPrice(TPension);
>> form.RSalud.value = fmtPrice(TSalud);
>> form.RAtep.value = fmtPrice(TAtep);
>> form.RTotSeg.value = fmtPrice(TPension + TSalud + TAtep);
>> form.RCaja.value = fmtPrice(TCaja);
>> form.RIcbf.value = fmtPrice(TIcbf);
>> form.RSena.value = fmtPrice(TSena);
>> form.RTotParaf.value = fmtPrice(TCaja + TIcbf + TSena);
>> form.RTotfprest.value = fmtPrice(TCesantias + TInts + TPrima +


TPension
>> +
>> TSalud + TAtep + TCaja + TIcbf + TSena);
>> form.RAdmin.value = fmtPrice(TAdmin);
>> form.RIva.value = fmtPrice(TIva);
>> form.VrSueldo.value = fmtPrice(VSueldo);
>> form.TotNomina.value = fmtPrice(VSueldo + TSubsidio + TCesantias +


TInts
> +
>> TPrima + TPension + TSalud + TAtep + TCaja + TIcbf + TSena);
>>
>> }
>> // Displays an Alert message if a selection is not made from both
> menus.
>> else
>> alert("Debe ingresar el sueldo - the number of
>> TS - a COST per unit - the applicable TAX before
> clicking
>> the COMPUTE button.");
>> }
>>
>> // Deactivate Cloaking -->
>> </SCRIPT>
>>
>> </head>
>> <body>
>>
>> <p><br>
>> <FORM NAME="myform">
>>
>> <table border="1" cellspacing="1" style="border-collapse: collapse"
>> bordercolor="#111111" width="67%" id="AutoNumber1">
>> <tr>
>> <td width="61%">Sueldo base de cálculo
>> <input type="text" name="Sueldo" size="12"></td>
>> <td width="37%">Valor sueldos<br>
>> <input type="text" name="VrSueldo" size="12"></td>
>> <td width="39%">Valor Total Esta Nómina</td>
>> </tr>
>> <tr>
>> <td width="61%">Numero de empleados
>> <input type="text" name="NumEmpl" size="12"></td>
>> <td width="37%">
>> <p align="center"><INPUT TYPE="button" VALUE="CALCULAR"
>> onClick="computeIt(this.form)"></td>
>> <td width="39%">
>> <input type="text" name="TotNomina" size="14"></td>
>> </tr>
>> <tr>
>> <td width="61%">&nbsp;</td>
>> <td width="37%">
>> <p align="center"><INPUT TYPE="Reset" VALUE=" Reiniciar "
>> size="20"></td>
>> <td width="39%">&nbsp;</td>
>> </tr>
>> </table>
>>
>> <p>En el cuadro de abajo se muestran los porcentajes </p>
>>
>> <%
>> dim cn, rs, sql
>> ' Name of the Accessdb being read
>>
>> ' Connect to the db with a DSN-less connection
>> cn="DRIVER={Microsoft Access Driver (*.mdb)};"
>> cn=cn & "DBQ=" & server.mappath("fpdbegistro.mdb")
>>
>> ' Create a server recordset object
>> Set rs = Server.CreateObject("ADODB.Recordset")
>>
>> ' Select all data from the table the_bird
>> sql = "select * from datos "
>>
>> ' Execute the sql
>> rs.Open sql, cn
>> %>
>>
>> <TABLE BORDER=3 WIDTHE0 height="100">
>> <TR>
>> <TD align="center" height="22" colspan="12">
>> <p align="left">Conceptos de Ley que se liquidan mensualmente sobre la
>> nómina<TR>
>> <TD align="center" height="36"><font size="2">Concepto</font><TD
>> align="center" height="36"><font size="1">Subsidio<br>
>> transporte</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
>> size="1">%<br>
>> cesantias</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
>> size="1">% ints<br>
>> cesantias</font><TD align="center" height="36" colspan="2"
>> bgcolor="#CCFFFF"><font size="1">%<br>
>> prima</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
>> size="1">%<br>
>> vacaciones</font><TD align="center" height="36" bgcolor="#CCCCFF"><font
>> size="1">Total %<br>
>> prestaciones soc</font><TD align="center" height="80" colspan="4"
>> rowspan="3">&nbsp;
>> <%
>> ' Move to the first record
>> rs.movefirst
>>
>> ' Start a loop that will end with the last record
>> do while not rs.eof
>> %> &nbsp;
>> <tr>
>> <td height="22">
>> <font size="2">Porcentaje</font><td height="22">
>> <input type="text" name="Subsidio" value="<%= rs("subtransp") %>"
>> size="7"><TD align="center" height="22">
>> <input type="text" name="cesantias" value="<%= rs("cesantias") %>"
>> size="7"><TD align="center" height="22">
>> <input type="text" name="Intereses" value="<%= rs("intereses") %>"
>> size="7"><TD align="center" height="22" colspan="2">
>> <input type="text" name="prima" value="<%= rs("prima")%>" size="7"><TD
>> align="center" height="22">
>> <input type="text" name="vacaciones" value="<%= rs("vacaciones") %>"
>> size="7"><TD align="center" height="22" bgcolor="#CCCCFF">
>> <input type="text" name="TotPrestS" value="<%= rs("tprestacsoc") %>"
>> size="7"><tr>
>> <TD align="center" height="22">
>> <font size="2">RESULTADOS</font><TD align="center" height="22">
>> <input type="text" name="RSubsidio" size="7"><TD align="center"
>> height="22">
>> <input type="text" name="RCesantias" size="7"><TD align="center"
>> height="22">
>> <input type="text" name="RInts" size="7"><TD align="center"


height="22">
>> <input type="text" name="RPrima" size="7"><TD align="center"
>> height="22">
>> &nbsp;<TD align="center" height="22">
>> <input type="text" name="RVacaciones" size="7"><TD align="center"
>> height="22">
>> <input type="text" name="RTotPrestac" size="7"></tr>
>> <tr>
>> <TD align="center" colspan="12" height="22">
>>
>> &nbsp;</TR>
>> <tr>
>> <TD align="center" height="36" bgcolor="#CCFFFF"><font
>> size="2">Concepto</font><TD align="center" height="36"
>> bgcolor="#CCFFFF"><font size="1">%<br>
>> Pension</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
>> size="1">%<br>
>> Salud</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
>> size="1">%<br>
>> ATEP</font><TD align="center" height="36" bgcolor="#CCCCFF"><font
>> size="1">Total %<br>
>> Seg.Social</font><TD align="center" height="36">&nbsp;<TD


align="center"
>> height="36" bgcolor="#CCFFFF"><font size="1">%<br>
>> Caja Comp.</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
>> size="1">%<br>
>> I.C.B.F.</font><TD align="center" height="36" bgcolor="#CCFFFF"><font
>> size="1">%<br>
>> Sena</font><TD align="center" height="36" bgcolor="#CCCCFF"><font
>> size="1">Total<br>
>> Ap. Parafiscales</font></TR>
>> <TD align="center" height="36">&nbsp;</TR>
>> <TD align="center" height="36" bgcolor="#CCCCFF"><font size="1">TOTAL
>> FACTOR<br>
>> PRESTACIONAL</font></TR>
>> <tr>
>> <TD align="center" height="22">
>> <font size="2">Porcentaje</font><TD align="center" height="22">
>> <input type="text" name="pension" value="<%= rs("pension") %>"
> size="7"><TD
>> align="center" height="22">
>> <input type="text" name="salud" value="<%= rs("salud") %>"


size="7"><TD
>> align="center" height="22">
>> <input type="text" name="atep" value="<%= rs("atep") %>" size="7"><TD
>> align="center" height="22" bgcolor="#CCCCFF">
>> <input type="text" name="segsoc" value="<%= rs("tsegsoc") %>"
> size="7"><TD
>> align="center" height="22">
>> &nbsp;<TD align="center" height="22">
>> <input type="text" name="caja" value="<%= rs("caja") %>" size="7"><TD
>> align="center" height="22">
>> <input type="text" name="icbf" value="<%= rs("icbf") %>" size="7"><TD
>> align="center" height="22">
>> <input type="text" name="sena" value="<%= rs("sena") %>" size="7"><TD
>> align="center" height="22" bgcolor="#CCCCFF">
>> <input type="text" name="TotParaf" value="<%= rs("tparafisc") %>"
>> size="7"></TR>
>> <TD align="center" height="22">
>> &nbsp;</TR>
>>
>> <TD align="center" height="22" bgcolor="#CCCCFF">
>> <input type="text" name="TotFPrestac" value="<%= rs("tfactprestac") %>"
>> size="7"></TR>
>>
>> <tr>
>> <TD align="center" height="22">
>> <font size="2">RESULTADOS</font><TD align="center" height="22">
>> <input type="text" name="RPension" size="7"><TD align="center"
> height="22">
>> <input type="text" name="RSalud" size="7"><TD align="center"
>> height="22">
>> <input type="text" name="RATEP" size="7"><TD align="center"


height="22"
>> bgcolor="#CCCCFF">
>> <input type="text" name="RTotSeg" size="7"><TD align="center"
> height="22">
>> &nbsp;<TD align="center" height="22">
>> <input type="text" name="RCaja" size="7"><TD align="center"


height="22">
>> <input type="text" name="RICBF" size="7"><TD align="center"


height="22">
>> <input type="text" name="RSena" size="7"><TD align="center"


height="22"
>> bgcolor="#CCCCFF">
>> <input type="text" name="RTotParaf" size="7"></TR>
>> <TD align="center" height="22">
>> &nbsp;</TR>
>>
>> <TD align="center" height="22" bgcolor="#CCCCFF">
>> <input type="text" name="RTotFPrest" size="7"></TR>
>>
>> <tr>
>> <TD align="center" height="22" colspan="12">
>> &nbsp;<tr>
>> <TD align="center" height="22">
>> <font size="2">Concepto</font><TD align="center" height="22">
>> <font size="1">% Costo<br>
>> Administrativo</font><TD align="center" height="22">
>> <font size="1">% de<br>
>> I.V.A.</font><TD align="center" height="22">
>> &nbsp;<TD align="center" height="22">
>> &nbsp;<TD align="center" height="22">
>> &nbsp;<TD align="center" height="22">
>> &nbsp;<TD align="center" height="22">
>> &nbsp;<TD align="center" height="22">
>> &nbsp;<TD align="center" height="22">
>> &nbsp;</TR>
>> <TD align="center" height="22">
>> &nbsp;</TR>
>>
>> <TD align="center" height="22">
>> &nbsp;</TR>
>>
>> <tr>
>> <TD align="center" height="22">
>> <font size="2">Porcentaje</font><TD align="center" height="22">
>> <input type="text" name="admin" value="<%= rs("admin") %>"


size="7"><TD
>> align="center" height="22">
>> <input type="text" name="iva" value="<%= rs("iva") %>" size="7"><TD
>> align="center" height="22">
>> &nbsp;<TD align="center" height="22">
>> &nbsp;<TD align="center" height="22">
>> &nbsp;<TD align="center" height="22">
>> &nbsp;<TD align="center" height="22">
>> &nbsp;<TD align="center" height="22">
>> &nbsp;<TD align="center" height="22">
>> &nbsp;</TR>
>> <TD align="center" height="22">
>> &nbsp;</TR>
>>
>> <TD align="center" height="22">
>> &nbsp;</TR>
>>
>> <tr>
>> <TD align="center" height="22">
>> <font size="2">RESULTADOS</font><TD align="center" height="22">
>> <input type="text" name="RAdmin" size="7"><TD align="center"
>> height="22">
>> <input type="text" name="RIva" size="7"><TD align="center"


height="22">
>> &nbsp;<TD align="center" height="22">
>> &nbsp;<TD align="center" height="22">
>> &nbsp;<TD align="center" height="22">
>> &nbsp;<TD align="center" height="22">
>> &nbsp;<TD align="center" height="22">
>> &nbsp;<TD align="center" height="22">
>> &nbsp;</TR>
>> <TD align="center" height="22">
>> &nbsp;</TR>
>>
>> <TD align="center" height="22">
>> &nbsp;</TR>
>>
>> <tr>
>> <TD align="center" height="22" colspan="12" bgcolor="#CCCCFF">
>> TOTAL COSTO DE ESTA NOMINA: $
>> <input type="text" name="TotNomina1" size="8"><tr>
>> <TD align="left" height="10">
>> <TD align="left" height="10" colspan="11">
>> Salario Minimo: $
>> <input type="text" name="Minimo" value="<%= rs("salminimo") %>"
>> size="10"><br>
>> Datos actualizados para el año <%= rs("periodo") %><tr>
>>
>> <%
>> ' Move to the next record
>> rs.movenext
>> ' Loop back to the do statement
>> loop %>
>>
>>
>>
>>
>> </p>
>> </table>
>> <p>&nbsp;</p>
>>
>> &nbsp;</FORM>
>>
>> <BR><center><a href='http://www.js-x.com'>JS-X.com</a></center>
>> </body>
>> </html>
>>
>>
>>
>> Gracias, Luis
>>
>>
>>
>> Outgoing mail is certified Virus Free.
>> Checked by AVG anti-virus system (http://www.grisoft.com).
>> Version: 6.0.802 / Virus Database: 545 - Release Date: 11/26/2004
>>
>>
>
>



Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.802 / Virus Database: 545 - Release Date: 11/26/2004


email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una preguntaRespuesta Tengo una respuesta
Search Busqueda sugerida