taxtank-core 3.0.13 → 3.0.14
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.
- package/fesm2022/taxtank-core.mjs +22 -11
- package/fesm2022/taxtank-core.mjs.map +1 -1
- package/index.d.ts +3 -4
- package/package.json +1 -1
|
@@ -8241,7 +8241,19 @@ class DepreciationCollection extends TransactionBaseCollection {
|
|
|
8241
8241
|
getForecasts() {
|
|
8242
8242
|
return new DepreciationForecastCollection(this.map(depreciation => depreciation.forecasts).flat());
|
|
8243
8243
|
}
|
|
8244
|
-
getCurrentYearForecastAmount() {
|
|
8244
|
+
getCurrentYearForecastAmount(dateRange = null) {
|
|
8245
|
+
if (dateRange) {
|
|
8246
|
+
const financialYear = new FinancialYear();
|
|
8247
|
+
let amount = 0;
|
|
8248
|
+
this.items.forEach(depreciation => {
|
|
8249
|
+
const forecast = depreciation.currentYearForecast;
|
|
8250
|
+
const from = moment.max(moment(forecast.fromDate).startOf('day'), moment(dateRange[0] ?? financialYear.startDate).startOf('day'));
|
|
8251
|
+
const to = moment.min(moment(forecast.toDate).startOf('day'), moment(dateRange[1] ?? financialYear.endDate).startOf('day'));
|
|
8252
|
+
const days = to.diff(from, 'days');
|
|
8253
|
+
amount += depreciation.currentYearForecast.dailyClaimAmount * days;
|
|
8254
|
+
});
|
|
8255
|
+
return amount;
|
|
8256
|
+
}
|
|
8245
8257
|
return this.sumBy('currentYearForecast.amount');
|
|
8246
8258
|
}
|
|
8247
8259
|
get closeBalance() {
|
|
@@ -9125,10 +9137,9 @@ const DEPRECIATION_TYPE_LABELS = {
|
|
|
9125
9137
|
* Class with depreciation-based property transactions report entities
|
|
9126
9138
|
*/
|
|
9127
9139
|
class PropertyReportItemDepreciation extends PropertyReportItem {
|
|
9128
|
-
constructor(depreciations, property, chartAccounts) {
|
|
9140
|
+
constructor(depreciations, property, chartAccounts, dateRange) {
|
|
9129
9141
|
super(property, chartAccounts);
|
|
9130
|
-
this.
|
|
9131
|
-
this.amount = Math.abs(depreciations.getCurrentYearForecastAmount());
|
|
9142
|
+
this.amount = Math.abs(depreciations.getCurrentYearForecastAmount(dateRange));
|
|
9132
9143
|
this.description = DEPRECIATION_TYPE_LABELS[depreciations.first.type];
|
|
9133
9144
|
}
|
|
9134
9145
|
get claimAmount() {
|
|
@@ -9482,16 +9493,16 @@ class PropertyReportItemCollection extends Collection {
|
|
|
9482
9493
|
* Collection to work with depreciation-based property report items
|
|
9483
9494
|
*/
|
|
9484
9495
|
class PropertyReportItemDepreciationCollection extends PropertyReportItemCollection {
|
|
9485
|
-
constructor(depreciations, properties, chartAccounts) {
|
|
9496
|
+
constructor(depreciations, properties, chartAccounts, dateRange) {
|
|
9486
9497
|
super();
|
|
9487
|
-
this.setItems(depreciations, properties, chartAccounts);
|
|
9498
|
+
this.setItems(depreciations, properties, chartAccounts, dateRange);
|
|
9488
9499
|
}
|
|
9489
|
-
setItems(depreciations, properties, chartAccounts) {
|
|
9500
|
+
setItems(depreciations, properties, chartAccounts, dateRange) {
|
|
9490
9501
|
this.items = [];
|
|
9491
9502
|
properties.items.forEach((property) => {
|
|
9492
9503
|
const depreciationsByType = depreciations.filterBy('property.id', property.id).groupBy('type');
|
|
9493
9504
|
depreciationsByType.keys.map((type) => {
|
|
9494
|
-
this.items.push(new PropertyReportItemDepreciation(depreciationsByType.get(type), property, chartAccounts.findBy('id', depreciationsByType.get(type).first.chartAccounts.id)));
|
|
9505
|
+
this.items.push(new PropertyReportItemDepreciation(depreciationsByType.get(type), property, chartAccounts.findBy('id', depreciationsByType.get(type).first.chartAccounts.id), dateRange));
|
|
9495
9506
|
});
|
|
9496
9507
|
});
|
|
9497
9508
|
}
|
|
@@ -24564,12 +24575,12 @@ class PropertyTransactionReportService {
|
|
|
24564
24575
|
}));
|
|
24565
24576
|
}
|
|
24566
24577
|
filter(filterForm) {
|
|
24567
|
-
return this.create(filterForm.filter(this.transactions),
|
|
24578
|
+
return this.create(filterForm.filter(this.transactions), this.depreciations, this.properties, this.chartAccounts, filterForm.value.dateRange);
|
|
24568
24579
|
}
|
|
24569
|
-
create(transactions, depreciations, properties, chartAccounts) {
|
|
24580
|
+
create(transactions, depreciations, properties, chartAccounts, dateRange = null) {
|
|
24570
24581
|
return new PropertyReportItemCollection([
|
|
24571
24582
|
...new PropertyReportItemTransactionCollection(transactions, properties, chartAccounts).items,
|
|
24572
|
-
...new PropertyReportItemDepreciationCollection(depreciations, properties, chartAccounts).items,
|
|
24583
|
+
...new PropertyReportItemDepreciationCollection(depreciations, properties, chartAccounts, dateRange).items,
|
|
24573
24584
|
]).sortBy('subCode', 'asc').groupBy('propertyId');
|
|
24574
24585
|
}
|
|
24575
24586
|
/**
|