first commit
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
from decimal import Decimal, ROUND_HALF_UP
|
||||
|
||||
|
||||
def money(value):
|
||||
return Decimal(str(value)).quantize(Decimal("0.01"), rounding=ROUND_HALF_UP)
|
||||
|
||||
|
||||
def calculate_costs(gross, vat_rate=23, vat_deduction_percent=50):
|
||||
gross = Decimal(str(gross)); rate = Decimal(str(vat_rate))
|
||||
deduction = Decimal(str(vat_deduction_percent)) / Decimal("100")
|
||||
net = gross / (Decimal("1") + rate / Decimal("100")); vat = gross - net
|
||||
deductible_vat = vat * deduction
|
||||
return {"gross": money(gross), "net": money(net), "vat": money(vat),
|
||||
"deductible_vat": money(deductible_vat), "final_cost": money(gross - deductible_vat)}
|
||||
Reference in New Issue
Block a user