JavaScript - Definir valor cuota según la forma de pago de un préstamo

 
Vista:
sin imagen de perfil
Val: 1
Ha disminuido su posición en 87 puestos en JavaScript (en relación al último mes)
Gráfica de JavaScript

Definir valor cuota según la forma de pago de un préstamo

Publicado por heberth (1 intervención) el 12/09/2017 23:12:42
Saludos para todos, tengo el siguiente interrogante: Cómo puedo determinar el valor de la cuota de un préstamo según el pago se haga diario, semanal, quincenal o mensual. Ejemplo: Se hace préstamo con los siguientes datos:

Valor préstamo: $ 100.000
interés : 5%
No. de cuotas:40

El anterior ejemplo me da como resultado:
Valor total a pagar: 105.000
valor_cuota (es este caso diaria) : $ 2.625

Aquí viene mi inquietud: Si el la forma de pago es semanal o quincenal cómo puedo hacer el anterior ejemplo de tal forma que me pueda calcular el valor de la cuota si la forma de pago es semanal, quincenal o mensual.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<script language="javascript">
 
var valor_total = $(' #TxtValor_total');
var No_cuotas =  $(' #TxtNo_cuotas');
 
 
$(document).ready(function(){
 
	$('#CboForma_pago').change(function(){ //the event here is change
		if($('#CboForma_pago').val() == 'Diario') //check the value into the select
		{
 
		//    var valor_total= document.getElementById('TxtValor_total').value;
		//    var No_cuotas = document.getElementById('TxtNo_cuotas').value;
 
		//    document.getElementById('TxtValor_cuotas').value = parseInt((valor_total / No_cuotas)*1);
		    var proxima_fecha = new Date();
		    var shortDateFormat = 'Y/m/d';
 
			proxima_fecha.setDate(proxima_fecha.getDate()+1);
 
 
		    $("#TxtFecha2").val(proxima_fecha), shortDateFormat ;
 
		}
		else if($('#CboForma_pago').val() == 'Semanal')
		{
 
		   var valor_total= document.getElementById('TxtValor_total').value;
		   var No_cuotas = document.getElementById('TxtNo_cuotas').value;
 
		    document.getElementById('TxtValor_cuotas').value = parseInt(((valor_total / No_cuotas)*4));
 
		    $('#TxtValor_cuotas').val() = ((valor_total / No_cuotas)*4);
 
		   var resultado = parseInt(form.Txtvalor_total.value) * parseInt(form.TxtNo_cuotas.value);
		   form.TxtValor_cuota.value = parseInt(resultado)*4;
 
		   var proxima_fecha = new Date();
		   var shortDateFormat = 'Y/m/d';
 
		    proxima_fecha.setDate(proxima_fecha.getDate() + 7);
		   ;
		    format.date($("#TxtFecha2").val(proxima_fecha),  shortDateFormat) ;
 
		}
		else if($('#CboForma_pago').val() == 'Quincenal')
		{
 
			var valor_total= document.getElementById('TxtValor_total').value;
		    var No_cuotas = document.getElementById('TxtNo_cuotas').value;
 
		    document.getElementById('TxtValor_cuotas').value = parseInt(((valor_total / No_cuotas)*15));
 
		    var proxima_fecha = new Date();
 
		    proxima_fecha.setDate(proxima_fecha.getDate() + 15);
		    $("#TxtFecha2").val(proxima_fecha);
 
		}
		else if($('#CboForma_pago').val() == 'Mensual')
		{
 
			var valor_total= document.getElementById('TxtValor_total').value;
		    var No_cuotas = document.getElementById('TxtNo_cuotas').value;
 
		    document.getElementById('TxtValor_cuotas').value = parseInt(((valor_total / No_cuotas)*30));
 
			var proxima_fecha = new Date();
 
			proxima_fecha.setDate(proxima_fecha.getDate() + 30);
 
		    $("#TxtFecha2").val(proxima_fecha);
		}
 
	});
 
});
 
</script>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder