Esempio n. 1
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 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 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 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 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)