added emergency price

This commit is contained in:
2024-09-26 08:48:37 -04:00
parent d7c809af82
commit c456ef301c
5 changed files with 28 additions and 19 deletions

View File

@@ -19,6 +19,7 @@ def create_oil_price():
price_for_employee = request.json["price_for_employee"] price_for_employee = request.json["price_for_employee"]
price_same_day = request.json["price_same_day"] price_same_day = request.json["price_same_day"]
price_prime = request.json["price_prime"] price_prime = request.json["price_prime"]
price_emergency= request.json["price_emergency"]
new_admin_oil_price = Pricing_Oil_Oil( new_admin_oil_price = Pricing_Oil_Oil(
price_from_supplier=price_from_supplier, price_from_supplier=price_from_supplier,
@@ -26,8 +27,17 @@ def create_oil_price():
price_for_employee=price_for_employee, price_for_employee=price_for_employee,
price_same_day=price_same_day, price_same_day=price_same_day,
price_prime=price_prime, price_prime=price_prime,
price_emergency=price_emergency,
date=now, date=now,
) )
# new_admin_oil_price = Pricing_Oil_Oil(
# price_from_supplier=price_from_supplier,
# price_for_customer=price_for_customer,
# price_for_employee=price_for_employee,
# price_same_day=price_same_day,
# price_prime=price_prime,
# date=now,
# )
db.session.add(new_admin_oil_price) db.session.add(new_admin_oil_price)
db.session.commit() db.session.commit()

View File

@@ -1,3 +1,4 @@
from app import db, ma from app import db, ma
from datetime import datetime from datetime import datetime

View File

@@ -15,11 +15,12 @@ class Pricing_Oil_Oil(db.Model):
autoincrement=True, autoincrement=True,
unique=False) unique=False)
price_from_supplier = db.Column(db.DECIMAL(50, 2)) price_from_supplier = db.Column(db.DECIMAL(6, 2))
price_for_customer = db.Column(db.DECIMAL(50, 2)) price_for_customer = db.Column(db.DECIMAL(6, 2))
price_for_employee = db.Column(db.DECIMAL(50, 2)) price_for_employee = db.Column(db.DECIMAL(6, 2))
price_same_day = db.Column(db.DECIMAL(50, 2)) price_same_day = db.Column(db.DECIMAL(6, 2))
price_prime = db.Column(db.DECIMAL(50, 2)) price_prime = db.Column(db.DECIMAL(6, 2))
price_emergency = db.Column(db.DECIMAL(6, 2))
date = db.Column(db.TIMESTAMP(), default=datetime.utcnow()) date = db.Column(db.TIMESTAMP(), default=datetime.utcnow())

View File

@@ -518,15 +518,18 @@ def create_a_delivery(user_id):
# 3 = check # 3 = check
# 4 = other # 4 = other
# 5 = unknown # 5 = unknown
if cash_payment is True:
delivery_payment_method = 0
if card_payment is True:
delivery_payment_method = 1
if card_payment is True and cash_payment is True: if card_payment is True and cash_payment is True:
delivery_payment_method = 2 delivery_payment_method = 2
if check_payment is True: elif cash_payment is True:
delivery_payment_method = 0
elif card_payment is True:
delivery_payment_method = 1
elif check_payment is True:
delivery_payment_method = 3 delivery_payment_method = 3
if other_payment is True: elif other_payment is True:
delivery_payment_method = 4
else:
delivery_payment_method = 4 delivery_payment_method = 4
@@ -559,14 +562,6 @@ def create_a_delivery(user_id):
card_id_from_customer = None card_id_from_customer = None
if customer_wants_fill is True: if customer_wants_fill is True:
customer_fill_up = 1 customer_fill_up = 1
@@ -620,6 +615,7 @@ def create_a_delivery(user_id):
when_delivered=None, when_delivered=None,
expected_delivery_date=when_to_deliver, expected_delivery_date=when_to_deliver,
automatic=get_customer.customer_automatic, automatic=get_customer.customer_automatic,
automatic_id=None,
oil_id=get_today_price.id, oil_id=get_today_price.id,
supplier_price=get_today_price.price_from_supplier, supplier_price=get_today_price.price_from_supplier,
customer_price=get_today_price.price_for_customer, customer_price=get_today_price.price_for_customer,

View File

@@ -17,6 +17,7 @@ def get_oil_price_today():
'price_for_employee': get_price_query.price_for_employee, 'price_for_employee': get_price_query.price_for_employee,
'price_same_day': get_price_query.price_same_day, 'price_same_day': get_price_query.price_same_day,
'price_prime': get_price_query.price_prime, 'price_prime': get_price_query.price_prime,
'price_emergency': get_price_query.price_emergency,
}), 200 }), 200