first commit
This commit is contained in:
0
app/classes/__init__.py
Normal file
0
app/classes/__init__.py
Normal file
26
app/classes/admin.py
Normal file
26
app/classes/admin.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from app import db, ma
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class Admin_Company(db.Model):
|
||||
__tablename__ = 'admin_company'
|
||||
__bind_key__ = 'eamco'
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
id = db.Column(db.Integer,
|
||||
primary_key=True,
|
||||
autoincrement=True,
|
||||
unique=False)
|
||||
creation_date = db.Column(db.TIMESTAMP(), default=datetime.utcnow())
|
||||
account_prefix = db.Column(db.VARCHAR(5))
|
||||
company_name = db.Column(db.VARCHAR(250))
|
||||
company_address = db.Column(db.VARCHAR(250))
|
||||
company_town = db.Column(db.VARCHAR(100))
|
||||
company_zip = db.Column(db.VARCHAR(25))
|
||||
company_state = db.Column(db.INTEGER())
|
||||
company_phone_number = db.Column(db.VARCHAR(50))
|
||||
|
||||
class Admin_Company_schema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Admin_Company
|
||||
|
||||
79
app/classes/auth.py
Normal file
79
app/classes/auth.py
Normal file
@@ -0,0 +1,79 @@
|
||||
from flask_login import UserMixin, AnonymousUserMixin
|
||||
from app import db, ma, login_manager
|
||||
from datetime import datetime
|
||||
from uuid import uuid4
|
||||
|
||||
|
||||
def get_uuid():
|
||||
return uuid4().hex
|
||||
|
||||
|
||||
class Auth_User(UserMixin, db.Model):
|
||||
__tablename__ = 'auth_users'
|
||||
__bind_key__ = 'eamco'
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
id = db.Column(db.Integer,
|
||||
autoincrement=True,
|
||||
primary_key=True,
|
||||
unique=True)
|
||||
uuid = db.Column(db.String(32), default=get_uuid)
|
||||
api_key = db.Column(db.TEXT)
|
||||
username = db.Column(db.VARCHAR(40))
|
||||
password_hash = db.Column(db.TEXT)
|
||||
member_since = db.Column(db.TIMESTAMP(), default=datetime.utcnow())
|
||||
email = db.Column(db.VARCHAR(350))
|
||||
last_seen = db.Column(db.TIMESTAMP(), default=datetime.utcnow())
|
||||
admin = db.Column(db.INTEGER)
|
||||
admin_role = db.Column(db.INTEGER)
|
||||
confirmed = db.Column(db.INTEGER)
|
||||
|
||||
def __init__(self,
|
||||
username,
|
||||
api_key,
|
||||
password_hash,
|
||||
member_since,
|
||||
email,
|
||||
last_seen,
|
||||
admin,
|
||||
admin_role,
|
||||
confirmed,
|
||||
):
|
||||
self.username = username
|
||||
self.api_key = api_key
|
||||
self.password_hash = password_hash
|
||||
self.member_since = member_since
|
||||
self.email = email
|
||||
self.last_seen = last_seen
|
||||
self.admin = admin
|
||||
self.admin_role = admin_role
|
||||
self.confirmed = confirmed
|
||||
|
||||
def is_authenticated(self):
|
||||
return True
|
||||
|
||||
def is_active(self):
|
||||
return True
|
||||
|
||||
def is_anonymous(self):
|
||||
return False
|
||||
|
||||
def get_id(self):
|
||||
return self.id
|
||||
|
||||
|
||||
class Auth_User_Schema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Auth_User
|
||||
|
||||
|
||||
user_schema = Auth_User_Schema()
|
||||
users_schema = Auth_User_Schema(many=True)
|
||||
|
||||
|
||||
class AnonymousUser(AnonymousUserMixin):
|
||||
def __init__(self):
|
||||
self.username = 'Guest'
|
||||
|
||||
|
||||
login_manager.anonymous_user = AnonymousUser
|
||||
49
app/classes/auto.py
Normal file
49
app/classes/auto.py
Normal file
@@ -0,0 +1,49 @@
|
||||
|
||||
from app import db, ma
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class Auto_Temp(db.Model):
|
||||
__tablename__ = 'auto_temp'
|
||||
__bind_key__ = 'eamco'
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
id = db.Column(db.Integer,
|
||||
primary_key=True,
|
||||
autoincrement=True,
|
||||
unique=False)
|
||||
todays_date = db.Column(db.TIMESTAMP(), default=datetime.utcnow())
|
||||
temp = db.Column(db.DECIMAL(50, 2))
|
||||
temp_max = db.Column(db.DECIMAL(50, 2))
|
||||
temp_min = db.Column(db.DECIMAL(50, 2))
|
||||
temp_avg = db.Column(db.DECIMAL(50, 2))
|
||||
degree_day = db.Column(db.INTEGER())
|
||||
|
||||
class Auto_Temp_schema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Auto_Temp
|
||||
|
||||
|
||||
|
||||
class Auto_Delivery(db.Model):
|
||||
__tablename__ = 'auto_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_full_name = db.Column(db.DECIMAL(50, 2))
|
||||
last_fill = db.Column(db.TIMESTAMP())
|
||||
last_updated = db.Column(db.TIMESTAMP())
|
||||
estimated_gallons_left = db.Column(db.INTEGER())
|
||||
estimated_gallons_left_prev_day = db.Column(db.INTEGER())
|
||||
tank_height = db.Column(db.VARCHAR(25))
|
||||
tank_size = db.Column(db.VARCHAR(25))
|
||||
k_factor = db.Column(db.DECIMAL(50, 2))
|
||||
|
||||
class Auto_Delivery_schema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Auto_Delivery
|
||||
29
app/classes/cards.py
Normal file
29
app/classes/cards.py
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
from app import db, ma
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class Card_Card(db.Model):
|
||||
__tablename__ = 'card_card'
|
||||
__bind_key__ = 'eamco'
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
id = db.Column(db.Integer,
|
||||
primary_key=True,
|
||||
autoincrement=True,
|
||||
unique=False)
|
||||
date_added = db.Column(db.TIMESTAMP(), default=datetime.utcnow())
|
||||
user_id = db.Column(db.INTEGER())
|
||||
card_number = db.Column(db.VARCHAR(50))
|
||||
last_four_digits = db.Column(db.INTEGER())
|
||||
name_on_card = db.Column(db.VARCHAR(500))
|
||||
expiration_month = db.Column(db.INTEGER())
|
||||
expiration_year = db.Column(db.INTEGER())
|
||||
type_of_card = db.Column(db.VARCHAR(500))
|
||||
security_number = db.Column(db.INTEGER())
|
||||
accepted_or_declined = db.Column(db.INTEGER())
|
||||
main_card = db.Column(db.BOOLEAN())
|
||||
|
||||
class Card_Card_schema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Card_Card
|
||||
25
app/classes/company.py
Normal file
25
app/classes/company.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from app import db, ma
|
||||
|
||||
|
||||
|
||||
class Company_Company(db.Model):
|
||||
__tablename__ = 'company_company'
|
||||
__bind_key__ = 'eamco'
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
id = db.Column(db.Integer,
|
||||
primary_key=True,
|
||||
autoincrement=True,
|
||||
unique=False)
|
||||
|
||||
company_dba_name = db.Column(db.VARCHAR(250))
|
||||
company_llc_name = db.Column(db.VARCHAR(250))
|
||||
company_town = db.Column(db.VARCHAR(140))
|
||||
company_state = db.Column(db.VARCHAR(140))
|
||||
company_zip = db.Column(db.INTEGER)
|
||||
|
||||
|
||||
class Company_Company_schema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Company_Company
|
||||
|
||||
82
app/classes/customer.py
Normal file
82
app/classes/customer.py
Normal file
@@ -0,0 +1,82 @@
|
||||
|
||||
from app import db, ma, login_manager
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class Customer_Customer(db.Model):
|
||||
__tablename__ = 'customer_customer'
|
||||
__bind_key__ = 'eamco'
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
id = db.Column(db.Integer,
|
||||
primary_key=True,
|
||||
autoincrement=True,
|
||||
unique=False)
|
||||
account_number = db.Column(db.VARCHAR(25))
|
||||
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_first_call = db.Column(db.TIMESTAMP(), default=datetime.utcnow())
|
||||
customer_email = db.Column(db.VARCHAR(500))
|
||||
customer_automatic = db.Column(db.INTEGER)
|
||||
customer_phone_number = db.Column(db.VARCHAR(25))
|
||||
customer_home_type = db.Column(db.INTEGER)
|
||||
customer_apt = db.Column(db.VARCHAR(140))
|
||||
customer_address = db.Column(db.VARCHAR(1000))
|
||||
|
||||
|
||||
class Customer_Customer_schema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Customer_Customer
|
||||
|
||||
|
||||
class Customer_Property(db.Model):
|
||||
__tablename__ = 'customer_property'
|
||||
__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)
|
||||
|
||||
# residential = 0
|
||||
# condo = 1
|
||||
# apartment = 2
|
||||
# commercial = 3
|
||||
# business = 4
|
||||
# vehicle = 4
|
||||
customer_property_type = db.Column(db.INTEGER)
|
||||
|
||||
|
||||
class Customer_Property_schema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Customer_Property
|
||||
|
||||
|
||||
class Customer_Payment_Credit(db.Model):
|
||||
__tablename__ = 'customer_payment'
|
||||
__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)
|
||||
|
||||
credit_card_type = db.Column(db.INTEGER)
|
||||
credit_card_name = db.Column(db.VARCHAR(240))
|
||||
credit_card_number = db.Column(db.VARCHAR(140))
|
||||
credit_card_security = db.Column(db.VARCHAR(140))
|
||||
customer_card_expiration = db.Column(db.TIMESTAMP(), default=datetime.utcnow())
|
||||
|
||||
|
||||
class Customer_Payment_Credit_schema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Customer_Payment_Credit
|
||||
117
app/classes/delivery.py
Normal file
117
app/classes/delivery.py
Normal 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
|
||||
73
app/classes/employee.py
Normal file
73
app/classes/employee.py
Normal file
@@ -0,0 +1,73 @@
|
||||
from app import db, ma
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class Employee_Employee(db.Model):
|
||||
__tablename__ = 'employee_employee'
|
||||
__bind_key__ = 'eamco'
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
id = db.Column(db.Integer,
|
||||
primary_key=True,
|
||||
autoincrement=True,
|
||||
unique=False)
|
||||
|
||||
user_id = db.Column(db.INTEGER)
|
||||
employee_first_name = db.Column(db.VARCHAR(250))
|
||||
employee_last_name = db.Column(db.VARCHAR(250))
|
||||
employee_apt = db.Column(db.VARCHAR(250))
|
||||
employee_address = db.Column(db.VARCHAR(1000))
|
||||
employee_town = db.Column(db.VARCHAR(140))
|
||||
employee_state = db.Column(db.VARCHAR(140))
|
||||
employee_zip = db.Column(db.VARCHAR(25))
|
||||
employee_birthday = db.Column(db.DATE(), default=datetime.utcnow())
|
||||
employee_type = db.Column(db.INTEGER)
|
||||
employee_phone_number = db.Column(db.VARCHAR(25))
|
||||
employee_start_date = db.Column(db.DATE(), default=datetime.utcnow())
|
||||
employee_end_date = db.Column(db.DATE(), default=None)
|
||||
|
||||
|
||||
class Employee_Employee_schema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Employee_Employee
|
||||
|
||||
|
||||
class Employee_Credentials(db.Model):
|
||||
__tablename__ = 'employee_credentials'
|
||||
__bind_key__ = 'eamco'
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
id = db.Column(db.Integer,
|
||||
primary_key=True,
|
||||
autoincrement=True,
|
||||
unique=False)
|
||||
employee_id = db.Column(db.INTEGER)
|
||||
employee_name = db.Column(db.VARCHAR(140))
|
||||
employee_cdl_expire = db.Column(db.TIMESTAMP(), default=datetime.utcnow())
|
||||
employee_hvac_expire = db.Column(db.TIMESTAMP(), default=datetime.utcnow())
|
||||
|
||||
|
||||
class Employee_Credentials_schema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Employee_Credentials
|
||||
|
||||
|
||||
class Employee_Vacation(db.Model):
|
||||
__tablename__ = 'employee_vacation'
|
||||
__bind_key__ = 'eamco'
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
id = db.Column(db.Integer,
|
||||
primary_key=True,
|
||||
autoincrement=True,
|
||||
unique=False)
|
||||
employee_id = db.Column(db.INTEGER)
|
||||
employee_name = db.Column(db.VARCHAR(140))
|
||||
employee_total_days_off = db.Column(db.INTEGER)
|
||||
employee_days_off_multiplier = db.Column(db.DECIMAL(50, 2))
|
||||
employee_days_off_per_year = db.Column(db.INTEGER)
|
||||
|
||||
|
||||
class Employee_Vacation_schema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Employee_Vacation
|
||||
49
app/classes/pricing.py
Normal file
49
app/classes/pricing.py
Normal file
@@ -0,0 +1,49 @@
|
||||
from app import db, ma, login_manager
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class Pricing_Service_General(db.Model):
|
||||
__tablename__ = 'pricing_service_general'
|
||||
__bind_key__ = 'eamco'
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
id = db.Column(db.Integer,
|
||||
primary_key=True,
|
||||
autoincrement=True,
|
||||
unique=False)
|
||||
|
||||
price_service_hour = db.Column(db.DECIMAL(50, 2))
|
||||
price_emergency_service_hour = db.Column(db.DECIMAL(50, 2))
|
||||
price_emergency_call = db.Column(db.DECIMAL(50, 2))
|
||||
price_out_of_oil = db.Column(db.DECIMAL(50, 2))
|
||||
price_prime = db.Column(db.DECIMAL(50, 2))
|
||||
price_same_day = db.Column(db.DECIMAL(50, 2))
|
||||
price_cleaning = db.Column(db.DECIMAL(50, 2))
|
||||
date = db.Column(db.TIMESTAMP(), default=datetime.utcnow())
|
||||
|
||||
|
||||
class Pricing_Service_General_schema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Pricing_Service_General
|
||||
|
||||
|
||||
class Pricing_Oil_Oil(db.Model):
|
||||
__tablename__ = 'pricing_oil_oil'
|
||||
__bind_key__ = 'eamco'
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
id = db.Column(db.Integer,
|
||||
primary_key=True,
|
||||
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))
|
||||
date = db.Column(db.TIMESTAMP(), default=datetime.utcnow())
|
||||
|
||||
|
||||
class Pricing_Oil_Oil_schema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Pricing_Oil_Oil
|
||||
|
||||
88
app/classes/query.py
Normal file
88
app/classes/query.py
Normal file
@@ -0,0 +1,88 @@
|
||||
|
||||
from app import db, ma
|
||||
|
||||
|
||||
class Query_EmployeeTypeList(db.Model):
|
||||
__tablename__ = 'query_employee_type_list'
|
||||
__bind_key__ = 'eamco'
|
||||
__table_args__ = {"schema": "public"}
|
||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||
value = db.Column(db.INTEGER)
|
||||
text = db.Column(db.VARCHAR(140))
|
||||
|
||||
|
||||
class Query_EmployeeTypeList_Schema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Query_EmployeeTypeList
|
||||
id = ma.auto_field()
|
||||
text = ma.auto_field()
|
||||
value = ma.auto_field()
|
||||
|
||||
class Query_StateList(db.Model):
|
||||
__tablename__ = 'query_state_list'
|
||||
__bind_key__ = 'eamco'
|
||||
__table_args__ = {"schema": "public"}
|
||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||
value = db.Column(db.INTEGER)
|
||||
text = db.Column(db.VARCHAR(140))
|
||||
|
||||
|
||||
class Query_StateList_Schema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Query_StateList
|
||||
id = ma.auto_field()
|
||||
text = ma.auto_field()
|
||||
value = ma.auto_field()
|
||||
|
||||
|
||||
class Query_CustomerTypeList(db.Model):
|
||||
__tablename__ = 'query_customer_type_list'
|
||||
__bind_key__ = 'eamco'
|
||||
__table_args__ = {"schema": "public"}
|
||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||
value = db.Column(db.INTEGER)
|
||||
text = db.Column(db.VARCHAR(140))
|
||||
|
||||
|
||||
class Query_CustomerTypeList_Schema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Query_CustomerTypeList
|
||||
id = ma.auto_field()
|
||||
text = ma.auto_field()
|
||||
value = ma.auto_field()
|
||||
|
||||
|
||||
|
||||
class Query_ServiceTypeList(db.Model):
|
||||
__tablename__ = 'query_service_type_list'
|
||||
__bind_key__ = 'eamco'
|
||||
__table_args__ = {"schema": "public"}
|
||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||
value = db.Column(db.INTEGER)
|
||||
text = db.Column(db.VARCHAR(140))
|
||||
|
||||
|
||||
class Query_ServiceTypeList_Schema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Query_ServiceTypeList
|
||||
id = ma.auto_field()
|
||||
text = ma.auto_field()
|
||||
value = ma.auto_field()
|
||||
|
||||
|
||||
|
||||
class Query_DeliveryStatusList(db.Model):
|
||||
__tablename__ = 'query_delivery_type_list'
|
||||
__bind_key__ = 'eamco'
|
||||
__table_args__ = {"schema": "public"}
|
||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||
value = db.Column(db.INTEGER)
|
||||
text = db.Column(db.VARCHAR(140))
|
||||
|
||||
|
||||
class Query_DeliveryStatusList_Schema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Query_DeliveryStatusList
|
||||
id = ma.auto_field()
|
||||
text = ma.auto_field()
|
||||
value = ma.auto_field()
|
||||
126
app/classes/service.py
Normal file
126
app/classes/service.py
Normal file
@@ -0,0 +1,126 @@
|
||||
|
||||
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))
|
||||
|
||||
payment_type = db.Column(db.INTEGER)
|
||||
payment_card_id = db.Column(db.INTEGER)
|
||||
|
||||
|
||||
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))
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
||||
29
app/classes/stats_customer.py
Normal file
29
app/classes/stats_customer.py
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
from app import db, ma, login_manager
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class Stats_Customer(db.Model):
|
||||
__tablename__ = 'stats_customer'
|
||||
__bind_key__ = 'eamco'
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
id = db.Column(db.Integer,
|
||||
primary_key=True,
|
||||
autoincrement=True,
|
||||
unique=False)
|
||||
|
||||
total_calls = db.Column(db.INTEGER)
|
||||
service_calls_total = db.Column(db.INTEGER)
|
||||
service_calls_total_spent = db.Column(db.DECIMAL(50, 2))
|
||||
service_calls_total_profit = db.Column(db.DECIMAL(50, 2))
|
||||
|
||||
|
||||
oil_deliveries = db.Column(db.INTEGER)
|
||||
oil_total_gallons = db.Column(db.INTEGER)
|
||||
oil_total_spent = db.Column(db.DECIMAL(50, 2))
|
||||
oil_total_profit = db.Column(db.DECIMAL(50, 2))
|
||||
|
||||
class Stats_Customer_schema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Stats_Customer
|
||||
46
app/classes/stats_employee.py
Normal file
46
app/classes/stats_employee.py
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
from app import db, ma, login_manager
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class Stats_Employee_Oil(db.Model):
|
||||
__tablename__ = 'stats_employee_oil'
|
||||
__bind_key__ = 'eamco'
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
id = db.Column(db.Integer,
|
||||
primary_key=True,
|
||||
autoincrement=True,
|
||||
unique=False)
|
||||
|
||||
total_deliveries = db.Column(db.INTEGER)
|
||||
total_gallons_delivered = db.Column(db.INTEGER)
|
||||
total_primes = db.Column(db.INTEGER)
|
||||
total_gallons_fuel = db.Column(db.INTEGER)
|
||||
oil_total_profit_delivered = db.Column(db.DECIMAL(50, 2))
|
||||
|
||||
class Stats_Employee_Oil_schema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Stats_Employee_Oil
|
||||
|
||||
|
||||
|
||||
|
||||
class Stats_Employee_Service(db.Model):
|
||||
__tablename__ = 'stats_employee_service'
|
||||
__bind_key__ = 'eamco'
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
id = db.Column(db.Integer,
|
||||
primary_key=True,
|
||||
autoincrement=True,
|
||||
unique=False)
|
||||
|
||||
total_service_calls = db.Column(db.INTEGER)
|
||||
total_service_calls_hours = db.Column(db.INTEGER)
|
||||
total_gallons_fuel = db.Column(db.INTEGER)
|
||||
total_amount_billed= db.Column(db.DECIMAL(50, 2))
|
||||
total_profit_made = db.Column(db.DECIMAL(50, 2))
|
||||
class Stats_Employee_Service_schema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Stats_Employee_Service
|
||||
27
app/classes/stripe.py
Normal file
27
app/classes/stripe.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from app import db, ma
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user