我在 Drupal 中有一个表单,我在一次选择更改、两个文本字段和该选择字段本身上获取三个值。我正在减去假定为借出金额的值,并且必须根据选择来计算 EMI,为此我得到了一个公式,但它不起作用。这是我正在使用的代码...
$(document).ready(function() {
var actualAmount = 100000;
var downPayment = 20000;
var emi_total_amount = actualAmount - downPayment;
var selected_emi_type = $("#edit-field-payment-emi-und option:selected").text();
var emi_amount;
var rate_24 = 15/(12*100);
var rate_30 = 15/(12*100);
var rate_36 = 15.5/(12*100);
var rate_42 = 15.5/(12*100);
var rate_48 = 16/(12*100);
switch (selected_emi_type){
case '6 EMI':
emi_amount = parseInt(emi_total_amount/6);
break;
case '12 EMI':
emi_amount = parseInt(emi_total_amount/12);
break;
case '24 EMI':
emi_amount = emi_total_amount x rate_24 x (1 + rate_24)24 / ((1+rate_24)24 -1);
break;
case '30 EMI':
emi_amount = emi_total_amount x rate_30 x (1 + rate_30)30 / ((1+rate_30)30 -1);
break;
case '36 EMI':
emi_amount = emi_total_amount x rate_36 x (1 + rate_36)36 / ((1+rate_36)36 -1);
break;
case '42 EMI':
emi_amount = emi_total_amount x rate_42 x (1 + rate_42)42 / ((1+rate_42)42 -1);
break;
case '48 EMI':
emi_amount = emi_total_amount x rate_48 x (1 + rate_48)48 / ((1+rate_48)48 -1);
break;
}
alert(emi_amount);
)};
我现在给出示例值。我的开关和所有其他东西都工作正常,前两个开关盒也没有公式实现。我知道这个公式可能有问题,但我需要解决它...