taxtank-core 0.28.71 → 0.28.73
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 +102 -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-invoice/sole-invoice.service.js +12 -1
- package/fesm2015/taxtank-core.js +70 -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-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
|
|
@@ -12935,6 +12977,16 @@
|
|
|
12935
12977
|
SoleInvoiceService.prototype.sendEmail = function (invoice) {
|
|
12936
12978
|
return this.http.post(this.environment.apiV2 + "/" + this.url + "/" + invoice.id + "/send", {});
|
|
12937
12979
|
};
|
|
12980
|
+
/**
|
|
12981
|
+
* Return the next number from the last invoice.
|
|
12982
|
+
* Basically needed to create a new invoice to show its number when the invoice has not yet been sent to the backend
|
|
12983
|
+
*/
|
|
12984
|
+
SoleInvoiceService.prototype.getNewInvoiceNumber = function () {
|
|
12985
|
+
if (!this.cache) {
|
|
12986
|
+
return 0;
|
|
12987
|
+
}
|
|
12988
|
+
return last__default["default"](this.cache).number + 1;
|
|
12989
|
+
};
|
|
12938
12990
|
return SoleInvoiceService;
|
|
12939
12991
|
}(RestService));
|
|
12940
12992
|
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 +19049,38 @@
|
|
|
18997
19049
|
return SoleInvoiceItemForm;
|
|
18998
19050
|
}(AbstractForm));
|
|
18999
19051
|
|
|
19052
|
+
/**
|
|
19053
|
+
* Form is divided into two groups, since the creation of Sole invoice takes place in two steps:
|
|
19054
|
+
* a common invoice data and sole invoice items.
|
|
19055
|
+
*/
|
|
19000
19056
|
var SoleInvoiceForm = /** @class */ (function (_super) {
|
|
19001
19057
|
__extends(SoleInvoiceForm, _super);
|
|
19002
19058
|
function SoleInvoiceForm(invoice, soleDetailsGST,
|
|
19003
19059
|
// default template to be preselected
|
|
19004
19060
|
defaultTemplate) {
|
|
19005
19061
|
var _this = _super.call(this, {
|
|
19006
|
-
|
|
19007
|
-
|
|
19062
|
+
commonData: new forms.FormGroup({
|
|
19063
|
+
dateFrom: new forms.FormControl(invoice.dateFrom || new Date(), forms.Validators.required),
|
|
19064
|
+
dateTo: new forms.FormControl(invoice.dateTo, forms.Validators.required),
|
|
19065
|
+
payer: new forms.FormControl(invoice.payer, forms.Validators.required),
|
|
19066
|
+
taxType: new forms.FormControl(invoice.taxType, forms.Validators.required),
|
|
19067
|
+
bankAccount: new forms.FormControl(invoice.bankAccount, forms.Validators.required),
|
|
19068
|
+
reference: new forms.FormControl(invoice.reference)
|
|
19069
|
+
}),
|
|
19008
19070
|
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
19071
|
}, invoice) || this;
|
|
19014
19072
|
_this.invoice = invoice;
|
|
19015
19073
|
_this.soleDetailsGST = soleDetailsGST;
|
|
19016
19074
|
_this.defaultTemplate = defaultTemplate;
|
|
19017
19075
|
// we need invoice template only for new invoices
|
|
19018
19076
|
if (!invoice.id) {
|
|
19019
|
-
_this.addControl('template', new forms.FormControl(_this.defaultTemplate));
|
|
19077
|
+
(_this.commonData).addControl('template', new forms.FormControl(_this.defaultTemplate));
|
|
19020
19078
|
_this.updateTemplateRelatedFields(_this.defaultTemplate);
|
|
19021
19079
|
}
|
|
19022
19080
|
// invoice.taxType is always NONE ('No Tax') when soleDetails.isGST === false
|
|
19023
19081
|
if (!_this.soleDetailsGST) {
|
|
19024
|
-
_this.get('taxType').setValue(exports.SoleInvoiceTaxTypeEnum.NO_TAX);
|
|
19025
|
-
_this.get('taxType').disable();
|
|
19082
|
+
_this.commonData.get('taxType').setValue(exports.SoleInvoiceTaxTypeEnum.NO_TAX);
|
|
19083
|
+
_this.commonData.get('taxType').disable();
|
|
19026
19084
|
// Items isGST is not available when invoice.taxType === NONE ('No Tax')
|
|
19027
19085
|
_this.items.controls.forEach(function (itemForm) {
|
|
19028
19086
|
_this.disableItemGST(itemForm);
|
|
@@ -19048,8 +19106,8 @@
|
|
|
19048
19106
|
_this.listenItemChartAccountsChanges(itemForm);
|
|
19049
19107
|
});
|
|
19050
19108
|
}
|
|
19051
|
-
// nothing to listen if template field is not
|
|
19052
|
-
if (this.contains('template')) {
|
|
19109
|
+
// nothing to listen if template field is not exist (edit invoice case)
|
|
19110
|
+
if ((this.commonData).contains('template')) {
|
|
19053
19111
|
this.listenTemplateChanges();
|
|
19054
19112
|
}
|
|
19055
19113
|
};
|
|
@@ -19067,16 +19125,21 @@
|
|
|
19067
19125
|
};
|
|
19068
19126
|
SoleInvoiceForm.prototype.submit = function (data) {
|
|
19069
19127
|
if (data === void 0) { data = {}; }
|
|
19070
|
-
|
|
19071
|
-
|
|
19072
|
-
|
|
19128
|
+
this.submitted = true;
|
|
19129
|
+
this.markAllAsTouched();
|
|
19130
|
+
if (!this.disabled && !this.valid) {
|
|
19131
|
+
return null;
|
|
19132
|
+
}
|
|
19133
|
+
var invoiceInstance = this.currentValue;
|
|
19134
|
+
this.onSubmit.emit(invoiceInstance);
|
|
19135
|
+
return invoiceInstance;
|
|
19073
19136
|
};
|
|
19074
19137
|
/**
|
|
19075
19138
|
* Update default values from selected invoice template
|
|
19076
19139
|
*/
|
|
19077
19140
|
SoleInvoiceForm.prototype.listenTemplateChanges = function () {
|
|
19078
19141
|
var _this = this;
|
|
19079
|
-
this.get('template').valueChanges.subscribe(function (template) {
|
|
19142
|
+
this.commonData.get('template').valueChanges.subscribe(function (template) {
|
|
19080
19143
|
_this.updateTemplateRelatedFields(template);
|
|
19081
19144
|
});
|
|
19082
19145
|
};
|
|
@@ -19085,7 +19148,7 @@
|
|
|
19085
19148
|
*/
|
|
19086
19149
|
SoleInvoiceForm.prototype.listenTaxTypeChanges = function () {
|
|
19087
19150
|
var _this = this;
|
|
19088
|
-
this.get('taxType').valueChanges.subscribe(function (type) {
|
|
19151
|
+
this.commonData.get('taxType').valueChanges.subscribe(function (type) {
|
|
19089
19152
|
_this.items.controls.forEach(function (itemForm) {
|
|
19090
19153
|
var chartAccounts = itemForm.get('chartAccounts').value;
|
|
19091
19154
|
// Item GST is available when invoice.taxType !== NONE ('No Tax')
|
|
@@ -19098,18 +19161,18 @@
|
|
|
19098
19161
|
});
|
|
19099
19162
|
};
|
|
19100
19163
|
SoleInvoiceForm.prototype.updateTemplateRelatedFields = function (template) {
|
|
19101
|
-
this.get('bankAccount').setValue(template.bankAccount);
|
|
19102
|
-
var dateFrom = this.get('dateFrom').value;
|
|
19164
|
+
this.commonData.get('bankAccount').setValue(template.bankAccount);
|
|
19165
|
+
var dateFrom = this.commonData.get('dateFrom').value;
|
|
19103
19166
|
if (dateFrom) {
|
|
19104
|
-
this.get('dateTo').setValue(new Date(dateFrom.getTime() + template.termTime));
|
|
19167
|
+
this.commonData.get('dateTo').setValue(new Date(dateFrom.getTime() + template.termTime));
|
|
19105
19168
|
}
|
|
19106
19169
|
// invoice.taxType is always 'No Tax' when soleDetails.isGST = false and not available for changing
|
|
19107
19170
|
if (this.soleDetailsGST) {
|
|
19108
|
-
this.get('taxType').setValue(template.taxType);
|
|
19171
|
+
this.commonData.get('taxType').setValue(template.taxType);
|
|
19109
19172
|
}
|
|
19110
19173
|
};
|
|
19111
19174
|
/**
|
|
19112
|
-
* GST availability depends
|
|
19175
|
+
* GST availability depends on chart accounts isGST flag
|
|
19113
19176
|
*/
|
|
19114
19177
|
SoleInvoiceForm.prototype.listenItemChartAccountsChanges = function (itemForm) {
|
|
19115
19178
|
var _this = this;
|
|
@@ -19134,6 +19197,24 @@
|
|
|
19134
19197
|
itemForm.get('isGST').setValue(true);
|
|
19135
19198
|
itemForm.get('isGST').enable();
|
|
19136
19199
|
};
|
|
19200
|
+
Object.defineProperty(SoleInvoiceForm.prototype, "commonData", {
|
|
19201
|
+
get: function () {
|
|
19202
|
+
return this.get('commonData');
|
|
19203
|
+
},
|
|
19204
|
+
enumerable: false,
|
|
19205
|
+
configurable: true
|
|
19206
|
+
});
|
|
19207
|
+
Object.defineProperty(SoleInvoiceForm.prototype, "currentValue", {
|
|
19208
|
+
/**
|
|
19209
|
+
* Rewrite abstract form getter to flat "commonData" field, which is not in the class
|
|
19210
|
+
*/
|
|
19211
|
+
get: function () {
|
|
19212
|
+
var formRawValue = this.getRawValue();
|
|
19213
|
+
return classTransformer.plainToClass(SoleInvoice, Object.assign({}, this.model, Object.assign(Object.assign({}, formRawValue.commonData), { items: formRawValue.items })));
|
|
19214
|
+
},
|
|
19215
|
+
enumerable: false,
|
|
19216
|
+
configurable: true
|
|
19217
|
+
});
|
|
19137
19218
|
return SoleInvoiceForm;
|
|
19138
19219
|
}(AbstractForm));
|
|
19139
19220
|
|