Skip to content

AllmostHumann/beer-excise-tax-calculator

Repository files navigation

Beer excise tax calculator

Excise Tax Calculator

Introduction

You have to make your life easier, right?

For this occasion, I have created an application to calculate excise taxes for beer. The application, with the help of React-paparse, takes a generated .CSV file and parses it into a JSON file. Based on the generated JSON file, the table with a list of all the beers is created. Due to the fact that the files generated in my work are not perfect I had to use Regexp. With its help, the name of the beer with data such as extract, volume, and type of package are separated into separate columns. In this way we get a table that is readable and ready for eventual editing. The table is used primarily for a clear check of the accuracy of the data obtained from the .CSV file and, if necessary, the opportunity to correct it.

In the next part of the application, the data downloaded from the JSON file is filtered to get rid of non-alcoholic beers (we don't count excise for them in Polish law). The next step, depending on the volume that appears next to the item, the amount of beer is converted according to a simple formula into hectoliters, and then the tax to be paid expressed in Polish zlotys. In addition, with the results you have the opportunity to check whether the brewery is entitled to a 50% discount on the tax.

All actions from parsing to tax calculation are saved in localstorage just in case 😆.

Cheers!

Ps: This application was created to work on files generated in my work. You can assume with 99% certainty that it will not work on files from another brewery.

Description

Excise duty calculator for beer according to Polish tax law

Instructions

  1. Download test.csv file from Public folder, and save it.
  2. Browse test.csv file.
  3. Let the magic begin!

Technologies

  • React.js
  • Vite
  • TypeScript
  • Zustand
  • Tanstack Table
  • React papaparse
  • TailwindCSS

React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

  • Configure the top-level parserOptions property like this:
   parserOptions: {
    ecmaVersion: 'latest',
    sourceType: 'module',
    project: ['./tsconfig.json', './tsconfig.node.json'],
    tsconfigRootDir: __dirname,
   },
  • Replace plugin:@typescript-eslint/recommended to plugin:@typescript-eslint/recommended-type-checked or plugin:@typescript-eslint/strict-type-checked
  • Optionally add plugin:@typescript-eslint/stylistic-type-checked
  • Install eslint-plugin-react and add plugin:react/recommended & plugin:react/jsx-runtime to the extends list