itemsTotalCost property

num get itemsTotalCost

Implementation

num get itemsTotalCost => fold(0, (value, item) {
      if (item.isBasket) {
        return value +
            (item.proxiesWorth as Iterable<ProxyArticleWorth>).baskeTotalCost(
                    0, //(item.article as ArticleBasketOnTicket).discountAmountSalesOnly,
                    0 //(item.article as ArticleBasketOnTicket).markupAmountSalesOnly)
                    ) *
                item.quantity;
        // here I do not apply discount since this is a purchase
        // if needed consider creating an additional field discountAmountPurchaseOnly
      } else if (item.isUncountable) {
        // item.quantity == 1 for uncountable
        return value + ((item.article as ArticleUncountableOnTicket).cost);
      } else {
        return value +
            ((item.article as ArticleRetailOnTicket).cost * item.quantity);
      }
    });