first commit

This commit is contained in:
2024-02-28 16:10:40 -05:00
commit b71bbe2dc5
49 changed files with 3582 additions and 0 deletions

117
app/classes/delivery.py Normal file
View File

@@ -0,0 +1,117 @@
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.TIMESTAMP(), default=datetime.utcnow())
# when the delivery date happened
when_delivered = db.Column(db.TIMESTAMP(), 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)
# 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
payment_type = db.Column(db.INTEGER)
payment_card_id = db.Column(db.INTEGER)
driver_employee_id = db.Column(db.VARCHAR(140))
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_Payment(db.Model):
__tablename__ = 'delivery_payment'
__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)
time_added = db.Column(db.TIMESTAMP(), default=datetime.utcnow())
total_amount_oil = db.Column(db.DECIMAL(50, 2))
total_amount_emergency = db.Column(db.DECIMAL(50, 2))
total_amount_prime = db.Column(db.DECIMAL(50, 2))
total_amount_fee = db.Column(db.DECIMAL(50, 2))
total_amount = db.Column(db.DECIMAL(50, 2))
class Delivery_Payment_schema(ma.SQLAlchemyAutoSchema):
class Meta:
model = Delivery_Payment
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