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 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): 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)