Skip to content

Commit

Permalink
fix SV calculation, use profit with grundfreibetrag again
Browse files Browse the repository at this point in the history
  • Loading branch information
bettysteger committed Sep 25, 2024
1 parent 088d536 commit 3d2cd17
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
7 changes: 1 addition & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ function profitOnEStBescheid(income, outgo, options) {
}
}

if (options.noGrundfreiBetrag) { return value; } // for profit for SV calculation

value -= (Math.min(value, freiBetragLimit) * freibetragValues(options.year).percentage); // - 15% Grundfreibetrag
if(options.useInvestFreibetrag && options.investFreibetrag) {
value -= options.investFreibetrag; // - 15% Investitionsbedingter Gewinnfreibetrag
Expand All @@ -44,10 +42,7 @@ function calculate(income, outgo, options = {}) {
options.paidSv = options.paidSv || 0;

let profit = profitOnEStBescheid(income, outgo, options);
// Check if Gewinnfreibetrag should be subtracted when calculating SV
// @see https://github.com/orgs/hundert11/projects/1?pane=issue&itemId=35161424
let profitForSV = profitOnEStBescheid(income, outgo, {...options, noGrundfreiBetrag: true});
const sv = SVbeitrag(profitForSV, options);
const sv = SVbeitrag(profit, options);

// if no user input, calculate profit based on SV estimate
if(!options.paidSv) {
Expand Down
10 changes: 8 additions & 2 deletions tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,17 @@ test('should return the correct SV-Beitrag for 10.000€ (older founding year)',
const options = { year, foundingYear: 2020 };
let income = 10000;
let outgo = 1200;
expect(hundert11.calculate(income, outgo, options).sv).toBe(2497); // value from WKO SV-Beitrag Rechner
/**
* 2497 would be the value from WKO & haude Rechner, but they are
* NOT using 'Einkommen lt. EStB', therefore missing the substraction of Grundfreibetrag.
* I now expect the value from https://www.ea-tabelle.at/?from=2548 which is 2143.
*/
const eaTabelleSvValue = 2143;
expect(hundert11.calculate(income, outgo, options).sv).toBe(eaTabelleSvValue);

income = 10000;
outgo = 0; // testing -12% Basispauschalierung
expect(hundert11.calculate(income, outgo, options).sv).toBe(2497); // value from WKO SV-Beitrag Rechner
expect(hundert11.calculate(income, outgo, options).sv).toBe(eaTabelleSvValue);
});

test('should return the correct SV-Nachzahlung for 10.000€ (year = founding year)', () => {
Expand Down

0 comments on commit 3d2cd17

Please sign in to comment.