128 lines
3.7 KiB
Python
Executable File
128 lines
3.7 KiB
Python
Executable File
|
|
from app import db, ma
|
|
from datetime import datetime
|
|
|
|
|
|
|
|
class Service_Call(db.Model):
|
|
__tablename__ = 'service_call'
|
|
__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_last_name = db.Column(db.VARCHAR(250))
|
|
customer_first_name = db.Column(db.VARCHAR(250))
|
|
customer_town = db.Column(db.VARCHAR(140))
|
|
customer_state = db.Column(db.INTEGER)
|
|
customer_zip = db.Column(db.VARCHAR(25))
|
|
customer_apt = db.Column(db.VARCHAR(140))
|
|
customer_address = db.Column(db.VARCHAR(1000))
|
|
|
|
#0 = closed
|
|
#1 = open
|
|
status = db.Column(db.INTEGER)
|
|
|
|
# 0 = unknown
|
|
# 1 = cleaning / tuneup
|
|
# 2 = problem
|
|
# 3 = install
|
|
# 3 = callback
|
|
service_type = db.Column(db.INTEGER)
|
|
|
|
# when the call to service took place
|
|
when_called = db.Column(db.DATE(), default=datetime.utcnow())
|
|
# what day the call will take place
|
|
scheduled_date = db.Column(db.DATE(), default=datetime.utcnow())
|
|
# what day the call will take place
|
|
scheduled_time = db.Column(db.INTEGER)
|
|
# when the service took place
|
|
when_serviced = db.Column(db.DATE(), default=datetime.utcnow())
|
|
|
|
# is the call finished or not
|
|
# 0 = open
|
|
#1 = finished
|
|
completed = db.Column(db.INTEGER)
|
|
tech_id = db.Column(db.INTEGER)
|
|
tech_first_name = db.Column(db.VARCHAR(300))
|
|
tech_last_name = db.Column(db.VARCHAR(300))
|
|
|
|
|
|
|
|
class Service_Call_schema(ma.SQLAlchemyAutoSchema):
|
|
class Meta:
|
|
model = Service_Call
|
|
|
|
|
|
class Service_Call_Money(db.Model):
|
|
__tablename__ = 'service_money'
|
|
__bind_key__ = 'eamco'
|
|
__table_args__ = {"schema": "public"}
|
|
|
|
id = db.Column(db.Integer,
|
|
primary_key=True,
|
|
autoincrement=True,
|
|
unique=False)
|
|
|
|
service_call_id = db.Column(db.INTEGER)
|
|
hours = db.Column(db.DECIMAL(50, 2))
|
|
cost_per_hour = db.Column(db.DECIMAL(50, 2))
|
|
parts_cost = db.Column(db.DECIMAL(50, 2))
|
|
total_cost_service = db.Column(db.DECIMAL(50, 2))
|
|
|
|
class Service_Call_Money_schema(ma.SQLAlchemyAutoSchema):
|
|
class Meta:
|
|
model = Service_Call_Money
|
|
|
|
|
|
class Service_Call_Notes_Dispatcher(db.Model):
|
|
__tablename__ = 'service_notes_dispatcher'
|
|
__bind_key__ = 'eamco'
|
|
__table_args__ = {"schema": "public"}
|
|
|
|
id = db.Column(db.Integer,
|
|
primary_key=True,
|
|
autoincrement=True,
|
|
unique=False)
|
|
|
|
service_call_id = db.Column(db.INTEGER)
|
|
dispatcher_notes = db.Column(db.TEXT)
|
|
dispatcher_subject = db.Column(db.VARCHAR(1024))
|
|
time_added = db.Column(db.TIMESTAMP(), default=datetime.utcnow())
|
|
dispatcher_id = db.Column(db.INTEGER)
|
|
dispatcher_name = db.Column(db.VARCHAR(140))
|
|
|
|
|
|
class Service_Call_Notes_Dispatcher_schema(ma.SQLAlchemyAutoSchema):
|
|
class Meta:
|
|
model = Service_Call_Notes_Dispatcher
|
|
|
|
|
|
class Service_Call_Notes_Technician(db.Model):
|
|
__tablename__ = 'service_notes_technician'
|
|
__bind_key__ = 'eamco'
|
|
__table_args__ = {"schema": "public"}
|
|
|
|
id = db.Column(db.Integer,
|
|
primary_key=True,
|
|
autoincrement=True,
|
|
unique=False)
|
|
|
|
service_call_id = db.Column(db.INTEGER)
|
|
technician_comments = db.Column(db.TEXT)
|
|
time_added = db.Column(db.TIMESTAMP(), default=datetime.utcnow())
|
|
technician_id = db.Column(db.INTEGER)
|
|
technician_name = db.Column(db.VARCHAR(140))
|
|
|
|
|
|
class Service_Call_Notes_Technician_schema(ma.SQLAlchemyAutoSchema):
|
|
class Meta:
|
|
model = Service_Call_Notes_Technician
|
|
|
|
|
|
|