taxtank-core 0.28.12 → 0.28.13
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 +1484 -1250
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/collection-dictionary.js +5 -2
- package/esm2015/lib/collections/sole/sole-invoice-item.collection.js +7 -0
- package/esm2015/lib/db/Enums/document-type.enum.js +5 -0
- package/esm2015/lib/db/Enums/index.js +3 -0
- package/esm2015/lib/db/Enums/sole-invoice-tax-type.enum.js +7 -0
- package/esm2015/lib/db/Enums/sole-invoice-template-tax-type.enum.js +4 -4
- package/esm2015/lib/db/Models/sole/sole-invoice-item.js +1 -1
- package/esm2015/lib/db/Models/sole/sole-invoice.js +1 -1
- package/esm2015/lib/forms/bank/bank-account/bank-account-add-manual.form.js +10 -6
- package/esm2015/lib/forms/bank/bank-account/bank-account-allocation.form.js +5 -4
- package/esm2015/lib/forms/sole/sole-invoice-item.form.js +3 -31
- package/esm2015/lib/forms/sole/sole-invoice-template.form.js +4 -5
- package/esm2015/lib/forms/sole/sole-invoice.form.js +93 -18
- package/esm2015/lib/models/dictionary/dictionary.js +2 -2
- package/esm2015/lib/models/document/index.js +3 -0
- package/esm2015/lib/models/index.js +2 -1
- package/esm2015/lib/models/sole/sole-details.js +1 -3
- package/esm2015/lib/models/sole/sole-invoice-item.js +10 -2
- package/esm2015/lib/models/sole/sole-invoice-template.js +13 -10
- package/esm2015/lib/models/sole/sole-invoice.js +82 -28
- package/esm2015/lib/services/http/document/document-folder/document-folder.service.js +1 -1
- package/esm2015/lib/services/http/document/document.service.js +20 -0
- package/esm2015/lib/services/http/document/index.js +3 -0
- package/esm2015/lib/services/http/index.js +2 -1
- package/esm2015/lib/services/http/rest/rest.service.js +23 -7
- package/esm2015/lib/services/http/sole/sole-invoice/sole-invoice.service.js +15 -1
- package/esm2015/lib/services/pdf/pdf-from-dom-element/pdf-from-dom-element.service.js +17 -5
- package/esm2015/lib/services/transaction/transaction-calculation.service.js +13 -1
- package/esm2015/public-api.js +3 -2
- package/fesm2015/taxtank-core.js +1149 -952
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/sole/sole-invoice-item.collection.d.ts +5 -0
- package/lib/db/Enums/document-type.enum.d.ts +3 -0
- package/lib/db/Enums/index.d.ts +1 -0
- package/lib/db/Enums/sole-invoice-tax-type.enum.d.ts +5 -0
- package/lib/db/Enums/sole-invoice-template-tax-type.enum.d.ts +3 -3
- package/lib/db/Models/sole/sole-invoice-item.d.ts +3 -1
- package/lib/db/Models/sole/sole-invoice.d.ts +8 -5
- package/lib/forms/bank/bank-account/bank-account-add-manual.form.d.ts +3 -1
- package/lib/forms/bank/bank-account/bank-account-allocation.form.d.ts +4 -1
- package/lib/forms/sole/sole-invoice-item.form.d.ts +2 -7
- package/lib/forms/sole/sole-invoice-template.form.d.ts +2 -3
- package/lib/forms/sole/sole-invoice.form.d.ts +19 -2
- package/lib/models/document/index.d.ts +2 -0
- package/lib/models/index.d.ts +1 -0
- package/lib/models/sole/sole-details.d.ts +0 -2
- package/lib/models/sole/sole-invoice-item.d.ts +7 -1
- package/lib/models/sole/sole-invoice-template.d.ts +10 -3
- package/lib/models/sole/sole-invoice.d.ts +49 -5
- package/lib/services/http/document/document.service.d.ts +10 -0
- package/lib/services/http/document/index.d.ts +2 -0
- package/lib/services/http/index.d.ts +1 -0
- package/lib/services/http/rest/rest.service.d.ts +13 -4
- package/lib/services/http/sole/sole-invoice/sole-invoice.service.d.ts +6 -1
- package/lib/services/pdf/pdf-from-dom-element/pdf-from-dom-element.service.d.ts +5 -1
- package/lib/services/transaction/transaction-calculation.service.d.ts +6 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators'), require('class-transformer'), require('@auth0/angular-jwt'), require('lodash/get'), require('lodash/last'), require('lodash/flatten'), require('lodash/hasIn'), require('lodash/first'), require('moment'), require('moment-range'), require('lodash/uniqBy'), require('lodash/concat'), require('rxjs/internal/observable/throwError'), require('lodash/cloneDeep'), require('event-source-polyfill/src/eventsource.min.js'), require('lodash/compact'), require('@angular/forms'), require('lodash/isEqual'), require('lodash/fromPairs'), require('lodash'), require('@angular/router'), require('lodash/clone'), require('html2pdf.js'), require('jspdf'), require('jspdf-autotable'), require('@stripe/stripe-js'), require('xlsx'), require('file-saver')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('taxtank-core', ['exports', '@angular/core', '@angular/common', '@angular/common/http', 'rxjs', 'rxjs/operators', 'class-transformer', '@auth0/angular-jwt', 'lodash/get', 'lodash/last', 'lodash/flatten', 'lodash/hasIn', 'lodash/first', 'moment', 'moment-range', 'lodash/uniqBy', 'lodash/concat', 'rxjs/internal/observable/throwError', 'lodash/cloneDeep', 'event-source-polyfill/src/eventsource.min.js', 'lodash/compact', '@angular/forms', 'lodash/isEqual', 'lodash/fromPairs', 'lodash', '@angular/router', 'lodash/clone', 'html2pdf.js', 'jspdf', 'jspdf-autotable', '@stripe/stripe-js', 'xlsx', 'file-saver'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["taxtank-core"] = {}, global.ng.core, global.ng.common, global.ng.common.http, global.rxjs, global.rxjs.operators, global.classTransformer, global.angularJwt, global.get, global.last, global.flatten, global.hasIn, global.first, global.moment$1, global.momentRange, global.uniqBy, global.concat, global.rxjs["internal/observable/throwError"], global.cloneDeep$1, global.eventsource_min_js, global.compact, global.ng.forms, global.isEqual, global.fromPairs, global._, global.ng.router, global.clone, global.html2pdf, global.jsPDF, global.autoTable, global.stripeJs, global.xlsx, global.FileSaver));
|
|
5
|
-
})(this, (function (exports, i0, i1$1, i1, rxjs, operators, classTransformer, angularJwt, get, last, flatten, hasIn, first, moment$1, momentRange, uniqBy, concat, throwError, cloneDeep$1, eventsource_min_js, compact, forms, isEqual, fromPairs, _, i1$2, clone, html2pdf, jsPDF, autoTable, stripeJs, xlsx, FileSaver) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators'), require('class-transformer'), require('@auth0/angular-jwt'), require('lodash/get'), require('lodash/last'), require('lodash/flatten'), require('lodash/hasIn'), require('lodash/first'), require('moment'), require('moment-range'), require('lodash/uniqBy'), require('lodash/concat'), require('rxjs/internal/observable/throwError'), require('lodash/cloneDeep'), require('event-source-polyfill/src/eventsource.min.js'), require('lodash/compact'), require('@angular/forms'), require('lodash/merge'), require('lodash/isEqual'), require('lodash/fromPairs'), require('lodash'), require('@angular/router'), require('lodash/clone'), require('html2pdf.js'), require('jspdf'), require('jspdf-autotable'), require('@stripe/stripe-js'), require('xlsx'), require('file-saver')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('taxtank-core', ['exports', '@angular/core', '@angular/common', '@angular/common/http', 'rxjs', 'rxjs/operators', 'class-transformer', '@auth0/angular-jwt', 'lodash/get', 'lodash/last', 'lodash/flatten', 'lodash/hasIn', 'lodash/first', 'moment', 'moment-range', 'lodash/uniqBy', 'lodash/concat', 'rxjs/internal/observable/throwError', 'lodash/cloneDeep', 'event-source-polyfill/src/eventsource.min.js', 'lodash/compact', '@angular/forms', 'lodash/merge', 'lodash/isEqual', 'lodash/fromPairs', 'lodash', '@angular/router', 'lodash/clone', 'html2pdf.js', 'jspdf', 'jspdf-autotable', '@stripe/stripe-js', 'xlsx', 'file-saver'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["taxtank-core"] = {}, global.ng.core, global.ng.common, global.ng.common.http, global.rxjs, global.rxjs.operators, global.classTransformer, global.angularJwt, global.get, global.last, global.flatten, global.hasIn, global.first, global.moment$1, global.momentRange, global.uniqBy, global.concat, global.rxjs["internal/observable/throwError"], global.cloneDeep$1, global.eventsource_min_js, global.compact, global.ng.forms, global.merge, global.isEqual, global.fromPairs, global._, global.ng.router, global.clone, global.html2pdf, global.jsPDF, global.autoTable, global.stripeJs, global.xlsx, global.FileSaver));
|
|
5
|
+
})(this, (function (exports, i0, i1$1, i1, rxjs, operators, classTransformer, angularJwt, get, last, flatten, hasIn, first, moment$1, momentRange, uniqBy, concat, throwError, cloneDeep$1, eventsource_min_js, compact, forms, merge, isEqual, fromPairs, _, i1$2, clone, html2pdf, jsPDF, autoTable, stripeJs, xlsx, FileSaver) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
var concat__default = /*#__PURE__*/_interopDefaultLegacy(concat);
|
|
38
38
|
var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep$1);
|
|
39
39
|
var compact__default = /*#__PURE__*/_interopDefaultLegacy(compact);
|
|
40
|
+
var merge__default = /*#__PURE__*/_interopDefaultLegacy(merge);
|
|
40
41
|
var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
|
|
41
42
|
var fromPairs__default = /*#__PURE__*/_interopDefaultLegacy(fromPairs);
|
|
42
43
|
var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
|
|
@@ -1341,12 +1342,11 @@
|
|
|
1341
1342
|
};
|
|
1342
1343
|
/**
|
|
1343
1344
|
* add new instance and update cache
|
|
1344
|
-
* @TODO rename to post
|
|
1345
1345
|
*/
|
|
1346
|
-
RestService.prototype.
|
|
1346
|
+
RestService.prototype.create = function (data, shouldUpdateCache) {
|
|
1347
1347
|
var _this = this;
|
|
1348
1348
|
if (shouldUpdateCache === void 0) { shouldUpdateCache = true; }
|
|
1349
|
-
return this.http.post(this.environment.apiV2 + "/" + this.url,
|
|
1349
|
+
return this.http.post(this.environment.apiV2 + "/" + this.url, data)
|
|
1350
1350
|
.pipe(operators.map(function (newItem) {
|
|
1351
1351
|
if (!shouldUpdateCache) {
|
|
1352
1352
|
return null;
|
|
@@ -1362,11 +1362,30 @@
|
|
|
1362
1362
|
return newInstance;
|
|
1363
1363
|
}));
|
|
1364
1364
|
};
|
|
1365
|
+
/**
|
|
1366
|
+
* @TODO Alex TT-1777 rename to post
|
|
1367
|
+
*/
|
|
1368
|
+
RestService.prototype.add = function (model, shouldUpdateCache) {
|
|
1369
|
+
if (shouldUpdateCache === void 0) { shouldUpdateCache = true; }
|
|
1370
|
+
return this.create(classTransformer.classToPlain(model), shouldUpdateCache);
|
|
1371
|
+
};
|
|
1372
|
+
/**
|
|
1373
|
+
* @TODO Alex TT-1777 rename to upload
|
|
1374
|
+
*/
|
|
1375
|
+
RestService.prototype.postForm = function (file, params) {
|
|
1376
|
+
if (params === void 0) { params = {}; }
|
|
1377
|
+
var formData = new FormData();
|
|
1378
|
+
formData.append('file', file);
|
|
1379
|
+
for (var key in params) {
|
|
1380
|
+
formData.append(key, params[key]);
|
|
1381
|
+
}
|
|
1382
|
+
return this.create(formData);
|
|
1383
|
+
};
|
|
1365
1384
|
/**
|
|
1366
1385
|
* Add several new items
|
|
1367
1386
|
* @param models Array of new items for saving
|
|
1368
1387
|
* @param queryParams query parameters for request
|
|
1369
|
-
* @TODO rename to postBatch
|
|
1388
|
+
* @TODO Alex TT-1777 rename to postBatch
|
|
1370
1389
|
*/
|
|
1371
1390
|
RestService.prototype.addBatch = function (models, queryParams) {
|
|
1372
1391
|
var _this = this;
|
|
@@ -1389,7 +1408,7 @@
|
|
|
1389
1408
|
* Update item
|
|
1390
1409
|
* @param model Existing instance for updating
|
|
1391
1410
|
* @param queryParams query parameters for request
|
|
1392
|
-
* @TODO rename to put
|
|
1411
|
+
* @TODO Alex TT-1777 rename to put
|
|
1393
1412
|
*/
|
|
1394
1413
|
RestService.prototype.update = function (model, queryParams) {
|
|
1395
1414
|
var _this = this;
|
|
@@ -1409,7 +1428,7 @@
|
|
|
1409
1428
|
* Update several items
|
|
1410
1429
|
* @param models Array of items for updating
|
|
1411
1430
|
* @param queryParams query parameters for request
|
|
1412
|
-
* TODO rename to putBatch
|
|
1431
|
+
* TODO Alex TT-1777 rename to putBatch
|
|
1413
1432
|
*/
|
|
1414
1433
|
RestService.prototype.updateBatch = function (models, queryParams) {
|
|
1415
1434
|
var _this = this;
|
|
@@ -1712,7 +1731,10 @@
|
|
|
1712
1731
|
*/
|
|
1713
1732
|
CollectionDictionary.prototype.merge = function (keys) {
|
|
1714
1733
|
var _this = this;
|
|
1715
|
-
|
|
1734
|
+
if (!this.length) {
|
|
1735
|
+
return this.createCollection([]);
|
|
1736
|
+
}
|
|
1737
|
+
return this.createCollection(flatten__default["default"](keys.map(function (key) { return _this.get(key.toString()).items; })));
|
|
1716
1738
|
};
|
|
1717
1739
|
/**
|
|
1718
1740
|
* Create instance of collection
|
|
@@ -3105,573 +3127,591 @@
|
|
|
3105
3127
|
classTransformer.Type(function () { return ChartAccountsMetadata; })
|
|
3106
3128
|
], ChartAccounts.prototype, "metadata", void 0);
|
|
3107
3129
|
|
|
3108
|
-
var
|
|
3109
|
-
__extends(
|
|
3110
|
-
function
|
|
3111
|
-
|
|
3112
|
-
_this.isGST = false;
|
|
3113
|
-
return _this;
|
|
3130
|
+
var TransactionBase = /** @class */ (function (_super) {
|
|
3131
|
+
__extends(TransactionBase, _super);
|
|
3132
|
+
function TransactionBase() {
|
|
3133
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
3114
3134
|
}
|
|
3115
|
-
Object.defineProperty(
|
|
3135
|
+
Object.defineProperty(TransactionBase.prototype, "tankType", {
|
|
3116
3136
|
get: function () {
|
|
3117
|
-
|
|
3137
|
+
switch (true) {
|
|
3138
|
+
case this.isPropertyTank():
|
|
3139
|
+
return exports.TankTypeEnum.PROPERTY;
|
|
3140
|
+
case this.isWorkTank():
|
|
3141
|
+
return exports.TankTypeEnum.WORK;
|
|
3142
|
+
case this.isSoleTank():
|
|
3143
|
+
return exports.TankTypeEnum.SOLE;
|
|
3144
|
+
default:
|
|
3145
|
+
return exports.TankTypeEnum.OTHER;
|
|
3146
|
+
}
|
|
3118
3147
|
},
|
|
3119
3148
|
enumerable: false,
|
|
3120
3149
|
configurable: true
|
|
3121
3150
|
});
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3151
|
+
/**
|
|
3152
|
+
* Check if current tank is Property
|
|
3153
|
+
*/
|
|
3154
|
+
TransactionBase.prototype.isPropertyTank = function () {
|
|
3155
|
+
// chart accounts may be empty for new instances
|
|
3156
|
+
if (this.chartAccounts) {
|
|
3157
|
+
return CHART_ACCOUNTS_CATEGORIES.property.includes(this.chartAccounts.category);
|
|
3158
|
+
}
|
|
3159
|
+
return !!this.property;
|
|
3160
|
+
};
|
|
3161
|
+
/**
|
|
3162
|
+
* Check if current tank is Work
|
|
3163
|
+
*/
|
|
3164
|
+
TransactionBase.prototype.isWorkTank = function () {
|
|
3165
|
+
var _a;
|
|
3166
|
+
// chart accounts may be empty for new instances
|
|
3167
|
+
if (this.chartAccounts) {
|
|
3168
|
+
return CHART_ACCOUNTS_CATEGORIES.work.includes((_a = this.chartAccounts) === null || _a === void 0 ? void 0 : _a.category);
|
|
3169
|
+
}
|
|
3170
|
+
return !this.isPropertyTank() && !this.isSoleTank();
|
|
3171
|
+
};
|
|
3172
|
+
/**
|
|
3173
|
+
* Check if current tank is Sole
|
|
3174
|
+
*/
|
|
3175
|
+
TransactionBase.prototype.isSoleTank = function () {
|
|
3176
|
+
var _a;
|
|
3177
|
+
// chart accounts may be empty for new instances
|
|
3178
|
+
if (this.chartAccounts) {
|
|
3179
|
+
return CHART_ACCOUNTS_CATEGORIES.sole.includes((_a = this.chartAccounts) === null || _a === void 0 ? void 0 : _a.category);
|
|
3180
|
+
}
|
|
3181
|
+
return !!this.business;
|
|
3182
|
+
};
|
|
3183
|
+
return TransactionBase;
|
|
3184
|
+
}(AbstractModel));
|
|
3127
3185
|
__decorate([
|
|
3128
|
-
classTransformer.
|
|
3129
|
-
|
|
3186
|
+
classTransformer.Exclude({ toPlainOnly: true }),
|
|
3187
|
+
classTransformer.Type(function () { return Object; }),
|
|
3188
|
+
classTransformer.Transform(function (_b) {
|
|
3189
|
+
var obj = _b.obj;
|
|
3190
|
+
return obj.file;
|
|
3191
|
+
})
|
|
3192
|
+
], TransactionBase.prototype, "file", void 0);
|
|
3130
3193
|
|
|
3131
|
-
var
|
|
3132
|
-
__extends(
|
|
3133
|
-
function
|
|
3194
|
+
var Transaction$1 = /** @class */ (function (_super) {
|
|
3195
|
+
__extends(Transaction, _super);
|
|
3196
|
+
function Transaction() {
|
|
3134
3197
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
3135
3198
|
}
|
|
3136
|
-
return
|
|
3137
|
-
}(
|
|
3199
|
+
return Transaction;
|
|
3200
|
+
}(TransactionBase));
|
|
3138
3201
|
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
}
|
|
3145
|
-
Object.defineProperty(SoleContact.prototype, "fullName", {
|
|
3146
|
-
get: function () {
|
|
3147
|
-
return this.firstName + " " + this.lastName;
|
|
3148
|
-
},
|
|
3149
|
-
enumerable: false,
|
|
3150
|
-
configurable: true
|
|
3151
|
-
});
|
|
3152
|
-
SoleContact.prototype.getPhotoPlaceholder = function () {
|
|
3153
|
-
return "" + this.firstName[0].toUpperCase() + this.lastName[0].toUpperCase();
|
|
3154
|
-
};
|
|
3155
|
-
// @TODO Vik: add photo field to SoleContact
|
|
3156
|
-
SoleContact.prototype.getPhoto = function () {
|
|
3157
|
-
return '';
|
|
3158
|
-
};
|
|
3159
|
-
return SoleContact;
|
|
3160
|
-
}(SoleContact$1));
|
|
3161
|
-
__decorate([
|
|
3162
|
-
classTransformer.Type(function () { return User; })
|
|
3163
|
-
], SoleContact.prototype, "user", void 0);
|
|
3164
|
-
__decorate([
|
|
3165
|
-
classTransformer.Type(function () { return Phone; })
|
|
3166
|
-
], SoleContact.prototype, "phone", void 0);
|
|
3167
|
-
__decorate([
|
|
3168
|
-
classTransformer.Type(function () { return Address; })
|
|
3169
|
-
], SoleContact.prototype, "address", void 0);
|
|
3170
|
-
__decorate([
|
|
3171
|
-
classTransformer.Type(function () { return SoleInvoice; })
|
|
3172
|
-
], SoleContact.prototype, "invoices", void 0);
|
|
3202
|
+
exports.TransactionTypeEnum = void 0;
|
|
3203
|
+
(function (TransactionTypeEnum) {
|
|
3204
|
+
TransactionTypeEnum[TransactionTypeEnum["DEBIT"] = 1] = "DEBIT";
|
|
3205
|
+
TransactionTypeEnum[TransactionTypeEnum["CREDIT"] = 2] = "CREDIT";
|
|
3206
|
+
})(exports.TransactionTypeEnum || (exports.TransactionTypeEnum = {}));
|
|
3173
3207
|
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3208
|
+
exports.TransactionOperationEnum = void 0;
|
|
3209
|
+
(function (TransactionOperationEnum) {
|
|
3210
|
+
TransactionOperationEnum[TransactionOperationEnum["ALLOCATE"] = 1] = "ALLOCATE";
|
|
3211
|
+
TransactionOperationEnum[TransactionOperationEnum["FIND_AND_MATCH"] = 2] = "FIND_AND_MATCH";
|
|
3212
|
+
TransactionOperationEnum[TransactionOperationEnum["TRANSFER"] = 3] = "TRANSFER";
|
|
3213
|
+
})(exports.TransactionOperationEnum || (exports.TransactionOperationEnum = {}));
|
|
3214
|
+
|
|
3215
|
+
exports.TransactionSourceEnum = void 0;
|
|
3216
|
+
(function (TransactionSourceEnum) {
|
|
3217
|
+
TransactionSourceEnum[TransactionSourceEnum["CASH"] = 1] = "CASH";
|
|
3218
|
+
TransactionSourceEnum[TransactionSourceEnum["BANK_TRANSACTION"] = 2] = "BANK_TRANSACTION";
|
|
3219
|
+
})(exports.TransactionSourceEnum || (exports.TransactionSourceEnum = {}));
|
|
3220
|
+
|
|
3221
|
+
exports.DepreciationTypeEnum = void 0;
|
|
3222
|
+
(function (DepreciationTypeEnum) {
|
|
3223
|
+
DepreciationTypeEnum[DepreciationTypeEnum["PLANT_EQUIPMENT"] = 1] = "PLANT_EQUIPMENT";
|
|
3224
|
+
DepreciationTypeEnum[DepreciationTypeEnum["CAPITAL_WORKS"] = 2] = "CAPITAL_WORKS";
|
|
3225
|
+
DepreciationTypeEnum[DepreciationTypeEnum["BULK_DEPRECIATION"] = 3] = "BULK_DEPRECIATION";
|
|
3226
|
+
DepreciationTypeEnum[DepreciationTypeEnum["BORROWING_EXPENSES"] = 4] = "BORROWING_EXPENSES";
|
|
3227
|
+
})(exports.DepreciationTypeEnum || (exports.DepreciationTypeEnum = {}));
|
|
3228
|
+
|
|
3229
|
+
exports.DepreciationCalculationEnum = void 0;
|
|
3230
|
+
(function (DepreciationCalculationEnum) {
|
|
3231
|
+
DepreciationCalculationEnum[DepreciationCalculationEnum["PRIME_COST"] = 1] = "PRIME_COST";
|
|
3232
|
+
DepreciationCalculationEnum[DepreciationCalculationEnum["DIMINISHING"] = 2] = "DIMINISHING";
|
|
3233
|
+
DepreciationCalculationEnum[DepreciationCalculationEnum["CAPITAL"] = 3] = "CAPITAL";
|
|
3234
|
+
DepreciationCalculationEnum[DepreciationCalculationEnum["LVP"] = 4] = "LVP";
|
|
3235
|
+
DepreciationCalculationEnum[DepreciationCalculationEnum["AMORTISATION"] = 5] = "AMORTISATION";
|
|
3236
|
+
DepreciationCalculationEnum[DepreciationCalculationEnum["SBP"] = 6] = "SBP";
|
|
3237
|
+
})(exports.DepreciationCalculationEnum || (exports.DepreciationCalculationEnum = {}));
|
|
3238
|
+
|
|
3239
|
+
var TransactionReceipt$1 = /** @class */ (function (_super) {
|
|
3240
|
+
__extends(TransactionReceipt, _super);
|
|
3241
|
+
function TransactionReceipt() {
|
|
3177
3242
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
3178
3243
|
}
|
|
3179
|
-
return
|
|
3244
|
+
return TransactionReceipt;
|
|
3180
3245
|
}(AbstractModel));
|
|
3181
3246
|
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3247
|
+
// @TODO this enum should come from backend
|
|
3248
|
+
/**
|
|
3249
|
+
* Enum with asset types
|
|
3250
|
+
*/
|
|
3251
|
+
exports.AssetTypeEnum = void 0;
|
|
3252
|
+
(function (AssetTypeEnum) {
|
|
3253
|
+
AssetTypeEnum["RECEIPTS"] = "receipts";
|
|
3254
|
+
AssetTypeEnum["DOCUMENTS"] = "documents";
|
|
3255
|
+
AssetTypeEnum["MESSAGE"] = "message";
|
|
3256
|
+
})(exports.AssetTypeEnum || (exports.AssetTypeEnum = {}));
|
|
3188
3257
|
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3258
|
+
/**
|
|
3259
|
+
* Enum with asset entity types
|
|
3260
|
+
*/
|
|
3261
|
+
exports.AssetEntityTypeEnum = void 0;
|
|
3262
|
+
(function (AssetEntityTypeEnum) {
|
|
3263
|
+
AssetEntityTypeEnum["PROPERTIES"] = "properties";
|
|
3264
|
+
AssetEntityTypeEnum["FOLDERS"] = "folders";
|
|
3265
|
+
AssetEntityTypeEnum["DEPRECIATIONS"] = "depreciations";
|
|
3266
|
+
AssetEntityTypeEnum["TRANSACTIONS"] = "transactions";
|
|
3267
|
+
AssetEntityTypeEnum["MESSAGES"] = "messages";
|
|
3268
|
+
})(exports.AssetEntityTypeEnum || (exports.AssetEntityTypeEnum = {}));
|
|
3269
|
+
|
|
3270
|
+
var TransactionReceipt = /** @class */ (function (_super) {
|
|
3271
|
+
__extends(TransactionReceipt, _super);
|
|
3272
|
+
function TransactionReceipt() {
|
|
3192
3273
|
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
3193
|
-
_this.
|
|
3274
|
+
_this.type = exports.AssetTypeEnum.RECEIPTS;
|
|
3275
|
+
_this.entityType = exports.AssetEntityTypeEnum.TRANSACTIONS;
|
|
3194
3276
|
return _this;
|
|
3195
3277
|
}
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
};
|
|
3199
|
-
SoleInvoiceTemplate.prototype.isTaxExclusive = function () {
|
|
3200
|
-
return this.taxType === exports.SoleInvoiceTemplateTaxTypeEnum.EXCLUSIVE;
|
|
3201
|
-
};
|
|
3202
|
-
SoleInvoiceTemplate.prototype.isTaxInclusive = function () {
|
|
3203
|
-
return this.taxType === exports.SoleInvoiceTemplateTaxTypeEnum.INCLUSIVE;
|
|
3204
|
-
};
|
|
3205
|
-
return SoleInvoiceTemplate;
|
|
3206
|
-
}(SoleInvoiceTemplate$1));
|
|
3207
|
-
__decorate([
|
|
3208
|
-
classTransformer.Type(function () { return SoleBusiness; })
|
|
3209
|
-
], SoleInvoiceTemplate.prototype, "business", void 0);
|
|
3210
|
-
__decorate([
|
|
3211
|
-
classTransformer.Type(function () { return BankAccount; })
|
|
3212
|
-
], SoleInvoiceTemplate.prototype, "bankAccount", void 0);
|
|
3213
|
-
|
|
3214
|
-
exports.SoleInvoiceStatusesEnum = void 0;
|
|
3215
|
-
(function (SoleInvoiceStatusesEnum) {
|
|
3216
|
-
SoleInvoiceStatusesEnum[SoleInvoiceStatusesEnum["CANCELED"] = 0] = "CANCELED";
|
|
3217
|
-
SoleInvoiceStatusesEnum[SoleInvoiceStatusesEnum["DRAFT"] = 1] = "DRAFT";
|
|
3218
|
-
SoleInvoiceStatusesEnum[SoleInvoiceStatusesEnum["PENDING"] = 2] = "PENDING";
|
|
3219
|
-
SoleInvoiceStatusesEnum[SoleInvoiceStatusesEnum["PAID"] = 3] = "PAID";
|
|
3220
|
-
})(exports.SoleInvoiceStatusesEnum || (exports.SoleInvoiceStatusesEnum = {}));
|
|
3278
|
+
return TransactionReceipt;
|
|
3279
|
+
}(TransactionReceipt$1));
|
|
3221
3280
|
|
|
3222
|
-
var
|
|
3223
|
-
__extends(
|
|
3224
|
-
function
|
|
3281
|
+
var IncomeSource$1 = /** @class */ (function (_super) {
|
|
3282
|
+
__extends(IncomeSource, _super);
|
|
3283
|
+
function IncomeSource() {
|
|
3225
3284
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
3226
3285
|
}
|
|
3227
|
-
return
|
|
3286
|
+
return IncomeSource;
|
|
3228
3287
|
}(AbstractModel));
|
|
3229
3288
|
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3289
|
+
exports.IncomeSourceTypeEnum = void 0;
|
|
3290
|
+
(function (IncomeSourceTypeEnum) {
|
|
3291
|
+
IncomeSourceTypeEnum[IncomeSourceTypeEnum["WORK"] = 1] = "WORK";
|
|
3292
|
+
IncomeSourceTypeEnum[IncomeSourceTypeEnum["SOLE"] = 2] = "SOLE";
|
|
3293
|
+
IncomeSourceTypeEnum[IncomeSourceTypeEnum["OTHER"] = 3] = "OTHER";
|
|
3294
|
+
})(exports.IncomeSourceTypeEnum || (exports.IncomeSourceTypeEnum = {}));
|
|
3295
|
+
|
|
3296
|
+
var SalaryForecast$1 = /** @class */ (function (_super) {
|
|
3297
|
+
__extends(SalaryForecast, _super);
|
|
3298
|
+
function SalaryForecast() {
|
|
3233
3299
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
3234
3300
|
}
|
|
3235
|
-
return
|
|
3236
|
-
}(
|
|
3237
|
-
SoleDetails.GSTPercentMultiplier = 0.1;
|
|
3238
|
-
SoleDetails.GSTPercentDivider = 11;
|
|
3239
|
-
__decorate([
|
|
3240
|
-
classTransformer.Type(function () { return User; })
|
|
3241
|
-
], SoleDetails.prototype, "user", void 0);
|
|
3301
|
+
return SalaryForecast;
|
|
3302
|
+
}(AbstractModel));
|
|
3242
3303
|
|
|
3243
|
-
var
|
|
3244
|
-
__extends(
|
|
3245
|
-
function
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3304
|
+
var SalaryForecast = /** @class */ (function (_super) {
|
|
3305
|
+
__extends(SalaryForecast, _super);
|
|
3306
|
+
function SalaryForecast() {
|
|
3307
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
3308
|
+
}
|
|
3309
|
+
return SalaryForecast;
|
|
3310
|
+
}(SalaryForecast$1));
|
|
3311
|
+
__decorate([
|
|
3312
|
+
classTransformer.Transform(function (_a) {
|
|
3313
|
+
var obj = _a.obj;
|
|
3314
|
+
return obj.netPay + obj.tax;
|
|
3315
|
+
}),
|
|
3316
|
+
classTransformer.Expose()
|
|
3317
|
+
], SalaryForecast.prototype, "grossAmount", void 0);
|
|
3318
|
+
__decorate([
|
|
3319
|
+
classTransformer.Type(function () { return IncomeSource; })
|
|
3320
|
+
], SalaryForecast.prototype, "incomeSource", void 0);
|
|
3321
|
+
|
|
3322
|
+
var SoleForecast$1 = /** @class */ (function (_super) {
|
|
3323
|
+
__extends(SoleForecast, _super);
|
|
3324
|
+
function SoleForecast() {
|
|
3325
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
3326
|
+
}
|
|
3327
|
+
return SoleForecast;
|
|
3328
|
+
}(AbstractModel));
|
|
3329
|
+
|
|
3330
|
+
var SoleForecast = /** @class */ (function (_super) {
|
|
3331
|
+
__extends(SoleForecast, _super);
|
|
3332
|
+
function SoleForecast() {
|
|
3333
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
3250
3334
|
}
|
|
3251
|
-
Object.defineProperty(
|
|
3335
|
+
Object.defineProperty(SoleForecast.prototype, "netPay", {
|
|
3252
3336
|
get: function () {
|
|
3253
|
-
return this.
|
|
3337
|
+
return this.amount;
|
|
3254
3338
|
},
|
|
3255
3339
|
enumerable: false,
|
|
3256
3340
|
configurable: true
|
|
3257
3341
|
});
|
|
3258
|
-
|
|
3259
|
-
|
|
3342
|
+
;
|
|
3343
|
+
return SoleForecast;
|
|
3344
|
+
}(SoleForecast$1));
|
|
3345
|
+
__decorate([
|
|
3346
|
+
classTransformer.Type(function () { return IncomeSource; })
|
|
3347
|
+
], SoleForecast.prototype, "incomeSource", void 0);
|
|
3348
|
+
|
|
3349
|
+
var IncomeSourceForecast$1 = /** @class */ (function (_super) {
|
|
3350
|
+
__extends(IncomeSourceForecast, _super);
|
|
3351
|
+
function IncomeSourceForecast() {
|
|
3352
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
3353
|
+
}
|
|
3354
|
+
return IncomeSourceForecast;
|
|
3355
|
+
}(AbstractModel));
|
|
3356
|
+
|
|
3357
|
+
exports.SalaryForecastFrequencyEnum = void 0;
|
|
3358
|
+
(function (SalaryForecastFrequencyEnum) {
|
|
3359
|
+
SalaryForecastFrequencyEnum[SalaryForecastFrequencyEnum["ANNUAL"] = 1] = "ANNUAL";
|
|
3360
|
+
SalaryForecastFrequencyEnum[SalaryForecastFrequencyEnum["MONTHLY"] = 12] = "MONTHLY";
|
|
3361
|
+
SalaryForecastFrequencyEnum[SalaryForecastFrequencyEnum["FORTNIGHTLY"] = 26] = "FORTNIGHTLY";
|
|
3362
|
+
SalaryForecastFrequencyEnum[SalaryForecastFrequencyEnum["WEEKLY"] = 52] = "WEEKLY";
|
|
3363
|
+
})(exports.SalaryForecastFrequencyEnum || (exports.SalaryForecastFrequencyEnum = {}));
|
|
3364
|
+
|
|
3365
|
+
var IncomeSourceType$1 = /** @class */ (function (_super) {
|
|
3366
|
+
__extends(IncomeSourceType, _super);
|
|
3367
|
+
function IncomeSourceType() {
|
|
3368
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
3369
|
+
}
|
|
3370
|
+
return IncomeSourceType;
|
|
3371
|
+
}(AbstractModel));
|
|
3372
|
+
|
|
3373
|
+
exports.IncomeSourceTypeListWorkEnum = void 0;
|
|
3374
|
+
(function (IncomeSourceTypeListWorkEnum) {
|
|
3375
|
+
IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["BONUSES"] = 1] = "BONUSES";
|
|
3376
|
+
IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["DIRECTOR_FEES"] = 2] = "DIRECTOR_FEES";
|
|
3377
|
+
IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["DIVIDENDS"] = 3] = "DIVIDENDS";
|
|
3378
|
+
IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["INTEREST"] = 4] = "INTEREST";
|
|
3379
|
+
IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["PENSIONS_AND_ALLOWANCES"] = 5] = "PENSIONS_AND_ALLOWANCES";
|
|
3380
|
+
IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["SUPERANNUATION"] = 8] = "SUPERANNUATION";
|
|
3381
|
+
IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["ATTRIBUTED_P_S_I"] = 11] = "ATTRIBUTED_P_S_I";
|
|
3382
|
+
})(exports.IncomeSourceTypeListWorkEnum || (exports.IncomeSourceTypeListWorkEnum = {}));
|
|
3383
|
+
|
|
3384
|
+
exports.IncomeSourceTypeListOtherEnum = void 0;
|
|
3385
|
+
(function (IncomeSourceTypeListOtherEnum) {
|
|
3386
|
+
IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["PSI"] = 6] = "PSI";
|
|
3387
|
+
IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["SOLE_TRADER"] = 7] = "SOLE_TRADER";
|
|
3388
|
+
IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["TRUSTS"] = 9] = "TRUSTS";
|
|
3389
|
+
IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["OTHER_INCOME"] = 10] = "OTHER_INCOME";
|
|
3390
|
+
IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["PARTNERSHIPS"] = 12] = "PARTNERSHIPS";
|
|
3391
|
+
})(exports.IncomeSourceTypeListOtherEnum || (exports.IncomeSourceTypeListOtherEnum = {}));
|
|
3392
|
+
|
|
3393
|
+
exports.IncomeSourceTypeListSoleEnum = void 0;
|
|
3394
|
+
(function (IncomeSourceTypeListSoleEnum) {
|
|
3395
|
+
IncomeSourceTypeListSoleEnum[IncomeSourceTypeListSoleEnum["SOLE_TRADER"] = 7] = "SOLE_TRADER";
|
|
3396
|
+
})(exports.IncomeSourceTypeListSoleEnum || (exports.IncomeSourceTypeListSoleEnum = {}));
|
|
3397
|
+
|
|
3398
|
+
var IncomeSourceType = /** @class */ (function (_super) {
|
|
3399
|
+
__extends(IncomeSourceType, _super);
|
|
3400
|
+
function IncomeSourceType() {
|
|
3401
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
3402
|
+
}
|
|
3403
|
+
IncomeSourceType.prototype.isBonuses = function () {
|
|
3404
|
+
return this.id === exports.IncomeSourceTypeListWorkEnum.BONUSES;
|
|
3405
|
+
};
|
|
3406
|
+
IncomeSourceType.prototype.isWork = function () {
|
|
3407
|
+
return !!exports.IncomeSourceTypeListWorkEnum[this.id];
|
|
3408
|
+
};
|
|
3409
|
+
IncomeSourceType.prototype.isOther = function () {
|
|
3410
|
+
return !!exports.IncomeSourceTypeListOtherEnum[this.id];
|
|
3260
3411
|
};
|
|
3261
|
-
|
|
3262
|
-
return this.
|
|
3412
|
+
IncomeSourceType.prototype.isSole = function () {
|
|
3413
|
+
return !!exports.IncomeSourceTypeListSoleEnum[this.id];
|
|
3263
3414
|
};
|
|
3264
|
-
Object.defineProperty(
|
|
3415
|
+
Object.defineProperty(IncomeSourceType.prototype, "type", {
|
|
3265
3416
|
get: function () {
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3417
|
+
switch (true) {
|
|
3418
|
+
case this.isWork():
|
|
3419
|
+
return exports.IncomeSourceTypeEnum.WORK;
|
|
3420
|
+
case this.isSole():
|
|
3421
|
+
return exports.IncomeSourceTypeEnum.SOLE;
|
|
3422
|
+
default:
|
|
3423
|
+
return exports.IncomeSourceTypeEnum.OTHER;
|
|
3269
3424
|
}
|
|
3270
|
-
return this.amount;
|
|
3271
3425
|
},
|
|
3272
3426
|
enumerable: false,
|
|
3273
3427
|
configurable: true
|
|
3274
3428
|
});
|
|
3275
|
-
|
|
3429
|
+
return IncomeSourceType;
|
|
3430
|
+
}(IncomeSourceType$1));
|
|
3431
|
+
|
|
3432
|
+
var IncomeSourceForecast = /** @class */ (function (_super) {
|
|
3433
|
+
__extends(IncomeSourceForecast, _super);
|
|
3434
|
+
function IncomeSourceForecast() {
|
|
3435
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
3436
|
+
_this.paygIncome = 0;
|
|
3437
|
+
_this.frequency = exports.SalaryForecastFrequencyEnum.ANNUAL;
|
|
3438
|
+
_this.isTaxFree = false;
|
|
3439
|
+
return _this;
|
|
3440
|
+
}
|
|
3441
|
+
Object.defineProperty(IncomeSourceForecast.prototype, "netPay", {
|
|
3442
|
+
/**
|
|
3443
|
+
* Sometimes Income source has Salary & Income source forecasts,
|
|
3444
|
+
* and we need these fields to work with Income source forecasts like with Salary Forecasts
|
|
3445
|
+
*/
|
|
3276
3446
|
get: function () {
|
|
3277
|
-
|
|
3278
|
-
switch (true) {
|
|
3279
|
-
case (_a = this.template) === null || _a === void 0 ? void 0 : _a.isTaxInclusive():
|
|
3280
|
-
return +(this.getGSTItemsAmount() / SoleDetails.GSTPercentDivider).toFixed(2);
|
|
3281
|
-
case (_b = this.template) === null || _b === void 0 ? void 0 : _b.isTaxExclusive():
|
|
3282
|
-
return +(this.getGSTItemsAmount() * SoleDetails.GSTPercentMultiplier).toFixed(2);
|
|
3283
|
-
default:
|
|
3284
|
-
return 0;
|
|
3285
|
-
}
|
|
3447
|
+
return this.amount;
|
|
3286
3448
|
},
|
|
3287
3449
|
enumerable: false,
|
|
3288
3450
|
configurable: true
|
|
3289
3451
|
});
|
|
3290
|
-
Object.defineProperty(
|
|
3452
|
+
Object.defineProperty(IncomeSourceForecast.prototype, "grossAmount", {
|
|
3291
3453
|
get: function () {
|
|
3292
|
-
|
|
3293
|
-
if ((_a = this.template) === null || _a === void 0 ? void 0 : _a.isTaxExclusive()) {
|
|
3294
|
-
return this.amount + this.GSTAmount;
|
|
3295
|
-
}
|
|
3296
|
-
return this.amount;
|
|
3454
|
+
return this.amount + this.tax + this.taxInstalments + this.frankingCredits;
|
|
3297
3455
|
},
|
|
3298
3456
|
enumerable: false,
|
|
3299
3457
|
configurable: true
|
|
3300
3458
|
});
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3459
|
+
return IncomeSourceForecast;
|
|
3460
|
+
}(IncomeSourceForecast$1));
|
|
3461
|
+
__decorate([
|
|
3462
|
+
classTransformer.Type(function () { return IncomeSourceType; })
|
|
3463
|
+
], IncomeSourceForecast.prototype, "incomeSourceType", void 0);
|
|
3464
|
+
__decorate([
|
|
3465
|
+
classTransformer.Type(function () { return IncomeSource; })
|
|
3466
|
+
], IncomeSourceForecast.prototype, "incomeSource", void 0);
|
|
3467
|
+
|
|
3468
|
+
var IncomeSource = /** @class */ (function (_super) {
|
|
3469
|
+
__extends(IncomeSource, _super);
|
|
3470
|
+
function IncomeSource() {
|
|
3471
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
3472
|
+
}
|
|
3473
|
+
IncomeSource.prototype.isSalaryIncome = function () {
|
|
3474
|
+
return !!this.salaryForecasts.length;
|
|
3475
|
+
// @TODO Vik: old code
|
|
3476
|
+
// return this.type === IncomeSourceTypeEnum.SALARY;
|
|
3306
3477
|
};
|
|
3307
|
-
|
|
3308
|
-
return this.
|
|
3478
|
+
IncomeSource.prototype.isSoleIncome = function () {
|
|
3479
|
+
return !!this.soleForecasts.length;
|
|
3309
3480
|
};
|
|
3310
|
-
|
|
3311
|
-
return this.
|
|
3481
|
+
IncomeSource.prototype.isWorkIncome = function () {
|
|
3482
|
+
return this.type === exports.IncomeSourceTypeEnum.WORK;
|
|
3312
3483
|
};
|
|
3313
|
-
|
|
3314
|
-
return this.
|
|
3484
|
+
IncomeSource.prototype.isOtherIncome = function () {
|
|
3485
|
+
return this.type === exports.IncomeSourceTypeEnum.OTHER || (!this.isSoleIncome() && !this.isSalaryIncome());
|
|
3315
3486
|
};
|
|
3316
|
-
|
|
3317
|
-
|
|
3487
|
+
Object.defineProperty(IncomeSource.prototype, "forecasts", {
|
|
3488
|
+
/**
|
|
3489
|
+
* Get salary and other income forecasts
|
|
3490
|
+
*/
|
|
3491
|
+
get: function () {
|
|
3492
|
+
return __spreadArray(__spreadArray(__spreadArray([], __read(this.salaryForecasts)), __read(this.incomeSourceForecasts)), __read(this.soleForecasts));
|
|
3493
|
+
},
|
|
3494
|
+
enumerable: false,
|
|
3495
|
+
configurable: true
|
|
3496
|
+
});
|
|
3497
|
+
Object.defineProperty(IncomeSource.prototype, "actualForecast", {
|
|
3498
|
+
/**
|
|
3499
|
+
* Get actual (1st from the list) forecast
|
|
3500
|
+
*/
|
|
3501
|
+
get: function () {
|
|
3502
|
+
return this.forecasts[0];
|
|
3503
|
+
},
|
|
3504
|
+
enumerable: false,
|
|
3505
|
+
configurable: true
|
|
3506
|
+
});
|
|
3507
|
+
/**
|
|
3508
|
+
* Check if user was working in month taken by the index
|
|
3509
|
+
* @param monthIndex by which month should be taken
|
|
3510
|
+
*/
|
|
3511
|
+
IncomeSource.prototype.isWorkedInMonth = function (monthIndex) {
|
|
3512
|
+
var monthDate = new FinancialYear().getMonthDate(monthIndex);
|
|
3513
|
+
return (!this.dateFrom || monthDate >= this.dateFrom) && (!this.dateTo || monthDate < this.dateTo);
|
|
3318
3514
|
};
|
|
3319
|
-
return
|
|
3320
|
-
}(
|
|
3321
|
-
__decorate([
|
|
3322
|
-
classTransformer.Type(function () { return Date; })
|
|
3323
|
-
], SoleInvoice.prototype, "dateFrom", void 0);
|
|
3324
|
-
__decorate([
|
|
3325
|
-
classTransformer.Type(function () { return Date; })
|
|
3326
|
-
], SoleInvoice.prototype, "dateTo", void 0);
|
|
3515
|
+
return IncomeSource;
|
|
3516
|
+
}(IncomeSource$1));
|
|
3327
3517
|
__decorate([
|
|
3328
|
-
classTransformer.Type(function () { return
|
|
3329
|
-
],
|
|
3518
|
+
classTransformer.Type(function () { return SalaryForecast; })
|
|
3519
|
+
], IncomeSource.prototype, "salaryForecasts", void 0);
|
|
3330
3520
|
__decorate([
|
|
3331
|
-
classTransformer.Type(function () { return
|
|
3332
|
-
],
|
|
3521
|
+
classTransformer.Type(function () { return SoleForecast; })
|
|
3522
|
+
], IncomeSource.prototype, "soleForecasts", void 0);
|
|
3333
3523
|
__decorate([
|
|
3334
|
-
classTransformer.Type(function () { return
|
|
3335
|
-
],
|
|
3524
|
+
classTransformer.Type(function () { return IncomeSourceForecast; })
|
|
3525
|
+
], IncomeSource.prototype, "incomeSourceForecasts", void 0);
|
|
3336
3526
|
__decorate([
|
|
3337
|
-
classTransformer.Type(function () { return
|
|
3338
|
-
],
|
|
3527
|
+
classTransformer.Type(function () { return Date; })
|
|
3528
|
+
], IncomeSource.prototype, "dateFrom", void 0);
|
|
3339
3529
|
__decorate([
|
|
3340
|
-
classTransformer.Type(function () { return
|
|
3341
|
-
],
|
|
3530
|
+
classTransformer.Type(function () { return Date; })
|
|
3531
|
+
], IncomeSource.prototype, "dateTo", void 0);
|
|
3342
3532
|
|
|
3343
|
-
/**
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
*/
|
|
3348
|
-
var LogbookPeriod = /** @class */ (function () {
|
|
3349
|
-
function LogbookPeriod() {
|
|
3533
|
+
var TransactionMetadata$1 = /** @class */ (function (_super) {
|
|
3534
|
+
__extends(TransactionMetadata, _super);
|
|
3535
|
+
function TransactionMetadata() {
|
|
3536
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
3350
3537
|
}
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
classTransformer.Type(function () { return Date; })
|
|
3362
|
-
], LogbookPeriod.prototype, "from", void 0);
|
|
3538
|
+
return TransactionMetadata;
|
|
3539
|
+
}(AbstractModel));
|
|
3540
|
+
|
|
3541
|
+
var TransactionMetadata = /** @class */ (function (_super) {
|
|
3542
|
+
__extends(TransactionMetadata, _super);
|
|
3543
|
+
function TransactionMetadata() {
|
|
3544
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
3545
|
+
}
|
|
3546
|
+
return TransactionMetadata;
|
|
3547
|
+
}(TransactionMetadata$1));
|
|
3363
3548
|
__decorate([
|
|
3364
|
-
classTransformer.Type(function () { return
|
|
3365
|
-
],
|
|
3549
|
+
classTransformer.Type(function () { return ChartAccountsMetadata; })
|
|
3550
|
+
], TransactionMetadata.prototype, "metadata", void 0);
|
|
3366
3551
|
|
|
3367
|
-
var
|
|
3368
|
-
__extends(
|
|
3369
|
-
function
|
|
3552
|
+
var TransactionAllocation$1 = /** @class */ (function (_super) {
|
|
3553
|
+
__extends(TransactionAllocation, _super);
|
|
3554
|
+
function TransactionAllocation() {
|
|
3370
3555
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
3371
3556
|
}
|
|
3372
|
-
return
|
|
3557
|
+
return TransactionAllocation;
|
|
3373
3558
|
}(AbstractModel));
|
|
3374
3559
|
|
|
3375
|
-
var
|
|
3376
|
-
__extends(
|
|
3377
|
-
function
|
|
3560
|
+
var BankTransaction$1 = /** @class */ (function (_super) {
|
|
3561
|
+
__extends(BankTransaction, _super);
|
|
3562
|
+
function BankTransaction() {
|
|
3378
3563
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
3379
3564
|
}
|
|
3380
|
-
return
|
|
3565
|
+
return BankTransaction;
|
|
3381
3566
|
}(AbstractModel));
|
|
3382
3567
|
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3568
|
+
exports.BankTransactionTypeEnum = void 0;
|
|
3569
|
+
(function (BankTransactionTypeEnum) {
|
|
3570
|
+
BankTransactionTypeEnum[BankTransactionTypeEnum["DEBIT"] = 1] = "DEBIT";
|
|
3571
|
+
BankTransactionTypeEnum[BankTransactionTypeEnum["CREDIT"] = 2] = "CREDIT";
|
|
3572
|
+
})(exports.BankTransactionTypeEnum || (exports.BankTransactionTypeEnum = {}));
|
|
3573
|
+
|
|
3574
|
+
var BankTransaction = /** @class */ (function (_super) {
|
|
3575
|
+
__extends(BankTransaction, _super);
|
|
3576
|
+
function BankTransaction() {
|
|
3577
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
3578
|
+
// allocated money amount for bank transaction
|
|
3579
|
+
_this.allocatedAmount = 0;
|
|
3580
|
+
_this.unallocatedAmount = 0;
|
|
3581
|
+
return _this;
|
|
3388
3582
|
}
|
|
3389
|
-
Object.defineProperty(
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
enumerable: false,
|
|
3394
|
-
configurable: true
|
|
3395
|
-
});
|
|
3396
|
-
Object.defineProperty(VehicleLogbook.prototype, "tankType", {
|
|
3583
|
+
Object.defineProperty(BankTransaction.prototype, "balanceAmount", {
|
|
3584
|
+
/**
|
|
3585
|
+
* get allocated amount value but with +/- sign
|
|
3586
|
+
*/
|
|
3397
3587
|
get: function () {
|
|
3398
|
-
return this.
|
|
3588
|
+
return this.isCredit() ? this.allocatedAmount : -this.allocatedAmount;
|
|
3399
3589
|
},
|
|
3400
3590
|
enumerable: false,
|
|
3401
3591
|
configurable: true
|
|
3402
3592
|
});
|
|
3403
|
-
|
|
3404
|
-
|
|
3593
|
+
/**
|
|
3594
|
+
* check if bank transaction is debit
|
|
3595
|
+
*/
|
|
3596
|
+
BankTransaction.prototype.isDebit = function () {
|
|
3597
|
+
return this.type === exports.BankTransactionTypeEnum.DEBIT;
|
|
3405
3598
|
};
|
|
3406
|
-
|
|
3407
|
-
|
|
3599
|
+
/**
|
|
3600
|
+
* check if bank transaction is credit
|
|
3601
|
+
*/
|
|
3602
|
+
BankTransaction.prototype.isCredit = function () {
|
|
3603
|
+
return this.type === exports.BankTransactionTypeEnum.CREDIT;
|
|
3408
3604
|
};
|
|
3409
3605
|
/**
|
|
3410
|
-
*
|
|
3606
|
+
* Create Transaction instance based on Bank Transaction
|
|
3411
3607
|
*/
|
|
3412
|
-
|
|
3413
|
-
return
|
|
3608
|
+
BankTransaction.prototype.toTransaction = function () {
|
|
3609
|
+
return classTransformer.plainToClass(Transaction, {
|
|
3610
|
+
amount: +this.amount.toFixed(2),
|
|
3611
|
+
description: this.description,
|
|
3612
|
+
date: this.date,
|
|
3613
|
+
source: exports.TransactionSourceEnum.BANK_TRANSACTION,
|
|
3614
|
+
operation: this.operation,
|
|
3615
|
+
type: this.type,
|
|
3616
|
+
});
|
|
3414
3617
|
};
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3618
|
+
/**
|
|
3619
|
+
* Check if bank transaction is completely allocated
|
|
3620
|
+
*/
|
|
3621
|
+
BankTransaction.prototype.isAllocated = function (allocations) {
|
|
3622
|
+
return this.amount === this.getAllocatedAmount(allocations);
|
|
3623
|
+
};
|
|
3624
|
+
/**
|
|
3625
|
+
* Get bank transaction allocated amount
|
|
3626
|
+
*/
|
|
3627
|
+
BankTransaction.prototype.getAllocatedAmount = function (allocations) {
|
|
3628
|
+
return allocations.getByBankTransactionsIds([this.id]).amount;
|
|
3629
|
+
};
|
|
3630
|
+
/**
|
|
3631
|
+
* Get bank transaction unallocated amount
|
|
3632
|
+
*/
|
|
3633
|
+
BankTransaction.prototype.getUnallocatedAmount = function (allocations) {
|
|
3634
|
+
return this.amount - this.getAllocatedAmount(allocations);
|
|
3635
|
+
};
|
|
3636
|
+
return BankTransaction;
|
|
3637
|
+
}(BankTransaction$1));
|
|
3422
3638
|
__decorate([
|
|
3423
3639
|
classTransformer.Type(function () { return Date; })
|
|
3424
|
-
],
|
|
3425
|
-
__decorate([
|
|
3426
|
-
classTransformer.Type(function () { return SoleBusiness; })
|
|
3427
|
-
], VehicleLogbook.prototype, "business", void 0);
|
|
3640
|
+
], BankTransaction.prototype, "date", void 0);
|
|
3428
3641
|
|
|
3429
|
-
var
|
|
3430
|
-
__extends(
|
|
3431
|
-
function
|
|
3642
|
+
var TransactionAllocation = /** @class */ (function (_super) {
|
|
3643
|
+
__extends(TransactionAllocation, _super);
|
|
3644
|
+
function TransactionAllocation() {
|
|
3432
3645
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
3433
3646
|
}
|
|
3434
|
-
|
|
3435
|
-
|
|
3647
|
+
/**
|
|
3648
|
+
* Create a new instance of transaction allocation
|
|
3649
|
+
* transaction could be empty since we can POST allocation inside a new transaction
|
|
3650
|
+
*/
|
|
3651
|
+
TransactionAllocation.create = function (amount, bankTransaction, transaction) {
|
|
3652
|
+
return classTransformer.plainToClass(TransactionAllocation, { amount: amount, transaction: transaction, bankTransaction: bankTransaction });
|
|
3653
|
+
};
|
|
3654
|
+
return TransactionAllocation;
|
|
3655
|
+
}(TransactionAllocation$1));
|
|
3436
3656
|
__decorate([
|
|
3437
|
-
classTransformer.Type(function () { return
|
|
3438
|
-
],
|
|
3657
|
+
classTransformer.Type(function () { return BankTransaction; })
|
|
3658
|
+
], TransactionAllocation.prototype, "bankTransaction", void 0);
|
|
3659
|
+
__decorate([
|
|
3660
|
+
classTransformer.Type(function () { return Transaction; })
|
|
3661
|
+
], TransactionAllocation.prototype, "transaction", void 0);
|
|
3439
3662
|
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3663
|
+
/**
|
|
3664
|
+
* Enum with income amount types (Net or Gross)
|
|
3665
|
+
*/
|
|
3666
|
+
exports.IncomeAmountTypeEnum = void 0;
|
|
3667
|
+
(function (IncomeAmountTypeEnum) {
|
|
3668
|
+
IncomeAmountTypeEnum[IncomeAmountTypeEnum["NET"] = 0] = "NET";
|
|
3669
|
+
IncomeAmountTypeEnum[IncomeAmountTypeEnum["GROSS"] = 1] = "GROSS";
|
|
3670
|
+
})(exports.IncomeAmountTypeEnum || (exports.IncomeAmountTypeEnum = {}));
|
|
3671
|
+
|
|
3672
|
+
var Depreciation$1 = /** @class */ (function (_super) {
|
|
3673
|
+
__extends(Depreciation, _super);
|
|
3674
|
+
function Depreciation() {
|
|
3443
3675
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
3444
3676
|
}
|
|
3445
|
-
return
|
|
3446
|
-
}(
|
|
3677
|
+
return Depreciation;
|
|
3678
|
+
}(TransactionBase));
|
|
3447
3679
|
|
|
3448
|
-
var
|
|
3449
|
-
__extends(
|
|
3450
|
-
function
|
|
3680
|
+
var DepreciationCapitalProject$1 = /** @class */ (function (_super) {
|
|
3681
|
+
__extends(DepreciationCapitalProject, _super);
|
|
3682
|
+
function DepreciationCapitalProject() {
|
|
3451
3683
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
3452
3684
|
}
|
|
3453
|
-
return
|
|
3685
|
+
return DepreciationCapitalProject;
|
|
3454
3686
|
}(AbstractModel));
|
|
3455
3687
|
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
})(exports.VehicleClaimDetailsMethodEnum || (exports.VehicleClaimDetailsMethodEnum = {}));
|
|
3461
|
-
|
|
3462
|
-
var VehicleClaimDetails = /** @class */ (function (_super) {
|
|
3463
|
-
__extends(VehicleClaimDetails, _super);
|
|
3464
|
-
function VehicleClaimDetails() {
|
|
3465
|
-
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
3466
|
-
/**
|
|
3467
|
-
* Init default values for the new instances
|
|
3468
|
-
*/
|
|
3469
|
-
_this.isManual = true;
|
|
3470
|
-
_this.method = exports.VehicleClaimDetailsMethodEnum.KMS;
|
|
3471
|
-
_this.financialYear = new FinancialYear().year;
|
|
3472
|
-
return _this;
|
|
3688
|
+
var DepreciationCapitalProject = /** @class */ (function (_super) {
|
|
3689
|
+
__extends(DepreciationCapitalProject, _super);
|
|
3690
|
+
function DepreciationCapitalProject() {
|
|
3691
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
3473
3692
|
}
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
};
|
|
3477
|
-
VehicleClaimDetails.prototype.isKmsMethod = function () {
|
|
3478
|
-
return this.method === exports.VehicleClaimDetailsMethodEnum.KMS;
|
|
3479
|
-
};
|
|
3480
|
-
return VehicleClaimDetails;
|
|
3481
|
-
}(VehicleClaimDetails$1));
|
|
3693
|
+
return DepreciationCapitalProject;
|
|
3694
|
+
}(DepreciationCapitalProject$1));
|
|
3482
3695
|
__decorate([
|
|
3483
|
-
classTransformer.Type(function () { return
|
|
3484
|
-
],
|
|
3696
|
+
classTransformer.Type(function () { return Date; })
|
|
3697
|
+
], DepreciationCapitalProject.prototype, "effectiveDate", void 0);
|
|
3485
3698
|
|
|
3486
|
-
var
|
|
3487
|
-
__extends(
|
|
3488
|
-
function
|
|
3489
|
-
|
|
3490
|
-
_this.kilometers = 0;
|
|
3491
|
-
_this.workUsage = 0;
|
|
3492
|
-
return _this;
|
|
3699
|
+
var DepreciationForecast$1 = /** @class */ (function (_super) {
|
|
3700
|
+
__extends(DepreciationForecast, _super);
|
|
3701
|
+
function DepreciationForecast() {
|
|
3702
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
3493
3703
|
}
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3704
|
+
return DepreciationForecast;
|
|
3705
|
+
}(AbstractModel));
|
|
3706
|
+
|
|
3707
|
+
var DepreciationForecast = /** @class */ (function (_super) {
|
|
3708
|
+
__extends(DepreciationForecast, _super);
|
|
3709
|
+
function DepreciationForecast() {
|
|
3710
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
3711
|
+
}
|
|
3712
|
+
Object.defineProperty(DepreciationForecast.prototype, "dailyClaimAmount", {
|
|
3501
3713
|
get: function () {
|
|
3502
|
-
return this.
|
|
3503
|
-
},
|
|
3504
|
-
enumerable: false,
|
|
3505
|
-
configurable: true
|
|
3506
|
-
});
|
|
3507
|
-
/**
|
|
3508
|
-
* Claim amount for KMs method. Exists only for KMs method.
|
|
3509
|
-
*/
|
|
3510
|
-
VehicleClaim.prototype.getKMSClaimAmount = function (vehicleClaimRate) {
|
|
3511
|
-
return +(this.kilometers * vehicleClaimRate).toFixed(2);
|
|
3512
|
-
};
|
|
3513
|
-
/**
|
|
3514
|
-
* Get logbook claim amount. Exists only for logbook method.
|
|
3515
|
-
* ClaimAmount = WorkUsage * transaction/depreciation amount
|
|
3516
|
-
*/
|
|
3517
|
-
VehicleClaim.prototype.getLogbookClaimAmount = function (transactions) {
|
|
3518
|
-
var transactionsAmount = transactions
|
|
3519
|
-
.getByVehicleClaim(this)
|
|
3520
|
-
.getLogbookTransactions()
|
|
3521
|
-
.sumBy('amount');
|
|
3522
|
-
// Math.abs because amount will be negative (because we sum expenses), but we don't want negative percent value
|
|
3523
|
-
return Math.abs(transactionsAmount) * this.workUsage / 100;
|
|
3524
|
-
};
|
|
3525
|
-
VehicleClaim.prototype.getAverageWeeklyKMS = function () {
|
|
3526
|
-
return this.kilometers / FinancialYear.weeksInYear;
|
|
3527
|
-
};
|
|
3528
|
-
VehicleClaim.getKMSChartAccountsIdByTankType = function (tankType) {
|
|
3529
|
-
return tankType === exports.TankTypeEnum.WORK
|
|
3530
|
-
? exports.ChartAccountsListEnum.KLMS_TRAVELLED_FOR_WORK
|
|
3531
|
-
: exports.ChartAccountsListEnum.KLMS_TRAVELLED;
|
|
3532
|
-
};
|
|
3533
|
-
return VehicleClaim;
|
|
3534
|
-
}(VehicleClaim$1));
|
|
3535
|
-
/**
|
|
3536
|
-
* limit for kms claim method
|
|
3537
|
-
*/
|
|
3538
|
-
VehicleClaim.totalKmsLimit = 5000;
|
|
3539
|
-
/**
|
|
3540
|
-
* limit for work usage claim method
|
|
3541
|
-
*/
|
|
3542
|
-
VehicleClaim.totalWorkUsagePercent = 100;
|
|
3543
|
-
__decorate([
|
|
3544
|
-
classTransformer.Type(function () { return VehicleClaimDetails; })
|
|
3545
|
-
], VehicleClaim.prototype, "details", void 0);
|
|
3546
|
-
__decorate([
|
|
3547
|
-
classTransformer.Type(function () { return SoleBusiness; })
|
|
3548
|
-
], VehicleClaim.prototype, "business", void 0);
|
|
3549
|
-
|
|
3550
|
-
var TransactionBase = /** @class */ (function (_super) {
|
|
3551
|
-
__extends(TransactionBase, _super);
|
|
3552
|
-
function TransactionBase() {
|
|
3553
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
3554
|
-
}
|
|
3555
|
-
Object.defineProperty(TransactionBase.prototype, "tankType", {
|
|
3556
|
-
get: function () {
|
|
3557
|
-
switch (true) {
|
|
3558
|
-
case this.isPropertyTank():
|
|
3559
|
-
return exports.TankTypeEnum.PROPERTY;
|
|
3560
|
-
case this.isWorkTank():
|
|
3561
|
-
return exports.TankTypeEnum.WORK;
|
|
3562
|
-
case this.isSoleTank():
|
|
3563
|
-
return exports.TankTypeEnum.SOLE;
|
|
3564
|
-
default:
|
|
3565
|
-
return exports.TankTypeEnum.OTHER;
|
|
3566
|
-
}
|
|
3567
|
-
},
|
|
3568
|
-
enumerable: false,
|
|
3569
|
-
configurable: true
|
|
3570
|
-
});
|
|
3571
|
-
/**
|
|
3572
|
-
* Check if current tank is Property
|
|
3573
|
-
*/
|
|
3574
|
-
TransactionBase.prototype.isPropertyTank = function () {
|
|
3575
|
-
// chart accounts may be empty for new instances
|
|
3576
|
-
if (this.chartAccounts) {
|
|
3577
|
-
return CHART_ACCOUNTS_CATEGORIES.property.includes(this.chartAccounts.category);
|
|
3578
|
-
}
|
|
3579
|
-
return !!this.property;
|
|
3580
|
-
};
|
|
3581
|
-
/**
|
|
3582
|
-
* Check if current tank is Work
|
|
3583
|
-
*/
|
|
3584
|
-
TransactionBase.prototype.isWorkTank = function () {
|
|
3585
|
-
var _a;
|
|
3586
|
-
// chart accounts may be empty for new instances
|
|
3587
|
-
if (this.chartAccounts) {
|
|
3588
|
-
return CHART_ACCOUNTS_CATEGORIES.work.includes((_a = this.chartAccounts) === null || _a === void 0 ? void 0 : _a.category);
|
|
3589
|
-
}
|
|
3590
|
-
return !this.isPropertyTank() && !this.isSoleTank();
|
|
3591
|
-
};
|
|
3592
|
-
/**
|
|
3593
|
-
* Check if current tank is Sole
|
|
3594
|
-
*/
|
|
3595
|
-
TransactionBase.prototype.isSoleTank = function () {
|
|
3596
|
-
var _a;
|
|
3597
|
-
// chart accounts may be empty for new instances
|
|
3598
|
-
if (this.chartAccounts) {
|
|
3599
|
-
return CHART_ACCOUNTS_CATEGORIES.sole.includes((_a = this.chartAccounts) === null || _a === void 0 ? void 0 : _a.category);
|
|
3600
|
-
}
|
|
3601
|
-
return !!this.business;
|
|
3602
|
-
};
|
|
3603
|
-
return TransactionBase;
|
|
3604
|
-
}(AbstractModel));
|
|
3605
|
-
__decorate([
|
|
3606
|
-
classTransformer.Exclude({ toPlainOnly: true }),
|
|
3607
|
-
classTransformer.Type(function () { return Object; }),
|
|
3608
|
-
classTransformer.Transform(function (_b) {
|
|
3609
|
-
var obj = _b.obj;
|
|
3610
|
-
return obj.file;
|
|
3611
|
-
})
|
|
3612
|
-
], TransactionBase.prototype, "file", void 0);
|
|
3613
|
-
|
|
3614
|
-
var Depreciation$1 = /** @class */ (function (_super) {
|
|
3615
|
-
__extends(Depreciation, _super);
|
|
3616
|
-
function Depreciation() {
|
|
3617
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
3618
|
-
}
|
|
3619
|
-
return Depreciation;
|
|
3620
|
-
}(TransactionBase));
|
|
3621
|
-
|
|
3622
|
-
exports.DepreciationTypeEnum = void 0;
|
|
3623
|
-
(function (DepreciationTypeEnum) {
|
|
3624
|
-
DepreciationTypeEnum[DepreciationTypeEnum["PLANT_EQUIPMENT"] = 1] = "PLANT_EQUIPMENT";
|
|
3625
|
-
DepreciationTypeEnum[DepreciationTypeEnum["CAPITAL_WORKS"] = 2] = "CAPITAL_WORKS";
|
|
3626
|
-
DepreciationTypeEnum[DepreciationTypeEnum["BULK_DEPRECIATION"] = 3] = "BULK_DEPRECIATION";
|
|
3627
|
-
DepreciationTypeEnum[DepreciationTypeEnum["BORROWING_EXPENSES"] = 4] = "BORROWING_EXPENSES";
|
|
3628
|
-
})(exports.DepreciationTypeEnum || (exports.DepreciationTypeEnum = {}));
|
|
3629
|
-
|
|
3630
|
-
exports.DepreciationCalculationEnum = void 0;
|
|
3631
|
-
(function (DepreciationCalculationEnum) {
|
|
3632
|
-
DepreciationCalculationEnum[DepreciationCalculationEnum["PRIME_COST"] = 1] = "PRIME_COST";
|
|
3633
|
-
DepreciationCalculationEnum[DepreciationCalculationEnum["DIMINISHING"] = 2] = "DIMINISHING";
|
|
3634
|
-
DepreciationCalculationEnum[DepreciationCalculationEnum["CAPITAL"] = 3] = "CAPITAL";
|
|
3635
|
-
DepreciationCalculationEnum[DepreciationCalculationEnum["LVP"] = 4] = "LVP";
|
|
3636
|
-
DepreciationCalculationEnum[DepreciationCalculationEnum["AMORTISATION"] = 5] = "AMORTISATION";
|
|
3637
|
-
DepreciationCalculationEnum[DepreciationCalculationEnum["SBP"] = 6] = "SBP";
|
|
3638
|
-
})(exports.DepreciationCalculationEnum || (exports.DepreciationCalculationEnum = {}));
|
|
3639
|
-
|
|
3640
|
-
var DepreciationCapitalProject$1 = /** @class */ (function (_super) {
|
|
3641
|
-
__extends(DepreciationCapitalProject, _super);
|
|
3642
|
-
function DepreciationCapitalProject() {
|
|
3643
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
3644
|
-
}
|
|
3645
|
-
return DepreciationCapitalProject;
|
|
3646
|
-
}(AbstractModel));
|
|
3647
|
-
|
|
3648
|
-
var DepreciationCapitalProject = /** @class */ (function (_super) {
|
|
3649
|
-
__extends(DepreciationCapitalProject, _super);
|
|
3650
|
-
function DepreciationCapitalProject() {
|
|
3651
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
3652
|
-
}
|
|
3653
|
-
return DepreciationCapitalProject;
|
|
3654
|
-
}(DepreciationCapitalProject$1));
|
|
3655
|
-
__decorate([
|
|
3656
|
-
classTransformer.Type(function () { return Date; })
|
|
3657
|
-
], DepreciationCapitalProject.prototype, "effectiveDate", void 0);
|
|
3658
|
-
|
|
3659
|
-
var DepreciationForecast$1 = /** @class */ (function (_super) {
|
|
3660
|
-
__extends(DepreciationForecast, _super);
|
|
3661
|
-
function DepreciationForecast() {
|
|
3662
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
3663
|
-
}
|
|
3664
|
-
return DepreciationForecast;
|
|
3665
|
-
}(AbstractModel));
|
|
3666
|
-
|
|
3667
|
-
var DepreciationForecast = /** @class */ (function (_super) {
|
|
3668
|
-
__extends(DepreciationForecast, _super);
|
|
3669
|
-
function DepreciationForecast() {
|
|
3670
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
3671
|
-
}
|
|
3672
|
-
Object.defineProperty(DepreciationForecast.prototype, "dailyClaimAmount", {
|
|
3673
|
-
get: function () {
|
|
3674
|
-
return this.claimAmount / this.daysApplied;
|
|
3714
|
+
return this.claimAmount / this.daysApplied;
|
|
3675
3715
|
},
|
|
3676
3716
|
enumerable: false,
|
|
3677
3717
|
configurable: true
|
|
@@ -3724,397 +3764,181 @@
|
|
|
3724
3764
|
return DepreciationForecast;
|
|
3725
3765
|
}(DepreciationForecast$1));
|
|
3726
3766
|
|
|
3727
|
-
var BankTransaction$1 = /** @class */ (function (_super) {
|
|
3728
|
-
__extends(BankTransaction, _super);
|
|
3729
|
-
function BankTransaction() {
|
|
3730
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
3731
|
-
}
|
|
3732
|
-
return BankTransaction;
|
|
3733
|
-
}(AbstractModel));
|
|
3734
|
-
|
|
3735
|
-
exports.BankTransactionTypeEnum = void 0;
|
|
3736
|
-
(function (BankTransactionTypeEnum) {
|
|
3737
|
-
BankTransactionTypeEnum[BankTransactionTypeEnum["DEBIT"] = 1] = "DEBIT";
|
|
3738
|
-
BankTransactionTypeEnum[BankTransactionTypeEnum["CREDIT"] = 2] = "CREDIT";
|
|
3739
|
-
})(exports.BankTransactionTypeEnum || (exports.BankTransactionTypeEnum = {}));
|
|
3740
|
-
|
|
3741
|
-
exports.TransactionSourceEnum = void 0;
|
|
3742
|
-
(function (TransactionSourceEnum) {
|
|
3743
|
-
TransactionSourceEnum[TransactionSourceEnum["CASH"] = 1] = "CASH";
|
|
3744
|
-
TransactionSourceEnum[TransactionSourceEnum["BANK_TRANSACTION"] = 2] = "BANK_TRANSACTION";
|
|
3745
|
-
})(exports.TransactionSourceEnum || (exports.TransactionSourceEnum = {}));
|
|
3746
|
-
|
|
3747
|
-
var Transaction$1 = /** @class */ (function (_super) {
|
|
3748
|
-
__extends(Transaction, _super);
|
|
3749
|
-
function Transaction() {
|
|
3750
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
3751
|
-
}
|
|
3752
|
-
return Transaction;
|
|
3753
|
-
}(TransactionBase));
|
|
3754
|
-
|
|
3755
|
-
exports.TransactionTypeEnum = void 0;
|
|
3756
|
-
(function (TransactionTypeEnum) {
|
|
3757
|
-
TransactionTypeEnum[TransactionTypeEnum["DEBIT"] = 1] = "DEBIT";
|
|
3758
|
-
TransactionTypeEnum[TransactionTypeEnum["CREDIT"] = 2] = "CREDIT";
|
|
3759
|
-
})(exports.TransactionTypeEnum || (exports.TransactionTypeEnum = {}));
|
|
3760
|
-
|
|
3761
|
-
exports.TransactionOperationEnum = void 0;
|
|
3762
|
-
(function (TransactionOperationEnum) {
|
|
3763
|
-
TransactionOperationEnum[TransactionOperationEnum["ALLOCATE"] = 1] = "ALLOCATE";
|
|
3764
|
-
TransactionOperationEnum[TransactionOperationEnum["FIND_AND_MATCH"] = 2] = "FIND_AND_MATCH";
|
|
3765
|
-
TransactionOperationEnum[TransactionOperationEnum["TRANSFER"] = 3] = "TRANSFER";
|
|
3766
|
-
})(exports.TransactionOperationEnum || (exports.TransactionOperationEnum = {}));
|
|
3767
|
-
|
|
3768
|
-
var TransactionReceipt$1 = /** @class */ (function (_super) {
|
|
3769
|
-
__extends(TransactionReceipt, _super);
|
|
3770
|
-
function TransactionReceipt() {
|
|
3771
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
3772
|
-
}
|
|
3773
|
-
return TransactionReceipt;
|
|
3774
|
-
}(AbstractModel));
|
|
3775
|
-
|
|
3776
|
-
// @TODO this enum should come from backend
|
|
3777
|
-
/**
|
|
3778
|
-
* Enum with asset types
|
|
3779
|
-
*/
|
|
3780
|
-
exports.AssetTypeEnum = void 0;
|
|
3781
|
-
(function (AssetTypeEnum) {
|
|
3782
|
-
AssetTypeEnum["RECEIPTS"] = "receipts";
|
|
3783
|
-
AssetTypeEnum["DOCUMENTS"] = "documents";
|
|
3784
|
-
AssetTypeEnum["MESSAGE"] = "message";
|
|
3785
|
-
})(exports.AssetTypeEnum || (exports.AssetTypeEnum = {}));
|
|
3786
|
-
|
|
3787
3767
|
/**
|
|
3788
|
-
*
|
|
3768
|
+
* @TODO Alex: clarify grouping rules and refactor
|
|
3789
3769
|
*/
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
AssetEntityTypeEnum["FOLDERS"] = "folders";
|
|
3794
|
-
AssetEntityTypeEnum["DEPRECIATIONS"] = "depreciations";
|
|
3795
|
-
AssetEntityTypeEnum["TRANSACTIONS"] = "transactions";
|
|
3796
|
-
AssetEntityTypeEnum["MESSAGES"] = "messages";
|
|
3797
|
-
})(exports.AssetEntityTypeEnum || (exports.AssetEntityTypeEnum = {}));
|
|
3798
|
-
|
|
3799
|
-
var TransactionReceipt = /** @class */ (function (_super) {
|
|
3800
|
-
__extends(TransactionReceipt, _super);
|
|
3801
|
-
function TransactionReceipt() {
|
|
3770
|
+
var Depreciation = /** @class */ (function (_super) {
|
|
3771
|
+
__extends(Depreciation, _super);
|
|
3772
|
+
function Depreciation() {
|
|
3802
3773
|
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
3803
|
-
_this.
|
|
3804
|
-
_this.
|
|
3774
|
+
_this.forecasts = [];
|
|
3775
|
+
_this.type = exports.DepreciationTypeEnum.PLANT_EQUIPMENT;
|
|
3776
|
+
/**
|
|
3777
|
+
* @TODO remove after ? signs removed from db models
|
|
3778
|
+
*/
|
|
3779
|
+
_this.amount = 0;
|
|
3805
3780
|
return _this;
|
|
3806
3781
|
}
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
var IncomeSource$1 = /** @class */ (function (_super) {
|
|
3811
|
-
__extends(IncomeSource, _super);
|
|
3812
|
-
function IncomeSource() {
|
|
3813
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
3814
|
-
}
|
|
3815
|
-
return IncomeSource;
|
|
3816
|
-
}(AbstractModel));
|
|
3817
|
-
|
|
3818
|
-
exports.IncomeSourceTypeEnum = void 0;
|
|
3819
|
-
(function (IncomeSourceTypeEnum) {
|
|
3820
|
-
IncomeSourceTypeEnum[IncomeSourceTypeEnum["WORK"] = 1] = "WORK";
|
|
3821
|
-
IncomeSourceTypeEnum[IncomeSourceTypeEnum["SOLE"] = 2] = "SOLE";
|
|
3822
|
-
IncomeSourceTypeEnum[IncomeSourceTypeEnum["OTHER"] = 3] = "OTHER";
|
|
3823
|
-
})(exports.IncomeSourceTypeEnum || (exports.IncomeSourceTypeEnum = {}));
|
|
3824
|
-
|
|
3825
|
-
var SalaryForecast$1 = /** @class */ (function (_super) {
|
|
3826
|
-
__extends(SalaryForecast, _super);
|
|
3827
|
-
function SalaryForecast() {
|
|
3828
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
3829
|
-
}
|
|
3830
|
-
return SalaryForecast;
|
|
3831
|
-
}(AbstractModel));
|
|
3832
|
-
|
|
3833
|
-
var SalaryForecast = /** @class */ (function (_super) {
|
|
3834
|
-
__extends(SalaryForecast, _super);
|
|
3835
|
-
function SalaryForecast() {
|
|
3836
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
3837
|
-
}
|
|
3838
|
-
return SalaryForecast;
|
|
3839
|
-
}(SalaryForecast$1));
|
|
3840
|
-
__decorate([
|
|
3841
|
-
classTransformer.Transform(function (_a) {
|
|
3842
|
-
var obj = _a.obj;
|
|
3843
|
-
return obj.netPay + obj.tax;
|
|
3844
|
-
}),
|
|
3845
|
-
classTransformer.Expose()
|
|
3846
|
-
], SalaryForecast.prototype, "grossAmount", void 0);
|
|
3847
|
-
__decorate([
|
|
3848
|
-
classTransformer.Type(function () { return IncomeSource; })
|
|
3849
|
-
], SalaryForecast.prototype, "incomeSource", void 0);
|
|
3850
|
-
|
|
3851
|
-
var SoleForecast$1 = /** @class */ (function (_super) {
|
|
3852
|
-
__extends(SoleForecast, _super);
|
|
3853
|
-
function SoleForecast() {
|
|
3854
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
3855
|
-
}
|
|
3856
|
-
return SoleForecast;
|
|
3857
|
-
}(AbstractModel));
|
|
3858
|
-
|
|
3859
|
-
var SoleForecast = /** @class */ (function (_super) {
|
|
3860
|
-
__extends(SoleForecast, _super);
|
|
3861
|
-
function SoleForecast() {
|
|
3862
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
3863
|
-
}
|
|
3864
|
-
Object.defineProperty(SoleForecast.prototype, "netPay", {
|
|
3865
|
-
get: function () {
|
|
3866
|
-
return this.amount;
|
|
3867
|
-
},
|
|
3868
|
-
enumerable: false,
|
|
3869
|
-
configurable: true
|
|
3870
|
-
});
|
|
3871
|
-
;
|
|
3872
|
-
return SoleForecast;
|
|
3873
|
-
}(SoleForecast$1));
|
|
3874
|
-
__decorate([
|
|
3875
|
-
classTransformer.Type(function () { return IncomeSource; })
|
|
3876
|
-
], SoleForecast.prototype, "incomeSource", void 0);
|
|
3877
|
-
|
|
3878
|
-
var IncomeSourceForecast$1 = /** @class */ (function (_super) {
|
|
3879
|
-
__extends(IncomeSourceForecast, _super);
|
|
3880
|
-
function IncomeSourceForecast() {
|
|
3881
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
3882
|
-
}
|
|
3883
|
-
return IncomeSourceForecast;
|
|
3884
|
-
}(AbstractModel));
|
|
3885
|
-
|
|
3886
|
-
exports.SalaryForecastFrequencyEnum = void 0;
|
|
3887
|
-
(function (SalaryForecastFrequencyEnum) {
|
|
3888
|
-
SalaryForecastFrequencyEnum[SalaryForecastFrequencyEnum["ANNUAL"] = 1] = "ANNUAL";
|
|
3889
|
-
SalaryForecastFrequencyEnum[SalaryForecastFrequencyEnum["MONTHLY"] = 12] = "MONTHLY";
|
|
3890
|
-
SalaryForecastFrequencyEnum[SalaryForecastFrequencyEnum["FORTNIGHTLY"] = 26] = "FORTNIGHTLY";
|
|
3891
|
-
SalaryForecastFrequencyEnum[SalaryForecastFrequencyEnum["WEEKLY"] = 52] = "WEEKLY";
|
|
3892
|
-
})(exports.SalaryForecastFrequencyEnum || (exports.SalaryForecastFrequencyEnum = {}));
|
|
3893
|
-
|
|
3894
|
-
var IncomeSourceType$1 = /** @class */ (function (_super) {
|
|
3895
|
-
__extends(IncomeSourceType, _super);
|
|
3896
|
-
function IncomeSourceType() {
|
|
3897
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
3898
|
-
}
|
|
3899
|
-
return IncomeSourceType;
|
|
3900
|
-
}(AbstractModel));
|
|
3901
|
-
|
|
3902
|
-
exports.IncomeSourceTypeListWorkEnum = void 0;
|
|
3903
|
-
(function (IncomeSourceTypeListWorkEnum) {
|
|
3904
|
-
IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["BONUSES"] = 1] = "BONUSES";
|
|
3905
|
-
IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["DIRECTOR_FEES"] = 2] = "DIRECTOR_FEES";
|
|
3906
|
-
IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["DIVIDENDS"] = 3] = "DIVIDENDS";
|
|
3907
|
-
IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["INTEREST"] = 4] = "INTEREST";
|
|
3908
|
-
IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["PENSIONS_AND_ALLOWANCES"] = 5] = "PENSIONS_AND_ALLOWANCES";
|
|
3909
|
-
IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["SUPERANNUATION"] = 8] = "SUPERANNUATION";
|
|
3910
|
-
IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["ATTRIBUTED_P_S_I"] = 11] = "ATTRIBUTED_P_S_I";
|
|
3911
|
-
})(exports.IncomeSourceTypeListWorkEnum || (exports.IncomeSourceTypeListWorkEnum = {}));
|
|
3912
|
-
|
|
3913
|
-
exports.IncomeSourceTypeListOtherEnum = void 0;
|
|
3914
|
-
(function (IncomeSourceTypeListOtherEnum) {
|
|
3915
|
-
IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["PSI"] = 6] = "PSI";
|
|
3916
|
-
IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["SOLE_TRADER"] = 7] = "SOLE_TRADER";
|
|
3917
|
-
IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["TRUSTS"] = 9] = "TRUSTS";
|
|
3918
|
-
IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["OTHER_INCOME"] = 10] = "OTHER_INCOME";
|
|
3919
|
-
IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["PARTNERSHIPS"] = 12] = "PARTNERSHIPS";
|
|
3920
|
-
})(exports.IncomeSourceTypeListOtherEnum || (exports.IncomeSourceTypeListOtherEnum = {}));
|
|
3921
|
-
|
|
3922
|
-
exports.IncomeSourceTypeListSoleEnum = void 0;
|
|
3923
|
-
(function (IncomeSourceTypeListSoleEnum) {
|
|
3924
|
-
IncomeSourceTypeListSoleEnum[IncomeSourceTypeListSoleEnum["SOLE_TRADER"] = 7] = "SOLE_TRADER";
|
|
3925
|
-
})(exports.IncomeSourceTypeListSoleEnum || (exports.IncomeSourceTypeListSoleEnum = {}));
|
|
3926
|
-
|
|
3927
|
-
var IncomeSourceType = /** @class */ (function (_super) {
|
|
3928
|
-
__extends(IncomeSourceType, _super);
|
|
3929
|
-
function IncomeSourceType() {
|
|
3930
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
3931
|
-
}
|
|
3932
|
-
IncomeSourceType.prototype.isBonuses = function () {
|
|
3933
|
-
return this.id === exports.IncomeSourceTypeListWorkEnum.BONUSES;
|
|
3782
|
+
// Type checking
|
|
3783
|
+
Depreciation.prototype.isCapital = function () {
|
|
3784
|
+
return this.type === exports.DepreciationTypeEnum.CAPITAL_WORKS;
|
|
3934
3785
|
};
|
|
3935
|
-
|
|
3936
|
-
return
|
|
3786
|
+
Depreciation.prototype.isBorrowingExpense = function () {
|
|
3787
|
+
return this.type === exports.DepreciationTypeEnum.BORROWING_EXPENSES;
|
|
3937
3788
|
};
|
|
3938
|
-
|
|
3939
|
-
return
|
|
3789
|
+
Depreciation.prototype.isAsset = function () {
|
|
3790
|
+
return this.type === exports.DepreciationTypeEnum.PLANT_EQUIPMENT;
|
|
3940
3791
|
};
|
|
3941
|
-
|
|
3942
|
-
|
|
3792
|
+
// Calculation checking
|
|
3793
|
+
Depreciation.prototype.isSBPCalculation = function () {
|
|
3794
|
+
return this.calculation === exports.DepreciationCalculationEnum.SBP;
|
|
3943
3795
|
};
|
|
3944
|
-
|
|
3796
|
+
Depreciation.prototype.isPrimeCost = function () {
|
|
3797
|
+
return this.calculation === exports.DepreciationCalculationEnum.PRIME_COST;
|
|
3798
|
+
};
|
|
3799
|
+
Depreciation.prototype.isDiminishing = function () {
|
|
3800
|
+
return this.calculation === exports.DepreciationCalculationEnum.DIMINISHING;
|
|
3801
|
+
};
|
|
3802
|
+
// Pool checking
|
|
3803
|
+
Depreciation.prototype.isPlantEquipmentPool = function () {
|
|
3804
|
+
return this.isAsset() && !this.isSBPCalculation() && !this.isWrittenOff() && !this.isLVP();
|
|
3805
|
+
};
|
|
3806
|
+
Depreciation.prototype.isLVP = function () {
|
|
3807
|
+
return this.isAsset()
|
|
3808
|
+
&& !this.isSBPCalculation()
|
|
3809
|
+
&& this.isDiminishing()
|
|
3810
|
+
&& this.currentYearForecast.closeBalance > Depreciation.WRITTEN_OFF_THRESHOLD
|
|
3811
|
+
&& this.currentYearForecast.closeBalance <= Depreciation.LOW_VALUE_POOL_THRESHOLD;
|
|
3812
|
+
};
|
|
3813
|
+
Depreciation.prototype.isSBP = function () {
|
|
3814
|
+
return this.isAsset() && this.isSBPCalculation() && !this.isWrittenOff();
|
|
3815
|
+
};
|
|
3816
|
+
Depreciation.prototype.isWrittenOff = function () {
|
|
3817
|
+
return this.writeOffYear === new FinancialYear().year;
|
|
3818
|
+
};
|
|
3819
|
+
Object.defineProperty(Depreciation.prototype, "writeOffYear", {
|
|
3945
3820
|
get: function () {
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
case this.isSole():
|
|
3950
|
-
return exports.IncomeSourceTypeEnum.SOLE;
|
|
3951
|
-
default:
|
|
3952
|
-
return exports.IncomeSourceTypeEnum.OTHER;
|
|
3821
|
+
var _a;
|
|
3822
|
+
if (!this.writeOffManualDate && !this.writeOffDate) {
|
|
3823
|
+
return null;
|
|
3953
3824
|
}
|
|
3825
|
+
return (_a = new FinancialYear(this.writeOffManualDate || this.writeOffDate)) === null || _a === void 0 ? void 0 : _a.year;
|
|
3954
3826
|
},
|
|
3955
3827
|
enumerable: false,
|
|
3956
3828
|
configurable: true
|
|
3957
3829
|
});
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3830
|
+
/**
|
|
3831
|
+
* Check if depreciation chart accounts heading related to vehicles category
|
|
3832
|
+
*/
|
|
3833
|
+
Depreciation.prototype.isVehicleDepreciation = function () {
|
|
3834
|
+
var _a;
|
|
3835
|
+
return ((_a = this.chartAccounts.heading) === null || _a === void 0 ? void 0 : _a.id) === exports.ChartAccountsHeadingVehicleListEnum.DEPRECIATION_VEHICLES;
|
|
3836
|
+
};
|
|
3837
|
+
/**
|
|
3838
|
+
* Get depreciation purchase date
|
|
3839
|
+
*/
|
|
3840
|
+
Depreciation.prototype.getDate = function () {
|
|
3841
|
+
return this.date;
|
|
3842
|
+
};
|
|
3843
|
+
Object.defineProperty(Depreciation.prototype, "currentYearForecast", {
|
|
3971
3844
|
/**
|
|
3972
|
-
*
|
|
3973
|
-
* and we need these fields to work with Income source forecasts like with Salary Forecasts
|
|
3845
|
+
* @TODO Vik: Research a problem with depreciations without current year forecast
|
|
3974
3846
|
*/
|
|
3975
3847
|
get: function () {
|
|
3976
|
-
return this.
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3848
|
+
return this.forecasts.find(function (forecast) {
|
|
3849
|
+
return forecast.financialYear === new FinancialYear().year;
|
|
3850
|
+
}) || classTransformer.plainToClass(DepreciationForecast, {
|
|
3851
|
+
financialYear: new FinancialYear().year,
|
|
3852
|
+
openBalance: 0,
|
|
3853
|
+
closeBalance: 0,
|
|
3854
|
+
amount: 0,
|
|
3855
|
+
claimPercent: 0
|
|
3856
|
+
});
|
|
3984
3857
|
},
|
|
3985
3858
|
enumerable: false,
|
|
3986
3859
|
configurable: true
|
|
3987
3860
|
});
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
], IncomeSourceForecast.prototype, "incomeSourceType", void 0);
|
|
3993
|
-
__decorate([
|
|
3994
|
-
classTransformer.Type(function () { return IncomeSource; })
|
|
3995
|
-
], IncomeSourceForecast.prototype, "incomeSource", void 0);
|
|
3996
|
-
|
|
3997
|
-
var IncomeSource = /** @class */ (function (_super) {
|
|
3998
|
-
__extends(IncomeSource, _super);
|
|
3999
|
-
function IncomeSource() {
|
|
4000
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
4001
|
-
}
|
|
4002
|
-
IncomeSource.prototype.isSalaryIncome = function () {
|
|
4003
|
-
return !!this.salaryForecasts.length;
|
|
4004
|
-
// @TODO Vik: old code
|
|
4005
|
-
// return this.type === IncomeSourceTypeEnum.SALARY;
|
|
3861
|
+
Depreciation.prototype.getForecastByYear = function (year) {
|
|
3862
|
+
return this.forecasts.find(function (forecast) {
|
|
3863
|
+
return forecast.financialYear === year;
|
|
3864
|
+
});
|
|
4006
3865
|
};
|
|
4007
|
-
|
|
4008
|
-
|
|
3866
|
+
Depreciation.prototype.getClaimAmountByYear = function (year) {
|
|
3867
|
+
var _a;
|
|
3868
|
+
return ((_a = this.getForecastByYear(year)) === null || _a === void 0 ? void 0 : _a.claimAmount) || 0;
|
|
4009
3869
|
};
|
|
4010
|
-
|
|
4011
|
-
|
|
3870
|
+
Depreciation.prototype.getCloseBalanceByYear = function (year) {
|
|
3871
|
+
var _a;
|
|
3872
|
+
return ((_a = this.getForecastByYear(year)) === null || _a === void 0 ? void 0 : _a.closeBalance) || 0;
|
|
4012
3873
|
};
|
|
4013
|
-
|
|
4014
|
-
return this.
|
|
3874
|
+
Depreciation.prototype.isBuildingAtCost = function () {
|
|
3875
|
+
return this.chartAccounts.id === exports.ChartAccountsListEnum.BUILDING_AT_COST;
|
|
4015
3876
|
};
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
configurable: true
|
|
4025
|
-
});
|
|
4026
|
-
Object.defineProperty(IncomeSource.prototype, "actualForecast", {
|
|
3877
|
+
/**
|
|
3878
|
+
* Create a new transaction from current depreciation
|
|
3879
|
+
*/
|
|
3880
|
+
Depreciation.prototype.toTransaction = function (params) {
|
|
3881
|
+
if (params === void 0) { params = {}; }
|
|
3882
|
+
return classTransformer.plainToClass(Transaction, Object.assign(params, this, { amount: -this.claimAmount, claimAmount: -this.amount * (this.claimPercent / 100) }));
|
|
3883
|
+
};
|
|
3884
|
+
Object.defineProperty(Depreciation.prototype, "claimAmount", {
|
|
4027
3885
|
/**
|
|
4028
|
-
*
|
|
3886
|
+
* @TODO Michael: remove and check everywhere in reports
|
|
4029
3887
|
*/
|
|
4030
3888
|
get: function () {
|
|
4031
|
-
|
|
3889
|
+
var _a;
|
|
3890
|
+
return ((_a = this.currentYearForecast) === null || _a === void 0 ? void 0 : _a.claimAmount) || 0;
|
|
4032
3891
|
},
|
|
4033
3892
|
enumerable: false,
|
|
4034
3893
|
configurable: true
|
|
4035
3894
|
});
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
IncomeSource.prototype.isWorkedInMonth = function (monthIndex) {
|
|
4041
|
-
var monthDate = new FinancialYear().getMonthDate(monthIndex);
|
|
4042
|
-
return (!this.dateFrom || monthDate >= this.dateFrom) && (!this.dateTo || monthDate < this.dateTo);
|
|
4043
|
-
};
|
|
4044
|
-
return IncomeSource;
|
|
4045
|
-
}(IncomeSource$1));
|
|
4046
|
-
__decorate([
|
|
4047
|
-
classTransformer.Type(function () { return SalaryForecast; })
|
|
4048
|
-
], IncomeSource.prototype, "salaryForecasts", void 0);
|
|
3895
|
+
return Depreciation;
|
|
3896
|
+
}(Depreciation$1));
|
|
3897
|
+
Depreciation.WRITTEN_OFF_THRESHOLD = 300;
|
|
3898
|
+
Depreciation.LOW_VALUE_POOL_THRESHOLD = 1000;
|
|
4049
3899
|
__decorate([
|
|
4050
|
-
classTransformer.Type(function () { return
|
|
4051
|
-
],
|
|
3900
|
+
classTransformer.Type(function () { return Date; })
|
|
3901
|
+
], Depreciation.prototype, "purchaseDate", void 0);
|
|
4052
3902
|
__decorate([
|
|
4053
|
-
classTransformer.Type(function () { return
|
|
4054
|
-
],
|
|
3903
|
+
classTransformer.Type(function () { return Date; })
|
|
3904
|
+
], Depreciation.prototype, "date", void 0);
|
|
4055
3905
|
__decorate([
|
|
4056
3906
|
classTransformer.Type(function () { return Date; })
|
|
4057
|
-
],
|
|
3907
|
+
], Depreciation.prototype, "lowValuePoolDate", void 0);
|
|
4058
3908
|
__decorate([
|
|
4059
3909
|
classTransformer.Type(function () { return Date; })
|
|
4060
|
-
],
|
|
4061
|
-
|
|
4062
|
-
var TransactionMetadata$1 = /** @class */ (function (_super) {
|
|
4063
|
-
__extends(TransactionMetadata, _super);
|
|
4064
|
-
function TransactionMetadata() {
|
|
4065
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
4066
|
-
}
|
|
4067
|
-
return TransactionMetadata;
|
|
4068
|
-
}(AbstractModel));
|
|
4069
|
-
|
|
4070
|
-
var TransactionMetadata = /** @class */ (function (_super) {
|
|
4071
|
-
__extends(TransactionMetadata, _super);
|
|
4072
|
-
function TransactionMetadata() {
|
|
4073
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
4074
|
-
}
|
|
4075
|
-
return TransactionMetadata;
|
|
4076
|
-
}(TransactionMetadata$1));
|
|
3910
|
+
], Depreciation.prototype, "writeOffManualDate", void 0);
|
|
4077
3911
|
__decorate([
|
|
4078
|
-
classTransformer.Type(function () { return
|
|
4079
|
-
],
|
|
4080
|
-
|
|
4081
|
-
var TransactionAllocation$1 = /** @class */ (function (_super) {
|
|
4082
|
-
__extends(TransactionAllocation, _super);
|
|
4083
|
-
function TransactionAllocation() {
|
|
4084
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
4085
|
-
}
|
|
4086
|
-
return TransactionAllocation;
|
|
4087
|
-
}(AbstractModel));
|
|
4088
|
-
|
|
4089
|
-
var TransactionAllocation = /** @class */ (function (_super) {
|
|
4090
|
-
__extends(TransactionAllocation, _super);
|
|
4091
|
-
function TransactionAllocation() {
|
|
4092
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
4093
|
-
}
|
|
4094
|
-
/**
|
|
4095
|
-
* Create a new instance of transaction allocation
|
|
4096
|
-
* transaction could be empty since we can POST allocation inside a new transaction
|
|
4097
|
-
*/
|
|
4098
|
-
TransactionAllocation.create = function (amount, bankTransaction, transaction) {
|
|
4099
|
-
return classTransformer.plainToClass(TransactionAllocation, { amount: amount, transaction: transaction, bankTransaction: bankTransaction });
|
|
4100
|
-
};
|
|
4101
|
-
return TransactionAllocation;
|
|
4102
|
-
}(TransactionAllocation$1));
|
|
3912
|
+
classTransformer.Type(function () { return Date; })
|
|
3913
|
+
], Depreciation.prototype, "writeOffDate", void 0);
|
|
4103
3914
|
__decorate([
|
|
4104
|
-
classTransformer.Type(function () { return
|
|
4105
|
-
],
|
|
3915
|
+
classTransformer.Type(function () { return DepreciationCapitalProject; })
|
|
3916
|
+
], Depreciation.prototype, "depreciationCapitalProject", void 0);
|
|
4106
3917
|
__decorate([
|
|
4107
|
-
classTransformer.Type(function () { return
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
3918
|
+
classTransformer.Type(function () { return DepreciationForecast; }),
|
|
3919
|
+
classTransformer.Transform(function (_b) {
|
|
3920
|
+
var value = _b.value, obj = _b.obj;
|
|
3921
|
+
// value = array of DepreciationForecast
|
|
3922
|
+
// obj = plain (whole Depreciation object)
|
|
3923
|
+
// Set isLVP flag for each DepreciationForecast
|
|
3924
|
+
// @TODO refactor
|
|
3925
|
+
value.forEach(function (forecast) {
|
|
3926
|
+
forecast.isLVP =
|
|
3927
|
+
forecast.closeBalance < 1000 &&
|
|
3928
|
+
obj.calculation === exports.DepreciationCalculationEnum.DIMINISHING &&
|
|
3929
|
+
obj.type === exports.DepreciationTypeEnum.PLANT_EQUIPMENT &&
|
|
3930
|
+
!(obj.amount > Depreciation.WRITTEN_OFF_THRESHOLD && obj.amount < Depreciation.LOW_VALUE_POOL_THRESHOLD) &&
|
|
3931
|
+
!(obj.writeOffDate && new FinancialYear(new Date(obj.writeOffDate)).year === obj.financialYear);
|
|
3932
|
+
});
|
|
3933
|
+
return value;
|
|
3934
|
+
})
|
|
3935
|
+
], Depreciation.prototype, "forecasts", void 0);
|
|
3936
|
+
__decorate([
|
|
3937
|
+
classTransformer.Type(function () { return ChartAccounts; })
|
|
3938
|
+
], Depreciation.prototype, "chartAccounts", void 0);
|
|
3939
|
+
__decorate([
|
|
3940
|
+
classTransformer.Type(function () { return BankTransaction; })
|
|
3941
|
+
], Depreciation.prototype, "bankTransaction", void 0);
|
|
4118
3942
|
|
|
4119
3943
|
// @TODO refactor with baseModel in constructor
|
|
4120
3944
|
var Transaction = /** @class */ (function (_super) {
|
|
@@ -4331,279 +4155,560 @@
|
|
|
4331
4155
|
return Transaction;
|
|
4332
4156
|
}(Transaction$1));
|
|
4333
4157
|
__decorate([
|
|
4334
|
-
classTransformer.Type(function () { return Transaction; })
|
|
4335
|
-
], Transaction.prototype, "transactions", void 0);
|
|
4158
|
+
classTransformer.Type(function () { return Transaction; })
|
|
4159
|
+
], Transaction.prototype, "transactions", void 0);
|
|
4160
|
+
__decorate([
|
|
4161
|
+
classTransformer.Type(function () { return Property; })
|
|
4162
|
+
], Transaction.prototype, "property", void 0);
|
|
4163
|
+
__decorate([
|
|
4164
|
+
classTransformer.Type(function () { return TransactionReceipt; })
|
|
4165
|
+
], Transaction.prototype, "receipt", void 0);
|
|
4166
|
+
__decorate([
|
|
4167
|
+
classTransformer.Type(function () { return ChartAccounts; })
|
|
4168
|
+
], Transaction.prototype, "chartAccounts", void 0);
|
|
4169
|
+
__decorate([
|
|
4170
|
+
classTransformer.Type(function () { return IncomeSource; })
|
|
4171
|
+
], Transaction.prototype, "incomeSource", void 0);
|
|
4172
|
+
__decorate([
|
|
4173
|
+
classTransformer.Type(function () { return TransactionMetadata; })
|
|
4174
|
+
], Transaction.prototype, "metadata", void 0);
|
|
4175
|
+
__decorate([
|
|
4176
|
+
classTransformer.Type(function () { return Transaction; })
|
|
4177
|
+
], Transaction.prototype, "transfer", void 0);
|
|
4178
|
+
__decorate([
|
|
4179
|
+
classTransformer.Type(function () { return Loan; })
|
|
4180
|
+
], Transaction.prototype, "loan", void 0);
|
|
4181
|
+
__decorate([
|
|
4182
|
+
classTransformer.Type(function () { return Date; })
|
|
4183
|
+
], Transaction.prototype, "date", void 0);
|
|
4184
|
+
__decorate([
|
|
4185
|
+
classTransformer.Type(function () { return TransactionAllocation; })
|
|
4186
|
+
], Transaction.prototype, "allocations", void 0);
|
|
4187
|
+
|
|
4188
|
+
var SoleInvoiceItem = /** @class */ (function (_super) {
|
|
4189
|
+
__extends(SoleInvoiceItem, _super);
|
|
4190
|
+
function SoleInvoiceItem() {
|
|
4191
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
4192
|
+
_this.isGST = false;
|
|
4193
|
+
return _this;
|
|
4194
|
+
}
|
|
4195
|
+
Object.defineProperty(SoleInvoiceItem.prototype, "totalPrice", {
|
|
4196
|
+
get: function () {
|
|
4197
|
+
return this.price * this.quantity;
|
|
4198
|
+
},
|
|
4199
|
+
enumerable: false,
|
|
4200
|
+
configurable: true
|
|
4201
|
+
});
|
|
4202
|
+
return SoleInvoiceItem;
|
|
4203
|
+
}(SoleInvoiceItem$1));
|
|
4204
|
+
/**
|
|
4205
|
+
* GST percent value
|
|
4206
|
+
*/
|
|
4207
|
+
SoleInvoiceItem.GSTRatio = 0.1;
|
|
4208
|
+
__decorate([
|
|
4209
|
+
classTransformer.Type(function () { return SoleInvoice; })
|
|
4210
|
+
], SoleInvoiceItem.prototype, "invoice", void 0);
|
|
4211
|
+
__decorate([
|
|
4212
|
+
classTransformer.Type(function () { return ChartAccounts; })
|
|
4213
|
+
], SoleInvoiceItem.prototype, "chartAccounts", void 0);
|
|
4214
|
+
__decorate([
|
|
4215
|
+
classTransformer.Type(function () { return Transaction; })
|
|
4216
|
+
], SoleInvoiceItem.prototype, "transaction", void 0);
|
|
4217
|
+
|
|
4218
|
+
var SoleContact$1 = /** @class */ (function (_super) {
|
|
4219
|
+
__extends(SoleContact, _super);
|
|
4220
|
+
function SoleContact() {
|
|
4221
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
4222
|
+
}
|
|
4223
|
+
return SoleContact;
|
|
4224
|
+
}(AbstractModel));
|
|
4225
|
+
|
|
4226
|
+
// @TODO Alex/Vik: Create some base class for User and SoleContact with common methods and properties
|
|
4227
|
+
var SoleContact = /** @class */ (function (_super) {
|
|
4228
|
+
__extends(SoleContact, _super);
|
|
4229
|
+
function SoleContact() {
|
|
4230
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
4231
|
+
}
|
|
4232
|
+
Object.defineProperty(SoleContact.prototype, "fullName", {
|
|
4233
|
+
get: function () {
|
|
4234
|
+
return this.firstName + " " + this.lastName;
|
|
4235
|
+
},
|
|
4236
|
+
enumerable: false,
|
|
4237
|
+
configurable: true
|
|
4238
|
+
});
|
|
4239
|
+
SoleContact.prototype.getPhotoPlaceholder = function () {
|
|
4240
|
+
return "" + this.firstName[0].toUpperCase() + this.lastName[0].toUpperCase();
|
|
4241
|
+
};
|
|
4242
|
+
// @TODO Vik: add photo field to SoleContact
|
|
4243
|
+
SoleContact.prototype.getPhoto = function () {
|
|
4244
|
+
return '';
|
|
4245
|
+
};
|
|
4246
|
+
return SoleContact;
|
|
4247
|
+
}(SoleContact$1));
|
|
4248
|
+
__decorate([
|
|
4249
|
+
classTransformer.Type(function () { return User; })
|
|
4250
|
+
], SoleContact.prototype, "user", void 0);
|
|
4251
|
+
__decorate([
|
|
4252
|
+
classTransformer.Type(function () { return Phone; })
|
|
4253
|
+
], SoleContact.prototype, "phone", void 0);
|
|
4254
|
+
__decorate([
|
|
4255
|
+
classTransformer.Type(function () { return Address; })
|
|
4256
|
+
], SoleContact.prototype, "address", void 0);
|
|
4257
|
+
__decorate([
|
|
4258
|
+
classTransformer.Type(function () { return SoleInvoice; })
|
|
4259
|
+
], SoleContact.prototype, "invoices", void 0);
|
|
4260
|
+
|
|
4261
|
+
var SoleInvoiceTemplate$1 = /** @class */ (function (_super) {
|
|
4262
|
+
__extends(SoleInvoiceTemplate, _super);
|
|
4263
|
+
function SoleInvoiceTemplate() {
|
|
4264
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
4265
|
+
}
|
|
4266
|
+
return SoleInvoiceTemplate;
|
|
4267
|
+
}(AbstractModel));
|
|
4268
|
+
|
|
4269
|
+
exports.SoleInvoiceTemplateTaxTypeEnum = void 0;
|
|
4270
|
+
(function (SoleInvoiceTemplateTaxTypeEnum) {
|
|
4271
|
+
SoleInvoiceTemplateTaxTypeEnum[SoleInvoiceTemplateTaxTypeEnum["TAX_EXCLUSIVE"] = 0] = "TAX_EXCLUSIVE";
|
|
4272
|
+
SoleInvoiceTemplateTaxTypeEnum[SoleInvoiceTemplateTaxTypeEnum["TAX_INCLUSIVE"] = 1] = "TAX_INCLUSIVE";
|
|
4273
|
+
SoleInvoiceTemplateTaxTypeEnum[SoleInvoiceTemplateTaxTypeEnum["NO_TAX"] = 2] = "NO_TAX";
|
|
4274
|
+
})(exports.SoleInvoiceTemplateTaxTypeEnum || (exports.SoleInvoiceTemplateTaxTypeEnum = {}));
|
|
4275
|
+
|
|
4276
|
+
var SoleInvoiceTemplate = /** @class */ (function (_super) {
|
|
4277
|
+
__extends(SoleInvoiceTemplate, _super);
|
|
4278
|
+
function SoleInvoiceTemplate() {
|
|
4279
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
4280
|
+
/**
|
|
4281
|
+
* Affects to SoleInvoiceItem.isGST flag availability.
|
|
4282
|
+
* When NONE: isGST is unavailable
|
|
4283
|
+
* When EXCLUSIVE: GST amount added additionaly to invoice total price
|
|
4284
|
+
* When INCLUSIVE: GST amount is already included to invoice total price
|
|
4285
|
+
*/
|
|
4286
|
+
_this.taxType = exports.SoleInvoiceTemplateTaxTypeEnum.NO_TAX;
|
|
4287
|
+
return _this;
|
|
4288
|
+
}
|
|
4289
|
+
Object.defineProperty(SoleInvoiceTemplate.prototype, "termTime", {
|
|
4290
|
+
/**
|
|
4291
|
+
* Get term duration in milliseconds
|
|
4292
|
+
*/
|
|
4293
|
+
get: function () {
|
|
4294
|
+
return this.term * 24 * 3600 * 1000;
|
|
4295
|
+
},
|
|
4296
|
+
enumerable: false,
|
|
4297
|
+
configurable: true
|
|
4298
|
+
});
|
|
4299
|
+
return SoleInvoiceTemplate;
|
|
4300
|
+
}(SoleInvoiceTemplate$1));
|
|
4301
|
+
__decorate([
|
|
4302
|
+
classTransformer.Type(function () { return SoleBusiness; })
|
|
4303
|
+
], SoleInvoiceTemplate.prototype, "business", void 0);
|
|
4304
|
+
__decorate([
|
|
4305
|
+
classTransformer.Type(function () { return BankAccount; })
|
|
4306
|
+
], SoleInvoiceTemplate.prototype, "bankAccount", void 0);
|
|
4307
|
+
|
|
4308
|
+
exports.SoleInvoiceStatusesEnum = void 0;
|
|
4309
|
+
(function (SoleInvoiceStatusesEnum) {
|
|
4310
|
+
SoleInvoiceStatusesEnum[SoleInvoiceStatusesEnum["CANCELED"] = 0] = "CANCELED";
|
|
4311
|
+
SoleInvoiceStatusesEnum[SoleInvoiceStatusesEnum["DRAFT"] = 1] = "DRAFT";
|
|
4312
|
+
SoleInvoiceStatusesEnum[SoleInvoiceStatusesEnum["PENDING"] = 2] = "PENDING";
|
|
4313
|
+
SoleInvoiceStatusesEnum[SoleInvoiceStatusesEnum["PAID"] = 3] = "PAID";
|
|
4314
|
+
})(exports.SoleInvoiceStatusesEnum || (exports.SoleInvoiceStatusesEnum = {}));
|
|
4315
|
+
|
|
4316
|
+
exports.SoleInvoiceTaxTypeEnum = void 0;
|
|
4317
|
+
(function (SoleInvoiceTaxTypeEnum) {
|
|
4318
|
+
SoleInvoiceTaxTypeEnum[SoleInvoiceTaxTypeEnum["TAX_EXCLUSIVE"] = 0] = "TAX_EXCLUSIVE";
|
|
4319
|
+
SoleInvoiceTaxTypeEnum[SoleInvoiceTaxTypeEnum["TAX_INCLUSIVE"] = 1] = "TAX_INCLUSIVE";
|
|
4320
|
+
SoleInvoiceTaxTypeEnum[SoleInvoiceTaxTypeEnum["NO_TAX"] = 2] = "NO_TAX";
|
|
4321
|
+
})(exports.SoleInvoiceTaxTypeEnum || (exports.SoleInvoiceTaxTypeEnum = {}));
|
|
4322
|
+
|
|
4323
|
+
var SoleInvoiceItemCollection = /** @class */ (function (_super) {
|
|
4324
|
+
__extends(SoleInvoiceItemCollection, _super);
|
|
4325
|
+
function SoleInvoiceItemCollection() {
|
|
4326
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
4327
|
+
}
|
|
4328
|
+
Object.defineProperty(SoleInvoiceItemCollection.prototype, "gstPrice", {
|
|
4329
|
+
get: function () {
|
|
4330
|
+
return this.filterBy('isGST', true).sumBy('totalPrice');
|
|
4331
|
+
},
|
|
4332
|
+
enumerable: false,
|
|
4333
|
+
configurable: true
|
|
4334
|
+
});
|
|
4335
|
+
return SoleInvoiceItemCollection;
|
|
4336
|
+
}(Collection));
|
|
4337
|
+
|
|
4338
|
+
var SoleInvoice = /** @class */ (function (_super) {
|
|
4339
|
+
__extends(SoleInvoice, _super);
|
|
4340
|
+
function SoleInvoice() {
|
|
4341
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
4342
|
+
_this.status = exports.SoleInvoiceStatusesEnum.DRAFT;
|
|
4343
|
+
_this.taxType = exports.SoleInvoiceTaxTypeEnum.NO_TAX;
|
|
4344
|
+
return _this;
|
|
4345
|
+
}
|
|
4346
|
+
Object.defineProperty(SoleInvoice.prototype, "itemsCollection", {
|
|
4347
|
+
/**
|
|
4348
|
+
* Get items array as collection
|
|
4349
|
+
*/
|
|
4350
|
+
get: function () {
|
|
4351
|
+
return new SoleInvoiceItemCollection(this.items);
|
|
4352
|
+
},
|
|
4353
|
+
enumerable: false,
|
|
4354
|
+
configurable: true
|
|
4355
|
+
});
|
|
4356
|
+
Object.defineProperty(SoleInvoice.prototype, "price", {
|
|
4357
|
+
/**
|
|
4358
|
+
* Total price of all items
|
|
4359
|
+
*/
|
|
4360
|
+
get: function () {
|
|
4361
|
+
return this.itemsCollection.sumBy('totalPrice');
|
|
4362
|
+
},
|
|
4363
|
+
enumerable: false,
|
|
4364
|
+
configurable: true
|
|
4365
|
+
});
|
|
4366
|
+
Object.defineProperty(SoleInvoice.prototype, "netPrice", {
|
|
4367
|
+
/**
|
|
4368
|
+
* Total invoice price without GST
|
|
4369
|
+
*/
|
|
4370
|
+
get: function () {
|
|
4371
|
+
if (this.isTaxInclusive()) {
|
|
4372
|
+
return this.price - this.GSTAmount;
|
|
4373
|
+
}
|
|
4374
|
+
return this.price;
|
|
4375
|
+
},
|
|
4376
|
+
enumerable: false,
|
|
4377
|
+
configurable: true
|
|
4378
|
+
});
|
|
4379
|
+
Object.defineProperty(SoleInvoice.prototype, "grossPrice", {
|
|
4380
|
+
/**
|
|
4381
|
+
* Total final price (net + GST)
|
|
4382
|
+
*/
|
|
4383
|
+
get: function () {
|
|
4384
|
+
if (this.isTaxExclusive()) {
|
|
4385
|
+
return this.price + this.GSTAmount;
|
|
4386
|
+
}
|
|
4387
|
+
return this.price;
|
|
4388
|
+
},
|
|
4389
|
+
enumerable: false,
|
|
4390
|
+
configurable: true
|
|
4391
|
+
});
|
|
4392
|
+
Object.defineProperty(SoleInvoice.prototype, "GSTAmount", {
|
|
4393
|
+
/**
|
|
4394
|
+
* Total GST amount
|
|
4395
|
+
*/
|
|
4396
|
+
get: function () {
|
|
4397
|
+
switch (this.taxType) {
|
|
4398
|
+
case exports.SoleInvoiceTaxTypeEnum.TAX_INCLUSIVE:
|
|
4399
|
+
return this.inclusiveGSTAmount;
|
|
4400
|
+
case exports.SoleInvoiceTaxTypeEnum.TAX_EXCLUSIVE:
|
|
4401
|
+
return this.exclusiveGSTAmount;
|
|
4402
|
+
case exports.SoleInvoiceTaxTypeEnum.NO_TAX:
|
|
4403
|
+
return 0;
|
|
4404
|
+
}
|
|
4405
|
+
},
|
|
4406
|
+
enumerable: false,
|
|
4407
|
+
configurable: true
|
|
4408
|
+
});
|
|
4409
|
+
Object.defineProperty(SoleInvoice.prototype, "inclusiveGSTAmount", {
|
|
4410
|
+
/**
|
|
4411
|
+
* When tax inclusive, GST amount is included to total price
|
|
4412
|
+
*/
|
|
4413
|
+
get: function () {
|
|
4414
|
+
var gstPrice = this.itemsCollection.gstPrice;
|
|
4415
|
+
return +(gstPrice - (gstPrice / (1 + SoleInvoiceItem.GSTRatio))).toFixed(2);
|
|
4416
|
+
},
|
|
4417
|
+
enumerable: false,
|
|
4418
|
+
configurable: true
|
|
4419
|
+
});
|
|
4420
|
+
Object.defineProperty(SoleInvoice.prototype, "exclusiveGSTAmount", {
|
|
4421
|
+
/**
|
|
4422
|
+
* When tax exclusive, GST amount should be added additionally to total price
|
|
4423
|
+
*/
|
|
4424
|
+
get: function () {
|
|
4425
|
+
return +(this.itemsCollection.gstPrice * SoleInvoiceItem.GSTRatio).toFixed(2);
|
|
4426
|
+
},
|
|
4427
|
+
enumerable: false,
|
|
4428
|
+
configurable: true
|
|
4429
|
+
});
|
|
4430
|
+
SoleInvoice.prototype.isDraft = function () {
|
|
4431
|
+
return this.status === exports.SoleInvoiceStatusesEnum.DRAFT;
|
|
4432
|
+
};
|
|
4433
|
+
SoleInvoice.prototype.isCancelled = function () {
|
|
4434
|
+
return this.status === exports.SoleInvoiceStatusesEnum.CANCELED;
|
|
4435
|
+
};
|
|
4436
|
+
SoleInvoice.prototype.isPending = function () {
|
|
4437
|
+
return this.status === exports.SoleInvoiceStatusesEnum.PENDING;
|
|
4438
|
+
};
|
|
4439
|
+
SoleInvoice.prototype.isPaid = function () {
|
|
4440
|
+
return this.status === exports.SoleInvoiceStatusesEnum.PAID;
|
|
4441
|
+
};
|
|
4442
|
+
SoleInvoice.prototype.isOverdue = function () {
|
|
4443
|
+
return this.isPending() && this.dateTo < new Date();
|
|
4444
|
+
};
|
|
4445
|
+
SoleInvoice.prototype.isUnpaid = function () {
|
|
4446
|
+
return this.isPending() && this.dateTo >= new Date();
|
|
4447
|
+
};
|
|
4448
|
+
/**
|
|
4449
|
+
* GST is not available for invoices without taxes
|
|
4450
|
+
*/
|
|
4451
|
+
SoleInvoice.prototype.isNoTax = function () {
|
|
4452
|
+
return this.taxType === exports.SoleInvoiceTaxTypeEnum.NO_TAX;
|
|
4453
|
+
};
|
|
4454
|
+
/**
|
|
4455
|
+
* GST amount is not included in items prices for invoices with tax exclusive,
|
|
4456
|
+
* we should add GST amount additionaly to subtotal price to get total price
|
|
4457
|
+
*/
|
|
4458
|
+
SoleInvoice.prototype.isTaxExclusive = function () {
|
|
4459
|
+
return this.taxType === exports.SoleInvoiceTaxTypeEnum.TAX_EXCLUSIVE;
|
|
4460
|
+
};
|
|
4461
|
+
/**
|
|
4462
|
+
* GST amount already included in items prices for invoices with tax inclusive,
|
|
4463
|
+
* we should subtract GST amount from total price to get subtotal price
|
|
4464
|
+
*/
|
|
4465
|
+
SoleInvoice.prototype.isTaxInclusive = function () {
|
|
4466
|
+
return this.taxType === exports.SoleInvoiceTaxTypeEnum.TAX_INCLUSIVE;
|
|
4467
|
+
};
|
|
4468
|
+
SoleInvoice.prototype.getNumber = function () {
|
|
4469
|
+
return String(this.number).padStart(SoleInvoice.NUMBER_LENGTH, '0');
|
|
4470
|
+
};
|
|
4471
|
+
Object.defineProperty(SoleInvoice.prototype, "name", {
|
|
4472
|
+
get: function () {
|
|
4473
|
+
return "invoice-" + this.getNumber() + ".pdf";
|
|
4474
|
+
},
|
|
4475
|
+
enumerable: false,
|
|
4476
|
+
configurable: true
|
|
4477
|
+
});
|
|
4478
|
+
return SoleInvoice;
|
|
4479
|
+
}(SoleInvoice$1));
|
|
4480
|
+
SoleInvoice.NUMBER_LENGTH = 4;
|
|
4481
|
+
__decorate([
|
|
4482
|
+
classTransformer.Type(function () { return Date; })
|
|
4483
|
+
], SoleInvoice.prototype, "dateFrom", void 0);
|
|
4336
4484
|
__decorate([
|
|
4337
|
-
classTransformer.Type(function () { return
|
|
4338
|
-
],
|
|
4485
|
+
classTransformer.Type(function () { return Date; })
|
|
4486
|
+
], SoleInvoice.prototype, "dateTo", void 0);
|
|
4339
4487
|
__decorate([
|
|
4340
|
-
classTransformer.Type(function () { return
|
|
4341
|
-
],
|
|
4488
|
+
classTransformer.Type(function () { return User; })
|
|
4489
|
+
], SoleInvoice.prototype, "user", void 0);
|
|
4342
4490
|
__decorate([
|
|
4343
|
-
classTransformer.Type(function () { return
|
|
4344
|
-
],
|
|
4491
|
+
classTransformer.Type(function () { return SoleBusiness; })
|
|
4492
|
+
], SoleInvoice.prototype, "business", void 0);
|
|
4345
4493
|
__decorate([
|
|
4346
|
-
classTransformer.Type(function () { return
|
|
4347
|
-
],
|
|
4494
|
+
classTransformer.Type(function () { return SoleInvoiceItem; })
|
|
4495
|
+
], SoleInvoice.prototype, "items", void 0);
|
|
4348
4496
|
__decorate([
|
|
4349
|
-
classTransformer.Type(function () { return
|
|
4350
|
-
],
|
|
4497
|
+
classTransformer.Type(function () { return SoleContact; })
|
|
4498
|
+
], SoleInvoice.prototype, "payer", void 0);
|
|
4351
4499
|
__decorate([
|
|
4352
|
-
classTransformer.Type(function () { return
|
|
4353
|
-
],
|
|
4500
|
+
classTransformer.Type(function () { return SoleInvoiceTemplate; })
|
|
4501
|
+
], SoleInvoice.prototype, "template", void 0);
|
|
4354
4502
|
__decorate([
|
|
4355
|
-
classTransformer.Type(function () { return
|
|
4356
|
-
],
|
|
4503
|
+
classTransformer.Type(function () { return BankAccount; })
|
|
4504
|
+
], SoleInvoice.prototype, "bankAccount", void 0);
|
|
4505
|
+
|
|
4506
|
+
/**
|
|
4507
|
+
* Class contains traveled kilometers and work usage percent in 12 weeks date range
|
|
4508
|
+
* @TODO Vik: Best period: move this and related logic to backend
|
|
4509
|
+
* @TODO Alex: check if we need this class when calculation refactored with backend
|
|
4510
|
+
*/
|
|
4511
|
+
var LogbookPeriod = /** @class */ (function () {
|
|
4512
|
+
function LogbookPeriod() {
|
|
4513
|
+
}
|
|
4514
|
+
LogbookPeriod.prototype.isEndOfYear = function () {
|
|
4515
|
+
return this.to === new FinancialYear().endDate;
|
|
4516
|
+
};
|
|
4517
|
+
LogbookPeriod.prototype.getWorkUsageByClaim = function (claim) {
|
|
4518
|
+
var claimKilometers = this.logbooks.getByVehicleClaim(claim).getClaimableLogbooks().kilometers;
|
|
4519
|
+
return Math.round(this.workUsage * (claimKilometers / this.kilometers));
|
|
4520
|
+
};
|
|
4521
|
+
return LogbookPeriod;
|
|
4522
|
+
}());
|
|
4357
4523
|
__decorate([
|
|
4358
4524
|
classTransformer.Type(function () { return Date; })
|
|
4359
|
-
],
|
|
4525
|
+
], LogbookPeriod.prototype, "from", void 0);
|
|
4360
4526
|
__decorate([
|
|
4361
|
-
classTransformer.Type(function () { return
|
|
4362
|
-
],
|
|
4527
|
+
classTransformer.Type(function () { return Date; })
|
|
4528
|
+
], LogbookPeriod.prototype, "to", void 0);
|
|
4363
4529
|
|
|
4364
|
-
var
|
|
4365
|
-
__extends(
|
|
4366
|
-
function
|
|
4367
|
-
|
|
4368
|
-
// allocated money amount for bank transaction
|
|
4369
|
-
_this.allocatedAmount = 0;
|
|
4370
|
-
_this.unallocatedAmount = 0;
|
|
4371
|
-
return _this;
|
|
4530
|
+
var Vehicle$1 = /** @class */ (function (_super) {
|
|
4531
|
+
__extends(Vehicle, _super);
|
|
4532
|
+
function Vehicle() {
|
|
4533
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
4372
4534
|
}
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4535
|
+
return Vehicle;
|
|
4536
|
+
}(AbstractModel));
|
|
4537
|
+
|
|
4538
|
+
var VehicleLogbook$1 = /** @class */ (function (_super) {
|
|
4539
|
+
__extends(VehicleLogbook, _super);
|
|
4540
|
+
function VehicleLogbook() {
|
|
4541
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
4542
|
+
}
|
|
4543
|
+
return VehicleLogbook;
|
|
4544
|
+
}(AbstractModel));
|
|
4545
|
+
|
|
4546
|
+
var moment = momentRange.extendMoment(moment__namespace);
|
|
4547
|
+
var VehicleLogbook = /** @class */ (function (_super) {
|
|
4548
|
+
__extends(VehicleLogbook, _super);
|
|
4549
|
+
function VehicleLogbook() {
|
|
4550
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
4551
|
+
}
|
|
4552
|
+
Object.defineProperty(VehicleLogbook.prototype, "kilometers", {
|
|
4377
4553
|
get: function () {
|
|
4378
|
-
return this.
|
|
4554
|
+
return this.odometerEnd - this.odometerStart;
|
|
4379
4555
|
},
|
|
4380
4556
|
enumerable: false,
|
|
4381
4557
|
configurable: true
|
|
4382
4558
|
});
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
BankTransaction.prototype.isCredit = function () {
|
|
4393
|
-
return this.type === exports.BankTransactionTypeEnum.CREDIT;
|
|
4394
|
-
};
|
|
4395
|
-
/**
|
|
4396
|
-
* Create Transaction instance based on Bank Transaction
|
|
4397
|
-
*/
|
|
4398
|
-
BankTransaction.prototype.toTransaction = function () {
|
|
4399
|
-
return classTransformer.plainToClass(Transaction, {
|
|
4400
|
-
amount: +this.amount.toFixed(2),
|
|
4401
|
-
description: this.description,
|
|
4402
|
-
date: this.date,
|
|
4403
|
-
source: exports.TransactionSourceEnum.BANK_TRANSACTION,
|
|
4404
|
-
operation: this.operation,
|
|
4405
|
-
type: this.type,
|
|
4406
|
-
});
|
|
4407
|
-
};
|
|
4408
|
-
/**
|
|
4409
|
-
* Check if bank transaction is completely allocated
|
|
4410
|
-
*/
|
|
4411
|
-
BankTransaction.prototype.isAllocated = function (allocations) {
|
|
4412
|
-
return this.amount === this.getAllocatedAmount(allocations);
|
|
4559
|
+
Object.defineProperty(VehicleLogbook.prototype, "tankType", {
|
|
4560
|
+
get: function () {
|
|
4561
|
+
return this.isSoleTank() ? exports.TankTypeEnum.SOLE : exports.TankTypeEnum.WORK;
|
|
4562
|
+
},
|
|
4563
|
+
enumerable: false,
|
|
4564
|
+
configurable: true
|
|
4565
|
+
});
|
|
4566
|
+
VehicleLogbook.prototype.isWorkTank = function () {
|
|
4567
|
+
return !this.business;
|
|
4413
4568
|
};
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
*/
|
|
4417
|
-
BankTransaction.prototype.getAllocatedAmount = function (allocations) {
|
|
4418
|
-
return allocations.getByBankTransactionsIds([this.id]).amount;
|
|
4569
|
+
VehicleLogbook.prototype.isSoleTank = function () {
|
|
4570
|
+
return !!this.business;
|
|
4419
4571
|
};
|
|
4420
4572
|
/**
|
|
4421
|
-
* Get
|
|
4573
|
+
* Get logbook period date range from logbook date and weeksInPeriod duration
|
|
4422
4574
|
*/
|
|
4423
|
-
|
|
4424
|
-
return
|
|
4575
|
+
VehicleLogbook.prototype.getPeriod = function () {
|
|
4576
|
+
return moment.rangeFromInterval('milliseconds', VehicleLogbook.bestPeriodDuration, this.date);
|
|
4425
4577
|
};
|
|
4426
|
-
return
|
|
4427
|
-
}(
|
|
4578
|
+
return VehicleLogbook;
|
|
4579
|
+
}(VehicleLogbook$1));
|
|
4580
|
+
/**
|
|
4581
|
+
* Logbook period duration in milliseconds.
|
|
4582
|
+
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/211517441/Logbook+Vehicle
|
|
4583
|
+
*/
|
|
4584
|
+
VehicleLogbook.bestPeriodDuration = 12 * 7 * 24 * 3600 * 1000;
|
|
4428
4585
|
__decorate([
|
|
4429
4586
|
classTransformer.Type(function () { return Date; })
|
|
4430
|
-
],
|
|
4587
|
+
], VehicleLogbook.prototype, "date", void 0);
|
|
4588
|
+
__decorate([
|
|
4589
|
+
classTransformer.Type(function () { return SoleBusiness; })
|
|
4590
|
+
], VehicleLogbook.prototype, "business", void 0);
|
|
4431
4591
|
|
|
4432
|
-
/**
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4592
|
+
var Vehicle = /** @class */ (function (_super) {
|
|
4593
|
+
__extends(Vehicle, _super);
|
|
4594
|
+
function Vehicle() {
|
|
4595
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
4596
|
+
}
|
|
4597
|
+
return Vehicle;
|
|
4598
|
+
}(Vehicle$1));
|
|
4599
|
+
__decorate([
|
|
4600
|
+
classTransformer.Type(function () { return VehicleLogbook; })
|
|
4601
|
+
], Vehicle.prototype, "logbook", void 0);
|
|
4602
|
+
|
|
4603
|
+
var VehicleClaim$1 = /** @class */ (function (_super) {
|
|
4604
|
+
__extends(VehicleClaim, _super);
|
|
4605
|
+
function VehicleClaim() {
|
|
4606
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
4607
|
+
}
|
|
4608
|
+
return VehicleClaim;
|
|
4609
|
+
}(AbstractModel));
|
|
4610
|
+
|
|
4611
|
+
var VehicleClaimDetails$1 = /** @class */ (function (_super) {
|
|
4612
|
+
__extends(VehicleClaimDetails, _super);
|
|
4613
|
+
function VehicleClaimDetails() {
|
|
4614
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
4615
|
+
}
|
|
4616
|
+
return VehicleClaimDetails;
|
|
4617
|
+
}(AbstractModel));
|
|
4618
|
+
|
|
4619
|
+
exports.VehicleClaimDetailsMethodEnum = void 0;
|
|
4620
|
+
(function (VehicleClaimDetailsMethodEnum) {
|
|
4621
|
+
VehicleClaimDetailsMethodEnum[VehicleClaimDetailsMethodEnum["KMS"] = 1] = "KMS";
|
|
4622
|
+
VehicleClaimDetailsMethodEnum[VehicleClaimDetailsMethodEnum["LOGBOOK"] = 2] = "LOGBOOK";
|
|
4623
|
+
})(exports.VehicleClaimDetailsMethodEnum || (exports.VehicleClaimDetailsMethodEnum = {}));
|
|
4624
|
+
|
|
4625
|
+
var VehicleClaimDetails = /** @class */ (function (_super) {
|
|
4626
|
+
__extends(VehicleClaimDetails, _super);
|
|
4627
|
+
function VehicleClaimDetails() {
|
|
4438
4628
|
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
4439
|
-
_this.forecasts = [];
|
|
4440
|
-
_this.type = exports.DepreciationTypeEnum.PLANT_EQUIPMENT;
|
|
4441
4629
|
/**
|
|
4442
|
-
*
|
|
4630
|
+
* Init default values for the new instances
|
|
4443
4631
|
*/
|
|
4444
|
-
_this.
|
|
4632
|
+
_this.isManual = true;
|
|
4633
|
+
_this.method = exports.VehicleClaimDetailsMethodEnum.KMS;
|
|
4634
|
+
_this.financialYear = new FinancialYear().year;
|
|
4445
4635
|
return _this;
|
|
4446
4636
|
}
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
return this.type === exports.DepreciationTypeEnum.CAPITAL_WORKS;
|
|
4450
|
-
};
|
|
4451
|
-
Depreciation.prototype.isBorrowingExpense = function () {
|
|
4452
|
-
return this.type === exports.DepreciationTypeEnum.BORROWING_EXPENSES;
|
|
4453
|
-
};
|
|
4454
|
-
Depreciation.prototype.isAsset = function () {
|
|
4455
|
-
return this.type === exports.DepreciationTypeEnum.PLANT_EQUIPMENT;
|
|
4456
|
-
};
|
|
4457
|
-
// Calculation checking
|
|
4458
|
-
Depreciation.prototype.isSBPCalculation = function () {
|
|
4459
|
-
return this.calculation === exports.DepreciationCalculationEnum.SBP;
|
|
4460
|
-
};
|
|
4461
|
-
Depreciation.prototype.isPrimeCost = function () {
|
|
4462
|
-
return this.calculation === exports.DepreciationCalculationEnum.PRIME_COST;
|
|
4463
|
-
};
|
|
4464
|
-
Depreciation.prototype.isDiminishing = function () {
|
|
4465
|
-
return this.calculation === exports.DepreciationCalculationEnum.DIMINISHING;
|
|
4466
|
-
};
|
|
4467
|
-
// Pool checking
|
|
4468
|
-
Depreciation.prototype.isPlantEquipmentPool = function () {
|
|
4469
|
-
return this.isAsset() && !this.isSBPCalculation() && !this.isWrittenOff() && !this.isLVP();
|
|
4637
|
+
VehicleClaimDetails.prototype.isLogbookMethod = function () {
|
|
4638
|
+
return this.method === exports.VehicleClaimDetailsMethodEnum.LOGBOOK;
|
|
4470
4639
|
};
|
|
4471
|
-
|
|
4472
|
-
return this.
|
|
4473
|
-
&& !this.isSBPCalculation()
|
|
4474
|
-
&& this.isDiminishing()
|
|
4475
|
-
&& this.currentYearForecast.closeBalance > Depreciation.WRITTEN_OFF_THRESHOLD
|
|
4476
|
-
&& this.currentYearForecast.closeBalance <= Depreciation.LOW_VALUE_POOL_THRESHOLD;
|
|
4640
|
+
VehicleClaimDetails.prototype.isKmsMethod = function () {
|
|
4641
|
+
return this.method === exports.VehicleClaimDetailsMethodEnum.KMS;
|
|
4477
4642
|
};
|
|
4478
|
-
|
|
4479
|
-
|
|
4643
|
+
return VehicleClaimDetails;
|
|
4644
|
+
}(VehicleClaimDetails$1));
|
|
4645
|
+
__decorate([
|
|
4646
|
+
classTransformer.Type(function () { return User; })
|
|
4647
|
+
], VehicleClaimDetails.prototype, "user", void 0);
|
|
4648
|
+
|
|
4649
|
+
var VehicleClaim = /** @class */ (function (_super) {
|
|
4650
|
+
__extends(VehicleClaim, _super);
|
|
4651
|
+
function VehicleClaim() {
|
|
4652
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
4653
|
+
_this.kilometers = 0;
|
|
4654
|
+
_this.workUsage = 0;
|
|
4655
|
+
return _this;
|
|
4656
|
+
}
|
|
4657
|
+
VehicleClaim.prototype.isWorkTank = function () {
|
|
4658
|
+
return !this.business;
|
|
4480
4659
|
};
|
|
4481
|
-
|
|
4482
|
-
return this.
|
|
4660
|
+
VehicleClaim.prototype.isSoleTank = function () {
|
|
4661
|
+
return !!this.business;
|
|
4483
4662
|
};
|
|
4484
|
-
Object.defineProperty(
|
|
4663
|
+
Object.defineProperty(VehicleClaim.prototype, "tankType", {
|
|
4485
4664
|
get: function () {
|
|
4486
|
-
|
|
4487
|
-
if (!this.writeOffManualDate && !this.writeOffDate) {
|
|
4488
|
-
return null;
|
|
4489
|
-
}
|
|
4490
|
-
return (_a = new FinancialYear(this.writeOffManualDate || this.writeOffDate)) === null || _a === void 0 ? void 0 : _a.year;
|
|
4665
|
+
return this.isSoleTank() ? exports.TankTypeEnum.SOLE : exports.TankTypeEnum.WORK;
|
|
4491
4666
|
},
|
|
4492
4667
|
enumerable: false,
|
|
4493
4668
|
configurable: true
|
|
4494
4669
|
});
|
|
4495
4670
|
/**
|
|
4496
|
-
*
|
|
4671
|
+
* Claim amount for KMs method. Exists only for KMs method.
|
|
4497
4672
|
*/
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
return ((_a = this.chartAccounts.heading) === null || _a === void 0 ? void 0 : _a.id) === exports.ChartAccountsHeadingVehicleListEnum.DEPRECIATION_VEHICLES;
|
|
4673
|
+
VehicleClaim.prototype.getKMSClaimAmount = function (vehicleClaimRate) {
|
|
4674
|
+
return +(this.kilometers * vehicleClaimRate).toFixed(2);
|
|
4501
4675
|
};
|
|
4502
4676
|
/**
|
|
4503
|
-
* Get
|
|
4677
|
+
* Get logbook claim amount. Exists only for logbook method.
|
|
4678
|
+
* ClaimAmount = WorkUsage * transaction/depreciation amount
|
|
4504
4679
|
*/
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
get: function () {
|
|
4513
|
-
return this.forecasts.find(function (forecast) {
|
|
4514
|
-
return forecast.financialYear === new FinancialYear().year;
|
|
4515
|
-
}) || classTransformer.plainToClass(DepreciationForecast, {
|
|
4516
|
-
financialYear: new FinancialYear().year,
|
|
4517
|
-
openBalance: 0,
|
|
4518
|
-
closeBalance: 0,
|
|
4519
|
-
amount: 0,
|
|
4520
|
-
claimPercent: 0
|
|
4521
|
-
});
|
|
4522
|
-
},
|
|
4523
|
-
enumerable: false,
|
|
4524
|
-
configurable: true
|
|
4525
|
-
});
|
|
4526
|
-
Depreciation.prototype.getForecastByYear = function (year) {
|
|
4527
|
-
return this.forecasts.find(function (forecast) {
|
|
4528
|
-
return forecast.financialYear === year;
|
|
4529
|
-
});
|
|
4530
|
-
};
|
|
4531
|
-
Depreciation.prototype.getClaimAmountByYear = function (year) {
|
|
4532
|
-
var _a;
|
|
4533
|
-
return ((_a = this.getForecastByYear(year)) === null || _a === void 0 ? void 0 : _a.claimAmount) || 0;
|
|
4534
|
-
};
|
|
4535
|
-
Depreciation.prototype.getCloseBalanceByYear = function (year) {
|
|
4536
|
-
var _a;
|
|
4537
|
-
return ((_a = this.getForecastByYear(year)) === null || _a === void 0 ? void 0 : _a.closeBalance) || 0;
|
|
4680
|
+
VehicleClaim.prototype.getLogbookClaimAmount = function (transactions) {
|
|
4681
|
+
var transactionsAmount = transactions
|
|
4682
|
+
.getByVehicleClaim(this)
|
|
4683
|
+
.getLogbookTransactions()
|
|
4684
|
+
.sumBy('amount');
|
|
4685
|
+
// Math.abs because amount will be negative (because we sum expenses), but we don't want negative percent value
|
|
4686
|
+
return Math.abs(transactionsAmount) * this.workUsage / 100;
|
|
4538
4687
|
};
|
|
4539
|
-
|
|
4540
|
-
return this.
|
|
4688
|
+
VehicleClaim.prototype.getAverageWeeklyKMS = function () {
|
|
4689
|
+
return this.kilometers / FinancialYear.weeksInYear;
|
|
4541
4690
|
};
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
if (params === void 0) { params = {}; }
|
|
4547
|
-
return classTransformer.plainToClass(Transaction, Object.assign(params, this, { amount: -this.claimAmount, claimAmount: -this.amount * (this.claimPercent / 100) }));
|
|
4691
|
+
VehicleClaim.getKMSChartAccountsIdByTankType = function (tankType) {
|
|
4692
|
+
return tankType === exports.TankTypeEnum.WORK
|
|
4693
|
+
? exports.ChartAccountsListEnum.KLMS_TRAVELLED_FOR_WORK
|
|
4694
|
+
: exports.ChartAccountsListEnum.KLMS_TRAVELLED;
|
|
4548
4695
|
};
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
});
|
|
4560
|
-
return Depreciation;
|
|
4561
|
-
}(Depreciation$1));
|
|
4562
|
-
Depreciation.WRITTEN_OFF_THRESHOLD = 300;
|
|
4563
|
-
Depreciation.LOW_VALUE_POOL_THRESHOLD = 1000;
|
|
4564
|
-
__decorate([
|
|
4565
|
-
classTransformer.Type(function () { return Date; })
|
|
4566
|
-
], Depreciation.prototype, "purchaseDate", void 0);
|
|
4567
|
-
__decorate([
|
|
4568
|
-
classTransformer.Type(function () { return Date; })
|
|
4569
|
-
], Depreciation.prototype, "date", void 0);
|
|
4570
|
-
__decorate([
|
|
4571
|
-
classTransformer.Type(function () { return Date; })
|
|
4572
|
-
], Depreciation.prototype, "lowValuePoolDate", void 0);
|
|
4573
|
-
__decorate([
|
|
4574
|
-
classTransformer.Type(function () { return Date; })
|
|
4575
|
-
], Depreciation.prototype, "writeOffManualDate", void 0);
|
|
4576
|
-
__decorate([
|
|
4577
|
-
classTransformer.Type(function () { return Date; })
|
|
4578
|
-
], Depreciation.prototype, "writeOffDate", void 0);
|
|
4579
|
-
__decorate([
|
|
4580
|
-
classTransformer.Type(function () { return DepreciationCapitalProject; })
|
|
4581
|
-
], Depreciation.prototype, "depreciationCapitalProject", void 0);
|
|
4582
|
-
__decorate([
|
|
4583
|
-
classTransformer.Type(function () { return DepreciationForecast; }),
|
|
4584
|
-
classTransformer.Transform(function (_b) {
|
|
4585
|
-
var value = _b.value, obj = _b.obj;
|
|
4586
|
-
// value = array of DepreciationForecast
|
|
4587
|
-
// obj = plain (whole Depreciation object)
|
|
4588
|
-
// Set isLVP flag for each DepreciationForecast
|
|
4589
|
-
// @TODO refactor
|
|
4590
|
-
value.forEach(function (forecast) {
|
|
4591
|
-
forecast.isLVP =
|
|
4592
|
-
forecast.closeBalance < 1000 &&
|
|
4593
|
-
obj.calculation === exports.DepreciationCalculationEnum.DIMINISHING &&
|
|
4594
|
-
obj.type === exports.DepreciationTypeEnum.PLANT_EQUIPMENT &&
|
|
4595
|
-
!(obj.amount > Depreciation.WRITTEN_OFF_THRESHOLD && obj.amount < Depreciation.LOW_VALUE_POOL_THRESHOLD) &&
|
|
4596
|
-
!(obj.writeOffDate && new FinancialYear(new Date(obj.writeOffDate)).year === obj.financialYear);
|
|
4597
|
-
});
|
|
4598
|
-
return value;
|
|
4599
|
-
})
|
|
4600
|
-
], Depreciation.prototype, "forecasts", void 0);
|
|
4696
|
+
return VehicleClaim;
|
|
4697
|
+
}(VehicleClaim$1));
|
|
4698
|
+
/**
|
|
4699
|
+
* limit for kms claim method
|
|
4700
|
+
*/
|
|
4701
|
+
VehicleClaim.totalKmsLimit = 5000;
|
|
4702
|
+
/**
|
|
4703
|
+
* limit for work usage claim method
|
|
4704
|
+
*/
|
|
4705
|
+
VehicleClaim.totalWorkUsagePercent = 100;
|
|
4601
4706
|
__decorate([
|
|
4602
|
-
classTransformer.Type(function () { return
|
|
4603
|
-
],
|
|
4707
|
+
classTransformer.Type(function () { return VehicleClaimDetails; })
|
|
4708
|
+
], VehicleClaim.prototype, "details", void 0);
|
|
4604
4709
|
__decorate([
|
|
4605
|
-
classTransformer.Type(function () { return
|
|
4606
|
-
],
|
|
4710
|
+
classTransformer.Type(function () { return SoleBusiness; })
|
|
4711
|
+
], VehicleClaim.prototype, "business", void 0);
|
|
4607
4712
|
|
|
4608
4713
|
var SoleBusinessActivity$1 = /** @class */ (function (_super) {
|
|
4609
4714
|
__extends(SoleBusinessActivity, _super);
|
|
@@ -4694,6 +4799,25 @@
|
|
|
4694
4799
|
return SoleDepreciationMethod;
|
|
4695
4800
|
}(SoleDepreciationMethod$1));
|
|
4696
4801
|
|
|
4802
|
+
var SoleDetails$1 = /** @class */ (function (_super) {
|
|
4803
|
+
__extends(SoleDetails, _super);
|
|
4804
|
+
function SoleDetails() {
|
|
4805
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
4806
|
+
}
|
|
4807
|
+
return SoleDetails;
|
|
4808
|
+
}(AbstractModel));
|
|
4809
|
+
|
|
4810
|
+
var SoleDetails = /** @class */ (function (_super) {
|
|
4811
|
+
__extends(SoleDetails, _super);
|
|
4812
|
+
function SoleDetails() {
|
|
4813
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
4814
|
+
}
|
|
4815
|
+
return SoleDetails;
|
|
4816
|
+
}(SoleDetails$1));
|
|
4817
|
+
__decorate([
|
|
4818
|
+
classTransformer.Type(function () { return User; })
|
|
4819
|
+
], SoleDetails.prototype, "user", void 0);
|
|
4820
|
+
|
|
4697
4821
|
var User = /** @class */ (function (_super) {
|
|
4698
4822
|
__extends(User, _super);
|
|
4699
4823
|
function User() {
|
|
@@ -6555,6 +6679,65 @@
|
|
|
6555
6679
|
}]
|
|
6556
6680
|
}] });
|
|
6557
6681
|
|
|
6682
|
+
var Document$1 = /** @class */ (function (_super) {
|
|
6683
|
+
__extends(Document, _super);
|
|
6684
|
+
function Document() {
|
|
6685
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
6686
|
+
}
|
|
6687
|
+
return Document;
|
|
6688
|
+
}(AbstractModel));
|
|
6689
|
+
|
|
6690
|
+
/**
|
|
6691
|
+
* Enum with document types which used to API url prefix
|
|
6692
|
+
*/
|
|
6693
|
+
exports.DocumentApiUrlPrefixEnum = void 0;
|
|
6694
|
+
(function (DocumentApiUrlPrefixEnum) {
|
|
6695
|
+
DocumentApiUrlPrefixEnum["FOLDERS"] = "folders";
|
|
6696
|
+
DocumentApiUrlPrefixEnum["PROPERTIES"] = "properties";
|
|
6697
|
+
})(exports.DocumentApiUrlPrefixEnum || (exports.DocumentApiUrlPrefixEnum = {}));
|
|
6698
|
+
|
|
6699
|
+
var Document = /** @class */ (function (_super) {
|
|
6700
|
+
__extends(Document, _super);
|
|
6701
|
+
function Document() {
|
|
6702
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
6703
|
+
_this.type = exports.AssetTypeEnum.DOCUMENTS;
|
|
6704
|
+
_this.entityType = exports.AssetEntityTypeEnum.FOLDERS;
|
|
6705
|
+
return _this;
|
|
6706
|
+
}
|
|
6707
|
+
/**
|
|
6708
|
+
* Get folder as document parent entity
|
|
6709
|
+
*/
|
|
6710
|
+
Document.prototype.getEntity = function () {
|
|
6711
|
+
return this.folder;
|
|
6712
|
+
};
|
|
6713
|
+
/**
|
|
6714
|
+
* Get API url prefix
|
|
6715
|
+
*/
|
|
6716
|
+
Document.prototype.getApiUrlPrefix = function () {
|
|
6717
|
+
return exports.DocumentApiUrlPrefixEnum.FOLDERS;
|
|
6718
|
+
};
|
|
6719
|
+
return Document;
|
|
6720
|
+
}(Document$1));
|
|
6721
|
+
|
|
6722
|
+
var DocumentFolder$1 = /** @class */ (function (_super) {
|
|
6723
|
+
__extends(DocumentFolder, _super);
|
|
6724
|
+
function DocumentFolder() {
|
|
6725
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
6726
|
+
}
|
|
6727
|
+
return DocumentFolder;
|
|
6728
|
+
}(AbstractModel));
|
|
6729
|
+
|
|
6730
|
+
var DocumentFolder = /** @class */ (function (_super) {
|
|
6731
|
+
__extends(DocumentFolder, _super);
|
|
6732
|
+
function DocumentFolder() {
|
|
6733
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
6734
|
+
}
|
|
6735
|
+
return DocumentFolder;
|
|
6736
|
+
}(DocumentFolder$1));
|
|
6737
|
+
__decorate([
|
|
6738
|
+
classTransformer.Type(function () { return Document; })
|
|
6739
|
+
], DocumentFolder.prototype, "documents", void 0);
|
|
6740
|
+
|
|
6558
6741
|
var VehicleClaimCollection = /** @class */ (function (_super) {
|
|
6559
6742
|
__extends(VehicleClaimCollection, _super);
|
|
6560
6743
|
function VehicleClaimCollection() {
|
|
@@ -8433,6 +8616,13 @@
|
|
|
8433
8616
|
return ChartAccountsCategoryECollection;
|
|
8434
8617
|
}());
|
|
8435
8618
|
|
|
8619
|
+
exports.DocumentTypeEnum = void 0;
|
|
8620
|
+
(function (DocumentTypeEnum) {
|
|
8621
|
+
DocumentTypeEnum[DocumentTypeEnum["INVOICE"] = 1] = "INVOICE";
|
|
8622
|
+
})(exports.DocumentTypeEnum || (exports.DocumentTypeEnum = {}));
|
|
8623
|
+
|
|
8624
|
+
// @TODO Artem TT-2308 move everything
|
|
8625
|
+
|
|
8436
8626
|
exports.ChartAccountsEtpEnum = void 0;
|
|
8437
8627
|
(function (ChartAccountsEtpEnum) {
|
|
8438
8628
|
ChartAccountsEtpEnum[ChartAccountsEtpEnum["ETP_R"] = 549] = "ETP_R";
|
|
@@ -9637,7 +9827,7 @@
|
|
|
9637
9827
|
this.items[key] = value;
|
|
9638
9828
|
};
|
|
9639
9829
|
Dictionary.prototype.get = function (key) {
|
|
9640
|
-
return this.items[key] ? this.items[key] : null;
|
|
9830
|
+
return this.items[key] !== undefined ? this.items[key] : null;
|
|
9641
9831
|
};
|
|
9642
9832
|
Dictionary.prototype.groupItems = function (items, path) {
|
|
9643
9833
|
var _this = this;
|
|
@@ -9747,48 +9937,8 @@
|
|
|
9747
9937
|
_this.entityType = exports.AssetEntityTypeEnum.DEPRECIATIONS;
|
|
9748
9938
|
return _this;
|
|
9749
9939
|
}
|
|
9750
|
-
return DepreciationReceipt;
|
|
9751
|
-
}(DepreciationReceipt$1));
|
|
9752
|
-
|
|
9753
|
-
var Document$1 = /** @class */ (function (_super) {
|
|
9754
|
-
__extends(Document, _super);
|
|
9755
|
-
function Document() {
|
|
9756
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
9757
|
-
}
|
|
9758
|
-
return Document;
|
|
9759
|
-
}(AbstractModel));
|
|
9760
|
-
|
|
9761
|
-
/**
|
|
9762
|
-
* Enum with document types which used to API url prefix
|
|
9763
|
-
*/
|
|
9764
|
-
exports.DocumentApiUrlPrefixEnum = void 0;
|
|
9765
|
-
(function (DocumentApiUrlPrefixEnum) {
|
|
9766
|
-
DocumentApiUrlPrefixEnum["FOLDERS"] = "folders";
|
|
9767
|
-
DocumentApiUrlPrefixEnum["PROPERTIES"] = "properties";
|
|
9768
|
-
})(exports.DocumentApiUrlPrefixEnum || (exports.DocumentApiUrlPrefixEnum = {}));
|
|
9769
|
-
|
|
9770
|
-
var Document = /** @class */ (function (_super) {
|
|
9771
|
-
__extends(Document, _super);
|
|
9772
|
-
function Document() {
|
|
9773
|
-
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
9774
|
-
_this.type = exports.AssetTypeEnum.DOCUMENTS;
|
|
9775
|
-
_this.entityType = exports.AssetEntityTypeEnum.FOLDERS;
|
|
9776
|
-
return _this;
|
|
9777
|
-
}
|
|
9778
|
-
/**
|
|
9779
|
-
* Get folder as document parent entity
|
|
9780
|
-
*/
|
|
9781
|
-
Document.prototype.getEntity = function () {
|
|
9782
|
-
return this.folder;
|
|
9783
|
-
};
|
|
9784
|
-
/**
|
|
9785
|
-
* Get API url prefix
|
|
9786
|
-
*/
|
|
9787
|
-
Document.prototype.getApiUrlPrefix = function () {
|
|
9788
|
-
return exports.DocumentApiUrlPrefixEnum.FOLDERS;
|
|
9789
|
-
};
|
|
9790
|
-
return Document;
|
|
9791
|
-
}(Document$1));
|
|
9940
|
+
return DepreciationReceipt;
|
|
9941
|
+
}(DepreciationReceipt$1));
|
|
9792
9942
|
|
|
9793
9943
|
var DOCUMENT_FILE_TYPES = {
|
|
9794
9944
|
image: [
|
|
@@ -9813,25 +9963,6 @@
|
|
|
9813
9963
|
]
|
|
9814
9964
|
};
|
|
9815
9965
|
|
|
9816
|
-
var DocumentFolder$1 = /** @class */ (function (_super) {
|
|
9817
|
-
__extends(DocumentFolder, _super);
|
|
9818
|
-
function DocumentFolder() {
|
|
9819
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
9820
|
-
}
|
|
9821
|
-
return DocumentFolder;
|
|
9822
|
-
}(AbstractModel));
|
|
9823
|
-
|
|
9824
|
-
var DocumentFolder = /** @class */ (function (_super) {
|
|
9825
|
-
__extends(DocumentFolder, _super);
|
|
9826
|
-
function DocumentFolder() {
|
|
9827
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
9828
|
-
}
|
|
9829
|
-
return DocumentFolder;
|
|
9830
|
-
}(DocumentFolder$1));
|
|
9831
|
-
__decorate([
|
|
9832
|
-
classTransformer.Type(function () { return Document; })
|
|
9833
|
-
], DocumentFolder.prototype, "documents", void 0);
|
|
9834
|
-
|
|
9835
9966
|
var EmployeeInvite$1 = /** @class */ (function (_super) {
|
|
9836
9967
|
__extends(EmployeeInvite, _super);
|
|
9837
9968
|
function EmployeeInvite() {
|
|
@@ -11736,6 +11867,17 @@
|
|
|
11736
11867
|
_this.isHydra = true;
|
|
11737
11868
|
return _this;
|
|
11738
11869
|
}
|
|
11870
|
+
SoleInvoiceService.prototype.updateStatus = function (invoice, status) {
|
|
11871
|
+
// use id only to avoid unexpected changes
|
|
11872
|
+
return this.update(classTransformer.plainToClass(SoleInvoice, merge__default["default"]({}, { id: invoice.id }, { status: status })));
|
|
11873
|
+
};
|
|
11874
|
+
SoleInvoiceService.prototype.publish = function (invoice, document) {
|
|
11875
|
+
// use id only to avoid unexpected changes
|
|
11876
|
+
return this.update(merge__default["default"]({}, invoice, { document: document, status: exports.SoleInvoiceStatusesEnum.PENDING }));
|
|
11877
|
+
};
|
|
11878
|
+
SoleInvoiceService.prototype.sendEmail = function (invoice) {
|
|
11879
|
+
return this.http.post(this.environment.apiV2 + "/" + this.url + "/" + invoice.id + "/send", {});
|
|
11880
|
+
};
|
|
11739
11881
|
return SoleInvoiceService;
|
|
11740
11882
|
}(RestService));
|
|
11741
11883
|
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 });
|
|
@@ -12114,6 +12256,99 @@
|
|
|
12114
12256
|
}]
|
|
12115
12257
|
}] });
|
|
12116
12258
|
|
|
12259
|
+
var DocumentService = /** @class */ (function (_super) {
|
|
12260
|
+
__extends(DocumentService, _super);
|
|
12261
|
+
function DocumentService() {
|
|
12262
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
12263
|
+
_this.url = 'documents';
|
|
12264
|
+
_this.modelClass = Document;
|
|
12265
|
+
return _this;
|
|
12266
|
+
}
|
|
12267
|
+
return DocumentService;
|
|
12268
|
+
}(RestService));
|
|
12269
|
+
DocumentService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DocumentService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
12270
|
+
DocumentService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DocumentService, providedIn: 'root' });
|
|
12271
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DocumentService, decorators: [{
|
|
12272
|
+
type: i0.Injectable,
|
|
12273
|
+
args: [{
|
|
12274
|
+
providedIn: 'root'
|
|
12275
|
+
}]
|
|
12276
|
+
}] });
|
|
12277
|
+
|
|
12278
|
+
/**
|
|
12279
|
+
* Service to handle document-folders and depending documents logic
|
|
12280
|
+
*/
|
|
12281
|
+
var DocumentFolderService = /** @class */ (function (_super) {
|
|
12282
|
+
__extends(DocumentFolderService, _super);
|
|
12283
|
+
function DocumentFolderService() {
|
|
12284
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
12285
|
+
_this.url = 'folders';
|
|
12286
|
+
_this.modelClass = DocumentFolder;
|
|
12287
|
+
return _this;
|
|
12288
|
+
}
|
|
12289
|
+
/**
|
|
12290
|
+
* Add new document to the folder
|
|
12291
|
+
* @param file to be uploaded to the folder
|
|
12292
|
+
* @param folder for document
|
|
12293
|
+
*/
|
|
12294
|
+
DocumentFolderService.prototype.addDocument = function (file, folder) {
|
|
12295
|
+
var _this = this;
|
|
12296
|
+
// create formData object with provided file
|
|
12297
|
+
var formDataDocument = new FormData();
|
|
12298
|
+
formDataDocument.append('file', file);
|
|
12299
|
+
return this.http.post(this.environment.apiV2 + "/folders/" + folder.id + "/documents", formDataDocument).pipe(operators.map(function (response) {
|
|
12300
|
+
var updatedFolder = Object.assign(classTransformer.plainToClass(DocumentFolder, {}), folder);
|
|
12301
|
+
updatedFolder.documents.push(classTransformer.plainToClass(Document, response));
|
|
12302
|
+
replace(_this.cache, classTransformer.plainToClass(DocumentFolder, updatedFolder));
|
|
12303
|
+
_this.cacheSubject.next(_this.cache);
|
|
12304
|
+
}));
|
|
12305
|
+
};
|
|
12306
|
+
/**
|
|
12307
|
+
* Edit folder document by moving it from one folder to another
|
|
12308
|
+
* @param editedDocument
|
|
12309
|
+
* @param selectedFolder to move the document to
|
|
12310
|
+
* @param oldFolderId: id of old folder from which need to remove the document
|
|
12311
|
+
*/
|
|
12312
|
+
DocumentFolderService.prototype.updateDocument = function (editedDocument, selectedFolder, oldFolderId) {
|
|
12313
|
+
var _this = this;
|
|
12314
|
+
return this.http.put(this.environment.apiV2 + "/folders/" + selectedFolder.id + "/documents/" + editedDocument.id, editedDocument).pipe(operators.map(function (response) {
|
|
12315
|
+
var oldFolder = _this.cache.find(function (folder) { return folder.id === oldFolderId; });
|
|
12316
|
+
// Remove document from old folder
|
|
12317
|
+
oldFolder.documents = oldFolder.documents.filter(function (deletedDocument) { return deletedDocument.id !== response.id; });
|
|
12318
|
+
// update old folder and replace it in cache
|
|
12319
|
+
response.folder = classTransformer.plainToClass(DocumentFolder, { id: selectedFolder.id, name: selectedFolder.name });
|
|
12320
|
+
replace(_this.cache, classTransformer.plainToClass(DocumentFolder, oldFolder));
|
|
12321
|
+
// update new document folder and replace it in cache
|
|
12322
|
+
selectedFolder.documents.push(classTransformer.plainToClass(Document, response));
|
|
12323
|
+
replace(_this.cache, classTransformer.plainToClass(DocumentFolder, selectedFolder));
|
|
12324
|
+
_this.cacheSubject.next(_this.cache);
|
|
12325
|
+
}));
|
|
12326
|
+
};
|
|
12327
|
+
/**
|
|
12328
|
+
* Delete document from folder
|
|
12329
|
+
* @param document to remove
|
|
12330
|
+
* @param folder from which document should be removed
|
|
12331
|
+
*/
|
|
12332
|
+
DocumentFolderService.prototype.deleteDocument = function (document, folder) {
|
|
12333
|
+
var _this = this;
|
|
12334
|
+
return this.http.delete(this.environment.apiV2 + "/folders/" + folder.id + "/documents/" + document.id).pipe(operators.map(function () {
|
|
12335
|
+
folder.documents = folder.documents
|
|
12336
|
+
.filter(function (deletedDocument) { return deletedDocument.id !== document.id; });
|
|
12337
|
+
replace(_this.cache, classTransformer.plainToClass(DocumentFolder, folder));
|
|
12338
|
+
_this.cacheSubject.next(_this.cache);
|
|
12339
|
+
}));
|
|
12340
|
+
};
|
|
12341
|
+
return DocumentFolderService;
|
|
12342
|
+
}(RestService));
|
|
12343
|
+
DocumentFolderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DocumentFolderService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
12344
|
+
DocumentFolderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DocumentFolderService, providedIn: 'root' });
|
|
12345
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DocumentFolderService, decorators: [{
|
|
12346
|
+
type: i0.Injectable,
|
|
12347
|
+
args: [{
|
|
12348
|
+
providedIn: 'root'
|
|
12349
|
+
}]
|
|
12350
|
+
}] });
|
|
12351
|
+
|
|
12117
12352
|
/**
|
|
12118
12353
|
* Service to work with Rewardful (affiliate program) API
|
|
12119
12354
|
* https://developers.rewardful.com/javascript-api/overview#executing-code-when-rewardful-loads
|
|
@@ -14624,80 +14859,6 @@
|
|
|
14624
14859
|
}] }];
|
|
14625
14860
|
} });
|
|
14626
14861
|
|
|
14627
|
-
/**
|
|
14628
|
-
* Service to handle document-folders and depending documents logic
|
|
14629
|
-
*/
|
|
14630
|
-
var DocumentFolderService = /** @class */ (function (_super) {
|
|
14631
|
-
__extends(DocumentFolderService, _super);
|
|
14632
|
-
function DocumentFolderService() {
|
|
14633
|
-
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
14634
|
-
_this.url = 'folders';
|
|
14635
|
-
_this.modelClass = DocumentFolder;
|
|
14636
|
-
return _this;
|
|
14637
|
-
}
|
|
14638
|
-
/**
|
|
14639
|
-
* Add new document to the folder
|
|
14640
|
-
* @param file to be uploaded to the folder
|
|
14641
|
-
* @param folder for document
|
|
14642
|
-
*/
|
|
14643
|
-
DocumentFolderService.prototype.addDocument = function (file, folder) {
|
|
14644
|
-
var _this = this;
|
|
14645
|
-
// create formData object with provided file
|
|
14646
|
-
var formDataDocument = new FormData();
|
|
14647
|
-
formDataDocument.append('file', file);
|
|
14648
|
-
return this.http.post(this.environment.apiV2 + "/folders/" + folder.id + "/documents", formDataDocument).pipe(operators.map(function (response) {
|
|
14649
|
-
var updatedFolder = Object.assign(classTransformer.plainToClass(DocumentFolder, {}), folder);
|
|
14650
|
-
updatedFolder.documents.push(classTransformer.plainToClass(Document, response));
|
|
14651
|
-
replace(_this.cache, classTransformer.plainToClass(DocumentFolder, updatedFolder));
|
|
14652
|
-
_this.cacheSubject.next(_this.cache);
|
|
14653
|
-
}));
|
|
14654
|
-
};
|
|
14655
|
-
/**
|
|
14656
|
-
* Edit folder document by moving it from one folder to another
|
|
14657
|
-
* @param editedDocument
|
|
14658
|
-
* @param selectedFolder to move the document to
|
|
14659
|
-
* @param oldFolderId: id of old folder from which need to remove the document
|
|
14660
|
-
*/
|
|
14661
|
-
DocumentFolderService.prototype.updateDocument = function (editedDocument, selectedFolder, oldFolderId) {
|
|
14662
|
-
var _this = this;
|
|
14663
|
-
return this.http.put(this.environment.apiV2 + "/folders/" + selectedFolder.id + "/documents/" + editedDocument.id, editedDocument).pipe(operators.map(function (response) {
|
|
14664
|
-
var oldFolder = _this.cache.find(function (folder) { return folder.id === oldFolderId; });
|
|
14665
|
-
// Remove document from old folder
|
|
14666
|
-
oldFolder.documents = oldFolder.documents.filter(function (deletedDocument) { return deletedDocument.id !== response.id; });
|
|
14667
|
-
// update old folder and replace it in cache
|
|
14668
|
-
response.folder = classTransformer.plainToClass(DocumentFolder, { id: selectedFolder.id, name: selectedFolder.name });
|
|
14669
|
-
replace(_this.cache, classTransformer.plainToClass(DocumentFolder, oldFolder));
|
|
14670
|
-
// update new document folder and replace it in cache
|
|
14671
|
-
selectedFolder.documents.push(classTransformer.plainToClass(Document, response));
|
|
14672
|
-
replace(_this.cache, classTransformer.plainToClass(DocumentFolder, selectedFolder));
|
|
14673
|
-
_this.cacheSubject.next(_this.cache);
|
|
14674
|
-
}));
|
|
14675
|
-
};
|
|
14676
|
-
/**
|
|
14677
|
-
* Delete document from folder
|
|
14678
|
-
* @param document to remove
|
|
14679
|
-
* @param folder from which document should be removed
|
|
14680
|
-
*/
|
|
14681
|
-
DocumentFolderService.prototype.deleteDocument = function (document, folder) {
|
|
14682
|
-
var _this = this;
|
|
14683
|
-
return this.http.delete(this.environment.apiV2 + "/folders/" + folder.id + "/documents/" + document.id).pipe(operators.map(function () {
|
|
14684
|
-
folder.documents = folder.documents
|
|
14685
|
-
.filter(function (deletedDocument) { return deletedDocument.id !== document.id; });
|
|
14686
|
-
replace(_this.cache, classTransformer.plainToClass(DocumentFolder, folder));
|
|
14687
|
-
_this.cacheSubject.next(_this.cache);
|
|
14688
|
-
}));
|
|
14689
|
-
};
|
|
14690
|
-
return DocumentFolderService;
|
|
14691
|
-
}(RestService));
|
|
14692
|
-
DocumentFolderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DocumentFolderService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
14693
|
-
DocumentFolderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DocumentFolderService, providedIn: 'root' });
|
|
14694
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DocumentFolderService, decorators: [{
|
|
14695
|
-
type: i0.Injectable,
|
|
14696
|
-
args: [{
|
|
14697
|
-
providedIn: 'root'
|
|
14698
|
-
}]
|
|
14699
|
-
}] });
|
|
14700
|
-
|
|
14701
14862
|
var EmployeeService = /** @class */ (function (_super) {
|
|
14702
14863
|
__extends(EmployeeService, _super);
|
|
14703
14864
|
function EmployeeService() {
|
|
@@ -15422,6 +15583,8 @@
|
|
|
15422
15583
|
};
|
|
15423
15584
|
|
|
15424
15585
|
/**
|
|
15586
|
+
* @TODO mikhail better typehint
|
|
15587
|
+
*
|
|
15425
15588
|
* Service to generate and export PDF file from provided HTML elements
|
|
15426
15589
|
* The file is generated using the html2pdf library in order to get a canvas at the output,
|
|
15427
15590
|
* in which all the styles that the user sees on the page will be saved
|
|
@@ -15429,20 +15592,30 @@
|
|
|
15429
15592
|
var PdfFromDomElementService = /** @class */ (function () {
|
|
15430
15593
|
function PdfFromDomElementService() {
|
|
15431
15594
|
}
|
|
15432
|
-
PdfFromDomElementService.prototype.
|
|
15595
|
+
PdfFromDomElementService.prototype.init = function (elements, fileSettings) {
|
|
15433
15596
|
var options = FILE_SETTINGS$1;
|
|
15434
|
-
|
|
15597
|
+
if (fileSettings) {
|
|
15598
|
+
merge__default["default"](options, fileSettings);
|
|
15599
|
+
}
|
|
15435
15600
|
// HTML container in which the exported DOM elements will be placed
|
|
15436
15601
|
var htmlWrapper = document.createElement('div');
|
|
15437
15602
|
elements.forEach(function (element) {
|
|
15438
15603
|
htmlWrapper.append(element.cloneNode(true));
|
|
15439
15604
|
});
|
|
15440
15605
|
// Set PDF options, save file and return result as Observable
|
|
15441
|
-
return
|
|
15442
|
-
|
|
15606
|
+
return html2pdf__namespace().from(htmlWrapper).set(options);
|
|
15607
|
+
};
|
|
15608
|
+
PdfFromDomElementService.prototype.download = function (elements, fileSettings) {
|
|
15609
|
+
return rxjs.from(this.init(elements, fileSettings)
|
|
15443
15610
|
.save()
|
|
15444
15611
|
.then());
|
|
15445
15612
|
};
|
|
15613
|
+
PdfFromDomElementService.prototype.export = function (elements, filename) {
|
|
15614
|
+
if (filename === void 0) { filename = FILE_SETTINGS$1.filename; }
|
|
15615
|
+
return rxjs.from(this.init(elements)
|
|
15616
|
+
.outputPdf('blob')
|
|
15617
|
+
.then(function (blob) { return new File([blob], filename, { type: 'application/pdf' }); }));
|
|
15618
|
+
};
|
|
15446
15619
|
return PdfFromDomElementService;
|
|
15447
15620
|
}());
|
|
15448
15621
|
PdfFromDomElementService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfFromDomElementService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
@@ -16572,6 +16745,17 @@
|
|
|
16572
16745
|
return !_this.isAllocated(transaction, allocations);
|
|
16573
16746
|
}));
|
|
16574
16747
|
};
|
|
16748
|
+
/**
|
|
16749
|
+
* Get invoices allocated amounts grouped bu invoice id
|
|
16750
|
+
*/
|
|
16751
|
+
TransactionCalculationService.prototype.getAllocationsAmountsByInvoiceId = function (allocations, invoices) {
|
|
16752
|
+
var allocationsByTransactionId = allocations.groupBy('transaction.id');
|
|
16753
|
+
var dictionary = new Dictionary([]);
|
|
16754
|
+
invoices.toArray().forEach(function (invoice) {
|
|
16755
|
+
dictionary.add(invoice.id, allocationsByTransactionId.merge(invoice.itemsCollection.mapBy('transaction.id')).amount || 0);
|
|
16756
|
+
});
|
|
16757
|
+
return dictionary;
|
|
16758
|
+
};
|
|
16575
16759
|
return TransactionCalculationService;
|
|
16576
16760
|
}());
|
|
16577
16761
|
TransactionCalculationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TransactionCalculationService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
@@ -17406,55 +17590,38 @@
|
|
|
17406
17590
|
description: new forms.FormControl(item.description, forms.Validators.required),
|
|
17407
17591
|
quantity: new forms.FormControl(item.quantity, forms.Validators.required),
|
|
17408
17592
|
price: new forms.FormControl(item.price, forms.Validators.required),
|
|
17409
|
-
isGST: new forms.FormControl({ value: item.isGST, disabled: !((_a = item.chartAccounts) === null || _a === void 0 ? void 0 : _a.isGST) }),
|
|
17410
|
-
chartAccounts: new forms.FormControl(item.chartAccounts, forms.Validators.required)
|
|
17593
|
+
isGST: new forms.FormControl({ value: item.isGST || false, disabled: !((_a = item.chartAccounts) === null || _a === void 0 ? void 0 : _a.isGST) }),
|
|
17594
|
+
chartAccounts: new forms.FormControl(item.chartAccounts, forms.Validators.required),
|
|
17411
17595
|
}, item) || this;
|
|
17412
|
-
_this.listenEvents();
|
|
17413
17596
|
return _this;
|
|
17414
17597
|
}
|
|
17415
|
-
SoleInvoiceItemForm.prototype.listenEvents = function () {
|
|
17416
|
-
this.listenChartAccountsChanges();
|
|
17417
|
-
};
|
|
17418
|
-
SoleInvoiceItemForm.prototype.onTemplateChanged = function (template) {
|
|
17419
|
-
this.template = template;
|
|
17420
|
-
if (this.template.isNoTax()) {
|
|
17421
|
-
this.get('isGST').setValue(false);
|
|
17422
|
-
this.get('isGST').disable();
|
|
17423
|
-
}
|
|
17424
|
-
else {
|
|
17425
|
-
this.get('isGST').enable();
|
|
17426
|
-
}
|
|
17427
|
-
};
|
|
17428
|
-
SoleInvoiceItemForm.prototype.listenChartAccountsChanges = function () {
|
|
17429
|
-
var _this = this;
|
|
17430
|
-
this.get('chartAccounts').valueChanges.subscribe(function (chartAccounts) {
|
|
17431
|
-
if (_this.template.isNoTax()) {
|
|
17432
|
-
return;
|
|
17433
|
-
}
|
|
17434
|
-
if (chartAccounts.isGST) {
|
|
17435
|
-
_this.get('isGST').enable();
|
|
17436
|
-
}
|
|
17437
|
-
else {
|
|
17438
|
-
_this.get('isGST').setValue(false);
|
|
17439
|
-
_this.get('isGST').disable();
|
|
17440
|
-
}
|
|
17441
|
-
});
|
|
17442
|
-
};
|
|
17443
17598
|
return SoleInvoiceItemForm;
|
|
17444
17599
|
}(AbstractForm));
|
|
17445
17600
|
|
|
17446
17601
|
var SoleInvoiceForm = /** @class */ (function (_super) {
|
|
17447
17602
|
__extends(SoleInvoiceForm, _super);
|
|
17448
|
-
function SoleInvoiceForm(invoice) {
|
|
17603
|
+
function SoleInvoiceForm(invoice, soleDetailsGST) {
|
|
17449
17604
|
var _this = _super.call(this, {
|
|
17450
|
-
dateFrom: new forms.FormControl(invoice.dateFrom, forms.Validators.required),
|
|
17605
|
+
dateFrom: new forms.FormControl(invoice.dateFrom || new Date(), forms.Validators.required),
|
|
17451
17606
|
dateTo: new forms.FormControl(invoice.dateTo, forms.Validators.required),
|
|
17452
|
-
items: new forms.FormArray(invoice.items.map(function (item) { return new SoleInvoiceItemForm(item); })),
|
|
17607
|
+
items: new forms.FormArray((invoice.items || [classTransformer.plainToClass(SoleInvoiceItem, {})]).map(function (item) { return new SoleInvoiceItemForm(item); })),
|
|
17453
17608
|
payer: new forms.FormControl(invoice.payer, forms.Validators.required),
|
|
17454
|
-
|
|
17609
|
+
taxType: new forms.FormControl(invoice.taxType, forms.Validators.required),
|
|
17610
|
+
bankAccount: new forms.FormControl(invoice.bankAccount, forms.Validators.required)
|
|
17455
17611
|
}, invoice) || this;
|
|
17456
|
-
|
|
17457
|
-
|
|
17612
|
+
_this.soleDetailsGST = soleDetailsGST;
|
|
17613
|
+
// we need invoice template only for new invoices
|
|
17614
|
+
if (!invoice.id) {
|
|
17615
|
+
_this.addControl('template', new forms.FormControl(invoice.template));
|
|
17616
|
+
}
|
|
17617
|
+
// invoice.taxType is always NONE ('No Tax') when soleDetails.isGST === false
|
|
17618
|
+
if (!_this.soleDetailsGST) {
|
|
17619
|
+
_this.get('taxType').setValue(exports.SoleInvoiceTaxTypeEnum.NO_TAX);
|
|
17620
|
+
_this.get('taxType').disable();
|
|
17621
|
+
// Items isGST is not available when invoice.taxType === NONE ('No Tax')
|
|
17622
|
+
_this.items.controls.forEach(function (itemForm) {
|
|
17623
|
+
_this.disableItemGST(itemForm);
|
|
17624
|
+
});
|
|
17458
17625
|
}
|
|
17459
17626
|
_this.listenEvents();
|
|
17460
17627
|
return _this;
|
|
@@ -17467,59 +17634,121 @@
|
|
|
17467
17634
|
configurable: true
|
|
17468
17635
|
});
|
|
17469
17636
|
SoleInvoiceForm.prototype.listenEvents = function () {
|
|
17470
|
-
this
|
|
17637
|
+
var _this = this;
|
|
17638
|
+
// no need to listen tax type and items chart accounts changes when soleDetails.isGST === false
|
|
17639
|
+
// because invoice tax type always 'No Tax' in this case and not available for changing
|
|
17640
|
+
if (this.soleDetailsGST) {
|
|
17641
|
+
this.listenTaxTypeChanges();
|
|
17642
|
+
this.items.controls.forEach(function (itemForm) {
|
|
17643
|
+
_this.listenItemChartAccountsChanges(itemForm);
|
|
17644
|
+
});
|
|
17645
|
+
}
|
|
17646
|
+
// nothing to listen if template field is not учшые (edit invoice case)
|
|
17647
|
+
if (this.contains('template')) {
|
|
17648
|
+
this.listenTemplateChanges();
|
|
17649
|
+
}
|
|
17471
17650
|
};
|
|
17472
17651
|
SoleInvoiceForm.prototype.addItem = function () {
|
|
17473
|
-
|
|
17652
|
+
var itemForm = new SoleInvoiceItemForm(classTransformer.plainToClass(SoleInvoiceItem, {}));
|
|
17653
|
+
// no need to listen items chart accounts changes when soleDetails.isGST === false
|
|
17654
|
+
// because invoice tax type always 'No Tax' in this case and not available for changing
|
|
17655
|
+
if (this.soleDetailsGST) {
|
|
17656
|
+
this.listenItemChartAccountsChanges(itemForm);
|
|
17657
|
+
}
|
|
17658
|
+
this.items.push(itemForm);
|
|
17474
17659
|
};
|
|
17475
17660
|
SoleInvoiceForm.prototype.removeItem = function (index) {
|
|
17476
|
-
// do not remove the last item
|
|
17477
|
-
if (this.items.length === 1) {
|
|
17478
|
-
return;
|
|
17479
|
-
}
|
|
17480
17661
|
this.items.removeAt(index);
|
|
17481
17662
|
};
|
|
17482
17663
|
SoleInvoiceForm.prototype.submit = function (data) {
|
|
17483
17664
|
if (data === void 0) { data = {}; }
|
|
17665
|
+
// @TODO Alex TT-2190: move child custom forms submit to Abstract Form
|
|
17484
17666
|
var items = this.items.controls.map(function (control) { return control.submit(); });
|
|
17485
|
-
return _super.prototype.submit.call(this,
|
|
17667
|
+
return _super.prototype.submit.call(this, merge__default["default"](data, { items: items }));
|
|
17486
17668
|
};
|
|
17669
|
+
/**
|
|
17670
|
+
* Update default values from selected invoice template
|
|
17671
|
+
*/
|
|
17487
17672
|
SoleInvoiceForm.prototype.listenTemplateChanges = function () {
|
|
17488
17673
|
var _this = this;
|
|
17489
17674
|
this.get('template').valueChanges.subscribe(function (template) {
|
|
17490
|
-
_this.
|
|
17675
|
+
_this.get('bankAccount').setValue(template.bankAccount);
|
|
17676
|
+
var dateFrom = _this.get('dateFrom').value;
|
|
17677
|
+
if (dateFrom) {
|
|
17678
|
+
_this.get('dateTo').setValue(new Date(dateFrom.getTime() + template.termTime));
|
|
17679
|
+
}
|
|
17680
|
+
// invoice.taxType is always 'No Tax' when soleDetails.isGST = false and not available for changing
|
|
17681
|
+
if (_this.soleDetailsGST) {
|
|
17682
|
+
_this.get('taxType').setValue(template.taxType);
|
|
17683
|
+
}
|
|
17684
|
+
});
|
|
17685
|
+
};
|
|
17686
|
+
/**
|
|
17687
|
+
* GST is not available for items when invoice.taxType === NONE
|
|
17688
|
+
*/
|
|
17689
|
+
SoleInvoiceForm.prototype.listenTaxTypeChanges = function () {
|
|
17690
|
+
var _this = this;
|
|
17691
|
+
this.get('taxType').valueChanges.subscribe(function (type) {
|
|
17692
|
+
_this.items.controls.forEach(function (itemForm) {
|
|
17693
|
+
var chartAccounts = itemForm.get('chartAccounts').value;
|
|
17694
|
+
// Item GST is available when invoice.taxType !== NONE ('No Tax')
|
|
17695
|
+
if (type !== exports.SoleInvoiceTaxTypeEnum.NO_TAX && (chartAccounts === null || chartAccounts === void 0 ? void 0 : chartAccounts.isGST)) {
|
|
17696
|
+
_this.enableItemGST(itemForm);
|
|
17697
|
+
return;
|
|
17698
|
+
}
|
|
17699
|
+
_this.disableItemGST(itemForm);
|
|
17700
|
+
});
|
|
17491
17701
|
});
|
|
17492
17702
|
};
|
|
17493
|
-
|
|
17494
|
-
|
|
17495
|
-
|
|
17703
|
+
/**
|
|
17704
|
+
* GST availability depends of chart accounts isGST flag
|
|
17705
|
+
*/
|
|
17706
|
+
SoleInvoiceForm.prototype.listenItemChartAccountsChanges = function (itemForm) {
|
|
17707
|
+
var _this = this;
|
|
17708
|
+
itemForm.get('chartAccounts').valueChanges.subscribe(function (chartAccounts) {
|
|
17709
|
+
// item.isGST is available only when item.chartAccounts.isGST === true, soleDetails.isGST === true and invoice.taxType !== NONE ('No Tax')
|
|
17710
|
+
if (_this.soleDetailsGST && chartAccounts.isGST && !_this.currentValue.isNoTax()) {
|
|
17711
|
+
_this.enableItemGST(itemForm);
|
|
17712
|
+
return;
|
|
17713
|
+
}
|
|
17714
|
+
_this.disableItemGST(itemForm);
|
|
17496
17715
|
});
|
|
17497
17716
|
};
|
|
17717
|
+
SoleInvoiceForm.prototype.disableItemGST = function (itemForm) {
|
|
17718
|
+
itemForm.get('isGST').setValue(false);
|
|
17719
|
+
itemForm.get('isGST').disable();
|
|
17720
|
+
};
|
|
17721
|
+
/**
|
|
17722
|
+
* Enable GST field for passed item form. Value is always true by default because only case when this field is enabled is
|
|
17723
|
+
* when ChartAccounts.isGST === true, so we just use default value from chartAccounts.isGST
|
|
17724
|
+
*/
|
|
17725
|
+
SoleInvoiceForm.prototype.enableItemGST = function (itemForm) {
|
|
17726
|
+
itemForm.get('isGST').setValue(true);
|
|
17727
|
+
itemForm.get('isGST').enable();
|
|
17728
|
+
};
|
|
17498
17729
|
return SoleInvoiceForm;
|
|
17499
17730
|
}(AbstractForm));
|
|
17500
17731
|
|
|
17501
17732
|
var SoleInvoiceTemplateForm = /** @class */ (function (_super) {
|
|
17502
17733
|
__extends(SoleInvoiceTemplateForm, _super);
|
|
17503
|
-
function SoleInvoiceTemplateForm(invoiceTemplate
|
|
17504
|
-
|
|
17734
|
+
function SoleInvoiceTemplateForm(invoiceTemplate) {
|
|
17735
|
+
return _super.call(this, {
|
|
17505
17736
|
name: new forms.FormControl(invoiceTemplate.name, forms.Validators.required),
|
|
17506
|
-
// taxType always 'No Tax' when
|
|
17507
|
-
taxType: new forms.FormControl(
|
|
17737
|
+
// taxType is always 'No Tax' when soleDetails.isGST === false
|
|
17738
|
+
taxType: new forms.FormControl(invoiceTemplate.taxType, forms.Validators.required),
|
|
17508
17739
|
term: new forms.FormControl(invoiceTemplate.term, [forms.Validators.required, forms.Validators.min(0)]),
|
|
17509
17740
|
bankAccount: new forms.FormControl(invoiceTemplate.bankAccount, [forms.Validators.required])
|
|
17510
17741
|
}, invoiceTemplate) || this;
|
|
17511
|
-
_this.soleDetails = soleDetails;
|
|
17512
|
-
return _this;
|
|
17513
17742
|
}
|
|
17514
17743
|
return SoleInvoiceTemplateForm;
|
|
17515
17744
|
}(AbstractForm));
|
|
17516
17745
|
|
|
17517
17746
|
var BankAccountAllocationForm = /** @class */ (function (_super) {
|
|
17518
17747
|
__extends(BankAccountAllocationForm, _super);
|
|
17519
|
-
function BankAccountAllocationForm(bankAccount) {
|
|
17520
|
-
var _this = _super.call(this, {
|
|
17748
|
+
function BankAccountAllocationForm(bankAccount, controls) {
|
|
17749
|
+
var _this = _super.call(this, merge__default["default"](controls, {
|
|
17521
17750
|
tankType: new forms.FormControl(bankAccount ? bankAccount.tankType : null, forms.Validators.required)
|
|
17522
|
-
}, classTransformer.plainToClass(BankAccount, bankAccount || {})) || this;
|
|
17751
|
+
}), classTransformer.plainToClass(BankAccount, bankAccount || {})) || this;
|
|
17523
17752
|
_this.bankAccount = bankAccount;
|
|
17524
17753
|
if (bankAccount === null || bankAccount === void 0 ? void 0 : bankAccount.isPropertyTank()) {
|
|
17525
17754
|
_this.addControl('bankAccountProperties', new BankAccountPropertiesForm(bankAccount.bankAccountProperties));
|
|
@@ -17579,15 +17808,19 @@
|
|
|
17579
17808
|
var BankAccountAddManualForm = /** @class */ (function (_super) {
|
|
17580
17809
|
__extends(BankAccountAddManualForm, _super);
|
|
17581
17810
|
function BankAccountAddManualForm(connection) {
|
|
17582
|
-
var _this = _super.call(this
|
|
17811
|
+
var _this = _super.call(this, null, {
|
|
17812
|
+
type: new forms.FormControl(null, forms.Validators.required),
|
|
17813
|
+
accountName: new forms.FormControl(null, forms.Validators.required),
|
|
17814
|
+
currentBalance: new forms.FormControl(null, forms.Validators.required),
|
|
17815
|
+
accountNumber: new forms.FormControl(null, [forms.Validators.required, forms.Validators.pattern(BankAccountAddManualForm.accountNumberPattern)])
|
|
17816
|
+
}) || this;
|
|
17583
17817
|
_this.connection = connection;
|
|
17584
|
-
_this.addControl('type', new forms.FormControl(null, forms.Validators.required));
|
|
17585
|
-
_this.addControl('accountName', new forms.FormControl(null, forms.Validators.required));
|
|
17586
|
-
_this.addControl('currentBalance', new forms.FormControl(null, forms.Validators.required));
|
|
17587
|
-
_this.addControl('accountNumber', new forms.FormControl(null, [forms.Validators.required, forms.Validators.pattern(BankAccountAddManualForm.accountNumberPattern)]));
|
|
17588
|
-
_this.listenTypeChanges();
|
|
17589
17818
|
return _this;
|
|
17590
17819
|
}
|
|
17820
|
+
BankAccountAddManualForm.prototype.listenEvents = function () {
|
|
17821
|
+
_super.prototype.listenEvents.call(this);
|
|
17822
|
+
this.listenTypeChanges();
|
|
17823
|
+
};
|
|
17591
17824
|
/**
|
|
17592
17825
|
* Add/Remove loan form depends on selected bank account type
|
|
17593
17826
|
*/
|
|
@@ -18664,6 +18897,7 @@
|
|
|
18664
18897
|
exports.Document = Document;
|
|
18665
18898
|
exports.DocumentFolder = DocumentFolder;
|
|
18666
18899
|
exports.DocumentFolderService = DocumentFolderService;
|
|
18900
|
+
exports.DocumentService = DocumentService;
|
|
18667
18901
|
exports.ENDPOINTS = ENDPOINTS;
|
|
18668
18902
|
exports.EmployeeCollection = EmployeeCollection;
|
|
18669
18903
|
exports.EmployeeDetails = EmployeeDetails;
|