From c456ef301c29b482c1a81c0db52e2aad23800ad6 Mon Sep 17 00:00:00 2001 From: Edwin Eames Date: Thu, 26 Sep 2024 08:48:37 -0400 Subject: [PATCH] added emergency price --- app/admin/views.py | 10 ++++++++++ app/classes/delivery.py | 1 + app/classes/pricing.py | 11 ++++++----- app/delivery/views.py | 24 ++++++++++-------------- app/info/views.py | 1 + 5 files changed, 28 insertions(+), 19 deletions(-) diff --git a/app/admin/views.py b/app/admin/views.py index bff37fd..03cd610 100755 --- a/app/admin/views.py +++ b/app/admin/views.py @@ -19,6 +19,7 @@ def create_oil_price(): price_for_employee = request.json["price_for_employee"] price_same_day = request.json["price_same_day"] price_prime = request.json["price_prime"] + price_emergency= request.json["price_emergency"] new_admin_oil_price = Pricing_Oil_Oil( price_from_supplier=price_from_supplier, @@ -26,8 +27,17 @@ def create_oil_price(): price_for_employee=price_for_employee, price_same_day=price_same_day, price_prime=price_prime, + price_emergency=price_emergency, 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.commit() diff --git a/app/classes/delivery.py b/app/classes/delivery.py index 158bc64..1782391 100755 --- a/app/classes/delivery.py +++ b/app/classes/delivery.py @@ -1,3 +1,4 @@ + from app import db, ma from datetime import datetime diff --git a/app/classes/pricing.py b/app/classes/pricing.py index c6ec09d..322bb39 100755 --- a/app/classes/pricing.py +++ b/app/classes/pricing.py @@ -15,11 +15,12 @@ class Pricing_Oil_Oil(db.Model): autoincrement=True, unique=False) - price_from_supplier = db.Column(db.DECIMAL(50, 2)) - price_for_customer = db.Column(db.DECIMAL(50, 2)) - price_for_employee = db.Column(db.DECIMAL(50, 2)) - price_same_day = db.Column(db.DECIMAL(50, 2)) - price_prime = db.Column(db.DECIMAL(50, 2)) + price_from_supplier = db.Column(db.DECIMAL(6, 2)) + price_for_customer = db.Column(db.DECIMAL(6, 2)) + price_for_employee = db.Column(db.DECIMAL(6, 2)) + price_same_day = db.Column(db.DECIMAL(6, 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()) diff --git a/app/delivery/views.py b/app/delivery/views.py index 298bcdf..30c6d94 100755 --- a/app/delivery/views.py +++ b/app/delivery/views.py @@ -518,15 +518,18 @@ def create_a_delivery(user_id): # 3 = check # 4 = other # 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: 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 - if other_payment is True: + elif other_payment is True: + delivery_payment_method = 4 + else: delivery_payment_method = 4 @@ -559,14 +562,6 @@ def create_a_delivery(user_id): card_id_from_customer = None - - - - - - - - if customer_wants_fill is True: customer_fill_up = 1 @@ -620,6 +615,7 @@ def create_a_delivery(user_id): when_delivered=None, expected_delivery_date=when_to_deliver, automatic=get_customer.customer_automatic, + automatic_id=None, oil_id=get_today_price.id, supplier_price=get_today_price.price_from_supplier, customer_price=get_today_price.price_for_customer, diff --git a/app/info/views.py b/app/info/views.py index da25ac0..f942510 100755 --- a/app/info/views.py +++ b/app/info/views.py @@ -17,6 +17,7 @@ def get_oil_price_today(): 'price_for_employee': get_price_query.price_for_employee, 'price_same_day': get_price_query.price_same_day, 'price_prime': get_price_query.price_prime, + 'price_emergency': get_price_query.price_emergency, }), 200