public GncCommodityAmount GetTotalConverted(DateInterval interval, bool withSubaccts, GncCommodity convertTo) { var result = new GncCommodityAmount(0, convertTo); foreach (var split in EnumSplits(withSubaccts).Where(spl => interval.Contains(spl.Transaction.DatePosted))) { result += split.AmountConverted(convertTo); } return(result); }
public GncCommodityAmount GetBalanceConverted(DateTime asOf, bool withSubaccts, GncCommodity convertTo) { var result = new GncCommodityAmount(0, convertTo); foreach (var split in EnumSplits(withSubaccts).Where(spl => spl.Transaction.DatePosted <= asOf)) { result += split.AmountConverted(convertTo); } return(result.WithTimepoint(asOf)); }