taxtank-core 0.28.65 → 0.28.66
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/bundles/taxtank-core.umd.js +310 -74
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/depreciation.collection.js +17 -1
- package/esm2015/lib/collections/transaction/transaction-base.collection.js +13 -1
- package/esm2015/lib/collections/transaction/transaction.collection.js +36 -8
- package/esm2015/lib/db/Enums/annual-frequency.enum.js +9 -0
- package/esm2015/lib/db/Enums/index.js +2 -1
- package/esm2015/lib/db/Models/sole/bas-report.js +3 -0
- package/esm2015/lib/db/Models/sole/sole-details.js +1 -1
- package/esm2015/lib/db/Models/transaction/transaction-base.js +25 -4
- package/esm2015/lib/forms/abstract.form.js +5 -2
- package/esm2015/lib/forms/sole/bas-report.form.js +62 -0
- package/esm2015/lib/forms/sole/index.js +2 -1
- package/esm2015/lib/models/depreciation/depreciation.js +25 -3
- package/esm2015/lib/models/report/property/property-report-item-transaction.js +2 -2
- package/esm2015/lib/models/sole/bas-report.js +21 -0
- package/esm2015/lib/models/sole/index.js +2 -1
- package/esm2015/lib/models/transaction/transaction.js +21 -42
- package/esm2015/lib/services/http/sole/bas-report/bas-report.service.js +21 -0
- package/esm2015/lib/services/http/sole/index.js +2 -1
- package/esm2015/lib/services/http/sole/sole-invoice/sole-invoice.service.js +1 -2
- package/fesm2015/taxtank-core.js +248 -64
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/depreciation.collection.d.ts +11 -0
- package/lib/collections/transaction/transaction-base.collection.d.ts +7 -0
- package/lib/collections/transaction/transaction.collection.d.ts +19 -2
- package/lib/db/Enums/annual-frequency.enum.d.ts +7 -0
- package/lib/db/Enums/index.d.ts +1 -0
- package/lib/db/Models/sole/bas-report.d.ts +15 -0
- package/lib/db/Models/sole/sole-details.d.ts +2 -0
- package/lib/db/Models/transaction/transaction-base.d.ts +6 -2
- package/lib/forms/abstract.form.d.ts +1 -0
- package/lib/forms/sole/bas-report.form.d.ts +16 -0
- package/lib/forms/sole/index.d.ts +1 -0
- package/lib/models/depreciation/depreciation.d.ts +5 -0
- package/lib/models/sole/bas-report.d.ts +10 -0
- package/lib/models/sole/index.d.ts +1 -0
- package/lib/models/transaction/transaction.d.ts +7 -16
- package/lib/services/http/sole/bas-report/bas-report.service.d.ts +11 -0
- package/lib/services/http/sole/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -3634,6 +3634,13 @@
|
|
|
3634
3634
|
function TransactionBase() {
|
|
3635
3635
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
3636
3636
|
}
|
|
3637
|
+
Object.defineProperty(TransactionBase.prototype, "claimRatio", {
|
|
3638
|
+
get: function () {
|
|
3639
|
+
return this.claimPercent / 100;
|
|
3640
|
+
},
|
|
3641
|
+
enumerable: false,
|
|
3642
|
+
configurable: true
|
|
3643
|
+
});
|
|
3637
3644
|
Object.defineProperty(TransactionBase.prototype, "tankType", {
|
|
3638
3645
|
get: function () {
|
|
3639
3646
|
switch (true) {
|
|
@@ -3682,12 +3689,41 @@
|
|
|
3682
3689
|
}
|
|
3683
3690
|
return !!this.business;
|
|
3684
3691
|
};
|
|
3685
|
-
TransactionBase.prototype
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3692
|
+
Object.defineProperty(TransactionBase.prototype, "amountWithGst", {
|
|
3693
|
+
get: function () {
|
|
3694
|
+
return this.isGST ? +(this.amount * ChartAccounts.GSTCoefficient).toFixed(2) : this.amount;
|
|
3695
|
+
},
|
|
3696
|
+
enumerable: false,
|
|
3697
|
+
configurable: true
|
|
3698
|
+
});
|
|
3699
|
+
Object.defineProperty(TransactionBase.prototype, "gstAmount", {
|
|
3700
|
+
get: function () {
|
|
3701
|
+
return +(this.amountWithGst - this.amount).toFixed(2);
|
|
3702
|
+
},
|
|
3703
|
+
enumerable: false,
|
|
3704
|
+
configurable: true
|
|
3705
|
+
});
|
|
3706
|
+
Object.defineProperty(TransactionBase.prototype, "gstClaimAmount", {
|
|
3707
|
+
get: function () {
|
|
3708
|
+
return this.gstAmount * this.claimRatio;
|
|
3709
|
+
},
|
|
3710
|
+
enumerable: false,
|
|
3711
|
+
configurable: true
|
|
3712
|
+
});
|
|
3713
|
+
Object.defineProperty(TransactionBase.prototype, "grossAmount", {
|
|
3714
|
+
get: function () {
|
|
3715
|
+
return this.amount + this.gstAmount;
|
|
3716
|
+
},
|
|
3717
|
+
enumerable: false,
|
|
3718
|
+
configurable: true
|
|
3719
|
+
});
|
|
3720
|
+
Object.defineProperty(TransactionBase.prototype, "grossClaimAmount", {
|
|
3721
|
+
get: function () {
|
|
3722
|
+
return +(this.grossAmount * (this.claimPercent / 100)).toFixed(2);
|
|
3723
|
+
},
|
|
3724
|
+
enumerable: false,
|
|
3725
|
+
configurable: true
|
|
3726
|
+
});
|
|
3691
3727
|
return TransactionBase;
|
|
3692
3728
|
}(AbstractModel));
|
|
3693
3729
|
__decorate([
|
|
@@ -3698,6 +3734,15 @@
|
|
|
3698
3734
|
return obj.file;
|
|
3699
3735
|
})
|
|
3700
3736
|
], TransactionBase.prototype, "file", void 0);
|
|
3737
|
+
__decorate([
|
|
3738
|
+
classTransformer.Exclude()
|
|
3739
|
+
], TransactionBase.prototype, "amountWithGst", null);
|
|
3740
|
+
__decorate([
|
|
3741
|
+
classTransformer.Exclude()
|
|
3742
|
+
], TransactionBase.prototype, "gstAmount", null);
|
|
3743
|
+
__decorate([
|
|
3744
|
+
classTransformer.Exclude()
|
|
3745
|
+
], TransactionBase.prototype, "gstClaimAmount", null);
|
|
3701
3746
|
|
|
3702
3747
|
var Transaction$1 = /** @class */ (function (_super) {
|
|
3703
3748
|
__extends(Transaction, _super);
|
|
@@ -4173,15 +4218,6 @@
|
|
|
4173
4218
|
classTransformer.Type(function () { return Transaction; })
|
|
4174
4219
|
], TransactionAllocation.prototype, "transaction", void 0);
|
|
4175
4220
|
|
|
4176
|
-
/**
|
|
4177
|
-
* Enum with income amount types (Net or Gross)
|
|
4178
|
-
*/
|
|
4179
|
-
exports.IncomeAmountTypeEnum = void 0;
|
|
4180
|
-
(function (IncomeAmountTypeEnum) {
|
|
4181
|
-
IncomeAmountTypeEnum[IncomeAmountTypeEnum["NET"] = 0] = "NET";
|
|
4182
|
-
IncomeAmountTypeEnum[IncomeAmountTypeEnum["GROSS"] = 1] = "GROSS";
|
|
4183
|
-
})(exports.IncomeAmountTypeEnum || (exports.IncomeAmountTypeEnum = {}));
|
|
4184
|
-
|
|
4185
4221
|
var Depreciation$1 = /** @class */ (function (_super) {
|
|
4186
4222
|
__extends(Depreciation, _super);
|
|
4187
4223
|
function Depreciation() {
|
|
@@ -4392,7 +4428,12 @@
|
|
|
4392
4428
|
*/
|
|
4393
4429
|
Depreciation.prototype.toTransaction = function (params) {
|
|
4394
4430
|
if (params === void 0) { params = {}; }
|
|
4395
|
-
|
|
4431
|
+
var _a, _b;
|
|
4432
|
+
return classTransformer.plainToClass(Transaction, Object.assign(params, this, {
|
|
4433
|
+
amount: -((_a = this.currentYearForecast) === null || _a === void 0 ? void 0 : _a.amount) || 0,
|
|
4434
|
+
claimAmount: ((_b = this.currentYearForecast) === null || _b === void 0 ? void 0 : _b.claimAmount) || 0,
|
|
4435
|
+
date: this.purchaseDate
|
|
4436
|
+
}));
|
|
4396
4437
|
};
|
|
4397
4438
|
Object.defineProperty(Depreciation.prototype, "claimAmount", {
|
|
4398
4439
|
/**
|
|
@@ -4405,6 +4446,28 @@
|
|
|
4405
4446
|
enumerable: false,
|
|
4406
4447
|
configurable: true
|
|
4407
4448
|
});
|
|
4449
|
+
Object.defineProperty(Depreciation.prototype, "amountWithGst", {
|
|
4450
|
+
get: function () {
|
|
4451
|
+
// only new assets
|
|
4452
|
+
if (new FinancialYear(this.purchaseDate).year !== new FinancialYear().year) {
|
|
4453
|
+
return this.amount;
|
|
4454
|
+
}
|
|
4455
|
+
return _super.prototype.amountWithGst;
|
|
4456
|
+
},
|
|
4457
|
+
enumerable: false,
|
|
4458
|
+
configurable: true
|
|
4459
|
+
});
|
|
4460
|
+
Object.defineProperty(Depreciation.prototype, "grossAmount", {
|
|
4461
|
+
/**
|
|
4462
|
+
* @TODO temporary hack, in future backend should return negative numbers
|
|
4463
|
+
*/
|
|
4464
|
+
get: function () {
|
|
4465
|
+
var _a;
|
|
4466
|
+
return -((_a = this.currentYearForecast) === null || _a === void 0 ? void 0 : _a.amount) - this.gstAmount;
|
|
4467
|
+
},
|
|
4468
|
+
enumerable: false,
|
|
4469
|
+
configurable: true
|
|
4470
|
+
});
|
|
4408
4471
|
return Depreciation;
|
|
4409
4472
|
}(Depreciation$1));
|
|
4410
4473
|
Depreciation.WRITTEN_OFF_THRESHOLD = 300;
|
|
@@ -4429,8 +4492,8 @@
|
|
|
4429
4492
|
], Depreciation.prototype, "depreciationCapitalProject", void 0);
|
|
4430
4493
|
__decorate([
|
|
4431
4494
|
classTransformer.Type(function () { return DepreciationForecast; }),
|
|
4432
|
-
classTransformer.Transform(function (
|
|
4433
|
-
var value =
|
|
4495
|
+
classTransformer.Transform(function (_c) {
|
|
4496
|
+
var value = _c.value, obj = _c.obj;
|
|
4434
4497
|
// value = array of DepreciationForecast
|
|
4435
4498
|
// obj = plain (whole Depreciation object)
|
|
4436
4499
|
// Set isLVP flag for each DepreciationForecast
|
|
@@ -4452,6 +4515,9 @@
|
|
|
4452
4515
|
__decorate([
|
|
4453
4516
|
classTransformer.Type(function () { return BankTransaction; })
|
|
4454
4517
|
], Depreciation.prototype, "bankTransaction", void 0);
|
|
4518
|
+
__decorate([
|
|
4519
|
+
classTransformer.Exclude()
|
|
4520
|
+
], Depreciation.prototype, "amountWithGst", null);
|
|
4455
4521
|
|
|
4456
4522
|
// @TODO Alex: refactor: move here allocations methods, netAmount = amount, grossAmount calculation, remove unused methods, etc.
|
|
4457
4523
|
var Transaction = /** @class */ (function (_super) {
|
|
@@ -4474,13 +4540,21 @@
|
|
|
4474
4540
|
Transaction.prototype.isCredit = function () {
|
|
4475
4541
|
return this.type === exports.TransactionTypeEnum.CREDIT;
|
|
4476
4542
|
};
|
|
4543
|
+
/**
|
|
4544
|
+
* @TODO move to base collection
|
|
4545
|
+
*/
|
|
4477
4546
|
Transaction.prototype.isIncome = function () {
|
|
4547
|
+
// @TODO not used
|
|
4478
4548
|
if (!this.chartAccounts) {
|
|
4479
4549
|
return this.isCredit();
|
|
4480
4550
|
}
|
|
4481
4551
|
return CHART_ACCOUNTS_CATEGORIES.income.includes(this.chartAccounts.category);
|
|
4482
4552
|
};
|
|
4553
|
+
/**
|
|
4554
|
+
* @TODO move to base collection
|
|
4555
|
+
*/
|
|
4483
4556
|
Transaction.prototype.isExpense = function () {
|
|
4557
|
+
// @TODO not used
|
|
4484
4558
|
if (!this.chartAccounts) {
|
|
4485
4559
|
return this.isDebit();
|
|
4486
4560
|
}
|
|
@@ -4489,6 +4563,9 @@
|
|
|
4489
4563
|
Transaction.prototype.isPersonal = function () {
|
|
4490
4564
|
return CHART_ACCOUNTS_CATEGORIES.personal.includes(this.chartAccounts.category);
|
|
4491
4565
|
};
|
|
4566
|
+
Transaction.prototype.isInterest = function () {
|
|
4567
|
+
return this.chartAccounts.id === exports.ChartAccountsListEnum.INTEREST_ON_LOAN;
|
|
4568
|
+
};
|
|
4492
4569
|
Object.defineProperty(Transaction.prototype, "chartAccountsCategories", {
|
|
4493
4570
|
get: function () {
|
|
4494
4571
|
switch (true) {
|
|
@@ -4527,21 +4604,6 @@
|
|
|
4527
4604
|
Transaction.prototype.isVehicleTransaction = function () {
|
|
4528
4605
|
return this.chartAccounts.isVehicleExpense();
|
|
4529
4606
|
};
|
|
4530
|
-
/**
|
|
4531
|
-
* Get net amount (clean amount after all deductions)
|
|
4532
|
-
* @TODO Alex: remove, this.amount should be netAmount actually
|
|
4533
|
-
*/
|
|
4534
|
-
Transaction.prototype.getNetAmount = function () {
|
|
4535
|
-
// @TODO fix hack while transactions refactoring (use class-transformer)
|
|
4536
|
-
return +(Math.round(this.getIncomeAmountByType(exports.IncomeAmountTypeEnum.NET) * 100) / 100).toFixed(2);
|
|
4537
|
-
};
|
|
4538
|
-
/**
|
|
4539
|
-
* Get gross income amount
|
|
4540
|
-
*/
|
|
4541
|
-
Transaction.prototype.getGrossIncome = function () {
|
|
4542
|
-
// @TODO fix hack while transactions refactoring (use class-transformer)
|
|
4543
|
-
return +(Math.round(this.getIncomeAmountByType(exports.IncomeAmountTypeEnum.GROSS) * 100) / 100).toFixed(2);
|
|
4544
|
-
};
|
|
4545
4607
|
Object.defineProperty(Transaction.prototype, "taxFreeComponent", {
|
|
4546
4608
|
get: function () {
|
|
4547
4609
|
return this.getMetadataFieldValue(exports.ChartAccountsMetadataListEnum.TAX_FREE_COMPONENT);
|
|
@@ -4612,29 +4674,6 @@
|
|
|
4612
4674
|
return transactionMetadata.chartAccountsMetadata.id === field;
|
|
4613
4675
|
})) === null || _a === void 0 ? void 0 : _a.value) || 0;
|
|
4614
4676
|
};
|
|
4615
|
-
/**
|
|
4616
|
-
* Returns Net or Gross income amount based on provided income type
|
|
4617
|
-
* @param incomeType by which amount should be returned
|
|
4618
|
-
*/
|
|
4619
|
-
Transaction.prototype.getIncomeAmountByType = function (incomeType) {
|
|
4620
|
-
// modifier that determines whether the values of the transaction fields will be added or subtracted
|
|
4621
|
-
var modifier = incomeType === exports.IncomeAmountTypeEnum.GROSS ? 1 : -1;
|
|
4622
|
-
switch (true) {
|
|
4623
|
-
case this.isPropertyTank():
|
|
4624
|
-
return this.amount +
|
|
4625
|
-
(this.transactions
|
|
4626
|
-
.reduce(function (sum, transaction) { return sum + Math.abs(transaction.amount); }, 0) * modifier);
|
|
4627
|
-
case this.isWorkTank():
|
|
4628
|
-
return this.amount + ((this.tax + this.frankingCredit - this.taxFreeComponent - this.eligibleForReduction) * modifier);
|
|
4629
|
-
case this.isSoleTank():
|
|
4630
|
-
return this.amount + this.tax * modifier;
|
|
4631
|
-
default:
|
|
4632
|
-
return this.amount || 0;
|
|
4633
|
-
}
|
|
4634
|
-
};
|
|
4635
|
-
Transaction.prototype.isInterest = function () {
|
|
4636
|
-
return this.chartAccounts.id === exports.ChartAccountsListEnum.INTEREST_ON_LOAN;
|
|
4637
|
-
};
|
|
4638
4677
|
Transaction.prototype.isCash = function () {
|
|
4639
4678
|
return this.source === exports.TransactionSourceEnum.CASH;
|
|
4640
4679
|
};
|
|
@@ -4674,10 +4713,17 @@
|
|
|
4674
4713
|
Object.defineProperty(Transaction.prototype, "grossAmount", {
|
|
4675
4714
|
/**
|
|
4676
4715
|
* Total transaction amount including taxes and other additional amounts
|
|
4677
|
-
* @TODO Alex: refactor everything related to amounts
|
|
4678
4716
|
*/
|
|
4679
4717
|
get: function () {
|
|
4680
|
-
|
|
4718
|
+
var grossAmount = _super.prototype.grossAmount + this.tax;
|
|
4719
|
+
if (this.isExpense()) {
|
|
4720
|
+
return grossAmount;
|
|
4721
|
+
}
|
|
4722
|
+
grossAmount += this.transactions.reduce(function (sum, transaction) { return sum + Math.abs(transaction.amount); }, 0);
|
|
4723
|
+
if (this.isWorkTank()) {
|
|
4724
|
+
grossAmount += this.frankingCredit - this.taxFreeComponent - this.eligibleForReduction;
|
|
4725
|
+
}
|
|
4726
|
+
return +(Math.round(grossAmount * 100) / 100).toFixed(2);
|
|
4681
4727
|
},
|
|
4682
4728
|
enumerable: false,
|
|
4683
4729
|
configurable: true
|
|
@@ -5348,6 +5394,43 @@
|
|
|
5348
5394
|
classTransformer.Type(function () { return User; })
|
|
5349
5395
|
], SoleDetails.prototype, "user", void 0);
|
|
5350
5396
|
|
|
5397
|
+
var BasReport$1 = /** @class */ (function () {
|
|
5398
|
+
function BasReport() {
|
|
5399
|
+
}
|
|
5400
|
+
return BasReport;
|
|
5401
|
+
}());
|
|
5402
|
+
|
|
5403
|
+
var BasReport = /** @class */ (function (_super) {
|
|
5404
|
+
__extends(BasReport, _super);
|
|
5405
|
+
function BasReport() {
|
|
5406
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
5407
|
+
}
|
|
5408
|
+
Object.defineProperty(BasReport.prototype, "taxWithheldTotal", {
|
|
5409
|
+
get: function () {
|
|
5410
|
+
return this.taxWithheldSalary + this.taxWithheldNoABN;
|
|
5411
|
+
},
|
|
5412
|
+
enumerable: false,
|
|
5413
|
+
configurable: true
|
|
5414
|
+
});
|
|
5415
|
+
Object.defineProperty(BasReport.prototype, "gst", {
|
|
5416
|
+
/**
|
|
5417
|
+
* GST payable to the ATO, or refundable from the ATO in case it's negative
|
|
5418
|
+
*/
|
|
5419
|
+
get: function () {
|
|
5420
|
+
return this.incomeGST - this.expenseGST + this.taxWithheldTotal + this.paygTaxInstalment - this.fuelTaxCredit;
|
|
5421
|
+
},
|
|
5422
|
+
enumerable: false,
|
|
5423
|
+
configurable: true
|
|
5424
|
+
});
|
|
5425
|
+
return BasReport;
|
|
5426
|
+
}(BasReport$1));
|
|
5427
|
+
__decorate([
|
|
5428
|
+
classTransformer.Type(function () { return Date; })
|
|
5429
|
+
], BasReport.prototype, "dateFrom", void 0);
|
|
5430
|
+
__decorate([
|
|
5431
|
+
classTransformer.Type(function () { return Date; })
|
|
5432
|
+
], BasReport.prototype, "dateTo", void 0);
|
|
5433
|
+
|
|
5351
5434
|
var User = /** @class */ (function (_super) {
|
|
5352
5435
|
__extends(User, _super);
|
|
5353
5436
|
function User() {
|
|
@@ -7718,19 +7801,32 @@
|
|
|
7718
7801
|
var MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan'];
|
|
7719
7802
|
|
|
7720
7803
|
/**
|
|
7804
|
+
* @TODO extend from TransactionBaseCollection
|
|
7721
7805
|
* Collection of transactions
|
|
7722
7806
|
*/
|
|
7723
7807
|
var TransactionCollection = /** @class */ (function (_super) {
|
|
7724
7808
|
__extends(TransactionCollection, _super);
|
|
7725
|
-
|
|
7726
|
-
|
|
7809
|
+
/**
|
|
7810
|
+
* @TODO use TransactionBaseCollection instead
|
|
7811
|
+
* we use depreciations as expense transactions a lot
|
|
7812
|
+
*/
|
|
7813
|
+
function TransactionCollection(transactions, depreciations) {
|
|
7814
|
+
if (transactions === void 0) { transactions = []; }
|
|
7815
|
+
if (depreciations === void 0) { depreciations = []; }
|
|
7816
|
+
return _super.call(this, __spreadArray(__spreadArray([], __read(transactions)), __read(depreciations.map(function (depreciation) { return depreciation.toTransaction(); })))) || this;
|
|
7727
7817
|
}
|
|
7818
|
+
/**
|
|
7819
|
+
* Get business related transactions
|
|
7820
|
+
*/
|
|
7821
|
+
TransactionCollection.prototype.getWithBusiness = function () {
|
|
7822
|
+
return this.filter(function (transaction) { return !!transaction.business; });
|
|
7823
|
+
};
|
|
7728
7824
|
Object.defineProperty(TransactionCollection.prototype, "amount", {
|
|
7729
7825
|
/**
|
|
7730
7826
|
* Get total amount of all transactions in the collection
|
|
7731
7827
|
*/
|
|
7732
7828
|
get: function () {
|
|
7733
|
-
return +this.items.reduce(function (sum, transaction) { return sum + transaction.
|
|
7829
|
+
return +this.items.reduce(function (sum, transaction) { return sum + transaction.amount; }, 0).toFixed(2);
|
|
7734
7830
|
},
|
|
7735
7831
|
enumerable: false,
|
|
7736
7832
|
configurable: true
|
|
@@ -7771,13 +7867,6 @@
|
|
|
7771
7867
|
enumerable: false,
|
|
7772
7868
|
configurable: true
|
|
7773
7869
|
});
|
|
7774
|
-
Object.defineProperty(TransactionCollection.prototype, "grossAmount", {
|
|
7775
|
-
get: function () {
|
|
7776
|
-
return +this.items.reduce(function (sum, transaction) { return sum + transaction.amount; }, 0).toFixed(2);
|
|
7777
|
-
},
|
|
7778
|
-
enumerable: false,
|
|
7779
|
-
configurable: true
|
|
7780
|
-
});
|
|
7781
7870
|
TransactionCollection.prototype.getByChartAccountsCategories = function (categories) {
|
|
7782
7871
|
return new TransactionCollection(this.items.filter(function (transaction) { return categories.includes(transaction.chartAccounts.category); }));
|
|
7783
7872
|
};
|
|
@@ -7801,6 +7890,9 @@
|
|
|
7801
7890
|
TransactionCollection.prototype.getIncomeTransactions = function () {
|
|
7802
7891
|
return new TransactionCollection(this.items.filter(function (transaction) { return transaction.isIncome(); }));
|
|
7803
7892
|
};
|
|
7893
|
+
TransactionCollection.prototype.getExpenseTransactions = function () {
|
|
7894
|
+
return new TransactionCollection(this.items.filter(function (transaction) { return transaction.isExpense() && !transaction.isInterest(); }));
|
|
7895
|
+
};
|
|
7804
7896
|
Object.defineProperty(TransactionCollection.prototype, "claimIncome", {
|
|
7805
7897
|
get: function () {
|
|
7806
7898
|
return this.getIncomeTransactions().claimAmount;
|
|
@@ -7808,9 +7900,6 @@
|
|
|
7808
7900
|
enumerable: false,
|
|
7809
7901
|
configurable: true
|
|
7810
7902
|
});
|
|
7811
|
-
TransactionCollection.prototype.getExpenseTransactions = function () {
|
|
7812
|
-
return new TransactionCollection(this.items.filter(function (transaction) { return transaction.isExpense() && !transaction.isInterest(); }));
|
|
7813
|
-
};
|
|
7814
7903
|
Object.defineProperty(TransactionCollection.prototype, "claimExpense", {
|
|
7815
7904
|
get: function () {
|
|
7816
7905
|
return this.getExpenseTransactions().claimAmount;
|
|
@@ -7958,6 +8047,22 @@
|
|
|
7958
8047
|
});
|
|
7959
8048
|
return chartData;
|
|
7960
8049
|
};
|
|
8050
|
+
/**
|
|
8051
|
+
* user pays GST only from allocated part of income (the rest user didn't get, so don't have to pay)
|
|
8052
|
+
*
|
|
8053
|
+
* @param allocations
|
|
8054
|
+
*/
|
|
8055
|
+
TransactionCollection.prototype.calculateAllocatedGST = function (allocations) {
|
|
8056
|
+
var allocationsByTransaction = allocations.groupBy('transaction.id');
|
|
8057
|
+
var allocatedGST = 0;
|
|
8058
|
+
this.filterBy('isGST', true).toArray().forEach(function (transaction) {
|
|
8059
|
+
allocatedGST += allocationsByTransaction.get(transaction.id).sumBy('amount') * transaction.claimRatio * ChartAccounts.GSTRatio;
|
|
8060
|
+
});
|
|
8061
|
+
return allocatedGST;
|
|
8062
|
+
};
|
|
8063
|
+
TransactionCollection.prototype.getAllocatedAmount = function (allocations) {
|
|
8064
|
+
return allocations.getByTransactionsIds(this.getIds()).sumBy('amount');
|
|
8065
|
+
};
|
|
7961
8066
|
return TransactionCollection;
|
|
7962
8067
|
}(ExportableCollection));
|
|
7963
8068
|
|
|
@@ -8009,11 +8114,17 @@
|
|
|
8009
8114
|
return TransactionAllocationCollection;
|
|
8010
8115
|
}(Collection));
|
|
8011
8116
|
|
|
8117
|
+
/**
|
|
8118
|
+
* used to combine transactions/depreciations
|
|
8119
|
+
*/
|
|
8012
8120
|
var TransactionBaseCollection = /** @class */ (function (_super) {
|
|
8013
8121
|
__extends(TransactionBaseCollection, _super);
|
|
8014
8122
|
function TransactionBaseCollection() {
|
|
8015
8123
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
8016
8124
|
}
|
|
8125
|
+
TransactionBaseCollection.prototype.filterByBusiness = function (business) {
|
|
8126
|
+
return this.filterBy('business.id', business.id);
|
|
8127
|
+
};
|
|
8017
8128
|
TransactionBaseCollection.prototype.getClaimAmountByBusinessId = function (businessId) {
|
|
8018
8129
|
return +this.filterBy('business.id', businessId).items.map(function (transaction) { return transaction instanceof Depreciation ? -transaction.claimAmount : transaction['claimAmount']; }).reduce(function (sum, claimAmount) { return sum + claimAmount; }, 0).toFixed(2);
|
|
8019
8130
|
};
|
|
@@ -8023,6 +8134,12 @@
|
|
|
8023
8134
|
TransactionBaseCollection.prototype.getWithBusiness = function () {
|
|
8024
8135
|
return this.filter(function (transaction) { return !!transaction.business; });
|
|
8025
8136
|
};
|
|
8137
|
+
TransactionBaseCollection.prototype.getIncomeTransactions = function () {
|
|
8138
|
+
return this.create(this.items.filter(function (transaction) { return transaction.isIncome(); }));
|
|
8139
|
+
};
|
|
8140
|
+
TransactionBaseCollection.prototype.getExpenseTransactions = function () {
|
|
8141
|
+
return this.create(this.items.filter(function (transaction) { return transaction.isExpense() && !transaction.isInterest(); }));
|
|
8142
|
+
};
|
|
8026
8143
|
return TransactionBaseCollection;
|
|
8027
8144
|
}(Collection));
|
|
8028
8145
|
|
|
@@ -8413,11 +8530,26 @@
|
|
|
8413
8530
|
return ClientPortfolioReportCollection;
|
|
8414
8531
|
}(Collection));
|
|
8415
8532
|
|
|
8533
|
+
/**
|
|
8534
|
+
* @TODO extend from TransactionBaseCollection
|
|
8535
|
+
*/
|
|
8416
8536
|
var DepreciationCollection = /** @class */ (function (_super) {
|
|
8417
8537
|
__extends(DepreciationCollection, _super);
|
|
8418
8538
|
function DepreciationCollection() {
|
|
8419
8539
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
8420
8540
|
}
|
|
8541
|
+
/**
|
|
8542
|
+
* Get business related transactions
|
|
8543
|
+
*/
|
|
8544
|
+
DepreciationCollection.prototype.getWithBusiness = function () {
|
|
8545
|
+
return this.filter(function (depreciation) { return !!depreciation.business; });
|
|
8546
|
+
};
|
|
8547
|
+
/**
|
|
8548
|
+
* assets purchased in the current financial year
|
|
8549
|
+
*/
|
|
8550
|
+
DepreciationCollection.prototype.getNew = function () {
|
|
8551
|
+
return this.filter(function (depreciation) { return new FinancialYear(depreciation.purchaseDate).year === new FinancialYear().year; });
|
|
8552
|
+
};
|
|
8421
8553
|
Object.defineProperty(DepreciationCollection.prototype, "amount", {
|
|
8422
8554
|
/**
|
|
8423
8555
|
* Get total amount of all depreciations in the collection
|
|
@@ -8835,7 +8967,7 @@
|
|
|
8835
8967
|
__extends(PropertyReportItemTransaction, _super);
|
|
8836
8968
|
function PropertyReportItemTransaction(transactions, property, chartAccounts) {
|
|
8837
8969
|
var _this = _super.call(this, property, chartAccounts) || this;
|
|
8838
|
-
_this.amount = Math.abs(transactions.
|
|
8970
|
+
_this.amount = Math.abs(transactions.amount);
|
|
8839
8971
|
_this.description = chartAccounts.name;
|
|
8840
8972
|
return _this;
|
|
8841
8973
|
}
|
|
@@ -9433,6 +9565,15 @@
|
|
|
9433
9565
|
DocumentTypeEnum[DocumentTypeEnum["INVOICE"] = 1] = "INVOICE";
|
|
9434
9566
|
})(exports.DocumentTypeEnum || (exports.DocumentTypeEnum = {}));
|
|
9435
9567
|
|
|
9568
|
+
exports.AnnualFrequencyEnum = void 0;
|
|
9569
|
+
(function (AnnualFrequencyEnum) {
|
|
9570
|
+
AnnualFrequencyEnum[AnnualFrequencyEnum["ANNUAL"] = 1] = "ANNUAL";
|
|
9571
|
+
AnnualFrequencyEnum[AnnualFrequencyEnum["QUARTERLY"] = 3] = "QUARTERLY";
|
|
9572
|
+
AnnualFrequencyEnum[AnnualFrequencyEnum["MONTHLY"] = 12] = "MONTHLY";
|
|
9573
|
+
AnnualFrequencyEnum[AnnualFrequencyEnum["FORTNIGHTLY"] = 26] = "FORTNIGHTLY";
|
|
9574
|
+
AnnualFrequencyEnum[AnnualFrequencyEnum["WEEKLY"] = 52] = "WEEKLY";
|
|
9575
|
+
})(exports.AnnualFrequencyEnum || (exports.AnnualFrequencyEnum = {}));
|
|
9576
|
+
|
|
9436
9577
|
// @TODO Artem TT-2308 move everything
|
|
9437
9578
|
|
|
9438
9579
|
exports.ChartAccountsEtpEnum = void 0;
|
|
@@ -12301,6 +12442,15 @@
|
|
|
12301
12442
|
TaxSummaryTypeEnum["FORECASTS"] = "forecasts";
|
|
12302
12443
|
})(exports.TaxSummaryTypeEnum || (exports.TaxSummaryTypeEnum = {}));
|
|
12303
12444
|
|
|
12445
|
+
/**
|
|
12446
|
+
* Enum with income amount types (Net or Gross)
|
|
12447
|
+
*/
|
|
12448
|
+
exports.IncomeAmountTypeEnum = void 0;
|
|
12449
|
+
(function (IncomeAmountTypeEnum) {
|
|
12450
|
+
IncomeAmountTypeEnum[IncomeAmountTypeEnum["NET"] = 0] = "NET";
|
|
12451
|
+
IncomeAmountTypeEnum[IncomeAmountTypeEnum["GROSS"] = 1] = "GROSS";
|
|
12452
|
+
})(exports.IncomeAmountTypeEnum || (exports.IncomeAmountTypeEnum = {}));
|
|
12453
|
+
|
|
12304
12454
|
exports.TransactionCategoryEnum = void 0;
|
|
12305
12455
|
(function (TransactionCategoryEnum) {
|
|
12306
12456
|
TransactionCategoryEnum[TransactionCategoryEnum["PROPERTY"] = 0] = "PROPERTY";
|
|
@@ -12733,7 +12883,6 @@
|
|
|
12733
12883
|
// use id only to avoid unexpected changes
|
|
12734
12884
|
return this.update(merge__default["default"]({}, invoice, { document: document, status: exports.SoleInvoiceStatusesEnum.PENDING }))
|
|
12735
12885
|
.pipe(operators.map(function (publishedInvoice) {
|
|
12736
|
-
debugger;
|
|
12737
12886
|
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.SOLE_INVOICE_PUBLISHED, publishedInvoice));
|
|
12738
12887
|
return publishedInvoice;
|
|
12739
12888
|
}));
|
|
@@ -12772,6 +12921,26 @@
|
|
|
12772
12921
|
}]
|
|
12773
12922
|
}] });
|
|
12774
12923
|
|
|
12924
|
+
var BasReportService = /** @class */ (function (_super) {
|
|
12925
|
+
__extends(BasReportService, _super);
|
|
12926
|
+
function BasReportService() {
|
|
12927
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
12928
|
+
_this.modelClass = BasReport;
|
|
12929
|
+
_this.url = 'bas-reports';
|
|
12930
|
+
_this.isHydra = true;
|
|
12931
|
+
return _this;
|
|
12932
|
+
}
|
|
12933
|
+
return BasReportService;
|
|
12934
|
+
}(RestService));
|
|
12935
|
+
BasReportService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BasReportService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
12936
|
+
BasReportService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BasReportService, providedIn: 'root' });
|
|
12937
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BasReportService, decorators: [{
|
|
12938
|
+
type: i0.Injectable,
|
|
12939
|
+
args: [{
|
|
12940
|
+
providedIn: 'root'
|
|
12941
|
+
}]
|
|
12942
|
+
}] });
|
|
12943
|
+
|
|
12775
12944
|
/**
|
|
12776
12945
|
* Service that allows to work with WorkTank operations
|
|
12777
12946
|
*/
|
|
@@ -17986,6 +18155,8 @@
|
|
|
17986
18155
|
__extends(AbstractForm, _super);
|
|
17987
18156
|
function AbstractForm(controls, model, validatorOrOpts, asyncValidator) {
|
|
17988
18157
|
var _this = _super.call(this, controls, validatorOrOpts, asyncValidator) || this;
|
|
18158
|
+
// @TODO remove and use getRawValue instead of value (needs testing and refactoring)
|
|
18159
|
+
_this.submitDisabledFields = false;
|
|
17989
18160
|
/**
|
|
17990
18161
|
* @TODO Alex bad name, it's also about unchanged
|
|
17991
18162
|
* Flag display if some form values changed
|
|
@@ -18027,7 +18198,8 @@
|
|
|
18027
18198
|
if (!this.disabled && !this.valid) {
|
|
18028
18199
|
return null;
|
|
18029
18200
|
}
|
|
18030
|
-
var
|
|
18201
|
+
var value = this.submitDisabledFields ? this.getRawValue() : this.value;
|
|
18202
|
+
var model = this.createModelInstance(Object.assign({}, this.model, value, data));
|
|
18031
18203
|
this.onSubmit.emit(model);
|
|
18032
18204
|
return model;
|
|
18033
18205
|
};
|
|
@@ -18914,6 +19086,67 @@
|
|
|
18914
19086
|
return SoleInvoiceTemplateForm;
|
|
18915
19087
|
}(AbstractForm));
|
|
18916
19088
|
|
|
19089
|
+
/**
|
|
19090
|
+
* business activity statement report
|
|
19091
|
+
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/268533936/BAS+Report
|
|
19092
|
+
*/
|
|
19093
|
+
var BasReportForm = /** @class */ (function (_super) {
|
|
19094
|
+
__extends(BasReportForm, _super);
|
|
19095
|
+
/**
|
|
19096
|
+
* @TODO vik TransactionBaseCollection here and everywhere
|
|
19097
|
+
*/
|
|
19098
|
+
function BasReportForm(report, transactions, allocations, depreciations) {
|
|
19099
|
+
var _this = _super.call(this, {
|
|
19100
|
+
dateFrom: new forms.FormControl(report.dateFrom, forms.Validators.required),
|
|
19101
|
+
dateTo: new forms.FormControl(report.dateTo, forms.Validators.required),
|
|
19102
|
+
income: new forms.FormControl({ value: report.income, disabled: true }),
|
|
19103
|
+
incomeGST: new forms.FormControl({ value: report.incomeGST, disabled: true }, forms.Validators.required),
|
|
19104
|
+
expenseGST: new forms.FormControl({ value: report.expenseGST, disabled: true }, forms.Validators.required),
|
|
19105
|
+
salary: new forms.FormControl(report.salary, forms.Validators.required),
|
|
19106
|
+
taxWithheldSalary: new forms.FormControl(report.taxWithheldSalary, forms.Validators.required),
|
|
19107
|
+
taxWithheldNoABN: new forms.FormControl(report.taxWithheldNoABN, forms.Validators.required),
|
|
19108
|
+
taxWithheldTotal: new forms.FormControl({ value: report.taxWithheldTotal || 0, disabled: true }),
|
|
19109
|
+
paygTaxInstalment: new forms.FormControl(report.paygTaxInstalment, forms.Validators.required),
|
|
19110
|
+
fuelTaxCredit: new forms.FormControl(report.fuelTaxCredit, forms.Validators.required),
|
|
19111
|
+
gst: new forms.FormControl({ value: report.gst, disabled: true }),
|
|
19112
|
+
}, report) || this;
|
|
19113
|
+
_this.report = report;
|
|
19114
|
+
_this.submitDisabledFields = true;
|
|
19115
|
+
// prefill income/expense data based on transactions/depreciations filtered by specified date
|
|
19116
|
+
rxjs.combineLatest([_this.get('dateFrom').valueChanges, _this.get('dateTo').valueChanges])
|
|
19117
|
+
.subscribe(function (_a) {
|
|
19118
|
+
var _b = __read(_a, 2), dateFrom = _b[0], dateTo = _b[1];
|
|
19119
|
+
var filteredTransactions = transactions.filterByRange('date', dateFrom, dateTo);
|
|
19120
|
+
var filteredDepreciations = depreciations.filterByRange('purchaseDate', dateFrom, dateTo);
|
|
19121
|
+
var incomeTransactions = filteredTransactions.getIncomeTransactions();
|
|
19122
|
+
var expenseTransactions = new TransactionBaseCollection(__spreadArray(__spreadArray([], __read(filteredTransactions.getExpenseTransactions().toArray())), __read(filteredDepreciations.toArray())));
|
|
19123
|
+
// all sole income claimed as 100%
|
|
19124
|
+
_this.get('income').setValue(incomeTransactions.getAllocatedAmount(allocations));
|
|
19125
|
+
_this.get('incomeGST').setValue(incomeTransactions.calculateAllocatedGST(allocations));
|
|
19126
|
+
_this.get('expenseGST').setValue(expenseTransactions.filterBy('isGST', true).sumBy('gstClaimAmount'));
|
|
19127
|
+
});
|
|
19128
|
+
// calculate taxWithheldTotal
|
|
19129
|
+
rxjs.combineLatest([_this.get('taxWithheldSalary').valueChanges, _this.get('taxWithheldNoABN').valueChanges])
|
|
19130
|
+
.subscribe(function (_a) {
|
|
19131
|
+
var _b = __read(_a, 2), taxWithheldSalary = _b[0], taxWithheldNoABN = _b[1];
|
|
19132
|
+
_this.get('taxWithheldTotal').setValue(taxWithheldSalary + taxWithheldNoABN);
|
|
19133
|
+
});
|
|
19134
|
+
// calculate gst payable/refundable
|
|
19135
|
+
rxjs.combineLatest([
|
|
19136
|
+
_this.get('incomeGST').valueChanges,
|
|
19137
|
+
_this.get('expenseGST').valueChanges,
|
|
19138
|
+
_this.get('taxWithheldTotal').valueChanges,
|
|
19139
|
+
_this.get('paygTaxInstalment').valueChanges,
|
|
19140
|
+
_this.get('fuelTaxCredit').valueChanges,
|
|
19141
|
+
]).subscribe(function (_a) {
|
|
19142
|
+
var _b = __read(_a, 5), incomeGST = _b[0], expenseGST = _b[1], taxWithheldTotal = _b[2], paygTaxInstalment = _b[3], fuelTaxCredit = _b[4];
|
|
19143
|
+
_this.get('gst').setValue(incomeGST - expenseGST + taxWithheldTotal + paygTaxInstalment - fuelTaxCredit);
|
|
19144
|
+
});
|
|
19145
|
+
return _this;
|
|
19146
|
+
}
|
|
19147
|
+
return BasReportForm;
|
|
19148
|
+
}(AbstractForm));
|
|
19149
|
+
|
|
18917
19150
|
var BankAccountAllocationForm = /** @class */ (function (_super) {
|
|
18918
19151
|
__extends(BankAccountAllocationForm, _super);
|
|
18919
19152
|
function BankAccountAllocationForm(bankAccount, controls) {
|
|
@@ -20208,6 +20441,9 @@
|
|
|
20208
20441
|
exports.BankTransactionChartData = BankTransactionChartData;
|
|
20209
20442
|
exports.BankTransactionCollection = BankTransactionCollection;
|
|
20210
20443
|
exports.BankTransactionService = BankTransactionService;
|
|
20444
|
+
exports.BasReport = BasReport;
|
|
20445
|
+
exports.BasReportForm = BasReportForm;
|
|
20446
|
+
exports.BasReportService = BasReportService;
|
|
20211
20447
|
exports.BasiqConfig = BasiqConfig;
|
|
20212
20448
|
exports.BasiqJob = BasiqJob;
|
|
20213
20449
|
exports.BasiqJobResponse = BasiqJobResponse;
|