contactClFinFlows method

List<FinFlow> contactClFinFlows(
  1. int herderId,
  2. DateRange dateRange,
  3. List<FinFlow> flows
)

Implementation

List<FinFlow> contactClFinFlows(
    int herderId, DateRange dateRange, List<FinFlow> flows) {
  //print('function dateRange start ${dateRange.startDate}');
  //print('function dateRange endDate ${dateRange.endDate}');
  //print('first c startDate ${first.closingRange.startDate}');
  //print('first c endDate ${first.closingRange.endDate}');
  //print('last c startDate ${last.closingRange.startDate}');
  //print('last c endDate ${last.closingRange.endDate}');
  forEach((c) {
    if (c.contactId == herderId) {
      if ((c.closingRange.start.isAtSameMomentAs(dateRange.start) ||
              c.closingRange.start.isAfter(dateRange.start)) &&
          (c.closingRange.end.isAtSameMomentAs(dateRange.end) ||
              c.closingRange.end.isBefore(dateRange.end))) {
        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;
}