Files
eamco_office_api/app/classes/delivery.py
2024-07-29 13:46:07 -04:00

98 lines
3.2 KiB
Python
Executable File

from app import db, ma
from datetime import datetime
class Delivery_Delivery(db.Model):
__tablename__ = 'delivery_delivery'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"}
id = db.Column(db.Integer,
primary_key=True,
autoincrement=True,
unique=False)
customer_id = db.Column(db.INTEGER)
customer_name = db.Column(db.VARCHAR(1000))
customer_address = db.Column(db.VARCHAR(1000))
customer_town = db.Column(db.VARCHAR(140))
customer_state = db.Column(db.VARCHAR(140))
customer_zip = db.Column(db.INTEGER)
# how many gallons ordered
gallons_ordered = db.Column(db.INTEGER)
# if customer asked for a fill
customer_asked_for_fill = db.Column(db.INTEGER)
# integer value if delivered, waiting, cancelled etc
gallons_delivered =db.Column(db.DECIMAL(50, 2))
# if customer has a full tank
customer_filled = db.Column(db.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 = db.Column(db.INTEGER)
# when the call to order took place
when_ordered = db.Column(db.DATE(), default=datetime.utcnow())
# when the delivery date happened
when_delivered = db.Column(db.DATE(), default=None)
# when the delivery is expected ie what day
expected_delivery_date = db.Column(db.DATE(), default=None)
# automatic delivery
automatic = db.Column(db.INTEGER)
automatic_id = db.Column(db.INTEGER)
# OIL info and id from table
oil_id = db.Column(db.INTEGER)
supplier_price = db.Column(db.DECIMAL(50, 2))
customer_price = db.Column(db.DECIMAL(50, 2))
# weather
customer_temperature = db.Column(db.DECIMAL(50, 2))
# services
dispatcher_notes = db.Column(db.TEXT())
prime = db.Column(db.INTEGER)
same_day = db.Column(db.INTEGER)
# cash = 0
# credit = 1
# credit/cash = 2
payment_type = db.Column(db.INTEGER)
payment_card_id = db.Column(db.INTEGER)
cash_recieved = db.Column(db.DECIMAL(50, 2))
driver_employee_id = db.Column(db.INTEGER)
driver_first_name = db.Column(db.VARCHAR(140))
driver_last_name = db.Column(db.VARCHAR(140))
pre_charge_amount = db.Column(db.DECIMAL(50, 2))
total_price = db.Column(db.DECIMAL(50, 2))
final_price = db.Column(db.DECIMAL(50, 2))
class Delivery_Delivery_schema(ma.SQLAlchemyAutoSchema):
class Meta:
model = Delivery_Delivery
class Delivery_Notes_Driver(db.Model):
__tablename__ = 'delivery_notes'
__bind_key__ = 'eamco'
__table_args__ = {"schema": "public"}
id = db.Column(db.Integer,
primary_key=True,
autoincrement=True,
unique=False)
delivery_id = db.Column(db.INTEGER)
driver_comments = db.Column(db.TEXT)
time_added = db.Column(db.TIMESTAMP(), default=datetime.utcnow())
driver_id = db.Column(db.INTEGER)
driver_name = db.Column(db.VARCHAR(140))
class Delivery_Notes_Driver_schema(ma.SQLAlchemyAutoSchema):
class Meta:
model = Delivery_Notes_Driver