fix for fees for selling.

fix for taxfree amount.
add description to transactions.
This commit is contained in:
2021-05-12 06:54:32 +02:00
parent 2818d9c11f
commit 68c26eb924
7 changed files with 70 additions and 3 deletions
+5 -2
View File
@@ -87,7 +87,7 @@ class Calc:
# calculate all fees.
with connection.cursor() as cursor:
sql = """SELECT SUM(crypto_fee) as crypto_fee, SUM(fiat_fee) as fiat_fee FROM `transaction` WHERE crypto_currency=%s and owner_id=%s and transaction_type in ('T','B')"""
sql = """SELECT SUM(crypto_fee) as crypto_fee, SUM(fiat_fee) as fiat_fee FROM `transaction` WHERE crypto_currency=%s and owner_id=%s"""
cursor.execute(sql, [crypto, userid])
fees = cursor.fetchone()
if fees[0]:
@@ -137,7 +137,10 @@ class Calc:
if bought[0]:
out["bought_recently"] = bought[0]
amount_within_past_year = Decimal(bought[0])
amount_available_to_sell = amount_kept - amount_within_past_year
if amount_kept > amount_within_past_year:
amount_available_to_sell = amount_kept - amount_within_past_year
else:
amount_available_to_sell = 0
out["bought_tax_free"] = None
out["value_tax_free"] = None
if rateEUR: