Skip to content

Instantly share code, notes, and snippets.

@rpuntaie
Last active May 27, 2024 14:51
Show Gist options
  • Save rpuntaie/6d591776ef82e90374d1348b81963630 to your computer and use it in GitHub Desktop.
Save rpuntaie/6d591776ef82e90374d1348b81963630 to your computer and use it in GitHub Desktop.
import datetime as dt
import numpy as np
def kfz_steuer_oesterreich(zulassung,**kw):
"""
Motorbezogene Versicherungssteuer Österreich < 3.5 Tonnen ohne Versicherungsentgelt.
https://www.ris.bka.gv.at/GeltendeFassung.wxe?Abfrage=Bundesnormen&Gesetzesnummer=10004742
- zulassung format "YYYYMMDD", z.B. "20201001"
- CO2=xyz => ab 1.10.2020
- kW=xyz => Auto
- ccm=xyz => Motorrad
>>> kfz_steuer_oesterreich(zulassung="2019",kW=110)
>>> kfz_steuer_oesterreich(zulassung="2022",kW=125,CO2=220)
>>> kfz_steuer_oesterreich(zulassung="2024",ccm=650,CO2=100)
>>> kfz_steuer_oesterreich(zulassung="2024",kW=85,CO2=135,inY=2033)
"""
min5=lambda x: np.max(np.array([[5]*len(x),x]),0)
min10=lambda x: np.max(np.array([[10]*len(x),x]),0)
def partpriced(parts,prices,v,minX=lambda x:x):
dp=np.array([v]*len(parts))-parts
p=np.array(prices)[dp>0]
ps=np.array(list(np.array(parts)[dp>0])+[v])
d=np.diff(ps)
return 12*sum(p*minX(d))
if 'ccm' in kw: # moto
ccm=kw["ccm"]
if zulassung < "202010":
return round(12*ccm*0.0275)
else:
CO2=kw["CO2"]
pCO2=partpriced([52],[0.20],CO2,min10)
pccm=partpriced([52],[0.014],ccm)
return round(pCO2 + pccm)
else: # auto
kW=kw["kW"]
if zulassung < "202010":
return round(partpriced([24,90,110],[0.682,0.726,0.825],kW))
else:
CO2=kw["CO2"]
inY=kw.get("inY",dt.datetime.now().year)
CO2_start=115-3*(inY-int(2021))
pCO2=partpriced([CO2_start],[0.72],CO2,min5)
kW_start=65-1*(inY-int(2021))
pkW=partpriced([kW_start],[0.72],kW,min5)
return round(pkW+pCO2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment