taxtank-core 0.29.36 → 0.29.37

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.
@@ -3075,6 +3075,7 @@
3075
3075
 
3076
3076
  exports.ChartAccountsListEnum = void 0;
3077
3077
  (function (ChartAccountsListEnum) {
3078
+ ChartAccountsListEnum[ChartAccountsListEnum["HOME_OFFICE_WORK_HOURS"] = 103] = "HOME_OFFICE_WORK_HOURS";
3078
3079
  ChartAccountsListEnum[ChartAccountsListEnum["PARTNERSHIP_EXPENSES"] = 156] = "PARTNERSHIP_EXPENSES";
3079
3080
  ChartAccountsListEnum[ChartAccountsListEnum["TRUST_EXPENSES"] = 157] = "TRUST_EXPENSES";
3080
3081
  ChartAccountsListEnum[ChartAccountsListEnum["INTEREST_CHARGED_BY_ATO"] = 278] = "INTEREST_CHARGED_BY_ATO";
@@ -3488,6 +3489,50 @@
3488
3489
  return ChartAccountsMetadata;
3489
3490
  }(ChartAccountsMetadata$1));
3490
3491
 
3492
+ /**
3493
+ * @TODO move to pipe/translation
3494
+ * enum with months short names.
3495
+ * Order of items match with financial year months order
3496
+ */
3497
+ exports.MonthNameShortEnum = void 0;
3498
+ (function (MonthNameShortEnum) {
3499
+ MonthNameShortEnum["JULY"] = "Jul";
3500
+ MonthNameShortEnum["AUGUST"] = "Aug";
3501
+ MonthNameShortEnum["SEPTEMBER"] = "Sep";
3502
+ MonthNameShortEnum["OCTOBER"] = "Oct";
3503
+ MonthNameShortEnum["NOVEMBER"] = "Nov";
3504
+ MonthNameShortEnum["DECEMBER"] = "Dec";
3505
+ MonthNameShortEnum["JANUARY"] = "Jan";
3506
+ MonthNameShortEnum["FEBRUARY"] = "Feb";
3507
+ MonthNameShortEnum["MARCH"] = "Mar";
3508
+ MonthNameShortEnum["APRIL"] = "Apr";
3509
+ MonthNameShortEnum["MAY"] = "May";
3510
+ MonthNameShortEnum["JUNE"] = "Jun";
3511
+ })(exports.MonthNameShortEnum || (exports.MonthNameShortEnum = {}));
3512
+
3513
+ /**
3514
+ * enum with months indexes.
3515
+ * item value match with js Date month index from 0 to 11
3516
+ * Order of items match with financial year months order
3517
+ */
3518
+ exports.MonthNumberEnum = void 0;
3519
+ (function (MonthNumberEnum) {
3520
+ MonthNumberEnum[MonthNumberEnum["JULY"] = 6] = "JULY";
3521
+ MonthNumberEnum[MonthNumberEnum["AUGUST"] = 7] = "AUGUST";
3522
+ MonthNumberEnum[MonthNumberEnum["SEPTEMBER"] = 8] = "SEPTEMBER";
3523
+ MonthNumberEnum[MonthNumberEnum["OCTOBER"] = 9] = "OCTOBER";
3524
+ MonthNumberEnum[MonthNumberEnum["NOVEMBER"] = 10] = "NOVEMBER";
3525
+ MonthNumberEnum[MonthNumberEnum["DECEMBER"] = 11] = "DECEMBER";
3526
+ MonthNumberEnum[MonthNumberEnum["JANUARY"] = 0] = "JANUARY";
3527
+ MonthNumberEnum[MonthNumberEnum["FEBRUARY"] = 1] = "FEBRUARY";
3528
+ MonthNumberEnum[MonthNumberEnum["MARCH"] = 2] = "MARCH";
3529
+ MonthNumberEnum[MonthNumberEnum["APRIL"] = 3] = "APRIL";
3530
+ MonthNumberEnum[MonthNumberEnum["MAY"] = 4] = "MAY";
3531
+ MonthNumberEnum[MonthNumberEnum["JUNE"] = 5] = "JUNE";
3532
+ })(exports.MonthNumberEnum || (exports.MonthNumberEnum = {}));
3533
+
3534
+ var MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan'];
3535
+
3491
3536
  exports.ChartAccountsTaxLabelsEnum = void 0;
3492
3537
  (function (ChartAccountsTaxLabelsEnum) {
3493
3538
  ChartAccountsTaxLabelsEnum["TAX_WITHHELD"] = "Tax withheld";
@@ -5399,8 +5444,6 @@
5399
5444
  classTransformer.Type(function () { return ChartSerie; })
5400
5445
  ], ChartData.prototype, "data", void 0);
5401
5446
 
5402
- var MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan'];
5403
-
5404
5447
  /**
5405
5448
  * Collection of transactions
5406
5449
  */
@@ -6368,7 +6411,7 @@
6368
6411
  return this.getInactive().getTrials();
6369
6412
  };
6370
6413
  ServiceSubscriptionCollection.prototype.getExpiredAfter = function (date) {
6371
- return this.filter(function (item) { return !date || item.endDate >= date; });
6414
+ return this.getInactive().filter(function (item) { return !date || item.endDate >= date; });
6372
6415
  };
6373
6416
  ServiceSubscriptionCollection.prototype.getPaid = function () {
6374
6417
  return this.filter(function (subscription) { return !!subscription.stripeId; });
@@ -7649,48 +7692,6 @@
7649
7692
  classTransformer.Type(function () { return ServiceSubscriptionItem; })
7650
7693
  ], ServiceSubscription.prototype, "items", void 0);
7651
7694
 
7652
- /**
7653
- * @TODO move to pipe/translation
7654
- * enum with months short names.
7655
- * Order of items match with financial year months order
7656
- */
7657
- exports.MonthNameShortEnum = void 0;
7658
- (function (MonthNameShortEnum) {
7659
- MonthNameShortEnum["JULY"] = "Jul";
7660
- MonthNameShortEnum["AUGUST"] = "Aug";
7661
- MonthNameShortEnum["SEPTEMBER"] = "Sep";
7662
- MonthNameShortEnum["OCTOBER"] = "Oct";
7663
- MonthNameShortEnum["NOVEMBER"] = "Nov";
7664
- MonthNameShortEnum["DECEMBER"] = "Dec";
7665
- MonthNameShortEnum["JANUARY"] = "Jan";
7666
- MonthNameShortEnum["FEBRUARY"] = "Feb";
7667
- MonthNameShortEnum["MARCH"] = "Mar";
7668
- MonthNameShortEnum["APRIL"] = "Apr";
7669
- MonthNameShortEnum["MAY"] = "May";
7670
- MonthNameShortEnum["JUNE"] = "Jun";
7671
- })(exports.MonthNameShortEnum || (exports.MonthNameShortEnum = {}));
7672
-
7673
- /**
7674
- * enum with months indexes.
7675
- * item value match with js Date month index from 0 to 11
7676
- * Order of items match with financial year months order
7677
- */
7678
- exports.MonthNumberEnum = void 0;
7679
- (function (MonthNumberEnum) {
7680
- MonthNumberEnum[MonthNumberEnum["JULY"] = 6] = "JULY";
7681
- MonthNumberEnum[MonthNumberEnum["AUGUST"] = 7] = "AUGUST";
7682
- MonthNumberEnum[MonthNumberEnum["SEPTEMBER"] = 8] = "SEPTEMBER";
7683
- MonthNumberEnum[MonthNumberEnum["OCTOBER"] = 9] = "OCTOBER";
7684
- MonthNumberEnum[MonthNumberEnum["NOVEMBER"] = 10] = "NOVEMBER";
7685
- MonthNumberEnum[MonthNumberEnum["DECEMBER"] = 11] = "DECEMBER";
7686
- MonthNumberEnum[MonthNumberEnum["JANUARY"] = 0] = "JANUARY";
7687
- MonthNumberEnum[MonthNumberEnum["FEBRUARY"] = 1] = "FEBRUARY";
7688
- MonthNumberEnum[MonthNumberEnum["MARCH"] = 2] = "MARCH";
7689
- MonthNumberEnum[MonthNumberEnum["APRIL"] = 3] = "APRIL";
7690
- MonthNumberEnum[MonthNumberEnum["MAY"] = 4] = "MAY";
7691
- MonthNumberEnum[MonthNumberEnum["JUNE"] = 5] = "JUNE";
7692
- })(exports.MonthNumberEnum || (exports.MonthNumberEnum = {}));
7693
-
7694
7695
  var User = /** @class */ (function (_super) {
7695
7696
  __extends(User, _super);
7696
7697
  function User() {
@@ -21300,7 +21301,10 @@
21300
21301
  __extends(TransactionForm, _super);
21301
21302
  function TransactionForm(transaction, registeredForGst, allocations, controls) {
21302
21303
  if (controls === void 0) { controls = {}; }
21303
- var _this = _super.call(this, transaction, registeredForGst, Object.assign(controls, { transactions: new forms.FormArray([]) })) || this;
21304
+ var _this = _super.call(this, transaction, registeredForGst, Object.assign(controls, {
21305
+ transactions: new forms.FormArray([]),
21306
+ source: new forms.FormControl(transaction.source || exports.TransactionSourceEnum.BANK_TRANSACTION, forms.Validators.required)
21307
+ })) || this;
21304
21308
  _this.get('date').addValidators([currentFinYearValidator()]);
21305
21309
  // convert child transactions to controls
21306
21310
  transaction.transactions.map(function (transaction) {
@@ -21359,6 +21363,50 @@
21359
21363
  return TransactionForm;
21360
21364
  }(TransactionBaseForm));
21361
21365
 
21366
+ var WorkTransactionForm = /** @class */ (function (_super) {
21367
+ __extends(WorkTransactionForm, _super);
21368
+ function WorkTransactionForm(transaction, registeredForGst, allocations, controls) {
21369
+ if (controls === void 0) { controls = {}; }
21370
+ var _this = _super.call(this, transaction, registeredForGst, allocations, Object.assign(controls, {
21371
+ // additional data related to work (like tax instalments)
21372
+ metadata: new forms.FormArray((transaction.metadata || []).map(function (transactionMetadata) {
21373
+ return new forms.FormGroup({
21374
+ value: new forms.FormControl(transactionMetadata.value),
21375
+ chartAccountsMetadata: new forms.FormControl(transactionMetadata.chartAccountsMetadata)
21376
+ });
21377
+ }))
21378
+ })) || this;
21379
+ _this.listenEvents();
21380
+ return _this;
21381
+ }
21382
+ WorkTransactionForm.prototype.listenEvents = function () {
21383
+ this.watchChartAccounts();
21384
+ };
21385
+ WorkTransactionForm.prototype.watchChartAccounts = function () {
21386
+ var _this = this;
21387
+ _super.prototype.watchChartAccounts.call(this);
21388
+ this.get('chartAccounts').valueChanges.subscribe(function (chartAccounts) {
21389
+ _this.buildMetadataForm();
21390
+ });
21391
+ };
21392
+ /**
21393
+ * depends on chartAccounts the form could include different extra fields
21394
+ */
21395
+ WorkTransactionForm.prototype.buildMetadataForm = function () {
21396
+ var _this = this;
21397
+ // Remove all controls in the FormArray before pushing
21398
+ this.get('metadata').clear();
21399
+ // create form controls for each metadata object from selected chart accounts
21400
+ (this.get('chartAccounts').value.metadata).forEach(function (chartAccountsMetadata) {
21401
+ _this.get('metadata').push(new forms.FormGroup({
21402
+ value: new forms.FormControl(chartAccountsMetadata.isSharePercentage() ? 100 : 0),
21403
+ chartAccountsMetadata: new forms.FormControl(chartAccountsMetadata),
21404
+ }));
21405
+ });
21406
+ };
21407
+ return WorkTransactionForm;
21408
+ }(TransactionForm));
21409
+
21362
21410
  var WorkIncomeForm = /** @class */ (function (_super) {
21363
21411
  __extends(WorkIncomeForm, _super);
21364
21412
  function WorkIncomeForm(transaction, registeredForGst, allocations) {
@@ -21367,13 +21415,6 @@
21367
21415
  // for work income we need to show netAmount instead of amount (because some adjustments are included in amount)
21368
21416
  transaction.amount = transaction.netAmount;
21369
21417
  _this = _super.call(this, transaction, registeredForGst, allocations, {
21370
- // additional data related to work income (like tax instalments)
21371
- metadata: new forms.FormArray((transaction.metadata || []).map(function (transactionMetadata) {
21372
- return new forms.FormGroup({
21373
- value: new forms.FormControl(transactionMetadata.value),
21374
- chartAccountsMetadata: new forms.FormControl(transactionMetadata.chartAccountsMetadata)
21375
- });
21376
- })),
21377
21418
  tax: new forms.FormControl({
21378
21419
  value: transaction.tax,
21379
21420
  disabled: !transaction.chartAccounts || transaction.chartAccounts.isNRAS(),
@@ -21400,8 +21441,8 @@
21400
21441
  return _this;
21401
21442
  }
21402
21443
  WorkIncomeForm.prototype.listenEvents = function () {
21444
+ _super.prototype.listenEvents.call(this);
21403
21445
  this.watchIncomeSource();
21404
- this.watchChartAccounts();
21405
21446
  };
21406
21447
  WorkIncomeForm.prototype.watchIncomeSource = function () {
21407
21448
  var _this = this;
@@ -21419,7 +21460,6 @@
21419
21460
  var _this = this;
21420
21461
  _super.prototype.watchChartAccounts.call(this);
21421
21462
  this.get('chartAccounts').valueChanges.subscribe(function (chartAccounts) {
21422
- _this.buildMetadataForm();
21423
21463
  // tax make no sense for pre-paying tax category
21424
21464
  if (chartAccounts.isNRAS()) {
21425
21465
  _this.get('tax').disable();
@@ -21436,21 +21476,6 @@
21436
21476
  }
21437
21477
  });
21438
21478
  };
21439
- /**
21440
- * depends on chartAccounts the form could include different extra fields
21441
- */
21442
- WorkIncomeForm.prototype.buildMetadataForm = function () {
21443
- var _this = this;
21444
- // Remove all controls in the FormArray before pushing
21445
- this.get('metadata').clear();
21446
- // create form controls for each metadata object from selected chart accounts
21447
- (this.get('chartAccounts').value.metadata).forEach(function (chartAccountsMetadata) {
21448
- _this.get('metadata').push(new forms.FormGroup({
21449
- value: new forms.FormControl(chartAccountsMetadata.isSharePercentage() ? 100 : 0),
21450
- chartAccountsMetadata: new forms.FormControl(chartAccountsMetadata),
21451
- }));
21452
- });
21453
- };
21454
21479
  /**
21455
21480
  * salary comes to bankAccount together with related transactions like tips (kind of salary, but reported in different tax summary section),
21456
21481
  * adjustments used to clarify received payment by separating it into multiple transactions,
@@ -21468,7 +21493,31 @@
21468
21493
  return _super.prototype.submit.call(this, Object.assign(data, { amount: this.getAmount() }));
21469
21494
  };
21470
21495
  return WorkIncomeForm;
21471
- }(TransactionForm));
21496
+ }(WorkTransactionForm));
21497
+
21498
+ var WorkExpenseForm = /** @class */ (function (_super) {
21499
+ __extends(WorkExpenseForm, _super);
21500
+ function WorkExpenseForm() {
21501
+ return _super !== null && _super.apply(this, arguments) || this;
21502
+ }
21503
+ WorkExpenseForm.prototype.listenEvents = function () {
21504
+ this.watchChartAccountsMetadata();
21505
+ };
21506
+ WorkExpenseForm.prototype.watchChartAccountsMetadata = function () {
21507
+ var _this = this;
21508
+ this.get('metadata').valueChanges.subscribe(function (metadata) {
21509
+ var hoursMetadata = new Collection(metadata).findBy('chartAccountsMetadata.id', exports.ChartAccountsMetadataListEnum.HOURS);
21510
+ if (!hoursMetadata) {
21511
+ return;
21512
+ }
21513
+ // for home office hours expense amount is a fixed rate per hour
21514
+ _this.get('amount').reset();
21515
+ _this.get('amount').disable();
21516
+ _this.get('amount').setValue(_this.get('chartAccounts').value.getCurrentYearValue().value * +hoursMetadata.value);
21517
+ });
21518
+ };
21519
+ return WorkExpenseForm;
21520
+ }(WorkTransactionForm));
21472
21521
 
21473
21522
  var DepreciationForm = /** @class */ (function (_super) {
21474
21523
  __extends(DepreciationForm, _super);
@@ -21880,6 +21929,7 @@
21880
21929
  exports.VehicleLogbookForm = VehicleLogbookForm;
21881
21930
  exports.VehicleLogbookService = VehicleLogbookService;
21882
21931
  exports.VehicleService = VehicleService;
21932
+ exports.WorkExpenseForm = WorkExpenseForm;
21883
21933
  exports.WorkIncomeForm = WorkIncomeForm;
21884
21934
  exports.XlsxService = XlsxService;
21885
21935
  exports.atLeastOneCheckedValidator = atLeastOneCheckedValidator;