taxtank-core 0.28.53 → 0.28.55
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 +58 -31
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/forms/sole/sole-invoice-item.form.js +1 -1
- package/esm2015/lib/forms/sole/sole-invoice.form.js +24 -12
- package/esm2015/lib/models/endpoint/endpoints.const.js +3 -1
- package/esm2015/lib/models/event/app-event-type.enum.js +20 -19
- package/esm2015/lib/models/sole/index.js +2 -1
- package/esm2015/lib/models/sole/sole-invoice-send-data.interface.js +2 -0
- package/esm2015/lib/services/http/sole/sole-invoice/sole-invoice.service.js +10 -2
- package/esm2015/lib/services/http/transaction/transaction.service.js +7 -1
- package/esm2015/lib/services/transaction/transaction-calculation.service.js +1 -2
- package/fesm2015/taxtank-core.js +56 -31
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/forms/sole/sole-invoice.form.d.ts +5 -2
- package/lib/models/event/app-event-type.enum.d.ts +19 -18
- package/lib/models/sole/index.d.ts +1 -0
- package/lib/models/sole/sole-invoice-send-data.interface.d.ts +9 -0
- package/lib/services/http/transaction/transaction.service.d.ts +1 -0
- package/package.json +1 -1
|
@@ -606,24 +606,25 @@
|
|
|
606
606
|
AppEventTypeEnum[AppEventTypeEnum["SOLE_DEPRECIATION_METHOD_UPDATED"] = 46] = "SOLE_DEPRECIATION_METHOD_UPDATED";
|
|
607
607
|
AppEventTypeEnum[AppEventTypeEnum["SOLE_DETAILS_CREATED"] = 47] = "SOLE_DETAILS_CREATED";
|
|
608
608
|
AppEventTypeEnum[AppEventTypeEnum["SOLE_DETAILS_UPDATED"] = 48] = "SOLE_DETAILS_UPDATED";
|
|
609
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
610
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
611
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
612
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
613
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
614
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
615
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
616
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
617
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
618
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
619
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
620
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
621
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
622
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
623
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
624
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
625
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
626
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
609
|
+
AppEventTypeEnum[AppEventTypeEnum["SOLE_INVOICE_PUBLISHED"] = 49] = "SOLE_INVOICE_PUBLISHED";
|
|
610
|
+
AppEventTypeEnum[AppEventTypeEnum["TAX_REVIEW_UPDATED"] = 50] = "TAX_REVIEW_UPDATED";
|
|
611
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_CREATED"] = 51] = "TRANSACTION_CREATED";
|
|
612
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_DELETED"] = 52] = "TRANSACTION_DELETED";
|
|
613
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED"] = 53] = "TRANSACTION_UPDATED";
|
|
614
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_RECEIPT"] = 54] = "TRANSACTION_UPDATED_WITH_RECEIPT";
|
|
615
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_DELETED_RECEIPT"] = 55] = "TRANSACTION_UPDATED_WITH_DELETED_RECEIPT";
|
|
616
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_CREATED"] = 56] = "TRANSACTION_RECEIPT_CREATED";
|
|
617
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_DELETED"] = 57] = "TRANSACTION_RECEIPT_DELETED";
|
|
618
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTIONS_CREATED"] = 58] = "TRANSACTIONS_CREATED";
|
|
619
|
+
AppEventTypeEnum[AppEventTypeEnum["USER_UPDATED"] = 59] = "USER_UPDATED";
|
|
620
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_UPDATED"] = 60] = "VEHICLE_CLAIM_UPDATED";
|
|
621
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_CREATED"] = 61] = "VEHICLE_CLAIM_CREATED";
|
|
622
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_UPDATED"] = 62] = "VEHICLE_CLAIM_DETAILS_UPDATED";
|
|
623
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_CREATED"] = 63] = "VEHICLE_CLAIM_DETAILS_CREATED";
|
|
624
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_CREATED"] = 64] = "VEHICLE_LOGBOOK_CREATED";
|
|
625
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_UPDATED"] = 65] = "VEHICLE_LOGBOOK_UPDATED";
|
|
626
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_DELETED"] = 66] = "VEHICLE_LOGBOOK_DELETED";
|
|
627
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED"] = 67] = "VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED";
|
|
627
628
|
})(exports.AppEventTypeEnum || (exports.AppEventTypeEnum = {}));
|
|
628
629
|
|
|
629
630
|
var EventDispatcherService = /** @class */ (function () {
|
|
@@ -1084,6 +1085,7 @@
|
|
|
1084
1085
|
SOLE_BUSINESS_LOSSES_PUT: new Endpoint('PUT', '\\/sole-business-losses\\/\\d+'),
|
|
1085
1086
|
SOLE_BUSINESS_LOSS_OFFSET_RULES_GET: new Endpoint('GET', '\\/sole-business-loss-offset-rules'),
|
|
1086
1087
|
SOLE_BUSINESS_LOGO_POST: new Endpoint('POST', '\\/sole-businesses\\/\\d+\\/logo'),
|
|
1088
|
+
SOLE_CONTACTS_GET: new Endpoint('GET', '\\/sole-contacts'),
|
|
1087
1089
|
SOLE_CONTACTS_POST: new Endpoint('POST', '\\/sole-contacts'),
|
|
1088
1090
|
SOLE_CONTACTS_PUT: new Endpoint('PUT', '\\/sole-contacts\\/\\d+'),
|
|
1089
1091
|
BUSINESS_ACTIVITIES_GET: new Endpoint('GET', '\\/sole-business-activities'),
|
|
@@ -1096,6 +1098,7 @@
|
|
|
1096
1098
|
SOLE_INVOICES_POST: new Endpoint('POST', '\\/sole-invoices'),
|
|
1097
1099
|
SOLE_INVOICES_PUT: new Endpoint('PUT', '\\/sole-invoices\\/\\d+'),
|
|
1098
1100
|
SOLE_INVOICES_DELETE: new Endpoint('DELETE', '\\/sole-invoices\\/\\d+'),
|
|
1101
|
+
SOLE_INVOICES_EMAIL_POST: new Endpoint('POST', '\\/sole-invoices\\/\\d+\\/send'),
|
|
1099
1102
|
SOLE_INVOICE_TEMPLATES_GET: new Endpoint('GET', '\\/sole-invoice-templates'),
|
|
1100
1103
|
SOLE_INVOICE_TEMPLATES_POST: new Endpoint('POST', '\\/sole-invoice-templates'),
|
|
1101
1104
|
SOLE_INVOICE_TEMPLATES_PUT: new Endpoint('PUT', '\\/sole-invoice-templates\\/\\d+'),
|
|
@@ -12714,8 +12717,14 @@
|
|
|
12714
12717
|
return this.update(updatedInvoice);
|
|
12715
12718
|
};
|
|
12716
12719
|
SoleInvoiceService.prototype.publish = function (invoice, document) {
|
|
12720
|
+
var _this = this;
|
|
12717
12721
|
// use id only to avoid unexpected changes
|
|
12718
|
-
return this.update(merge__default["default"]({}, invoice, { document: document, status: exports.SoleInvoiceStatusesEnum.PENDING }))
|
|
12722
|
+
return this.update(merge__default["default"]({}, invoice, { document: document, status: exports.SoleInvoiceStatusesEnum.PENDING }))
|
|
12723
|
+
.pipe(operators.map(function (publishedInvoice) {
|
|
12724
|
+
debugger;
|
|
12725
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.SOLE_INVOICE_PUBLISHED, publishedInvoice));
|
|
12726
|
+
return publishedInvoice;
|
|
12727
|
+
}));
|
|
12719
12728
|
};
|
|
12720
12729
|
SoleInvoiceService.prototype.sendEmail = function (invoice) {
|
|
12721
12730
|
return this.http.post(this.environment.apiV2 + "/" + this.url + "/" + invoice.id + "/send", {});
|
|
@@ -14009,6 +14018,7 @@
|
|
|
14009
14018
|
this.listenReceiptDeleted();
|
|
14010
14019
|
this.listenVehicleClaimChanges();
|
|
14011
14020
|
this.listenPropertyForecastUpdate();
|
|
14021
|
+
this.listenInvoicesPublish();
|
|
14012
14022
|
};
|
|
14013
14023
|
/**
|
|
14014
14024
|
* get list of all user's TaxTank transactions
|
|
@@ -14324,6 +14334,12 @@
|
|
|
14324
14334
|
replace(this.cache, transactionToReplace);
|
|
14325
14335
|
this.updateCache();
|
|
14326
14336
|
};
|
|
14337
|
+
TransactionService.prototype.listenInvoicesPublish = function () {
|
|
14338
|
+
var _this = this;
|
|
14339
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.SOLE_INVOICE_PUBLISHED).subscribe(function () {
|
|
14340
|
+
_this.resetCache();
|
|
14341
|
+
});
|
|
14342
|
+
};
|
|
14327
14343
|
return TransactionService;
|
|
14328
14344
|
}(RestService));
|
|
14329
14345
|
TransactionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: TransactionService, deps: [{ token: i1__namespace.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }, { token: TransactionReceiptService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
@@ -17657,7 +17673,6 @@
|
|
|
17657
17673
|
invoices.toArray().forEach(function (invoice) {
|
|
17658
17674
|
allocationsByInvoices.add(invoice.id, allocations.filterBy('transaction.id', invoice.getTransactionsIds()));
|
|
17659
17675
|
});
|
|
17660
|
-
console.log(allocationsByInvoices);
|
|
17661
17676
|
return allocationsByInvoices;
|
|
17662
17677
|
};
|
|
17663
17678
|
TransactionCalculationService.prototype.getBankTransactionsUnallocatedAmount = function (bankTransactions, allocations) {
|
|
@@ -18728,7 +18743,9 @@
|
|
|
18728
18743
|
|
|
18729
18744
|
var SoleInvoiceForm = /** @class */ (function (_super) {
|
|
18730
18745
|
__extends(SoleInvoiceForm, _super);
|
|
18731
|
-
function SoleInvoiceForm(invoice, soleDetailsGST
|
|
18746
|
+
function SoleInvoiceForm(invoice, soleDetailsGST,
|
|
18747
|
+
// default template to be preselected
|
|
18748
|
+
defaultTemplate) {
|
|
18732
18749
|
var _this = _super.call(this, {
|
|
18733
18750
|
dateFrom: new forms.FormControl(invoice.dateFrom || new Date(), forms.Validators.required),
|
|
18734
18751
|
dateTo: new forms.FormControl(invoice.dateTo, forms.Validators.required),
|
|
@@ -18738,10 +18755,13 @@
|
|
|
18738
18755
|
bankAccount: new forms.FormControl(invoice.bankAccount, forms.Validators.required),
|
|
18739
18756
|
reference: new forms.FormControl(invoice.reference)
|
|
18740
18757
|
}, invoice) || this;
|
|
18758
|
+
_this.invoice = invoice;
|
|
18741
18759
|
_this.soleDetailsGST = soleDetailsGST;
|
|
18760
|
+
_this.defaultTemplate = defaultTemplate;
|
|
18742
18761
|
// we need invoice template only for new invoices
|
|
18743
18762
|
if (!invoice.id) {
|
|
18744
|
-
_this.addControl('template', new forms.FormControl(
|
|
18763
|
+
_this.addControl('template', new forms.FormControl(_this.defaultTemplate));
|
|
18764
|
+
_this.updateTemplateRelatedFields(_this.defaultTemplate);
|
|
18745
18765
|
}
|
|
18746
18766
|
// invoice.taxType is always NONE ('No Tax') when soleDetails.isGST === false
|
|
18747
18767
|
if (!_this.soleDetailsGST) {
|
|
@@ -18752,6 +18772,10 @@
|
|
|
18752
18772
|
_this.disableItemGST(itemForm);
|
|
18753
18773
|
});
|
|
18754
18774
|
}
|
|
18775
|
+
else {
|
|
18776
|
+
// set tax type as 'Tax Exclusive' by default for new invoice if soleDetails.isGST === true
|
|
18777
|
+
_this.get('taxType').setValue(_this.invoice.id ? _this.invoice.taxType : exports.SoleInvoiceTaxTypeEnum.TAX_EXCLUSIVE);
|
|
18778
|
+
}
|
|
18755
18779
|
_this.listenEvents();
|
|
18756
18780
|
return _this;
|
|
18757
18781
|
}
|
|
@@ -18801,15 +18825,7 @@
|
|
|
18801
18825
|
SoleInvoiceForm.prototype.listenTemplateChanges = function () {
|
|
18802
18826
|
var _this = this;
|
|
18803
18827
|
this.get('template').valueChanges.subscribe(function (template) {
|
|
18804
|
-
_this.
|
|
18805
|
-
var dateFrom = _this.get('dateFrom').value;
|
|
18806
|
-
if (dateFrom) {
|
|
18807
|
-
_this.get('dateTo').setValue(new Date(dateFrom.getTime() + template.termTime));
|
|
18808
|
-
}
|
|
18809
|
-
// invoice.taxType is always 'No Tax' when soleDetails.isGST = false and not available for changing
|
|
18810
|
-
if (_this.soleDetailsGST) {
|
|
18811
|
-
_this.get('taxType').setValue(template.taxType);
|
|
18812
|
-
}
|
|
18828
|
+
_this.updateTemplateRelatedFields(template);
|
|
18813
18829
|
});
|
|
18814
18830
|
};
|
|
18815
18831
|
/**
|
|
@@ -18829,6 +18845,17 @@
|
|
|
18829
18845
|
});
|
|
18830
18846
|
});
|
|
18831
18847
|
};
|
|
18848
|
+
SoleInvoiceForm.prototype.updateTemplateRelatedFields = function (template) {
|
|
18849
|
+
this.get('bankAccount').setValue(template.bankAccount);
|
|
18850
|
+
var dateFrom = this.get('dateFrom').value;
|
|
18851
|
+
if (dateFrom) {
|
|
18852
|
+
this.get('dateTo').setValue(new Date(dateFrom.getTime() + template.termTime));
|
|
18853
|
+
}
|
|
18854
|
+
// invoice.taxType is always 'No Tax' when soleDetails.isGST = false and not available for changing
|
|
18855
|
+
if (this.soleDetailsGST) {
|
|
18856
|
+
this.get('taxType').setValue(template.taxType);
|
|
18857
|
+
}
|
|
18858
|
+
};
|
|
18832
18859
|
/**
|
|
18833
18860
|
* GST availability depends of chart accounts isGST flag
|
|
18834
18861
|
*/
|