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