taxtank-core 0.23.3 → 0.23.4

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.
Files changed (25) hide show
  1. package/bundles/taxtank-core.umd.js +121 -0
  2. package/bundles/taxtank-core.umd.js.map +1 -1
  3. package/esm2015/lib/collections/property/property-sale/property-sale.collection.js +16 -0
  4. package/esm2015/lib/collections/property/property.collection.js +13 -1
  5. package/esm2015/lib/forms/report/my-tax/index.js +2 -1
  6. package/esm2015/lib/forms/report/my-tax/my-tax-cgt.form.js +25 -0
  7. package/esm2015/lib/models/property/property-sale/property-sale.js +10 -1
  8. package/esm2015/lib/models/property/property.js +13 -1
  9. package/esm2015/lib/models/report/my-tax/index.js +3 -1
  10. package/esm2015/lib/models/report/my-tax/my-tax-cgt/cgt-exemption-and-rollover-code.enum.js +9 -0
  11. package/esm2015/lib/models/report/my-tax/my-tax-cgt/my-tax-cgt.js +26 -0
  12. package/esm2015/public-api.js +2 -1
  13. package/fesm2015/taxtank-core.js +104 -1
  14. package/fesm2015/taxtank-core.js.map +1 -1
  15. package/lib/collections/property/property-sale/property-sale.collection.d.ts +10 -0
  16. package/lib/collections/property/property.collection.d.ts +8 -0
  17. package/lib/forms/report/my-tax/index.d.ts +1 -0
  18. package/lib/forms/report/my-tax/my-tax-cgt.form.d.ts +5 -0
  19. package/lib/models/property/property-sale/property-sale.d.ts +5 -0
  20. package/lib/models/property/property.d.ts +10 -0
  21. package/lib/models/report/my-tax/index.d.ts +2 -0
  22. package/lib/models/report/my-tax/my-tax-cgt/cgt-exemption-and-rollover-code.enum.d.ts +7 -0
  23. package/lib/models/report/my-tax/my-tax-cgt/my-tax-cgt.d.ts +23 -0
  24. package/package.json +1 -1
  25. package/public-api.d.ts +1 -0
@@ -4931,6 +4931,13 @@
4931
4931
  Property.prototype.isOneYearExemptionApplicable = function (sale) {
4932
4932
  return sale.grossCGT > 0 && this.getOwnershipDuration(sale, 'years') > 0;
4933
4933
  };
4934
+ /**
4935
+ * CGT is not applicable for properties acquired before 20.09.1985 (tax didn't exist before this date).
4936
+ * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4644110466/Tax+Return+MyTax+-+Online+Form ("Capital gains or losses" section)
4937
+ */
4938
+ Property.prototype.isCGTApplicable = function () {
4939
+ return this.contractDate >= Property.preCGTAssetDate;
4940
+ };
4934
4941
  /**
4935
4942
  * ownership duration from purchase till sale
4936
4943
  */
@@ -4948,6 +4955,11 @@
4948
4955
  };
4949
4956
  return Property;
4950
4957
  }(Property$1));
4958
+ /**
4959
+ * Property acquired before 20 September 1985 will generally be treated as pre-Capital Gains Tax (CGT) assets.
4960
+ * Any assets acquired before this day are CGT exempt (because the tax didn't exist before this date).
4961
+ */
4962
+ Property.preCGTAssetDate = new Date(1985, 9, 20);
4951
4963
  __decorate([
4952
4964
  classTransformer.Type(function () { return Date; })
4953
4965
  ], Property.prototype, "contractDate", void 0);
@@ -6649,6 +6661,12 @@
6649
6661
  PropertyCollection.prototype.getSharedProperties = function () {
6650
6662
  return new PropertyCollection(this.items.filter(function (property) { return !property.isOwn(); }));
6651
6663
  };
6664
+ /**
6665
+ * Properties that are taxed and will be included in reports (Tax summary, My tax report, e.t.c.)
6666
+ */
6667
+ PropertyCollection.prototype.getTaxInclusive = function () {
6668
+ return this.create(this.items.filter(function (property) { return property.category.isTaxInclusive; }));
6669
+ };
6652
6670
  PropertyCollection.prototype.getUnsold = function () {
6653
6671
  return this.create(this.items.filter(function (property) { return !property.isSold(); }));
6654
6672
  };
@@ -6693,6 +6711,12 @@
6693
6711
  enumerable: false,
6694
6712
  configurable: true
6695
6713
  });
6714
+ /**
6715
+ * list of properties
6716
+ */
6717
+ PropertyCollection.prototype.getCGTApplicable = function () {
6718
+ return this.create(this.items.filter(function (property) { return property.isCGTApplicable(); }));
6719
+ };
6696
6720
  PropertyCollection.prototype.getOwnerOccupiedProperties = function () {
6697
6721
  return new PropertyCollection(this.items.filter(function (property) { return property.category.isOwnerOccupied(); }));
6698
6722
  };
@@ -6752,6 +6776,30 @@
6752
6776
  return PropertyCollection;
6753
6777
  }(Collection));
6754
6778
 
6779
+ var PropertySaleCollection = /** @class */ (function (_super) {
6780
+ __extends(PropertySaleCollection, _super);
6781
+ function PropertySaleCollection() {
6782
+ return _super !== null && _super.apply(this, arguments) || this;
6783
+ }
6784
+ Object.defineProperty(PropertySaleCollection.prototype, "grossCGT", {
6785
+ get: function () {
6786
+ return this.create(this.items.filter(function (propertySale) { return propertySale.grossCGT > 0; })).sumBy('grossCGT');
6787
+ },
6788
+ enumerable: false,
6789
+ configurable: true
6790
+ });
6791
+ /**
6792
+ * Property sales are CGT applicable unless it has "Principle place of residence" exemption type
6793
+ */
6794
+ PropertySaleCollection.prototype.getCGTApplicable = function () {
6795
+ return this.create(this.items.filter(function (propertySale) { return propertySale.isCGTApplicable(); }));
6796
+ };
6797
+ PropertySaleCollection.prototype.getByPropertyShareIds = function (ids) {
6798
+ return this.filterBy('share.id', ids);
6799
+ };
6800
+ return PropertySaleCollection;
6801
+ }(Collection));
6802
+
6755
6803
  /**
6756
6804
  * Enum with symbols based on depreciation LVP asset type
6757
6805
  */
@@ -9603,6 +9651,14 @@
9603
9651
  enumerable: false,
9604
9652
  configurable: true
9605
9653
  });
9654
+ /**
9655
+ * CGT is not applicable for sales with "Principle place of residence" exemption type.
9656
+ * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4644110466/Tax+Return+MyTax+-+Online+Form ("Capital gains or losses" section)
9657
+ */
9658
+ PropertySale.prototype.isCGTApplicable = function () {
9659
+ var _a;
9660
+ return ((_a = this.taxExemption) === null || _a === void 0 ? void 0 : _a.id) !== exports.TaxExemptionEnum.PPR;
9661
+ };
9606
9662
  return PropertySale;
9607
9663
  }(PropertySale$1));
9608
9664
  __decorate([
@@ -9673,6 +9729,43 @@
9673
9729
  return MyTaxBusinessOrLosses;
9674
9730
  }());
9675
9731
 
9732
+ ;
9733
+ /**
9734
+ * Report related to Property sales CGT details.
9735
+ * All fields are about current year, except netCapitalLoss
9736
+ *
9737
+ */
9738
+ var MyTaxCgt = /** @class */ (function () {
9739
+ function MyTaxCgt() {
9740
+ }
9741
+ MyTaxCgt.createFrom = function (propertySales, properties, clientCapitalLoss) {
9742
+ return classTransformer.plainToClass(MyTaxCgt, {
9743
+ hasCapitalGain: !!propertySales.grossCGT,
9744
+ hasExemption: this.isCGTApplicable(propertySales, properties),
9745
+ netCapitalGain: propertySales.sumBy('netCGT'),
9746
+ grossCapitalGain: propertySales.grossCGT,
9747
+ netCapitalLoss: clientCapitalLoss
9748
+ });
9749
+ };
9750
+ /**
9751
+ * Exemption is applicable for PPR sales and properties acquired before Property.preCGTAssetDate
9752
+ * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4644110466/Tax+Return+MyTax+-+Online+Form ("Capital gains or losses" section)
9753
+ */
9754
+ MyTaxCgt.isCGTApplicable = function (sales, properties) {
9755
+ return !sales.getCGTApplicable().length || !properties.getCGTApplicable().length;
9756
+ };
9757
+ return MyTaxCgt;
9758
+ }());
9759
+
9760
+ /**
9761
+ * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4644110466/Tax+Return+MyTax+-+Online+Form ("Capital gains or losses" section)
9762
+ */
9763
+ exports.CgtExemptionAndRolloverCodeEnum = void 0;
9764
+ (function (CgtExemptionAndRolloverCodeEnum) {
9765
+ CgtExemptionAndRolloverCodeEnum[CgtExemptionAndRolloverCodeEnum["MAIN_RESIDENT_EXEMPTION_I"] = 0] = "MAIN_RESIDENT_EXEMPTION_I";
9766
+ CgtExemptionAndRolloverCodeEnum[CgtExemptionAndRolloverCodeEnum["PRE_CGT_ASSET_J"] = 1] = "PRE_CGT_ASSET_J";
9767
+ })(exports.CgtExemptionAndRolloverCodeEnum || (exports.CgtExemptionAndRolloverCodeEnum = {}));
9768
+
9676
9769
  /**
9677
9770
  * Const with the categories for my-tax 'Deductions' report.
9678
9771
  * Grouped by ChartAccountsHeadingListEnum / ChartAccountsListEnum based on rules from documentation
@@ -16230,6 +16323,31 @@
16230
16323
  return MyTaxBusinessOrLossesForm;
16231
16324
  }(AbstractForm));
16232
16325
 
16326
+ var MyTaxCgtForm = /** @class */ (function (_super) {
16327
+ __extends(MyTaxCgtForm, _super);
16328
+ function MyTaxCgtForm(gainsOrLosses) {
16329
+ var _this = _super.call(this, {
16330
+ hasCapitalGain: new forms.FormControl(gainsOrLosses.hasCapitalGain),
16331
+ hasExemption: new forms.FormControl(gainsOrLosses.hasExemption),
16332
+ exemptionType: new forms.FormControl(null, conditionalValidator(function () { return _this.get('hasExemption').value; }, forms.Validators.required)),
16333
+ netCapitalGain: new forms.FormControl({
16334
+ value: gainsOrLosses.netCapitalGain,
16335
+ disabled: true
16336
+ }),
16337
+ grossCapitalGain: new forms.FormControl({
16338
+ value: gainsOrLosses.grossCapitalGain,
16339
+ disabled: true
16340
+ }),
16341
+ netCapitalLoss: new forms.FormControl({
16342
+ value: gainsOrLosses.netCapitalLoss,
16343
+ disabled: true
16344
+ })
16345
+ }) || this;
16346
+ return _this;
16347
+ }
16348
+ return MyTaxCgtForm;
16349
+ }(AbstractForm));
16350
+
16233
16351
  var MyTaxDeductionsForm = /** @class */ (function (_super) {
16234
16352
  __extends(MyTaxDeductionsForm, _super);
16235
16353
  function MyTaxDeductionsForm(deductions) {
@@ -16805,6 +16923,8 @@
16805
16923
  exports.MyAccountHistory = MyAccountHistory;
16806
16924
  exports.MyTaxBusinessOrLosses = MyTaxBusinessOrLosses;
16807
16925
  exports.MyTaxBusinessOrLossesForm = MyTaxBusinessOrLossesForm;
16926
+ exports.MyTaxCgt = MyTaxCgt;
16927
+ exports.MyTaxCgtForm = MyTaxCgtForm;
16808
16928
  exports.MyTaxDeductions = MyTaxDeductions;
16809
16929
  exports.MyTaxDeductionsForm = MyTaxDeductionsForm;
16810
16930
  exports.MyTaxDividends = MyTaxDividends;
@@ -16858,6 +16978,7 @@
16858
16978
  exports.PropertyReportItemTransaction = PropertyReportItemTransaction;
16859
16979
  exports.PropertyReportItemTransactionCollection = PropertyReportItemTransactionCollection;
16860
16980
  exports.PropertySale = PropertySale;
16981
+ exports.PropertySaleCollection = PropertySaleCollection;
16861
16982
  exports.PropertySaleService = PropertySaleService;
16862
16983
  exports.PropertySaleTaxExemptionMetadata = PropertySaleTaxExemptionMetadata;
16863
16984
  exports.PropertyService = PropertyService;