Giter VIP home page Giter VIP logo

taxcalculator's People

Contributors

admiralsmaster avatar akuechl avatar dependabot[bot] avatar thomasdarimont avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

taxcalculator's Issues

You can not figure out which type have the input values.

You can not figure out which have the input values.

For example, if the input values are Strings (query parameter, form inputs), then you can not set without the type of each individual to know.

The type can be:

  • int
  • double
  • BigDecimal

Getter found "getClass"

Version: 2016.1.1

IS:
The method TaxCalculatorFactory.getOutputs() returns the getClass() method key.

SHOULD:
The class to return only methods that are related to the tax calculation.

final TaxCalculatorFactory factory = new TaxCalculatorFactory();
final Set<String> outs = factory.getOutputs("2015Dezember")
// outs contains getClass method "CLASS"

Getters and Setters are not being generated properly.

The gettersAndSetters and getters templates in the current XSLT definition don't match against the given xml format.

Expected is /PAP/VARIABLES/INPUT where the actual path is /PAP/VARIABLES/INPUTS/INPUT
same story with:
/PAP/VARIABLES/OUTPUT and /PAP/VARIABLES/OUTPUTS/OUTPUT

2018 calculation

Add the calculation for 2018. Should be available in October or November 2017.

Add support for dynamic lookup of Lohnsteuer Calculation Strategies.

It would be nice if there was a facility for programatically looking up
Lohnsteuer calculation strategies based on some key or date parameter.

This would be helpful for applications that need to dynamically
select the appropriate calculation strategy based on some context.

In order to support this there must be some sort of interface to abstract the actual calculation.
The interface needs to be able to deal with varying input since the calculation input and output fields
change from time to time.

I gave this a quick spin in my feature/calculator-lookup-support branch.

public class LohnsteuerCalculatorTest {

    LohnsteuerCalculator calculator;

    @Before
    public void setup() {
        calculator = new DefaultLohnsteuerCalculator();
    }

    @Test
    public void testCalculateWithInputParameters() throws Exception {

        Map<String, Object> input = new HashMap<>();
        input.put("LZZ", 2); // monthly payment
        input.put("STKL", 1); // tax class
        input.put("RE4", new BigDecimal("223456")); // income in cent
        input.put("LZZFREIB", BigDecimal.ZERO); // Freibeträge
        input.put("PVS", 0); // not in saxony
        input.put("PVZ", 0); // Additional care insurance for employee: birth > 1940, older
                             // than 23, no kids
        input.put("R", 0); // no church
        input.put("ZKF", new BigDecimal("0.5")); // a half child :)
        input.put("KVZ", new BigDecimal("0.90")); // additional med insurance [percent]
        input.put("KRV", 1); // pensions fund: east germany

        input.put("VBEZ", BigDecimal.ZERO);
        input.put("LZZHINZU", BigDecimal.ZERO);
        input.put("SONSTB", BigDecimal.ZERO);
        input.put("VKAPA", BigDecimal.ZERO);
        input.put("VMT", BigDecimal.ZERO);

        CalculationOutput output = calculator.calculate("201512", input);

        assertThat(output.getProperty("LSTLZZ", BigDecimal.class).divide(new BigDecimal("100")),
                is(new BigDecimal("239.41")));
        assertThat(
                output.getProperty("SOLZLZZ", BigDecimal.class).divide(new BigDecimal("100")),
                is(new BigDecimal("7.79")));

        System.out.println(output.getProperties());

    }
}

Here the calculation is looked up based on a date kay pattern which internally resolves to
the appropriate LohnsteuerCalculation. The calculation input is provided as a Map as well as the output but the latter is wrapped in a CalculationOutput.

The DefaultLohnsteuerCalculator provides access to the supported LohnsteuerCalculations that can be resolved via a date pattern key that allow direct lookup as well as "lenient" lookups where we lookup the actual valid calculation for the particular date range a calculation is valid based on the provided key.

Some examples are show in the LohnsteuerCalculatorFactoryTests.

Switch to Java 8

From the 2018 version on, the library will switch to Java 8. In addition, Reflection's generic access (TaxCalculatorFactory) will switch to a variant with Java functions.

Current Planned Tasks:

  1. The collections of existing getter and setter are created during code generation.
private static final Map<String, BiConsumer<Lohnsteuer2017Big, BigDecimal>> MAP;
static {
	MAP.put(normalizeKey("ENTSCH"), Lohnsteuer2017Big::setENTSCH);
	...
}
  1. All calculation classes implement the new calculator interface. This interface includes not only the calculate method but also a "getAccessor"method.
    When this method is called, an object is provided with the Interface Accessor, via which values can be read (getInt, getBigDecimal, getDouble) and set (setInt, setBigDecimal, setDouble) and set (setInt, setBigDecimal, setDouble).
  2. TaxCalculatorFactory is adapted to use the methods of the accessor. This simplifies the class. There is also no caching of methods.

Performance will improve.

I try to keep the API as compatible as possible.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.