Commit 4d890063 authored by droces's avatar droces

Fixed calculation of addons total cost

parent e0b029ac
......@@ -508,7 +508,7 @@ function refresh_main_info() {
// Deductions (not shown)
// Addons
var addons_total = get_addons_total();
var addons_total = get_addons_total(num_nights);
booking_info_container.find('.field_addons .value')
.html(currency_prefix + addons_total);
......@@ -671,11 +671,11 @@ function get_addons_sum(type) {
return sum;
}
function get_addons_total() {
function get_addons_total(num_nights) {
// console.log('num_nights: ', num_nights);
var total = 0;
var num_guests = parseInt(num_guests_field.val()),
num_nights = parseInt(num_nights_field.val());
var num_guests = parseInt(num_guests_field.val());
var addons_once = get_addons_sum('once-off'),
addons_flat = get_addons_sum('flat'),
......@@ -686,6 +686,7 @@ function get_addons_total() {
for (var i = num_nights - 1; i >= 0; i--) {
total += addons_flat;
total += addons_pguest * num_guests;
// console.log('total: ', total);
}
return total;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment