taxtank-core 0.4.1 → 0.5.3
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 +307 -156
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/depreciation.collection.js +8 -1
- package/esm2015/lib/collections/income-source.collection.js +1 -1
- package/esm2015/lib/collections/transaction.collection.js +4 -1
- package/esm2015/lib/db/Enums/chart-accounts-category.enum.js +4 -1
- package/esm2015/lib/db/Enums/income-source-type.enum.js +2 -1
- package/esm2015/lib/db/Enums/tank-type.enum.js +2 -1
- package/esm2015/lib/db/Models/income-source.js +1 -1
- package/esm2015/lib/db/Models/sole-forecast.js +3 -0
- package/esm2015/lib/interfaces/income-source-forecast.interface.js +1 -1
- package/esm2015/lib/models/depreciation/depreciation.js +9 -2
- package/esm2015/lib/models/income-source/income-source-forecast.js +1 -1
- package/esm2015/lib/models/income-source/income-source-type.js +6 -1
- package/esm2015/lib/models/income-source/income-source.js +9 -2
- package/esm2015/lib/models/income-source/salary-forecast.js +1 -1
- package/esm2015/lib/models/income-source/sole-forecast.js +14 -0
- package/esm2015/lib/models/pdf/pdf-config.js +3 -3
- package/esm2015/lib/services/income-source/sole-forecast.service.js +87 -0
- package/esm2015/lib/services/pdf/pdf.service.js +12 -6
- package/esm2015/public-api.js +3 -2
- package/fesm2015/taxtank-core.js +254 -128
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/depreciation.collection.d.ts +5 -0
- package/lib/collections/income-source.collection.d.ts +2 -2
- package/lib/collections/transaction.collection.d.ts +1 -0
- package/lib/db/Enums/chart-accounts-category.enum.d.ts +4 -1
- package/lib/db/Enums/income-source-type.enum.d.ts +2 -1
- package/lib/db/Enums/tank-type.enum.d.ts +2 -1
- package/lib/db/Models/income-source.d.ts +2 -0
- package/lib/db/Models/sole-forecast.d.ts +8 -0
- package/lib/interfaces/income-source-forecast.interface.d.ts +5 -2
- package/lib/models/depreciation/depreciation.d.ts +5 -0
- package/lib/models/income-source/income-source-forecast.d.ts +1 -5
- package/lib/models/income-source/income-source-type.d.ts +1 -0
- package/lib/models/income-source/income-source.d.ts +4 -2
- package/lib/models/income-source/salary-forecast.d.ts +1 -10
- package/lib/models/income-source/sole-forecast.d.ts +7 -0
- package/lib/services/income-source/sole-forecast.service.d.ts +33 -0
- package/lib/services/pdf/pdf.service.d.ts +1 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -1
- package/esm2015/lib/interfaces/salary-forecast.interface.js +0 -2
- package/lib/interfaces/salary-forecast.interface.d.ts +0 -16
|
@@ -1760,8 +1760,164 @@
|
|
|
1760
1760
|
TankTypeEnum[TankTypeEnum["PROPERTY"] = 1] = "PROPERTY";
|
|
1761
1761
|
TankTypeEnum[TankTypeEnum["WORK"] = 2] = "WORK";
|
|
1762
1762
|
TankTypeEnum[TankTypeEnum["OTHER"] = 3] = "OTHER";
|
|
1763
|
+
TankTypeEnum[TankTypeEnum["SOLE"] = 4] = "SOLE";
|
|
1763
1764
|
})(exports.TankTypeEnum || (exports.TankTypeEnum = {}));
|
|
1764
1765
|
|
|
1766
|
+
/**
|
|
1767
|
+
* Collection of transactions
|
|
1768
|
+
*/
|
|
1769
|
+
var TransactionCollection = /** @class */ (function (_super) {
|
|
1770
|
+
__extends(TransactionCollection, _super);
|
|
1771
|
+
function TransactionCollection() {
|
|
1772
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
1773
|
+
}
|
|
1774
|
+
Object.defineProperty(TransactionCollection.prototype, "amount", {
|
|
1775
|
+
/**
|
|
1776
|
+
* Get total amount of all transactions in the collection
|
|
1777
|
+
*/
|
|
1778
|
+
get: function () {
|
|
1779
|
+
return +this.items.reduce(function (sum, transaction) { return sum + transaction.getNetAmount(); }, 0).toFixed(2);
|
|
1780
|
+
},
|
|
1781
|
+
enumerable: false,
|
|
1782
|
+
configurable: true
|
|
1783
|
+
});
|
|
1784
|
+
/**
|
|
1785
|
+
* Difference between allocated amount and total amount
|
|
1786
|
+
*/
|
|
1787
|
+
TransactionCollection.prototype.getUnallocatedAmount = function (allocations) {
|
|
1788
|
+
return +(this.amount - allocations.getByTransactionsIds(this.getIds()).amount).toFixed(2);
|
|
1789
|
+
};
|
|
1790
|
+
Object.defineProperty(TransactionCollection.prototype, "cashPosition", {
|
|
1791
|
+
/**
|
|
1792
|
+
* Get cash position
|
|
1793
|
+
* Cash Position = Income - Expenses
|
|
1794
|
+
* Cash position is equal to Total Amount because income is positive and expense is negative,
|
|
1795
|
+
*/
|
|
1796
|
+
get: function () {
|
|
1797
|
+
return this.claimAmount;
|
|
1798
|
+
},
|
|
1799
|
+
enumerable: false,
|
|
1800
|
+
configurable: true
|
|
1801
|
+
});
|
|
1802
|
+
/**
|
|
1803
|
+
* Get new collection of transactions filtered by tank type
|
|
1804
|
+
* @param tankType
|
|
1805
|
+
*/
|
|
1806
|
+
TransactionCollection.prototype.getByTankType = function (tankType) {
|
|
1807
|
+
return new TransactionCollection(this.items.filter(function (transaction) { return transaction.tankType === tankType; }));
|
|
1808
|
+
};
|
|
1809
|
+
/**
|
|
1810
|
+
* get date of the last transaction
|
|
1811
|
+
*/
|
|
1812
|
+
TransactionCollection.prototype.getLastTransactionDate = function () {
|
|
1813
|
+
return new Date(Math.max.apply(Math, this.items.map(function (transaction) { return transaction.date; })));
|
|
1814
|
+
};
|
|
1815
|
+
Object.defineProperty(TransactionCollection.prototype, "claimAmount", {
|
|
1816
|
+
/**
|
|
1817
|
+
* Get summary of claim amounts
|
|
1818
|
+
*/
|
|
1819
|
+
get: function () {
|
|
1820
|
+
return this.items.reduce(function (sum, transaction) { return sum + transaction.claimAmount; }, 0);
|
|
1821
|
+
},
|
|
1822
|
+
enumerable: false,
|
|
1823
|
+
configurable: true
|
|
1824
|
+
});
|
|
1825
|
+
Object.defineProperty(TransactionCollection.prototype, "grossAmount", {
|
|
1826
|
+
get: function () {
|
|
1827
|
+
return +this.items.reduce(function (sum, transaction) { return sum + transaction.amount; }, 0).toFixed(2);
|
|
1828
|
+
},
|
|
1829
|
+
enumerable: false,
|
|
1830
|
+
configurable: true
|
|
1831
|
+
});
|
|
1832
|
+
TransactionCollection.prototype.getByCategories = function (categories) {
|
|
1833
|
+
return new TransactionCollection(this.items.filter(function (transaction) { return categories.includes(transaction.chartAccounts.category); }));
|
|
1834
|
+
};
|
|
1835
|
+
/**
|
|
1836
|
+
* Get transactions by month
|
|
1837
|
+
* @param monthIndex by which desired month should be taken
|
|
1838
|
+
*/
|
|
1839
|
+
TransactionCollection.prototype.getByMonth = function (monthIndex) {
|
|
1840
|
+
return new TransactionCollection(this.items.filter(function (transaction) { return transaction.date.getMonth() === monthIndex; }));
|
|
1841
|
+
};
|
|
1842
|
+
/**
|
|
1843
|
+
* get list of transactions filtered by chart accounts id
|
|
1844
|
+
* @param chartAccountsId chart accounts id for filtering
|
|
1845
|
+
*/
|
|
1846
|
+
TransactionCollection.prototype.getByChartAccountsId = function (chartAccountsId) {
|
|
1847
|
+
return this.items.filter(function (transaction) { return transaction.chartAccounts.id === chartAccountsId; });
|
|
1848
|
+
};
|
|
1849
|
+
TransactionCollection.prototype.getIncomeTransactions = function () {
|
|
1850
|
+
return new TransactionCollection(this.items.filter(function (transaction) { return transaction.isIncome(); }));
|
|
1851
|
+
};
|
|
1852
|
+
Object.defineProperty(TransactionCollection.prototype, "claimIncome", {
|
|
1853
|
+
get: function () {
|
|
1854
|
+
return this.getIncomeTransactions().claimAmount;
|
|
1855
|
+
},
|
|
1856
|
+
enumerable: false,
|
|
1857
|
+
configurable: true
|
|
1858
|
+
});
|
|
1859
|
+
TransactionCollection.prototype.getExpenseTransactions = function () {
|
|
1860
|
+
return new TransactionCollection(this.items.filter(function (transaction) { return transaction.isExpense() && !transaction.isInterest(); }));
|
|
1861
|
+
};
|
|
1862
|
+
Object.defineProperty(TransactionCollection.prototype, "claimExpense", {
|
|
1863
|
+
get: function () {
|
|
1864
|
+
return this.getExpenseTransactions().claimAmount;
|
|
1865
|
+
},
|
|
1866
|
+
enumerable: false,
|
|
1867
|
+
configurable: true
|
|
1868
|
+
});
|
|
1869
|
+
TransactionCollection.prototype.getInterestTransactions = function () {
|
|
1870
|
+
return new TransactionCollection(this.items.filter(function (transaction) { return transaction.isInterest(); }));
|
|
1871
|
+
};
|
|
1872
|
+
Object.defineProperty(TransactionCollection.prototype, "claimInterest", {
|
|
1873
|
+
get: function () {
|
|
1874
|
+
return this.getInterestTransactions().claimAmount;
|
|
1875
|
+
},
|
|
1876
|
+
enumerable: false,
|
|
1877
|
+
configurable: true
|
|
1878
|
+
});
|
|
1879
|
+
/**
|
|
1880
|
+
* Get collection of transactions and properties filtered by properties ids
|
|
1881
|
+
* @param ids Ids of properties for filter
|
|
1882
|
+
*/
|
|
1883
|
+
TransactionCollection.prototype.getByPropertiesIds = function (ids) {
|
|
1884
|
+
return new TransactionCollection(this.items.filter(function (transaction) {
|
|
1885
|
+
var _a;
|
|
1886
|
+
return ids.includes((_a = transaction.property) === null || _a === void 0 ? void 0 : _a.id);
|
|
1887
|
+
}));
|
|
1888
|
+
};
|
|
1889
|
+
/**
|
|
1890
|
+
* Get new collection filtered by income source id
|
|
1891
|
+
* @param id id of income source for filter
|
|
1892
|
+
*/
|
|
1893
|
+
TransactionCollection.prototype.getByIncomeSourceId = function (id) {
|
|
1894
|
+
return new TransactionCollection(this.items.filter(function (transaction) { var _a; return ((_a = transaction.incomeSource) === null || _a === void 0 ? void 0 : _a.id) === id; }));
|
|
1895
|
+
};
|
|
1896
|
+
/**
|
|
1897
|
+
* Get new collection filtered by chart accounts category
|
|
1898
|
+
* @param category Chart accounts category value
|
|
1899
|
+
*/
|
|
1900
|
+
TransactionCollection.prototype.getByChartAccountsCategory = function (category) {
|
|
1901
|
+
return new TransactionCollection(this.items.filter(function (transaction) { return transaction.chartAccounts.category === category; }));
|
|
1902
|
+
};
|
|
1903
|
+
/**
|
|
1904
|
+
* Get new collection of property transactions
|
|
1905
|
+
*/
|
|
1906
|
+
TransactionCollection.prototype.getPropertyTransactions = function () {
|
|
1907
|
+
return new TransactionCollection(this.items.filter(function (transaction) { return transaction.isPropertyTank(); }));
|
|
1908
|
+
};
|
|
1909
|
+
TransactionCollection.prototype.getDebitTransactions = function () {
|
|
1910
|
+
return new TransactionCollection(this.items.filter(function (transaction) { return transaction.isDebit(); }));
|
|
1911
|
+
};
|
|
1912
|
+
TransactionCollection.prototype.getCreditTransactions = function () {
|
|
1913
|
+
return new TransactionCollection(this.items.filter(function (transaction) { return transaction.isCredit(); }));
|
|
1914
|
+
};
|
|
1915
|
+
TransactionCollection.prototype.getByAllocations = function (allocations) {
|
|
1916
|
+
return new TransactionCollection(this.items.filter(function (transaction) { return allocations.hasTransaction(transaction); }));
|
|
1917
|
+
};
|
|
1918
|
+
return TransactionCollection;
|
|
1919
|
+
}(Collection));
|
|
1920
|
+
|
|
1765
1921
|
var DepreciationCollection = /** @class */ (function (_super) {
|
|
1766
1922
|
__extends(DepreciationCollection, _super);
|
|
1767
1923
|
function DepreciationCollection() {
|
|
@@ -1844,6 +2000,12 @@
|
|
|
1844
2000
|
return depreciation.depreciationCapitalProject;
|
|
1845
2001
|
})), 'id');
|
|
1846
2002
|
};
|
|
2003
|
+
/**
|
|
2004
|
+
* Create TransactionCollection from depreciation items
|
|
2005
|
+
*/
|
|
2006
|
+
DepreciationCollection.prototype.toTransactions = function () {
|
|
2007
|
+
return new TransactionCollection(this.items.map(function (item) { return item.toTransaction(); }));
|
|
2008
|
+
};
|
|
1847
2009
|
return DepreciationCollection;
|
|
1848
2010
|
}(Collection));
|
|
1849
2011
|
|
|
@@ -2683,154 +2845,6 @@
|
|
|
2683
2845
|
return TransactionAllocationCollection;
|
|
2684
2846
|
}(Collection));
|
|
2685
2847
|
|
|
2686
|
-
/**
|
|
2687
|
-
* Collection of transactions
|
|
2688
|
-
*/
|
|
2689
|
-
var TransactionCollection = /** @class */ (function (_super) {
|
|
2690
|
-
__extends(TransactionCollection, _super);
|
|
2691
|
-
function TransactionCollection() {
|
|
2692
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
2693
|
-
}
|
|
2694
|
-
Object.defineProperty(TransactionCollection.prototype, "amount", {
|
|
2695
|
-
/**
|
|
2696
|
-
* Get total amount of all transactions in the collection
|
|
2697
|
-
*/
|
|
2698
|
-
get: function () {
|
|
2699
|
-
return +this.items.reduce(function (sum, transaction) { return sum + transaction.getNetAmount(); }, 0).toFixed(2);
|
|
2700
|
-
},
|
|
2701
|
-
enumerable: false,
|
|
2702
|
-
configurable: true
|
|
2703
|
-
});
|
|
2704
|
-
/**
|
|
2705
|
-
* Difference between allocated amount and total amount
|
|
2706
|
-
*/
|
|
2707
|
-
TransactionCollection.prototype.getUnallocatedAmount = function (allocations) {
|
|
2708
|
-
return +(this.amount - allocations.getByTransactionsIds(this.getIds()).amount).toFixed(2);
|
|
2709
|
-
};
|
|
2710
|
-
Object.defineProperty(TransactionCollection.prototype, "cashPosition", {
|
|
2711
|
-
/**
|
|
2712
|
-
* Get cash position
|
|
2713
|
-
* Cash Position = Income - Expenses
|
|
2714
|
-
* Cash position is equal to Total Amount because income is positive and expense is negative,
|
|
2715
|
-
*/
|
|
2716
|
-
get: function () {
|
|
2717
|
-
return this.claimAmount;
|
|
2718
|
-
},
|
|
2719
|
-
enumerable: false,
|
|
2720
|
-
configurable: true
|
|
2721
|
-
});
|
|
2722
|
-
/**
|
|
2723
|
-
* Get new collection of transactions filtered by tank type
|
|
2724
|
-
* @param tankType
|
|
2725
|
-
*/
|
|
2726
|
-
TransactionCollection.prototype.getByTankType = function (tankType) {
|
|
2727
|
-
return new TransactionCollection(this.items.filter(function (transaction) { return transaction.tankType === tankType; }));
|
|
2728
|
-
};
|
|
2729
|
-
/**
|
|
2730
|
-
* get date of the last transaction
|
|
2731
|
-
*/
|
|
2732
|
-
TransactionCollection.prototype.getLastTransactionDate = function () {
|
|
2733
|
-
return new Date(Math.max.apply(Math, this.items.map(function (transaction) { return transaction.date; })));
|
|
2734
|
-
};
|
|
2735
|
-
Object.defineProperty(TransactionCollection.prototype, "claimAmount", {
|
|
2736
|
-
/**
|
|
2737
|
-
* Get summary of claim amounts
|
|
2738
|
-
*/
|
|
2739
|
-
get: function () {
|
|
2740
|
-
return this.items.reduce(function (sum, transaction) { return sum + transaction.claimAmount; }, 0);
|
|
2741
|
-
},
|
|
2742
|
-
enumerable: false,
|
|
2743
|
-
configurable: true
|
|
2744
|
-
});
|
|
2745
|
-
TransactionCollection.prototype.getByCategories = function (categories) {
|
|
2746
|
-
return new TransactionCollection(this.items.filter(function (transaction) { return categories.includes(transaction.chartAccounts.category); }));
|
|
2747
|
-
};
|
|
2748
|
-
/**
|
|
2749
|
-
* Get transactions by month
|
|
2750
|
-
* @param monthIndex by which desired month should be taken
|
|
2751
|
-
*/
|
|
2752
|
-
TransactionCollection.prototype.getByMonth = function (monthIndex) {
|
|
2753
|
-
return new TransactionCollection(this.items.filter(function (transaction) { return transaction.date.getMonth() === monthIndex; }));
|
|
2754
|
-
};
|
|
2755
|
-
/**
|
|
2756
|
-
* get list of transactions filtered by chart accounts id
|
|
2757
|
-
* @param chartAccountsId chart accounts id for filtering
|
|
2758
|
-
*/
|
|
2759
|
-
TransactionCollection.prototype.getByChartAccountsId = function (chartAccountsId) {
|
|
2760
|
-
return this.items.filter(function (transaction) { return transaction.chartAccounts.id === chartAccountsId; });
|
|
2761
|
-
};
|
|
2762
|
-
TransactionCollection.prototype.getIncomeTransactions = function () {
|
|
2763
|
-
return new TransactionCollection(this.items.filter(function (transaction) { return transaction.isIncome(); }));
|
|
2764
|
-
};
|
|
2765
|
-
Object.defineProperty(TransactionCollection.prototype, "claimIncome", {
|
|
2766
|
-
get: function () {
|
|
2767
|
-
return this.getIncomeTransactions().claimAmount;
|
|
2768
|
-
},
|
|
2769
|
-
enumerable: false,
|
|
2770
|
-
configurable: true
|
|
2771
|
-
});
|
|
2772
|
-
TransactionCollection.prototype.getExpenseTransactions = function () {
|
|
2773
|
-
return new TransactionCollection(this.items.filter(function (transaction) { return transaction.isExpense() && !transaction.isInterest(); }));
|
|
2774
|
-
};
|
|
2775
|
-
Object.defineProperty(TransactionCollection.prototype, "claimExpense", {
|
|
2776
|
-
get: function () {
|
|
2777
|
-
return this.getExpenseTransactions().claimAmount;
|
|
2778
|
-
},
|
|
2779
|
-
enumerable: false,
|
|
2780
|
-
configurable: true
|
|
2781
|
-
});
|
|
2782
|
-
TransactionCollection.prototype.getInterestTransactions = function () {
|
|
2783
|
-
return new TransactionCollection(this.items.filter(function (transaction) { return transaction.isInterest(); }));
|
|
2784
|
-
};
|
|
2785
|
-
Object.defineProperty(TransactionCollection.prototype, "claimInterest", {
|
|
2786
|
-
get: function () {
|
|
2787
|
-
return this.getInterestTransactions().claimAmount;
|
|
2788
|
-
},
|
|
2789
|
-
enumerable: false,
|
|
2790
|
-
configurable: true
|
|
2791
|
-
});
|
|
2792
|
-
/**
|
|
2793
|
-
* Get collection of transactions and properties filtered by properties ids
|
|
2794
|
-
* @param ids Ids of properties for filter
|
|
2795
|
-
*/
|
|
2796
|
-
TransactionCollection.prototype.getByPropertiesIds = function (ids) {
|
|
2797
|
-
return new TransactionCollection(this.items.filter(function (transaction) {
|
|
2798
|
-
var _a;
|
|
2799
|
-
return ids.includes((_a = transaction.property) === null || _a === void 0 ? void 0 : _a.id);
|
|
2800
|
-
}));
|
|
2801
|
-
};
|
|
2802
|
-
/**
|
|
2803
|
-
* Get new collection filtered by income source id
|
|
2804
|
-
* @param id id of income source for filter
|
|
2805
|
-
*/
|
|
2806
|
-
TransactionCollection.prototype.getByIncomeSourceId = function (id) {
|
|
2807
|
-
return new TransactionCollection(this.items.filter(function (transaction) { var _a; return ((_a = transaction.incomeSource) === null || _a === void 0 ? void 0 : _a.id) === id; }));
|
|
2808
|
-
};
|
|
2809
|
-
/**
|
|
2810
|
-
* Get new collection filtered by chart accounts category
|
|
2811
|
-
* @param category Chart accounts category value
|
|
2812
|
-
*/
|
|
2813
|
-
TransactionCollection.prototype.getByChartAccountsCategory = function (category) {
|
|
2814
|
-
return new TransactionCollection(this.items.filter(function (transaction) { return transaction.chartAccounts.category === category; }));
|
|
2815
|
-
};
|
|
2816
|
-
/**
|
|
2817
|
-
* Get new collection of property transactions
|
|
2818
|
-
*/
|
|
2819
|
-
TransactionCollection.prototype.getPropertyTransactions = function () {
|
|
2820
|
-
return new TransactionCollection(this.items.filter(function (transaction) { return transaction.isPropertyTank(); }));
|
|
2821
|
-
};
|
|
2822
|
-
TransactionCollection.prototype.getDebitTransactions = function () {
|
|
2823
|
-
return new TransactionCollection(this.items.filter(function (transaction) { return transaction.isDebit(); }));
|
|
2824
|
-
};
|
|
2825
|
-
TransactionCollection.prototype.getCreditTransactions = function () {
|
|
2826
|
-
return new TransactionCollection(this.items.filter(function (transaction) { return transaction.isCredit(); }));
|
|
2827
|
-
};
|
|
2828
|
-
TransactionCollection.prototype.getByAllocations = function (allocations) {
|
|
2829
|
-
return new TransactionCollection(this.items.filter(function (transaction) { return allocations.hasTransaction(transaction); }));
|
|
2830
|
-
};
|
|
2831
|
-
return TransactionCollection;
|
|
2832
|
-
}(Collection));
|
|
2833
|
-
|
|
2834
2848
|
/**
|
|
2835
2849
|
* Collection of user event settings
|
|
2836
2850
|
*/
|
|
@@ -2858,6 +2872,9 @@
|
|
|
2858
2872
|
ChartAccountsCategoryEnum[ChartAccountsCategoryEnum["OTHER_EXPENSE"] = 9] = "OTHER_EXPENSE";
|
|
2859
2873
|
ChartAccountsCategoryEnum[ChartAccountsCategoryEnum["PERSONAL_INCOME"] = 10] = "PERSONAL_INCOME";
|
|
2860
2874
|
ChartAccountsCategoryEnum[ChartAccountsCategoryEnum["PERSONAL_EXPENSE"] = 11] = "PERSONAL_EXPENSE";
|
|
2875
|
+
ChartAccountsCategoryEnum[ChartAccountsCategoryEnum["SOLE_INCOME"] = 12] = "SOLE_INCOME";
|
|
2876
|
+
ChartAccountsCategoryEnum[ChartAccountsCategoryEnum["SOLE_EXPENSE"] = 13] = "SOLE_EXPENSE";
|
|
2877
|
+
ChartAccountsCategoryEnum[ChartAccountsCategoryEnum["SOLE_DEPRECIATION"] = 14] = "SOLE_DEPRECIATION";
|
|
2861
2878
|
})(exports.ChartAccountsCategoryEnum || (exports.ChartAccountsCategoryEnum = {}));
|
|
2862
2879
|
|
|
2863
2880
|
var CHART_ACCOUNTS_CATEGORIES = {
|
|
@@ -3145,6 +3162,7 @@
|
|
|
3145
3162
|
IncomeSourceTypeEnum[IncomeSourceTypeEnum["SALARY"] = 1] = "SALARY";
|
|
3146
3163
|
IncomeSourceTypeEnum[IncomeSourceTypeEnum["WORK"] = 2] = "WORK";
|
|
3147
3164
|
IncomeSourceTypeEnum[IncomeSourceTypeEnum["OTHER"] = 3] = "OTHER";
|
|
3165
|
+
IncomeSourceTypeEnum[IncomeSourceTypeEnum["SOLE"] = 4] = "SOLE";
|
|
3148
3166
|
})(exports.IncomeSourceTypeEnum || (exports.IncomeSourceTypeEnum = {}));
|
|
3149
3167
|
|
|
3150
3168
|
exports.IncomeSourceTypeListOtherEnum = void 0;
|
|
@@ -5112,6 +5130,31 @@
|
|
|
5112
5130
|
classTransformer.Type(function () { return IncomeSource; })
|
|
5113
5131
|
], SalaryForecast.prototype, "incomeSource", void 0);
|
|
5114
5132
|
|
|
5133
|
+
var SoleForecast$1 = /** @class */ (function () {
|
|
5134
|
+
function SoleForecast() {
|
|
5135
|
+
}
|
|
5136
|
+
return SoleForecast;
|
|
5137
|
+
}());
|
|
5138
|
+
|
|
5139
|
+
var SoleForecast = /** @class */ (function (_super) {
|
|
5140
|
+
__extends(SoleForecast, _super);
|
|
5141
|
+
function SoleForecast() {
|
|
5142
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
5143
|
+
}
|
|
5144
|
+
Object.defineProperty(SoleForecast.prototype, "netPay", {
|
|
5145
|
+
get: function () {
|
|
5146
|
+
return this.amount;
|
|
5147
|
+
},
|
|
5148
|
+
enumerable: false,
|
|
5149
|
+
configurable: true
|
|
5150
|
+
});
|
|
5151
|
+
;
|
|
5152
|
+
return SoleForecast;
|
|
5153
|
+
}(SoleForecast$1));
|
|
5154
|
+
__decorate([
|
|
5155
|
+
classTransformer.Type(function () { return IncomeSource; })
|
|
5156
|
+
], SoleForecast.prototype, "incomeSource", void 0);
|
|
5157
|
+
|
|
5115
5158
|
var IncomeSourceForecast$1 = /** @class */ (function () {
|
|
5116
5159
|
function IncomeSourceForecast() {
|
|
5117
5160
|
}
|
|
@@ -5138,6 +5181,9 @@
|
|
|
5138
5181
|
IncomeSourceType.prototype.isOther = function () {
|
|
5139
5182
|
return !!exports.IncomeSourceTypeListOtherEnum[this.id];
|
|
5140
5183
|
};
|
|
5184
|
+
IncomeSourceType.prototype.isSole = function () {
|
|
5185
|
+
return !!exports.IncomeSourceTypeListOtherEnum[this.id];
|
|
5186
|
+
};
|
|
5141
5187
|
Object.defineProperty(IncomeSourceType.prototype, "type", {
|
|
5142
5188
|
get: function () {
|
|
5143
5189
|
switch (true) {
|
|
@@ -5145,6 +5191,8 @@
|
|
|
5145
5191
|
return exports.IncomeSourceTypeEnum.SALARY;
|
|
5146
5192
|
case this.isWork():
|
|
5147
5193
|
return exports.IncomeSourceTypeEnum.WORK;
|
|
5194
|
+
case this.isSole():
|
|
5195
|
+
return exports.IncomeSourceTypeEnum.SOLE;
|
|
5148
5196
|
default:
|
|
5149
5197
|
return exports.IncomeSourceTypeEnum.OTHER;
|
|
5150
5198
|
}
|
|
@@ -5199,6 +5247,9 @@
|
|
|
5199
5247
|
IncomeSource.prototype.isSalaryIncome = function () {
|
|
5200
5248
|
return this.type === exports.IncomeSourceTypeEnum.SALARY;
|
|
5201
5249
|
};
|
|
5250
|
+
IncomeSource.prototype.isSoleIncome = function () {
|
|
5251
|
+
return this.type === exports.IncomeSourceTypeEnum.SOLE;
|
|
5252
|
+
};
|
|
5202
5253
|
IncomeSource.prototype.isWorkIncome = function () {
|
|
5203
5254
|
return this.type === exports.IncomeSourceTypeEnum.WORK;
|
|
5204
5255
|
};
|
|
@@ -5210,7 +5261,7 @@
|
|
|
5210
5261
|
* Get salary and other income forecasts
|
|
5211
5262
|
*/
|
|
5212
5263
|
get: function () {
|
|
5213
|
-
return __spreadArray(__spreadArray([], __read(this.salaryForecasts)), __read(this.incomeSourceForecasts));
|
|
5264
|
+
return __spreadArray(__spreadArray(__spreadArray([], __read(this.salaryForecasts)), __read(this.incomeSourceForecasts)), __read(this.soleForecasts));
|
|
5214
5265
|
},
|
|
5215
5266
|
enumerable: false,
|
|
5216
5267
|
configurable: true
|
|
@@ -5238,6 +5289,9 @@
|
|
|
5238
5289
|
__decorate([
|
|
5239
5290
|
classTransformer.Type(function () { return SalaryForecast; })
|
|
5240
5291
|
], IncomeSource.prototype, "salaryForecasts", void 0);
|
|
5292
|
+
__decorate([
|
|
5293
|
+
classTransformer.Type(function () { return SoleForecast; })
|
|
5294
|
+
], IncomeSource.prototype, "soleForecasts", void 0);
|
|
5241
5295
|
__decorate([
|
|
5242
5296
|
classTransformer.Type(function () { return IncomeSourceForecast; })
|
|
5243
5297
|
], IncomeSource.prototype, "incomeSourceForecasts", void 0);
|
|
@@ -5487,6 +5541,12 @@
|
|
|
5487
5541
|
Depreciation.prototype.isBuildingAtCost = function () {
|
|
5488
5542
|
return this.chartAccounts.id === exports.ChartAccountsListEnum.BUILDING_AT_COST;
|
|
5489
5543
|
};
|
|
5544
|
+
/**
|
|
5545
|
+
* Create a new transaction from current depreciation
|
|
5546
|
+
*/
|
|
5547
|
+
Depreciation.prototype.toTransaction = function () {
|
|
5548
|
+
return classTransformer.plainToClass(Transaction, this);
|
|
5549
|
+
};
|
|
5490
5550
|
return Depreciation;
|
|
5491
5551
|
}(Depreciation$1));
|
|
5492
5552
|
Depreciation.WRITTEN_OFF_THRESHOLD = 300;
|
|
@@ -10092,6 +10152,89 @@
|
|
|
10092
10152
|
}] }];
|
|
10093
10153
|
} });
|
|
10094
10154
|
|
|
10155
|
+
var SoleForecastService = /** @class */ (function (_super) {
|
|
10156
|
+
__extends(SoleForecastService, _super);
|
|
10157
|
+
function SoleForecastService(http, eventDispatcherService, environment) {
|
|
10158
|
+
var _this = _super.call(this, http, eventDispatcherService, environment) || this;
|
|
10159
|
+
_this.http = http;
|
|
10160
|
+
_this.eventDispatcherService = eventDispatcherService;
|
|
10161
|
+
_this.environment = environment;
|
|
10162
|
+
_this.modelClass = SoleForecast;
|
|
10163
|
+
_this.url = 'sole-forecasts';
|
|
10164
|
+
_this.listenEvents();
|
|
10165
|
+
return _this;
|
|
10166
|
+
}
|
|
10167
|
+
/**
|
|
10168
|
+
* Listen to Income Sources events
|
|
10169
|
+
*/
|
|
10170
|
+
SoleForecastService.prototype.listenEvents = function () {
|
|
10171
|
+
this.listenToAddedIncomeSources();
|
|
10172
|
+
this.listenToUpdatedIncomeSources();
|
|
10173
|
+
};
|
|
10174
|
+
/**
|
|
10175
|
+
* Listen to EventDispatcherService event related to added Income Sources
|
|
10176
|
+
*/
|
|
10177
|
+
SoleForecastService.prototype.listenToAddedIncomeSources = function () {
|
|
10178
|
+
var _this = this;
|
|
10179
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.INCOME_SOURCES_CREATED)
|
|
10180
|
+
.pipe(operators.map(function (incomeSources) { return incomeSources
|
|
10181
|
+
.filter(function (incomeSource) { return incomeSource.isSoleIncome(); }); }))
|
|
10182
|
+
.subscribe(function (incomeSources) {
|
|
10183
|
+
var soleForecasts = _this.assignSoleForecasts(incomeSources);
|
|
10184
|
+
if (soleForecasts.length) {
|
|
10185
|
+
_this.addBatch(soleForecasts).subscribe(function (createdSoleForecasts) {
|
|
10186
|
+
_this.eventDispatcherService
|
|
10187
|
+
.dispatch(new AppEvent(exports.AppEventTypeEnum.INCOME_SOURCES_FORECASTS_CREATED, createdSoleForecasts));
|
|
10188
|
+
});
|
|
10189
|
+
}
|
|
10190
|
+
});
|
|
10191
|
+
};
|
|
10192
|
+
/**
|
|
10193
|
+
* Listen to EventDispatcherService event related to updated Income Sources
|
|
10194
|
+
*/
|
|
10195
|
+
SoleForecastService.prototype.listenToUpdatedIncomeSources = function () {
|
|
10196
|
+
var _this = this;
|
|
10197
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.INCOME_SOURCES_UPDATED)
|
|
10198
|
+
.subscribe(function (incomeSources) {
|
|
10199
|
+
var soleForecasts = _this.assignSoleForecasts(incomeSources);
|
|
10200
|
+
if (soleForecasts.length) {
|
|
10201
|
+
_this.updateBatch(soleForecasts).subscribe(function (updatedSoleForecasts) {
|
|
10202
|
+
_this.eventDispatcherService
|
|
10203
|
+
.dispatch(new AppEvent(exports.AppEventTypeEnum.INCOME_SOURCES_FORECASTS_UPDATED, updatedSoleForecasts));
|
|
10204
|
+
});
|
|
10205
|
+
}
|
|
10206
|
+
});
|
|
10207
|
+
};
|
|
10208
|
+
/**
|
|
10209
|
+
* Assign sole forecasts based on provided income sources
|
|
10210
|
+
* @param incomeSources by which sole forecasts will be assigned
|
|
10211
|
+
*/
|
|
10212
|
+
SoleForecastService.prototype.assignSoleForecasts = function (incomeSources) {
|
|
10213
|
+
return incomeSources.map(function (incomeSource) {
|
|
10214
|
+
incomeSource.soleForecasts = incomeSource.soleForecasts
|
|
10215
|
+
.map(function (soleForecast) {
|
|
10216
|
+
soleForecast.incomeSource = classTransformer.plainToClass(IncomeSource, { id: incomeSource.id });
|
|
10217
|
+
return soleForecast;
|
|
10218
|
+
});
|
|
10219
|
+
return incomeSource.soleForecasts;
|
|
10220
|
+
}).flat();
|
|
10221
|
+
};
|
|
10222
|
+
return SoleForecastService;
|
|
10223
|
+
}(BaseRestService));
|
|
10224
|
+
SoleForecastService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleForecastService, deps: [{ token: i1__namespace.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
10225
|
+
SoleForecastService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleForecastService, providedIn: 'root' });
|
|
10226
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleForecastService, decorators: [{
|
|
10227
|
+
type: i0.Injectable,
|
|
10228
|
+
args: [{
|
|
10229
|
+
providedIn: 'root'
|
|
10230
|
+
}]
|
|
10231
|
+
}], ctorParameters: function () {
|
|
10232
|
+
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
10233
|
+
type: i0.Inject,
|
|
10234
|
+
args: ['environment']
|
|
10235
|
+
}] }];
|
|
10236
|
+
} });
|
|
10237
|
+
|
|
10095
10238
|
/**
|
|
10096
10239
|
* Service to work with intercom
|
|
10097
10240
|
*/
|
|
@@ -10342,7 +10485,7 @@
|
|
|
10342
10485
|
*/
|
|
10343
10486
|
var PDF_CONFIG = {
|
|
10344
10487
|
text: {
|
|
10345
|
-
fontSize:
|
|
10488
|
+
fontSize: 12,
|
|
10346
10489
|
fontName: 'helvetica',
|
|
10347
10490
|
fontStyle: '',
|
|
10348
10491
|
fontWeight: 'bold',
|
|
@@ -10353,7 +10496,7 @@
|
|
|
10353
10496
|
},
|
|
10354
10497
|
// coords for file section title (group, table, e.t.c.)
|
|
10355
10498
|
contentTitleCoords: {
|
|
10356
|
-
marginTop:
|
|
10499
|
+
marginTop: 15
|
|
10357
10500
|
},
|
|
10358
10501
|
contentCoords: {
|
|
10359
10502
|
marginTop: 15,
|
|
@@ -10387,17 +10530,18 @@
|
|
|
10387
10530
|
*/
|
|
10388
10531
|
PdfService.prototype.generateFromTables = function (tables, title) {
|
|
10389
10532
|
var pdf = new jsPDF__default["default"]();
|
|
10390
|
-
|
|
10391
|
-
pdf.setFontSize(PDF_CONFIG.text.fontSize)
|
|
10392
|
-
.setFont(PDF_CONFIG.text.fontName, PDF_CONFIG.text.fontStyle, PDF_CONFIG.text.fontWeight)
|
|
10393
|
-
.text(title, PDF_CONFIG.text.positionX, PDF_CONFIG.text.positionY);
|
|
10533
|
+
this.setDocumentTitle(pdf, title);
|
|
10394
10534
|
tables.forEach(function (table) {
|
|
10535
|
+
var _a, _b;
|
|
10395
10536
|
// coords of last table
|
|
10396
10537
|
var lastTableCoords = pdf['lastAutoTable'].finalY || PDF_CONFIG.contentCoords.marginTop;
|
|
10538
|
+
pdf.text((_a = table.caption) === null || _a === void 0 ? void 0 : _a.innerText, PDF_CONFIG.contentCoords.marginLeft, lastTableCoords + PDF_CONFIG.contentCoords.marginTop);
|
|
10539
|
+
// get caption height based on caption content height
|
|
10540
|
+
var captionHeight = pdf.getTextDimensions(pdf.splitTextToSize((_b = table.caption) === null || _b === void 0 ? void 0 : _b.innerText, pdf.internal.pageSize.width)).h;
|
|
10397
10541
|
// table options
|
|
10398
10542
|
var options = {
|
|
10399
10543
|
html: table,
|
|
10400
|
-
startY: lastTableCoords + PDF_CONFIG.contentTitleCoords.marginTop,
|
|
10544
|
+
startY: lastTableCoords + captionHeight + PDF_CONFIG.contentTitleCoords.marginTop,
|
|
10401
10545
|
footStyles: {
|
|
10402
10546
|
fillColor: PDF_CONFIG.text.fillColor,
|
|
10403
10547
|
textColor: PDF_CONFIG.text.textColor
|
|
@@ -10407,6 +10551,11 @@
|
|
|
10407
10551
|
});
|
|
10408
10552
|
return pdf;
|
|
10409
10553
|
};
|
|
10554
|
+
PdfService.prototype.setDocumentTitle = function (doc, title) {
|
|
10555
|
+
doc.setFontSize(PDF_CONFIG.text.fontSize)
|
|
10556
|
+
.setFont(PDF_CONFIG.text.fontName, PDF_CONFIG.text.fontStyle, PDF_CONFIG.text.fontWeight)
|
|
10557
|
+
.text(title, PDF_CONFIG.text.positionX, PDF_CONFIG.text.positionY);
|
|
10558
|
+
};
|
|
10410
10559
|
/**
|
|
10411
10560
|
* @Todo remove/refactor when all DataTable dependent methods will be cleared-up
|
|
10412
10561
|
* Generate PDF file from provided data
|
|
@@ -12629,6 +12778,8 @@
|
|
|
12629
12778
|
exports.ServiceSubscription = ServiceSubscription;
|
|
12630
12779
|
exports.ServiceSubscriptionCollection = ServiceSubscriptionCollection;
|
|
12631
12780
|
exports.ServiceSubscriptionItem = ServiceSubscriptionItem;
|
|
12781
|
+
exports.SoleForecast = SoleForecast;
|
|
12782
|
+
exports.SoleForecastService = SoleForecastService;
|
|
12632
12783
|
exports.SseService = SseService;
|
|
12633
12784
|
exports.SubscriptionService = SubscriptionService;
|
|
12634
12785
|
exports.TYPE_LOAN = TYPE_LOAN;
|