boutiqueCLFinFlows method

List<FinFlow> boutiqueCLFinFlows(
  1. DateRange dateRange,
  2. List<FinFlow> flows, {
  3. int shopId = 0,
})

Implementation

List<FinFlow> boutiqueCLFinFlows(DateRange dateRange, List<FinFlow> flows,
    {int shopId = 0}) {
  var closingsFilteredById = this;
  if (shopId != 0) {
    closingsFilteredById = where(
      (c) => c.boutiqueId == shopId,
    ).toList();
  }
  for (final c in closingsFilteredById) {
    if ((c.closingRange.start.isAfter(dateRange.start) ||
            c.closingRange.start.isAtSameMomentAs(dateRange.start)) &&
        (c.closingRange.end.isBefore(dateRange.end) ||
            c.closingRange.start.isAtSameMomentAs(dateRange.start))) {
      flows.sell.sumClosings += c.sell;
      flows.sellCovered.sumClosings += c.sellCovered;
      flows.sellDeferred.sumClosings += c.sellDeferred;
      flows.spend.sumClosings += c.spend;
      flows.spendCovered.sumClosings += c.spendCovered;
      flows.spendDeferred.sumClosings += c.spendDeferred;
      flows.wage.sumClosings += c.wage;
    }
  }
  return flows;
}