Added recalculating receipt on item count changed. Some UI changes.
This commit is contained in:
@@ -29,9 +29,14 @@ void ShopService::calculate(QSharedPointer<Voucher> voucher)
|
||||
QDecDouble total;
|
||||
|
||||
foreach (QSharedPointer<VoucherItem> item, voucher->items()) {
|
||||
QDecDouble itemPrice = item->unitPrice() * item->count();
|
||||
total += itemPrice;
|
||||
calculateItem(item);
|
||||
total += item->price();
|
||||
}
|
||||
|
||||
voucher->setTotalPrice(total);
|
||||
}
|
||||
|
||||
void ShopService::calculateItem(QSharedPointer<VoucherItem> item)
|
||||
{
|
||||
item->setPrice(item->unitPrice() * item->count());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user