taxtank-core 2.0.79 → 2.0.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9401,6 +9401,9 @@ class BudgetRuleCollection extends Collection {
9401
9401
  get calendarEvents() {
9402
9402
  return this.mapBy('calendarEvents').flat();
9403
9403
  }
9404
+ getByMonth(index) {
9405
+ return new BudgetRuleCollection(this.items.filter(rule => rule.inMonth(index)));
9406
+ }
9404
9407
  }
9405
9408
 
9406
9409
  class AllocationGroupCollection extends Collection {
@@ -11575,7 +11578,7 @@ class BudgetRule extends BudgetRule$1 {
11575
11578
  extendedProps: {
11576
11579
  id: this.id,
11577
11580
  class: BudgetRule.className,
11578
- amount: this.chartAccounts.isExpense() ? -this.amount : this.amount,
11581
+ amount: this.amount,
11579
11582
  isIncome: this.chartAccounts.isIncome(),
11580
11583
  isExpense: this.chartAccounts.isExpense(),
11581
11584
  isProperty: this.chartAccounts.isPropertyTank(),
@@ -11589,6 +11592,19 @@ class BudgetRule extends BudgetRule$1 {
11589
11592
  }
11590
11593
  }));
11591
11594
  }
11595
+ inMonth(month) {
11596
+ if (!this.endDate) {
11597
+ return this.startDate.getMonth() === month;
11598
+ }
11599
+ let year = new FinancialYear().year;
11600
+ // previous calendar year after july (new financial year)
11601
+ if (month >= 6) {
11602
+ year -= 1;
11603
+ }
11604
+ // utc to match startDate/endDate time (from server)
11605
+ const date = new Date(Date.UTC(year, month, this.startDate.getDate()));
11606
+ return this.startDate <= date && this.endDate >= date;
11607
+ }
11592
11608
  }
11593
11609
  __decorate([
11594
11610
  Type(() => Budget)