taxtank-core 0.28.71 → 0.28.74
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/bundles/taxtank-core.umd.js +114 -21
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/forms/sole/sole-invoice.form.js +45 -25
- package/esm2015/lib/models/sole/bas-report.js +19 -1
- package/esm2015/lib/services/http/sole/sole-business-loss/sole-business-loss.service.js +13 -1
- package/esm2015/lib/services/http/sole/sole-invoice/sole-invoice.service.js +12 -1
- package/fesm2015/taxtank-core.js +81 -21
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/forms/sole/sole-invoice.form.d.ts +11 -2
- package/lib/models/sole/bas-report.d.ts +6 -0
- package/lib/services/http/sole/sole-business-loss/sole-business-loss.service.d.ts +7 -1
- package/lib/services/http/sole/sole-invoice/sole-invoice.service.d.ts +5 -0
- package/package.json +1 -1
|
@@ -5460,6 +5460,48 @@
|
|
|
5460
5460
|
enumerable: false,
|
|
5461
5461
|
configurable: true
|
|
5462
5462
|
});
|
|
5463
|
+
Object.defineProperty(BasReport.prototype, "paygTaxInstalmentOwedToATO", {
|
|
5464
|
+
get: function () {
|
|
5465
|
+
return this.paygTaxInstalment > 0 ? this.paygTaxInstalment : 0;
|
|
5466
|
+
},
|
|
5467
|
+
enumerable: false,
|
|
5468
|
+
configurable: true
|
|
5469
|
+
});
|
|
5470
|
+
Object.defineProperty(BasReport.prototype, "paygTaxInstalmentOwedByATO", {
|
|
5471
|
+
get: function () {
|
|
5472
|
+
return this.paygTaxInstalment < 0 ? Math.abs(this.paygTaxInstalment) : 0;
|
|
5473
|
+
},
|
|
5474
|
+
enumerable: false,
|
|
5475
|
+
configurable: true
|
|
5476
|
+
});
|
|
5477
|
+
Object.defineProperty(BasReport.prototype, "fuelTaxCreditOwedToATO", {
|
|
5478
|
+
get: function () {
|
|
5479
|
+
return this.fuelTaxCredit < 0 ? this.fuelTaxCredit : 0;
|
|
5480
|
+
},
|
|
5481
|
+
enumerable: false,
|
|
5482
|
+
configurable: true
|
|
5483
|
+
});
|
|
5484
|
+
Object.defineProperty(BasReport.prototype, "fuelTaxCreditOwedByATO", {
|
|
5485
|
+
get: function () {
|
|
5486
|
+
return this.fuelTaxCredit > 0 ? Math.abs(this.fuelTaxCredit) : 0;
|
|
5487
|
+
},
|
|
5488
|
+
enumerable: false,
|
|
5489
|
+
configurable: true
|
|
5490
|
+
});
|
|
5491
|
+
Object.defineProperty(BasReport.prototype, "owesToATO", {
|
|
5492
|
+
get: function () {
|
|
5493
|
+
return this.incomeGST + this.taxWithheldTotal + this.paygTaxInstalmentOwedToATO + this.fuelTaxCreditOwedToATO;
|
|
5494
|
+
},
|
|
5495
|
+
enumerable: false,
|
|
5496
|
+
configurable: true
|
|
5497
|
+
});
|
|
5498
|
+
Object.defineProperty(BasReport.prototype, "owedByATO", {
|
|
5499
|
+
get: function () {
|
|
5500
|
+
return this.expenseGST + this.paygTaxInstalmentOwedByATO + this.fuelTaxCreditOwedByATO;
|
|
5501
|
+
},
|
|
5502
|
+
enumerable: false,
|
|
5503
|
+
configurable: true
|
|
5504
|
+
});
|
|
5463
5505
|
Object.defineProperty(BasReport.prototype, "gst", {
|
|
5464
5506
|
/**
|
|
5465
5507
|
* GST payable to the ATO, or refundable from the ATO in case it's negative
|
|
@@ -12727,6 +12769,18 @@
|
|
|
12727
12769
|
_this.isHydra = true;
|
|
12728
12770
|
return _this;
|
|
12729
12771
|
}
|
|
12772
|
+
SoleBusinessLossService.prototype.listenEvents = function () {
|
|
12773
|
+
this.listenBusinessCreated();
|
|
12774
|
+
};
|
|
12775
|
+
/**
|
|
12776
|
+
* Listen business created because we create prior year losses together with business
|
|
12777
|
+
*/
|
|
12778
|
+
SoleBusinessLossService.prototype.listenBusinessCreated = function () {
|
|
12779
|
+
var _this = this;
|
|
12780
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.SOLE_BUSINESS_CREATED).subscribe(function () {
|
|
12781
|
+
_this.resetCache();
|
|
12782
|
+
});
|
|
12783
|
+
};
|
|
12730
12784
|
return SoleBusinessLossService;
|
|
12731
12785
|
}(RestService));
|
|
12732
12786
|
SoleBusinessLossService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleBusinessLossService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
@@ -12935,6 +12989,16 @@
|
|
|
12935
12989
|
SoleInvoiceService.prototype.sendEmail = function (invoice) {
|
|
12936
12990
|
return this.http.post(this.environment.apiV2 + "/" + this.url + "/" + invoice.id + "/send", {});
|
|
12937
12991
|
};
|
|
12992
|
+
/**
|
|
12993
|
+
* Return the next number from the last invoice.
|
|
12994
|
+
* Basically needed to create a new invoice to show its number when the invoice has not yet been sent to the backend
|
|
12995
|
+
*/
|
|
12996
|
+
SoleInvoiceService.prototype.getNewInvoiceNumber = function () {
|
|
12997
|
+
if (!this.cache) {
|
|
12998
|
+
return 0;
|
|
12999
|
+
}
|
|
13000
|
+
return last__default["default"](this.cache).number + 1;
|
|
13001
|
+
};
|
|
12938
13002
|
return SoleInvoiceService;
|
|
12939
13003
|
}(RestService));
|
|
12940
13004
|
SoleInvoiceService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleInvoiceService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
@@ -18997,32 +19061,38 @@
|
|
|
18997
19061
|
return SoleInvoiceItemForm;
|
|
18998
19062
|
}(AbstractForm));
|
|
18999
19063
|
|
|
19064
|
+
/**
|
|
19065
|
+
* Form is divided into two groups, since the creation of Sole invoice takes place in two steps:
|
|
19066
|
+
* a common invoice data and sole invoice items.
|
|
19067
|
+
*/
|
|
19000
19068
|
var SoleInvoiceForm = /** @class */ (function (_super) {
|
|
19001
19069
|
__extends(SoleInvoiceForm, _super);
|
|
19002
19070
|
function SoleInvoiceForm(invoice, soleDetailsGST,
|
|
19003
19071
|
// default template to be preselected
|
|
19004
19072
|
defaultTemplate) {
|
|
19005
19073
|
var _this = _super.call(this, {
|
|
19006
|
-
|
|
19007
|
-
|
|
19074
|
+
commonData: new forms.FormGroup({
|
|
19075
|
+
dateFrom: new forms.FormControl(invoice.dateFrom || new Date(), forms.Validators.required),
|
|
19076
|
+
dateTo: new forms.FormControl(invoice.dateTo, forms.Validators.required),
|
|
19077
|
+
payer: new forms.FormControl(invoice.payer, forms.Validators.required),
|
|
19078
|
+
taxType: new forms.FormControl(invoice.taxType, forms.Validators.required),
|
|
19079
|
+
bankAccount: new forms.FormControl(invoice.bankAccount, forms.Validators.required),
|
|
19080
|
+
reference: new forms.FormControl(invoice.reference)
|
|
19081
|
+
}),
|
|
19008
19082
|
items: new forms.FormArray((invoice.items || [classTransformer.plainToClass(SoleInvoiceItem, {})]).map(function (item) { return new SoleInvoiceItemForm(item); })),
|
|
19009
|
-
payer: new forms.FormControl(invoice.payer, forms.Validators.required),
|
|
19010
|
-
taxType: new forms.FormControl(invoice.taxType, forms.Validators.required),
|
|
19011
|
-
bankAccount: new forms.FormControl(invoice.bankAccount, forms.Validators.required),
|
|
19012
|
-
reference: new forms.FormControl(invoice.reference)
|
|
19013
19083
|
}, invoice) || this;
|
|
19014
19084
|
_this.invoice = invoice;
|
|
19015
19085
|
_this.soleDetailsGST = soleDetailsGST;
|
|
19016
19086
|
_this.defaultTemplate = defaultTemplate;
|
|
19017
19087
|
// we need invoice template only for new invoices
|
|
19018
19088
|
if (!invoice.id) {
|
|
19019
|
-
_this.addControl('template', new forms.FormControl(_this.defaultTemplate));
|
|
19089
|
+
(_this.commonData).addControl('template', new forms.FormControl(_this.defaultTemplate));
|
|
19020
19090
|
_this.updateTemplateRelatedFields(_this.defaultTemplate);
|
|
19021
19091
|
}
|
|
19022
19092
|
// invoice.taxType is always NONE ('No Tax') when soleDetails.isGST === false
|
|
19023
19093
|
if (!_this.soleDetailsGST) {
|
|
19024
|
-
_this.get('taxType').setValue(exports.SoleInvoiceTaxTypeEnum.NO_TAX);
|
|
19025
|
-
_this.get('taxType').disable();
|
|
19094
|
+
_this.commonData.get('taxType').setValue(exports.SoleInvoiceTaxTypeEnum.NO_TAX);
|
|
19095
|
+
_this.commonData.get('taxType').disable();
|
|
19026
19096
|
// Items isGST is not available when invoice.taxType === NONE ('No Tax')
|
|
19027
19097
|
_this.items.controls.forEach(function (itemForm) {
|
|
19028
19098
|
_this.disableItemGST(itemForm);
|
|
@@ -19048,8 +19118,8 @@
|
|
|
19048
19118
|
_this.listenItemChartAccountsChanges(itemForm);
|
|
19049
19119
|
});
|
|
19050
19120
|
}
|
|
19051
|
-
// nothing to listen if template field is not
|
|
19052
|
-
if (this.contains('template')) {
|
|
19121
|
+
// nothing to listen if template field is not exist (edit invoice case)
|
|
19122
|
+
if ((this.commonData).contains('template')) {
|
|
19053
19123
|
this.listenTemplateChanges();
|
|
19054
19124
|
}
|
|
19055
19125
|
};
|
|
@@ -19067,16 +19137,21 @@
|
|
|
19067
19137
|
};
|
|
19068
19138
|
SoleInvoiceForm.prototype.submit = function (data) {
|
|
19069
19139
|
if (data === void 0) { data = {}; }
|
|
19070
|
-
|
|
19071
|
-
|
|
19072
|
-
|
|
19140
|
+
this.submitted = true;
|
|
19141
|
+
this.markAllAsTouched();
|
|
19142
|
+
if (!this.disabled && !this.valid) {
|
|
19143
|
+
return null;
|
|
19144
|
+
}
|
|
19145
|
+
var invoiceInstance = this.currentValue;
|
|
19146
|
+
this.onSubmit.emit(invoiceInstance);
|
|
19147
|
+
return invoiceInstance;
|
|
19073
19148
|
};
|
|
19074
19149
|
/**
|
|
19075
19150
|
* Update default values from selected invoice template
|
|
19076
19151
|
*/
|
|
19077
19152
|
SoleInvoiceForm.prototype.listenTemplateChanges = function () {
|
|
19078
19153
|
var _this = this;
|
|
19079
|
-
this.get('template').valueChanges.subscribe(function (template) {
|
|
19154
|
+
this.commonData.get('template').valueChanges.subscribe(function (template) {
|
|
19080
19155
|
_this.updateTemplateRelatedFields(template);
|
|
19081
19156
|
});
|
|
19082
19157
|
};
|
|
@@ -19085,7 +19160,7 @@
|
|
|
19085
19160
|
*/
|
|
19086
19161
|
SoleInvoiceForm.prototype.listenTaxTypeChanges = function () {
|
|
19087
19162
|
var _this = this;
|
|
19088
|
-
this.get('taxType').valueChanges.subscribe(function (type) {
|
|
19163
|
+
this.commonData.get('taxType').valueChanges.subscribe(function (type) {
|
|
19089
19164
|
_this.items.controls.forEach(function (itemForm) {
|
|
19090
19165
|
var chartAccounts = itemForm.get('chartAccounts').value;
|
|
19091
19166
|
// Item GST is available when invoice.taxType !== NONE ('No Tax')
|
|
@@ -19098,18 +19173,18 @@
|
|
|
19098
19173
|
});
|
|
19099
19174
|
};
|
|
19100
19175
|
SoleInvoiceForm.prototype.updateTemplateRelatedFields = function (template) {
|
|
19101
|
-
this.get('bankAccount').setValue(template.bankAccount);
|
|
19102
|
-
var dateFrom = this.get('dateFrom').value;
|
|
19176
|
+
this.commonData.get('bankAccount').setValue(template.bankAccount);
|
|
19177
|
+
var dateFrom = this.commonData.get('dateFrom').value;
|
|
19103
19178
|
if (dateFrom) {
|
|
19104
|
-
this.get('dateTo').setValue(new Date(dateFrom.getTime() + template.termTime));
|
|
19179
|
+
this.commonData.get('dateTo').setValue(new Date(dateFrom.getTime() + template.termTime));
|
|
19105
19180
|
}
|
|
19106
19181
|
// invoice.taxType is always 'No Tax' when soleDetails.isGST = false and not available for changing
|
|
19107
19182
|
if (this.soleDetailsGST) {
|
|
19108
|
-
this.get('taxType').setValue(template.taxType);
|
|
19183
|
+
this.commonData.get('taxType').setValue(template.taxType);
|
|
19109
19184
|
}
|
|
19110
19185
|
};
|
|
19111
19186
|
/**
|
|
19112
|
-
* GST availability depends
|
|
19187
|
+
* GST availability depends on chart accounts isGST flag
|
|
19113
19188
|
*/
|
|
19114
19189
|
SoleInvoiceForm.prototype.listenItemChartAccountsChanges = function (itemForm) {
|
|
19115
19190
|
var _this = this;
|
|
@@ -19134,6 +19209,24 @@
|
|
|
19134
19209
|
itemForm.get('isGST').setValue(true);
|
|
19135
19210
|
itemForm.get('isGST').enable();
|
|
19136
19211
|
};
|
|
19212
|
+
Object.defineProperty(SoleInvoiceForm.prototype, "commonData", {
|
|
19213
|
+
get: function () {
|
|
19214
|
+
return this.get('commonData');
|
|
19215
|
+
},
|
|
19216
|
+
enumerable: false,
|
|
19217
|
+
configurable: true
|
|
19218
|
+
});
|
|
19219
|
+
Object.defineProperty(SoleInvoiceForm.prototype, "currentValue", {
|
|
19220
|
+
/**
|
|
19221
|
+
* Rewrite abstract form getter to flat "commonData" field, which is not in the class
|
|
19222
|
+
*/
|
|
19223
|
+
get: function () {
|
|
19224
|
+
var formRawValue = this.getRawValue();
|
|
19225
|
+
return classTransformer.plainToClass(SoleInvoice, Object.assign({}, this.model, Object.assign(Object.assign({}, formRawValue.commonData), { items: formRawValue.items })));
|
|
19226
|
+
},
|
|
19227
|
+
enumerable: false,
|
|
19228
|
+
configurable: true
|
|
19229
|
+
});
|
|
19137
19230
|
return SoleInvoiceForm;
|
|
19138
19231
|
}(AbstractForm));
|
|
19139
19232
|
|