taxtank-core 2.1.31 → 2.1.32

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.
@@ -5970,6 +5970,9 @@ __decorate([
5970
5970
  __decorate([
5971
5971
  Type(() => Date)
5972
5972
  ], BasReport.prototype, "dateTo", void 0);
5973
+ __decorate([
5974
+ Type(() => SoleBusiness)
5975
+ ], BasReport.prototype, "businesses", void 0);
5973
5976
 
5974
5977
  class SoleContactItem {
5975
5978
  }
@@ -16768,11 +16771,14 @@ var BasReportMessagesEnum;
16768
16771
  BasReportMessagesEnum["CONFIRM_DELETE"] = "Are you sure you want to delete this BAS report?";
16769
16772
  })(BasReportMessagesEnum || (BasReportMessagesEnum = {}));
16770
16773
 
16771
- class BasReportService extends RestService {
16774
+ class BasReportService extends RestService$1 {
16772
16775
  constructor() {
16773
16776
  super(...arguments);
16774
16777
  this.modelClass = BasReport;
16775
- this.url = 'bas-reports';
16778
+ this.collectionClass = Collection;
16779
+ this.endpointUri = 'bas-reports';
16780
+ this.roles = [UserRolesEnum.SOLE_TANK];
16781
+ this.useBackendError = true;
16776
16782
  }
16777
16783
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: BasReportService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
16778
16784
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: BasReportService, providedIn: 'root' }); }
@@ -25198,25 +25204,31 @@ class SoleInvoiceTemplateForm extends AbstractForm {
25198
25204
  class BasReportForm extends AbstractForm {
25199
25205
  constructor(report, transactions, depreciations) {
25200
25206
  super({
25201
- dateFrom: new UntypedFormControl(report.dateFrom, Validators.required),
25202
- dateTo: new UntypedFormControl(report.dateTo, Validators.required),
25203
- income: new UntypedFormControl({ value: report.income, disabled: true }),
25204
- incomeGST: new UntypedFormControl({ value: report.incomeGST, disabled: true }, Validators.required),
25205
- expenseGST: new UntypedFormControl({ value: report.expenseGST, disabled: true }, Validators.required),
25206
- salary: new UntypedFormControl(report.salary, Validators.required),
25207
- taxWithheldSalary: new UntypedFormControl(report.taxWithheldSalary, Validators.required),
25208
- taxWithheldNoABN: new UntypedFormControl(report.taxWithheldNoABN, Validators.required),
25209
- taxWithheldTotal: new UntypedFormControl({ value: report.taxWithheldTotal, disabled: true }),
25210
- paygTaxInstalment: new UntypedFormControl(report.paygTaxInstalment, Validators.required),
25211
- fuelTaxCredit: new UntypedFormControl(report.fuelTaxCredit, Validators.required),
25212
- gst: new UntypedFormControl({ value: report.gst, disabled: true }),
25207
+ businesses: new FormControl(report.businesses, Validators.required),
25208
+ dateFrom: new FormControl(report.dateFrom, Validators.required),
25209
+ dateTo: new FormControl(report.dateTo, Validators.required),
25210
+ income: new FormControl({ value: report.income, disabled: true }),
25211
+ incomeGST: new FormControl({ value: report.incomeGST, disabled: true }, Validators.required),
25212
+ expenseGST: new FormControl({ value: report.expenseGST, disabled: true }, Validators.required),
25213
+ salary: new FormControl(report.salary, Validators.required),
25214
+ taxWithheldSalary: new FormControl(report.taxWithheldSalary, Validators.required),
25215
+ taxWithheldNoABN: new FormControl(report.taxWithheldNoABN, Validators.required),
25216
+ taxWithheldTotal: new FormControl({ value: report.taxWithheldTotal, disabled: true }),
25217
+ paygTaxInstalment: new FormControl(report.paygTaxInstalment, Validators.required),
25218
+ fuelTaxCredit: new FormControl(report.fuelTaxCredit, Validators.required),
25219
+ gst: new FormControl({ value: report.gst, disabled: true }),
25213
25220
  }, report);
25214
25221
  this.includeDisabledFields = true;
25215
25222
  // prefill income/expense data based on transactions/depreciations filtered by specified date
25216
- combineLatest([this.get('dateFrom').valueChanges, this.get('dateTo').valueChanges])
25217
- .subscribe(([dateFrom, dateTo]) => {
25218
- const filteredTransactions = transactions.filterByRange('date', dateFrom, dateTo);
25219
- const filteredDepreciations = depreciations.filterByRange('date', dateFrom, dateTo);
25223
+ combineLatest([this.get('businesses').valueChanges, this.get('dateFrom').valueChanges, this.get('dateTo').valueChanges])
25224
+ .subscribe(([businesses, dateFrom, dateTo]) => {
25225
+ const businessIds = businesses.map(business => business.id);
25226
+ const filteredTransactions = transactions
25227
+ .filterByRange('date', dateFrom, dateTo)
25228
+ .filterBy('business.id', businessIds);
25229
+ const filteredDepreciations = depreciations
25230
+ .filterByRange('date', dateFrom, dateTo)
25231
+ .filterBy('business.id', businessIds);
25220
25232
  const incomeTransactions = filteredTransactions.getIncomeTransactions();
25221
25233
  const depreciationTransactions = filteredDepreciations.map(depreciation => depreciation.toTransaction({ amount: -depreciation.amount }));
25222
25234
  const expenseTransactions = new TransactionCollection(filteredTransactions.getExpenseTransactions().toArray());