class OrderProduct(db.Model): __tablename__ = 'orderProducts' orderProductID = db.Column(db.Integer(), primary_key=True) orderID = db.Column(db.Integer(), db.ForeignKey('orders.orderID')) productID = db.Column(db.Integer(), db.ForeignKey('products.productID')) productQuantity = db.Column(db.Integer(), nullable=False, default=0) productStatus = db.Column(db.String(20), nullable=True)
class TraSubOrder(db.Model): __tablename__ = 'tra_sub_order' sub_order_id = db.Column(db.Integer, db.Sequence('tra_sub_order_seq'), unique=True, nullable=False) client_cd = db.Column(db.String(20), primary_key=True) group_id = db.Column(db.String(20), primary_key=True) order_cd = db.Column(db.String(20), primary_key=True) sub_order_cd = db.Column(db.String(20), primary_key=True) sub_order_value = db.Column(db.String(100)) display_order = db.Column(db.Integer) is_active = db.Column(db.Boolean, default=True) update_user = db.Column(db.String(20)) update_date = db.Column(db.DateTime, default=datetime.now) def __init__(self, client_cd=None, group_id=None, order_cd=None, sub_order_cd=None): self.client_cd = client_cd self.group_id = group_id self.order_cd = order_cd self.sub_order_cd = sub_order_cd def __repr__(self): return '<TraSubOrder cd:{} value:{}>'.format(self.sub_order_cd, self.sub_order_value)
class Receptionist(db.Model): __tablename__ = 'receptionists' receptionistID = db.Column(db.Integer(), primary_key=True) receptionistName = db.Column(db.String(64), nullable=False) receptionistEmail = db.Column(db.String(128), unique=True, nullable=False) receptionistContact = db.Column(db.String(11), nullable=False) receptionistPassword = db.Column(db.String(128), nullable=False) receptionistDigitalSign = db.Column(db.String(64), nullable=False) receptionistRole = db.Column(db.String(64), nullable=False, default='CASHIER') receptionistStatus = db.Column(db.String(64), nullable=False, default='DEACTIVE')
class CashReceipt(db.Model): __tablename__ = 'cashReceipts' cashReceiptID = db.Column(db.Integer(), primary_key=True) dueOrderID = db.Column(db.Integer(), db.ForeignKey('orders.orderID')) receptionistID = db.Column(db.Integer(), db.ForeignKey('receptionists.receptionistID')) duePaidDate = db.Column(db.Date(), default=datetime.utcnow, nullable=True) duePaidAmount = db.Column(db.Numeric(12, 2), nullable=False) duePaidMode = db.Column(db.String(16), nullable=False) dueReceivedFrom = db.Column(db.String(64), nullable=False)
class Order(db.Model): __tablename__ = 'orders' orderID = db.Column(db.Integer(), primary_key=True) customerID = db.Column(db.Integer(), db.ForeignKey('customers.customerID')) orderDate = db.Column(db.Date(), default=datetime.utcnow, nullable=True) orderDiscount = db.Column(db.Numeric(12, 2), nullable=True, default=0) orderTotal = db.Column(db.Numeric(12, 2), nullable=False) orderNetPaid = db.Column(db.Numeric(12, 2), nullable=False) orderStatus = db.Column(db.String(20), nullable=True)
class Product(db.Model): __tablename__ = 'products' productID = db.Column(db.Integer(), primary_key=True) productName = db.Column(db.String(64), nullable=False) productCostPrice = db.Column(db.Numeric(12, 2), nullable=False) productSellPrice = db.Column(db.Numeric(12, 2), nullable=False) productQuantity = db.Column(db.Integer(), nullable=False, default=0) productDiscount = db.Column(db.Numeric(12, 2), nullable=True, default=0)
class User(db.Model): uid = db.Column(db.BigInteger, primary_key=True, autoincrement=True) name = db.Column(db.String(200), nullable=False) email = db.Column(db.String(100), index=True, unique=True, nullable=False) password = db.Column(db.String(100), nullable=False) created_at = db.Column(db.DateTime, default=datetime.utcnow) updated_at = db.Column(db.DateTime, default=datetime.utcnow) def __repr__(self): return '<User {}>'.format(self.name)
class Product(db.Model): pid = db.Column(db.BigInteger, primary_key=True, autoincrement=True) name = db.Column(db.String(200), nullable=False) quantity = db.Column(db.Integer, nullable=False) created_at = db.Column(db.DateTime, default=datetime.utcnow) updated_at = db.Column(db.DateTime, default=datetime.utcnow) user_id = db.Column(db.BigInteger, db.ForeignKey(User.uid)) def __repr__(self): return '<Product {}>'.format(self.name)
class User(db.Model, UserMixin): __tablename__ = 'com_user' user_id = db.Column(db.String(20), primary_key=True) group_id = db.Column(db.String(20)) role = db.Column(db.Integer, nullable=False) user_name = db.Column(db.String(20)) password = db.Column(db.String(150)) email = db.Column(db.String(50)) is_active = db.Column(db.Boolean, default=True) update_user = db.Column(db.String(20)) update_date = db.Column(db.DateTime, default=datetime.now) def __init__(self, user_id=None, group_id=None, user_name=None): self.user_id = user_id self.group_id = group_id self.user_name = user_name def get_id(self): return (self.user_id) def __repr__(self): return '<User user_name:{}>'.format(self.user_name)
class User(db.Model): uid = db.Column(db.BigInteger, primary_key=True, autoincrement=True) name = db.Column(db.String(200), nullable=False) email = db.Column(db.String(100), index=True, unique=True, nullable=False) password = db.Column(db.String(100), nullable=False) created_at = db.Column(db.DateTime, default=datetime.utcnow) updated_at = db.Column(db.DateTime, default=datetime.utcnow) products = db.relationship("Product", lazy="select", backref=db.backref('products', lazy='joined')) def __repr__(self): return '<User {}>'.format(self.name)
class ComItem(db.Model): __tablename__ = 'com_item' item_id = db.Column(db.Integer, db.Sequence('com_item_seq'), unique=True, nullable=False) item_category = db.Column(db.String(20), primary_key=True) item_cd = db.Column(db.String(20), primary_key=True) item_value = db.Column(db.String(100)) display_order = db.Column(db.Integer) is_active = db.Column(db.Boolean, default=True) update_user = db.Column(db.String(20)) update_date = db.Column(db.DateTime, default=datetime.now) def __init__(self, item_category=None, item_cd=None, item_value=None): self.item_category = item_category self.item_cd = item_cd self.item_value = item_value def __repr__(self): return '<ComItem key:{} value:{}>'.format(self.item_cd, self.item_value)
class Customer(db.Model): __tablename__ = 'customers' customerID = db.Column(db.Integer(), primary_key=True) customerName = db.Column(db.String(64), nullable=False) customerEmail = db.Column(db.String(128), unique=True, nullable=False) customerContact = db.Column(db.String(11), nullable=False) customerZip = db.Column(db.String(10), nullable=False) customerCity = db.Column(db.String(20), nullable=False) customerDistrict = db.Column(db.String(20), nullable=False) customerState = db.Column(db.String(20), nullable=False) customerCountry = db.Column(db.String(20), nullable=False) customerDues = db.Column(db.Numeric(12, 2), nullable=True, default=0) customerDiscount = db.Column(db.Numeric(12, 2), nullable=True, default=0)
class TraMonthlyReport(db.Model): __tablename__ = 'tra_monthly_report' user_id = db.Column(db.String(20), primary_key=True) work_year = db.Column(db.Integer, primary_key=True) work_month = db.Column(db.Integer, primary_key=True) work_day = db.Column(db.Integer, primary_key=True) rest_flg = db.Column(db.Integer) work_details = db.Column(db.String(100)) start_work_time = db.Column(db.DateTime) end_work_time = db.Column(db.DateTime) normal_working_hours = db.Column(db.Numeric(4, 2)) overtime_hours = db.Column(db.Numeric(4, 2)) holiday_work_hours = db.Column(db.Numeric(4, 2)) note = db.Column(db.String(200)) def __init__(self, user_id=None, work_year=None, work_month=None, work_day=None): self.user_id = user_id self.work_year = work_year self.work_month = work_month self.work_day = work_day def __repr__(self): return '<TraMonthlyReport user_id:{} work_year:{} work_month:{} work_day:{}>'.format( self.user_id, self.work_year, self.work_month, self.work_day)
class TraClientWork(db.Model): __tablename__ = 'tra_client_work' client_work_id = db.Column(db.Integer, db.Sequence('tra_client_work_seq'), primary_key=True) user_id = db.Column(db.String(20), primary_key=True) work_year = db.Column(db.SMALLINT, primary_key=True) work_month = db.Column(db.SMALLINT, primary_key=True) work_day = db.Column(db.SMALLINT) rest_flg = db.Column(db.SMALLINT, default=0) order_cd = db.Column(db.String(20)) task_cd = db.Column(db.String(20)) sub_order_cd = db.Column(db.String(20)) work_time = db.Column(db.Time) note = db.Column(db.String(200)) def __init__(self, user_id=None, work_year=None, work_month=None, work_day=None): self.user_id = user_id self.work_year = work_year self.work_month = work_month self.work_day = work_day def __repr__(self): return '<Entry client_work_id:{}>'.format(self.client_work_id)
class TraTravelExpenses(db.Model): __tablename__ = 'tra_travel_expenses' travel_expenses_id = db.Column(db.Integer, db.Sequence('tra_travel_expenses_seq'), primary_key=True) user_id = db.Column(db.String(20), nullable=False) entry_year = db.Column(db.Integer, nullable=False) entry_month = db.Column(db.Integer, nullable=False) expense_date = db.Column(db.String(30)) expense_item = db.Column(db.String(50)) route = db.Column(db.String(50)) transit = db.Column(db.String(50)) payment = db.Column(db.Integer) file_name = db.Column(db.String(100)) note = db.Column(db.String(200)) def __init__(self, travel_expenses_id=None): self.travel_expenses_id = travel_expenses_id def __repr__(self): return '<model id:{}>'.format(self.travel_expenses_id)