taxtank-core 2.1.21 → 2.1.23

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.
@@ -1096,6 +1096,9 @@ var ChartAccountsHeadingListEnum;
1096
1096
  ChartAccountsHeadingListEnum[ChartAccountsHeadingListEnum["TYRES_BATTERIES"] = 66] = "TYRES_BATTERIES";
1097
1097
  ChartAccountsHeadingListEnum[ChartAccountsHeadingListEnum["OTHER_EXPENSES"] = 67] = "OTHER_EXPENSES";
1098
1098
  ChartAccountsHeadingListEnum[ChartAccountsHeadingListEnum["DEPRECIATION_EXPENSES"] = 68] = "DEPRECIATION_EXPENSES";
1099
+ ChartAccountsHeadingListEnum[ChartAccountsHeadingListEnum["BAS_GST"] = 69] = "BAS_GST";
1100
+ ChartAccountsHeadingListEnum[ChartAccountsHeadingListEnum["SOLE_HOME_OFFICE_FIXED"] = 76] = "SOLE_HOME_OFFICE_FIXED";
1101
+ ChartAccountsHeadingListEnum[ChartAccountsHeadingListEnum["SOLE_HOME_OFFICE_ACTUAL"] = 77] = "SOLE_HOME_OFFICE_ACTUAL";
1099
1102
  })(ChartAccountsHeadingListEnum || (ChartAccountsHeadingListEnum = {}));
1100
1103
 
1101
1104
  var ChartAccountsHeadingTaxDeductibleEnum;
@@ -6996,12 +6999,23 @@ class Transaction extends Transaction$1 {
6996
6999
  isInterest() {
6997
7000
  return this.chartAccounts.id === ChartAccountsListEnum.INTEREST_ON_LOAN;
6998
7001
  }
6999
- /**
7000
- * Check if transaction type is vehicle
7001
- */
7002
- isVehicleTransaction() {
7002
+ isVehicleExpense() {
7003
7003
  return this.chartAccounts.isVehicleExpense();
7004
7004
  }
7005
+ isHomeOfficeExpense() {
7006
+ return [
7007
+ ChartAccountsHeadingListEnum.HOME_OFFICE_RUNNING,
7008
+ ChartAccountsHeadingListEnum.HOME_OFFICE_OCCUPANCY,
7009
+ ChartAccountsHeadingListEnum.SOLE_HOME_OFFICE_FIXED,
7010
+ ChartAccountsHeadingListEnum.SOLE_HOME_OFFICE_ACTUAL,
7011
+ ].includes(this.chartAccounts.heading?.id);
7012
+ }
7013
+ isBasExpense() {
7014
+ return this.chartAccounts.heading?.id === ChartAccountsHeadingListEnum.BAS_GST;
7015
+ }
7016
+ isOperatingExpense() {
7017
+ return !this.isVehicleExpense() && !this.isHomeOfficeExpense() && !this.isBasExpense();
7018
+ }
7005
7019
  get taxFreeComponent() {
7006
7020
  return this.getMetaFieldValue(ChartAccountsMetaFieldListEnum.TAX_FREE_COMPONENT);
7007
7021
  }
@@ -7658,11 +7672,14 @@ class TransactionCollection extends TransactionBaseCollection {
7658
7672
  });
7659
7673
  return dictionary;
7660
7674
  }
7661
- /**
7662
- * Get transactions related to Vehicle category
7663
- */
7664
- getVehicleTransactions() {
7665
- return this.create(this.items.filter((transaction) => transaction.isVehicleTransaction()));
7675
+ getVehicleExpenses() {
7676
+ return this.create(this.items.filter((transaction) => transaction.isVehicleExpense()));
7677
+ }
7678
+ getHomeOfficeExpenses() {
7679
+ return this.create(this.items.filter((transaction) => transaction.isHomeOfficeExpense()));
7680
+ }
7681
+ getOperatingExpenses() {
7682
+ return this.create(this.items.filter((transaction) => transaction.isOperatingExpense()));
7666
7683
  }
7667
7684
  /**
7668
7685
  * Get new transaction collection filtered by tank type
@@ -7700,7 +7717,7 @@ class TransactionCollection extends TransactionBaseCollection {
7700
7717
  if (!vehicleClaim) {
7701
7718
  return this.create([]);
7702
7719
  }
7703
- return this.getVehicleTransactions()
7720
+ return this.getVehicleExpenses()
7704
7721
  .filterBy('tankType', vehicleClaim.tankType)
7705
7722
  .filterBy('business.id', vehicleClaim.business?.id);
7706
7723
  }
@@ -7709,7 +7726,7 @@ class TransactionCollection extends TransactionBaseCollection {
7709
7726
  */
7710
7727
  getLogbookTransactions() {
7711
7728
  return this
7712
- .getVehicleTransactions()
7729
+ .getVehicleExpenses()
7713
7730
  .removeBy('chartAccounts.id', [ChartAccountsListEnum.KMS_TRAVELLED, BusinessChartAccountsEnum.KMS_TRAVELLED]);
7714
7731
  }
7715
7732
  /**
@@ -8148,7 +8165,7 @@ class MyTaxBusinessLosses {
8148
8165
  depreciations
8149
8166
  .filterBy('chartAccounts.category', [BusinessChartAccountsEnum.KMS_TRAVELLED])
8150
8167
  .sumBy('claimAmount'));
8151
- this.logbookExpensesAmount = Math.abs(transactions.getVehicleTransactions().sumBy('claimAmount')) +
8168
+ this.logbookExpensesAmount = Math.abs(transactions.getVehicleExpenses().sumBy('claimAmount')) +
8152
8169
  depreciations.getVehicleDepreciations().sumBy('claimAmount');
8153
8170
  this.otherExpensesAmount = Math.abs(transactions
8154
8171
  .filterBy('chartAccounts.taxReturnItem.id', TaxReturnItemEnum.ALL_OTHER_EXPENSES)
@@ -8876,6 +8893,10 @@ const REPORTS = {
8876
8893
  title: 'BAS Report',
8877
8894
  description: 'Summarises your GST obligations from applicable sales and purchases to enable accurate ATO lodgements.',
8878
8895
  routerLink: './bas',
8896
+ }, {
8897
+ title: 'Profit & Loss Report',
8898
+ description: 'Business-style P&L showing income, expenses and profit across your selected businesses, with optional prior year comparison.',
8899
+ routerLink: './sole-profit-loss',
8879
8900
  },
8880
8901
  ],
8881
8902
  [UserRolesEnum$1.HOLDING_TANK]: [
@@ -24705,6 +24726,18 @@ class BankAccountPropertiesForm extends UntypedFormArray {
24705
24726
  }
24706
24727
  }
24707
24728
 
24729
+ /**
24730
+ * Validator check if entered strong length is equal to passed length parameter
24731
+ */
24732
+ function requiredLengthValidator(length) {
24733
+ return (control) => {
24734
+ if (control.value && control.value.length !== length) {
24735
+ return { requiredLength: length };
24736
+ }
24737
+ return null;
24738
+ };
24739
+ }
24740
+
24708
24741
  class SoleBusinessForm extends AbstractForm {
24709
24742
  constructor(business = plainToClass(SoleBusiness, {})) {
24710
24743
  super({
@@ -24715,6 +24748,7 @@ class SoleBusinessForm extends AbstractForm {
24715
24748
  file: new UntypedFormControl(business.file),
24716
24749
  isPrimaryProduction: new FormControl(business.isPrimaryProduction),
24717
24750
  isTaxFree: new FormControl(business.isTaxFree),
24751
+ abn: new FormControl(business.abn, requiredLengthValidator(11)),
24718
24752
  }, business);
24719
24753
  this.business = business;
24720
24754
  // User have to create income source with new business.
@@ -24745,6 +24779,9 @@ class SoleBusinessForm extends AbstractForm {
24745
24779
  if (this.contains('incomeSource')) {
24746
24780
  this.listenNameChanges();
24747
24781
  }
24782
+ this.get('isTaxFree').valueChanges.subscribe(() => {
24783
+ this.get('abn').setValue(null);
24784
+ });
24748
24785
  }
24749
24786
  /**
24750
24787
  * We take the first forecast because income sources available only for new business, so we have only one forecast
@@ -24852,18 +24889,6 @@ class SoleBusinessLossForm extends AbstractForm {
24852
24889
  }
24853
24890
  }
24854
24891
 
24855
- /**
24856
- * Validator check if entered strong length is equal to passed length parameter
24857
- */
24858
- function requiredLengthValidator(length) {
24859
- return (control) => {
24860
- if (control.value && control.value.length !== length) {
24861
- return { requiredLength: length };
24862
- }
24863
- return null;
24864
- };
24865
- }
24866
-
24867
24892
  class SoleContactForm extends AbstractForm {
24868
24893
  constructor(contact = plainToClass(SoleContact, {})) {
24869
24894
  super({
@@ -27356,8 +27381,8 @@ class TransactionBaseFilterForm extends FormGroup {
27356
27381
  constructor(model = plainToClass(TransactionBaseFilter, {})) {
27357
27382
  super({
27358
27383
  tankType: new FormControl(model.tankType),
27359
- business: new FormControl({ value: model.business, disabled: true }),
27360
- properties: new FormControl({ value: model.properties, disabled: true }),
27384
+ business: new FormControl({ value: model.business, disabled: model.tankType !== TankTypeEnum.SOLE }),
27385
+ properties: new FormControl({ value: model.properties, disabled: model.tankType !== TankTypeEnum.PROPERTY }),
27361
27386
  dateRange: new FormControl(model.dateRange),
27362
27387
  chartAccounts: new FormControl(model.chartAccounts),
27363
27388
  });
@@ -27385,6 +27410,7 @@ class TransactionBaseFilterForm extends FormGroup {
27385
27410
  }
27386
27411
  const value = this.value;
27387
27412
  const [dateFrom, dateTo] = value.dateRange || [];
27413
+ const businesses = Array.isArray(value.business) ? value.business : [value.business];
27388
27414
  if (!excludeDate && dateFrom) {
27389
27415
  collection = collection.filter(transaction => transaction.date >= dateFrom);
27390
27416
  }
@@ -27394,8 +27420,8 @@ class TransactionBaseFilterForm extends FormGroup {
27394
27420
  if (value.tankType) {
27395
27421
  collection = collection.filterBy('tankType', value.tankType);
27396
27422
  }
27397
- if (value.business) {
27398
- collection = collection.filterBy('business.id', value.business.id);
27423
+ if (businesses.length) {
27424
+ collection = collection.filterBy('business.id', businesses.map(business => business.id));
27399
27425
  }
27400
27426
  if (value.properties?.length) {
27401
27427
  collection = collection.filterBy('property.id', value.properties.map(property => property.id));