taxtank-core 0.28.10 → 0.28.11

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.
@@ -4544,7 +4544,7 @@
4544
4544
  */
4545
4545
  Depreciation.prototype.toTransaction = function (params) {
4546
4546
  if (params === void 0) { params = {}; }
4547
- return classTransformer.plainToClass(Transaction, Object.assign(params, this, { amount: this.currentYearForecast.amount }));
4547
+ return classTransformer.plainToClass(Transaction, Object.assign(params, this, { amount: -this.claimAmount, claimAmount: -this.amount * (this.claimPercent / 100) }));
4548
4548
  };
4549
4549
  Object.defineProperty(Depreciation.prototype, "claimAmount", {
4550
4550
  /**
@@ -7015,6 +7015,31 @@
7015
7015
  return ClientPortfolioReportCollection;
7016
7016
  }(Collection));
7017
7017
 
7018
+ /**
7019
+ * Chart serie class: chart data item
7020
+ * @TODO consider rename to ChartSerieData
7021
+ */
7022
+ var ChartSerie = /** @class */ (function () {
7023
+ function ChartSerie() {
7024
+ }
7025
+ return ChartSerie;
7026
+ }());
7027
+
7028
+ /**
7029
+ * Chart data class
7030
+ * @TODO consider rename to ChartSerie
7031
+ */
7032
+ var ChartData = /** @class */ (function () {
7033
+ function ChartData() {
7034
+ }
7035
+ return ChartData;
7036
+ }());
7037
+ __decorate([
7038
+ classTransformer.Type(function () { return ChartSerie; })
7039
+ ], ChartData.prototype, "data", void 0);
7040
+
7041
+ var MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan'];
7042
+
7018
7043
  /**
7019
7044
  * Collection of transactions
7020
7045
  */
@@ -7231,6 +7256,29 @@
7231
7256
  .getVehicleTransactions()
7232
7257
  .removeBy('chartAccounts.id', [exports.ChartAccountsListEnum.KLMS_TRAVELLED_FOR_WORK, exports.ChartAccountsListEnum.KLMS_TRAVELLED]);
7233
7258
  };
7259
+ /**
7260
+ * Build chart data with transactions cash position.
7261
+ * Cash position = Income - Expenses (include depreciations)
7262
+ * Chart data for each month from fin year start till current month
7263
+ */
7264
+ TransactionCollection.prototype.getCashPositionChartData = function () {
7265
+ var _this = this;
7266
+ var chartData = [
7267
+ classTransformer.plainToClass(ChartData, { name: 'Income', data: [] }),
7268
+ classTransformer.plainToClass(ChartData, { name: 'Expense', data: [] })
7269
+ ];
7270
+ new FinancialYear().getPastMonths().forEach(function (month) {
7271
+ chartData[0].data.push({
7272
+ label: MONTHS[month],
7273
+ value: _this.getIncomeTransactions().getByMonth(month).claimAmount
7274
+ });
7275
+ chartData[1].data.push({
7276
+ label: MONTHS[month],
7277
+ value: Math.abs(_this.getExpenseTransactions().getByMonth(month).claimAmount)
7278
+ });
7279
+ });
7280
+ return chartData;
7281
+ };
7234
7282
  return TransactionCollection;
7235
7283
  }(ExportableCollection));
7236
7284
 
@@ -9147,29 +9195,6 @@
9147
9195
  return BorrowingExpenseLoan;
9148
9196
  }(BorrowingExpenseLoan$1));
9149
9197
 
9150
- /**
9151
- * Chart serie class: chart data item
9152
- * @TODO consider rename to ChartSerieData
9153
- */
9154
- var ChartSerie = /** @class */ (function () {
9155
- function ChartSerie() {
9156
- }
9157
- return ChartSerie;
9158
- }());
9159
-
9160
- /**
9161
- * Chart data class
9162
- * @TODO consider rename to ChartSerie
9163
- */
9164
- var ChartData = /** @class */ (function () {
9165
- function ChartData() {
9166
- }
9167
- return ChartData;
9168
- }());
9169
- __decorate([
9170
- classTransformer.Type(function () { return ChartSerie; })
9171
- ], ChartData.prototype, "data", void 0);
9172
-
9173
9198
  var ChartAccountsDepreciation$1 = /** @class */ (function (_super) {
9174
9199
  __extends(ChartAccountsDepreciation, _super);
9175
9200
  function ChartAccountsDepreciation() {
@@ -9842,8 +9867,6 @@
9842
9867
  IconsFileEnum["DOC"] = "icon-doc";
9843
9868
  })(exports.IconsFileEnum || (exports.IconsFileEnum = {}));
9844
9869
 
9845
- var MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan'];
9846
-
9847
9870
  // Todo extend from the base model when the backend is ready TT-555
9848
9871
  var IncomePosition = /** @class */ (function () {
9849
9872
  function IncomePosition() {