-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
37 lines (32 loc) · 1.13 KB
/
Copy pathscript.js
File metadata and controls
37 lines (32 loc) · 1.13 KB
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
$(document).ready(function () {
$(".date-promissory-note").each(function () {
$(this).pDatepicker({
observer: true,
format: 'YYYY/MM/DD',
altField: '.observer-example-alt[data-count="' + $(this).data('count') + '"]'
});
});
$('.datepicker-container').click(function (e) {
setTimeout(function () {
$(".observer-example-alt").each(function (i, obj) {
var count = $(this).data("count");
var start = $(this).val();
var end = new Date();
var diff = new Date(start - end);
$("#day-" + count).val(Math.ceil(diff / 1000 / 60 / 60 / 24));
});
}, 500);
});
$("#calc").on("click", function () {
var sum = 0;
var sum_note = 0;
$(".price").each(function () {
var count = $(this).data("count");
sum_note += parseInt($(this).val());
sum += $(this).val() * $("#day-" + count).val();
});
var final = sum / sum_note;
$(".ras").val(final);
$(".sood").val(sum_note * (5 / 100))
});
});