Calculation Formula
-
Hello, can you help me identify where I’m making a mistake in this code? I’m trying to write a scenario. The code for the scenario is linked below.
According to this scenario, I’m adapting it, but the result for criterion 1 is not coming out.
Thank you!
(function() {
var kriter1 = '';
var self = {
a4Dates: [
["01/01/1900", "05/08/1991"],
["06/08/1991", "05/08/1994"],
["06/08/1994", "05/08/1997"],
["06/08/1997", "05/08/2000"],
["06/08/2000", "05/08/2003"],
["06/08/2003", "30/09/2008"],
["01/10/2008", "31/12/2008"],
["01/10/2009", "31/12/2009"],
["01/01/2010", "31/12/2010"],
["01/01/2011", "31/12/2011"],
["01/01/2012", "31/12/2012"],
["01/01/2013", "31/12/2013"],
["01/01/2014", "31/12/2014"],
["01/01/2015", "31/12/2100"]
],
a4Rates: [
[[80, 100, [15, 0, 3600]], [60, 79, [15, 0, 3600]], [40, 59, [15, 0, 3600]]],
[[80, 100, [15, 0, 3600]], [60, 79, [15, 8, 3680]], [40, 59, [16, 0, 3760]]],
[[80, 100, [15, 0, 3600]], [60, 79, [16, 4, 3760]], [40, 59, [17, 0, 3920]]],
[[80, 100, [15, 0, 3600]], [60, 79, [17, 0, 3840]], [40, 59, [18, 0, 4080]]],
[[80, 100, [15, 0, 3600]], [60, 79, [17, 8, 3920]], [40, 59, [19, 0, 4240]]],
[[80, 100, [15, 0, 3600]], [60, 79, [18, 0, 4000]], [40, 59, [20, 0, 4400]]],
[[60, 100, [15, 0, 3700]], [50, 59, [16, 0, 3700]], [40, 49, [18, 0, 4100]]],
[[60, 100, [15, 0, 3800]], [50, 59, [16, 0, 3800]], [40, 49, [18, 0, 4200]]],
[[60, 100, [15, 0, 3900]], [50, 59, [16, 0, 3900]], [40, 49, [18, 0, 4300]]],
[[60, 100, [15, 0, 3960]], [50, 59, [16, 0, 4000]], [40, 49, [18, 0, 4400]]],
[[60, 100, [15, 0, 3960]], [50, 59, [16, 0, 4100]], [40, 49, [18, 0, 4500]]],
[[60, 100, [15, 0, 3960]], [50, 59, [16, 0, 4200]], [40, 49, [18, 0, 4600]]],
[[60, 100, [15, 0, 3960]], [50, 59, [16, 0, 4320]], [40, 49, [18, 0, 4680]]]
]
};
if (fieldname34 === "A") {
for (var i = 0; i < self.a4Dates.length; i++) {
var startdate = moment(DATEOBJ(fieldname32, 'dd/mm/yyyy'), 'DD/MM/YYYY');
var a4Date = self.a4Dates[i];
if (moment(a4Date[0], 'DD/MM/YYYY').isSameOrBefore(startdate) && moment(a4Date[1], 'DD/MM/YYYY').isSameOrAfter(startdate)) {
for (var k = 0; k < self.a4Rates[i].length; k++) {
var a4Rate = self.a4Rates[i][k];
if (a4Rate[0] <= fieldname37 && a4Rate[1] >= fieldname37) {
var a4Score = a4Rate[2];
kriter1 = a4Score[0] + " y?l " + (a4Score[1] === 0 ? "" : a4Score[1] + " ay") + " sigortal?l?k süresi";
jQuery('#calculation-kriter1').html(kriter1);
jQuery('.kriter1-aciklama').html('Sonu? : ');
jQuery('.kriter1-sonuc').html(kriter1);
return;
}
}
}
}
}
})();
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.