taxtank-core 0.30.134 → 0.30.136
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/esm2020/lib/collections/collection-dictionary.mjs +2 -1
- package/esm2020/lib/db/Enums/sole-invoice-statuses.enum.mjs +2 -1
- package/esm2020/lib/models/sole/sole-invoice.mjs +4 -1
- package/esm2020/lib/models/tax-summary/tax-summary.mjs +18 -3
- package/esm2020/lib/models/transaction/transaction.mjs +4 -1
- package/fesm2015/taxtank-core.mjs +25 -2
- package/fesm2015/taxtank-core.mjs.map +1 -1
- package/fesm2020/taxtank-core.mjs +25 -2
- package/fesm2020/taxtank-core.mjs.map +1 -1
- package/lib/collections/collection-dictionary.d.ts +1 -0
- package/lib/db/Enums/sole-invoice-statuses.enum.d.ts +2 -1
- package/lib/models/sole/sole-invoice.d.ts +1 -0
- package/lib/models/tax-summary/tax-summary.d.ts +3 -0
- package/lib/models/transaction/transaction.d.ts +3 -0
- package/package.json +1 -1
|
@@ -1640,6 +1640,7 @@ class CollectionDictionary {
|
|
|
1640
1640
|
return this.items[key] ? this.items[key] : this.createCollection([]);
|
|
1641
1641
|
}
|
|
1642
1642
|
/**
|
|
1643
|
+
* @TODO bad name, it just gets items by keys, same as get method by multiple keys
|
|
1643
1644
|
* Join several collections by ids, return collection of uniq models (skip duplicates)
|
|
1644
1645
|
*/
|
|
1645
1646
|
merge(keys) {
|
|
@@ -4509,6 +4510,7 @@ var SoleInvoiceStatusesEnum;
|
|
|
4509
4510
|
SoleInvoiceStatusesEnum[SoleInvoiceStatusesEnum["DRAFT"] = 1] = "DRAFT";
|
|
4510
4511
|
SoleInvoiceStatusesEnum[SoleInvoiceStatusesEnum["PENDING"] = 2] = "PENDING";
|
|
4511
4512
|
SoleInvoiceStatusesEnum[SoleInvoiceStatusesEnum["PAID"] = 3] = "PAID";
|
|
4513
|
+
SoleInvoiceStatusesEnum[SoleInvoiceStatusesEnum["PAID_CASH"] = 4] = "PAID_CASH";
|
|
4512
4514
|
})(SoleInvoiceStatusesEnum || (SoleInvoiceStatusesEnum = {}));
|
|
4513
4515
|
|
|
4514
4516
|
var SoleInvoiceTaxTypeEnum;
|
|
@@ -4592,6 +4594,9 @@ class SoleInvoice extends SoleInvoice$1 {
|
|
|
4592
4594
|
isPaid() {
|
|
4593
4595
|
return this.status === SoleInvoiceStatusesEnum.PAID;
|
|
4594
4596
|
}
|
|
4597
|
+
isPaidCash() {
|
|
4598
|
+
return this.status === SoleInvoiceStatusesEnum.PAID_CASH;
|
|
4599
|
+
}
|
|
4595
4600
|
isOverdue() {
|
|
4596
4601
|
return this.isPending() && this.dateTo < new Date();
|
|
4597
4602
|
}
|
|
@@ -6251,6 +6256,9 @@ class Transaction extends Transaction$1 {
|
|
|
6251
6256
|
getAllocatedAmount(allocations) {
|
|
6252
6257
|
return allocations.filterBy('transaction.id', this.id).sumBy('amount');
|
|
6253
6258
|
}
|
|
6259
|
+
/**
|
|
6260
|
+
* @TODO vik TT-3363
|
|
6261
|
+
*/
|
|
6254
6262
|
getAllocatedClaimAmount(allocations) {
|
|
6255
6263
|
let coef = 1;
|
|
6256
6264
|
if (this.isSoleTank() && this.isIncome() && this.isGST) {
|
|
@@ -12389,7 +12397,7 @@ class TaxSummary {
|
|
|
12389
12397
|
return [this.work, this.property, this.other, this.sole, this.summary];
|
|
12390
12398
|
}
|
|
12391
12399
|
getReportItems(sections) {
|
|
12392
|
-
return new ReportItemCollection([].concat(...
|
|
12400
|
+
return new ReportItemCollection([].concat(...sections.map((section) => section.items.toArray())));
|
|
12393
12401
|
}
|
|
12394
12402
|
get taxPercent() {
|
|
12395
12403
|
// Check if netAmount is not 0 to avoid division by zero
|
|
@@ -12407,12 +12415,27 @@ class TaxSummary {
|
|
|
12407
12415
|
return this.workNetTotal - Math.abs(taxWithheld);
|
|
12408
12416
|
}
|
|
12409
12417
|
get income() {
|
|
12410
|
-
return this.getReportItems([this.work, this.property, this.other]).sumByCategories([
|
|
12418
|
+
return this.getReportItems([this.work, this.property, this.sole, this.other]).sumByCategories([
|
|
12411
12419
|
...TAX_RETURN_CATEGORIES.work.income,
|
|
12412
12420
|
...TAX_RETURN_CATEGORIES.property.income,
|
|
12421
|
+
...TAX_RETURN_CATEGORIES.sole.income,
|
|
12413
12422
|
...TAX_RETURN_CATEGORIES.other.income,
|
|
12414
12423
|
]);
|
|
12415
12424
|
}
|
|
12425
|
+
get expense() {
|
|
12426
|
+
return this.getReportItems([this.work, this.property, this.sole, this.other]).sumByCategories([
|
|
12427
|
+
...TAX_RETURN_CATEGORIES.work.expenses,
|
|
12428
|
+
...TAX_RETURN_CATEGORIES.property.expenses,
|
|
12429
|
+
...TAX_RETURN_CATEGORIES.sole.expenses,
|
|
12430
|
+
...TAX_RETURN_CATEGORIES.other.expenses,
|
|
12431
|
+
]);
|
|
12432
|
+
}
|
|
12433
|
+
get netCash() {
|
|
12434
|
+
return this.workNetCash + this.propertyNetCash + this.soleNetCash + this.otherNetCash;
|
|
12435
|
+
}
|
|
12436
|
+
get netTotal() {
|
|
12437
|
+
return this.workNetTotal + this.propertyNetTotal + this.soleNetTotal + this.otherNetTotal;
|
|
12438
|
+
}
|
|
12416
12439
|
/**
|
|
12417
12440
|
* Work Net Total = Income - expenses - interest
|
|
12418
12441
|
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
|