added promo

This commit is contained in:
2024-10-07 17:35:09 -04:00
parent 033a751441
commit 726f71aed0
4 changed files with 135 additions and 72 deletions

View File

@@ -1,50 +1,79 @@
from sqlalchemy import Column, Integer,\
DECIMAL, Text,\
VARCHAR, TIMESTAMP, Date
import datetime
from sqlalchemy import Column, TEXT, DECIMAL, INTEGER, VARCHAR, DATE
from database import Base
class Delivery(Base):
__tablename__ = "delivery_delivery"
id = Column(Integer,
id = Column(INTEGER,
primary_key=True,
autoincrement=True,
unique=False)
customer_id = Column(Integer)
customer_id = Column(INTEGER)
customer_name = Column(VARCHAR(1000))
customer_address = Column(VARCHAR(1000))
customer_town = Column(VARCHAR(140))
customer_state = Column(VARCHAR(140))
customer_zip = Column(Integer)
gallons_ordered = Column(Integer)
customer_asked_for_fill = Column(Integer)
gallons_delivered = Column(DECIMAL(6, 2))
customer_filled = Column(Integer)
delivery_status = Column(Integer)
when_ordered = Column(TIMESTAMP(), default=datetime.datetime.utcnow())
when_delivered = Column(TIMESTAMP(), default=None)
expected_delivery_date = Column(Date(), default=None)
automatic = Column(Integer)
oil_id = Column(Integer)
customer_zip = Column(INTEGER)
# how many gallons ordered
gallons_ordered = Column(INTEGER)
# if customer asked for a fill
customer_asked_for_fill = Column(INTEGER)
# integer value if delivered, waiting, cancelled etc
gallons_delivered =Column(DECIMAL(6, 2))
# if customer has a full tank
customer_filled = Column(INTEGER)
# integer value if delivered, waiting, cancelled etc
# waiting = 0
# delivered = 1
# out for delivery = 2
# cancelled = 3
# partial delivery = 4
# issue = 5
# finalized = 10
delivery_status = Column(INTEGER)
# when the call to order took place
when_ordered = Column(DATE(), default=None)
# when the delivery date happened
when_delivered = Column(DATE(), default=None)
# when the delivery is expected ie what day
expected_delivery_date = Column(DATE(), default=None)
# automatic delivery
automatic = Column(INTEGER)
automatic_id = Column(INTEGER)
# OIL info and id from table
oil_id = Column(INTEGER)
supplier_price = Column(DECIMAL(6, 2))
customer_price = Column(DECIMAL(6, 2))
# weather
customer_temperature = Column(DECIMAL(6, 2))
dispatcher_notes = Column(Text())
prime = Column(Integer)
same_day = Column(Integer)
payment_type = Column(Integer)
payment_card_id = Column(Integer)
# services
dispatcher_notes = Column(TEXT())
prime = Column(INTEGER)
same_day = Column(INTEGER)
emergency = Column(INTEGER)
# cash = 0
# credit = 1
# credit/cash = 2
# check = 3
# other = 4
payment_type = Column(INTEGER)
payment_card_id = Column(INTEGER)
cash_recieved = Column(DECIMAL(6, 2))
driver_employee_id = Column(Integer)
driver_employee_id = Column(INTEGER)
driver_first_name = Column(VARCHAR(140))
driver_last_name = Column(VARCHAR(140))
pre_charge_amount = Column(DECIMAL(6, 2))
total_price = Column(DECIMAL(6, 2))
final_price = Column(DECIMAL(6, 2))
final_price = Column(DECIMAL(6, 2))
check_number = Column(VARCHAR(20))
promo_id = Column(INTEGER)
promo_money_discount = Column(DECIMAL(6, 2))

View File

@@ -1,28 +1,30 @@
from sqlalchemy import Column, Integer,\
DECIMAL, Text,\
VARCHAR, TIMESTAMP, Date
VARCHAR, TIMESTAMP, DATE
from datetime import datetime, timezone
from database import Base
class MoneyDelivery(Base):
__tablename__ = 'money_delivery'
__tablename__ = 'money_delivery'
id = Column(Integer,
primary_key=True,
autoincrement=True,
unique=False)
id = Column(Integer,
primary_key=True,
autoincrement=True,
unique=False)
delivery_id = Column(Integer)
time_added = Column(TIMESTAMP(), default=datetime.utcnow())
gallons_delivered = Column(DECIMAL(6, 2))
supplier_price = Column(DECIMAL(6, 2))
customer_price = Column(DECIMAL(6, 2))
total_amount_oil = Column(DECIMAL(6, 2))
total_amount_prime = Column(DECIMAL(6, 2))
total_amount_same_day = Column(DECIMAL(6, 2))
total_amount_fee = Column(DECIMAL(6, 2))
total_amount = Column(DECIMAL(6, 2))
taxes_paid = Column(DECIMAL(6, 2))
total_profit = Column(DECIMAL(6, 2))
total_profit_oil = Column(DECIMAL(6, 2))
delivery_id = Column(Integer)
time_added = Column(DATE())
gallons_delivered = Column(DECIMAL(6, 2))
supplier_price = Column(DECIMAL(6, 2))
customer_price = Column(DECIMAL(6, 2))
total_amount_oil = Column(DECIMAL(6, 2))
total_amount_prime = Column(DECIMAL(6, 2))
total_amount_same_day = Column(DECIMAL(6, 2))
total_amount_fee = Column(DECIMAL(6, 2))
total_amount = Column(DECIMAL(6, 2))
total_discount_amount = Column(DECIMAL(6, 2))
total_discount_total = Column(DECIMAL(6, 2))
taxes_paid = Column(DECIMAL(6, 2))
total_profit = Column(DECIMAL(6, 2))
total_profit_oil = Column(DECIMAL(6, 2))

22
app/models/promo.py Normal file
View File

@@ -0,0 +1,22 @@
from sqlalchemy import Column, INTEGER, DECIMAL, VARCHAR, DATE, BOOLEAN, TEXT
from database import Base
class Promo_Promo(Base):
__tablename__ = 'promo_Promo'
id = Column(INTEGER,
primary_key=True,
autoincrement=True,
unique=False)
active = Column(BOOLEAN())
name_of_promotion = Column(VARCHAR(1000))
money_off_delivery = Column(DECIMAL(6, 2))
description = Column(VARCHAR(1000))
date_created = Column(DATE())