Fixed people prices recalculation.

master
Josef Rokos 6 years ago
parent bb5b136aea
commit 32a836d3cf

@ -238,10 +238,26 @@ void CampService::calcPeople(CampDataPtr data)
first = first.addDays(daysEnd);
int endAge = first.year() - 1;
auto setTotal = [&](){
if (sale != QDecDouble(0) && !fixedSale)
{
QDecDouble itemSale = (item->price() * sale) / 100;
item->setSale(itemSale);
item->setTotalPrice(item->price() - itemSale);
}
else
{
item->setSale(0);
item->setTotalPrice(item->price());
}
addAccFee(data, item, startAge, endAge, days);
};
if (!item->personPrice().isNull())
{
item->setPrice(item->personPrice()->price() * days);
addAccFee(data, item, startAge, endAge, days);
setTotal();
continue;
}
else
@ -258,19 +274,7 @@ void CampService::calcPeople(CampDataPtr data)
}
}
if (sale != QDecDouble(0) && !fixedSale)
{
QDecDouble itemSale = (item->price() * sale) / 100;
item->setSale(itemSale);
item->setTotalPrice(item->price() - itemSale);
}
else
{
item->setSale(0);
item->setTotalPrice(item->price());
}
addAccFee(data, item, startAge, endAge, days);
setTotal();
}
}

Loading…
Cancel
Save