Fixed bug with discount
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
from sqlalchemy import Column, Integer,\
|
||||
DECIMAL, Text,\
|
||||
DECIMAL, TEXT,\
|
||||
VARCHAR, TIMESTAMP, DATE
|
||||
from datetime import datetime, timezone
|
||||
from database import Base
|
||||
|
||||
|
||||
|
||||
@@ -71,8 +71,10 @@ async def calculate_delivery_final(delivery_id_order):
|
||||
if get_delivery.promo_id is not None:
|
||||
get_promo_amount = (float(get_delivery.gallons_delivered)) *(float(get_promo_data.money_off_delivery))
|
||||
discount = (float(calc_total_oil)) - (float(get_promo_amount))
|
||||
discount_amount = get_promo_data.money_off_delivery
|
||||
else:
|
||||
discount = 0
|
||||
discount_amount = 0
|
||||
|
||||
# calculate fees
|
||||
total_amount_fees_from_delivery = (float(same_day_price) + float(prime_price))
|
||||
@@ -101,7 +103,7 @@ async def calculate_delivery_final(delivery_id_order):
|
||||
total_amount_fee= total_amount_fees_from_delivery,
|
||||
total_amount=total_amount_delivery,
|
||||
taxes_paid=None,
|
||||
total_discount_amount=get_promo_data.money_off_delivery,
|
||||
total_discount_amount=discount_amount,
|
||||
total_discount_total=discount,
|
||||
total_profit_oil=profit_from_oil,
|
||||
total_profit=profit_from_stop,
|
||||
|
||||
Reference in New Issue
Block a user